-
Notifications
You must be signed in to change notification settings - Fork 5
Add survey to Onboarding Users #171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
faf42ba
Added a modal with a typeform survey that opens after User signup
jfcsantos ffe3fbf
hiding survey credits block
jfcsantos c734a36
Merge branch 'main' into jsantos/profile-survey
jfcsantos 1b04c68
updated migrations
jfcsantos ebabe3c
cleanup
jfcsantos c30cb50
removing user_id
jfcsantos aaca242
adding error handling and fixing migrations
jfcsantos 5b7fab6
styling close button
jfcsantos cbab28d
styling and cleanup
jfcsantos fdff371
added update users to migration
jfcsantos 18ac04b
Merge branch 'main' of github.com:Kilo-Org/cloud into jsantos/profile…
jfcsantos f573bb8
simplifying modal callbacks
jfcsantos c75eff4
Merge branch 'main' of github.com:Kilo-Org/cloud into jsantos/profile…
jfcsantos 7793fda
recreating migrations
jfcsantos c02fe9f
fixing migration
jfcsantos 6ba0821
Merge branch 'main' of github.com:Kilo-Org/cloud into jsantos/profile…
jfcsantos 75025e7
updating migrations
jfcsantos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| 'use client'; | ||
|
|
||
| import { useState } from 'react'; | ||
| import { Widget } from '@typeform/embed-react'; | ||
| import { useTRPC } from '@/lib/trpc/utils'; | ||
| import { useMutation } from '@tanstack/react-query'; | ||
| import { Dialog, DialogContent, DialogTitle } from '@/components/ui/dialog'; | ||
|
|
||
| const WELCOME_FORM_ID = 'xNTrQO4E'; | ||
|
|
||
| type WelcomeTypeformModalProps = { | ||
| userEmail: string; | ||
| }; | ||
|
|
||
| export function WelcomeTypeformModal({ userEmail }: WelcomeTypeformModalProps) { | ||
| const [isOpen, setIsOpen] = useState(true); | ||
| const [hasMarkedComplete, setHasMarkedComplete] = useState(false); | ||
| const trpc = useTRPC(); | ||
|
|
||
| const markCompleteMutation = useMutation( | ||
| trpc.user.markWelcomeFormCompleted.mutationOptions({ | ||
| onSuccess: () => { | ||
| setIsOpen(false); | ||
| }, | ||
| onError: error => { | ||
| console.error('Failed to mark welcome form completed:', error); | ||
| setHasMarkedComplete(false); | ||
| }, | ||
| }) | ||
| ); | ||
|
|
||
| const handleComplete = () => { | ||
| if (hasMarkedComplete) return; | ||
| setHasMarkedComplete(true); | ||
| markCompleteMutation.mutate(); | ||
| }; | ||
|
|
||
| if (!isOpen) return null; | ||
|
|
||
| return ( | ||
| <Dialog | ||
| open={isOpen} | ||
| onOpenChange={open => { | ||
| if (!open) { | ||
| handleComplete(); | ||
| } | ||
| }} | ||
| > | ||
| <DialogContent | ||
| className="[&>button]:text-muted-foreground [&>button]:hover:bg-muted [&>button]:hover:text-foreground h-[50vh] max-w-[90vw] overflow-hidden p-0 sm:h-[400px] sm:max-w-xl [&>button]:rounded-md [&>button]:p-2" | ||
| onPointerDownOutside={e => e.preventDefault()} | ||
| onEscapeKeyDown={e => e.preventDefault()} | ||
| > | ||
| <DialogTitle className="sr-only">Welcome to Kilo</DialogTitle> | ||
| <Widget | ||
| id={WELCOME_FORM_ID} | ||
| hidden={{ | ||
| email: userEmail, | ||
| }} | ||
| onSubmit={handleComplete} | ||
| onClose={handleComplete} | ||
| /> | ||
| </DialogContent> | ||
| </Dialog> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| ALTER TABLE "kilocode_users" ADD COLUMN "completed_welcome_form" boolean DEFAULT false NOT NULL; | ||
| UPDATE "kilocode_users" SET "completed_welcome_form" = true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| ALTER TABLE "kilocode_users" ADD COLUMN "completed_welcome_form" boolean DEFAULT false NOT NULL; | ||
| UPDATE "kilocode_users" SET "completed_welcome_form" = true; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the bot may have a good point about theming
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's weird because dark mode on the modal wasn't triggering for me until I forced it in the browser console, regardless it should look good now