-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
801b275
commit d270a98
Showing
10 changed files
with
358 additions
and
33 deletions.
There are no files selected for viewing
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
31 changes: 31 additions & 0 deletions
31
src/app/app/(authenticated-routes)/(onboarding)/layout.tsx
This file contains 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,31 @@ | ||
"use client"; | ||
|
||
import { LogOut } from "lucide-react"; | ||
import React from "react"; | ||
import { Zenitho } from "uvcanvas"; | ||
import { AvatarSelection } from "~/components/patterns/avatar-selection"; | ||
import { Button } from "~/components/ui/button"; | ||
import { signOut } from "next-auth/react"; | ||
|
||
const Layout = ({ children }: { children: React.ReactNode }) => { | ||
return ( | ||
<div> | ||
<Button | ||
onClick={() => signOut()} | ||
variant="ghost" | ||
className="absolute left-4 top-4 z-10" | ||
> | ||
<LogOut className="mr-2 h-5 w-5" /> Sign out | ||
</Button> | ||
<div className="relative flex w-full flex-col"> | ||
<div className="block [&_canvas]:h-[250px] [&_canvas]:w-[100vw]"> | ||
<Zenitho /> | ||
</div> | ||
<AvatarSelection /> | ||
</div> | ||
<div className="px-4">{children}</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Layout; |
30 changes: 30 additions & 0 deletions
30
src/app/app/(authenticated-routes)/(onboarding)/onboarding/settings/page.tsx
This file contains 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,30 @@ | ||
"use client"; | ||
|
||
import { useSession } from "next-auth/react"; | ||
|
||
import React from "react"; | ||
|
||
import { api } from "~/trpc/react"; | ||
|
||
const Onboarding = () => { | ||
const session = useSession(); | ||
|
||
const getUserQuery = api.user.getUser.useQuery(); | ||
|
||
return ( | ||
<div className="flex flex-col gap-2"> | ||
<div> | ||
<h1 className="text-center text-4xl font-bold tracking-tight"> | ||
{session.status === "authenticated" | ||
? `Welcome, ${getUserQuery.data?.name}` | ||
: "Welcome to Pullout.so"} | ||
</h1> | ||
<h2 className="text-center text-xl text-muted-foreground"> | ||
Change your name or avatar so we can personalize your experience | ||
</h2> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Onboarding; |
73 changes: 73 additions & 0 deletions
73
src/app/app/(authenticated-routes)/(onboarding)/onboarding/user/page.tsx
This file contains 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,73 @@ | ||
"use client"; | ||
|
||
import { ChevronRight, Loader2 } from "lucide-react"; | ||
import { useSession } from "next-auth/react"; | ||
import { useRouter } from "next/navigation"; | ||
|
||
import React from "react"; | ||
|
||
import { Button } from "~/components/ui/button"; | ||
import { Input } from "~/components/ui/input"; | ||
import { api } from "~/trpc/react"; | ||
import { motion } from "framer-motion"; | ||
|
||
const Onboarding = () => { | ||
const session = useSession(); | ||
const [name, setName] = React.useState(session.data?.user.name ?? ""); | ||
const utils = api.useUtils(); | ||
const getUserQuery = api.user.getUser.useQuery(); | ||
const updateUserMutation = api.user.updateUser.useMutation({ | ||
onSuccess: (data) => { | ||
utils.user.invalidate(); | ||
router.push("/app/onboarding/settings"); | ||
}, | ||
}); | ||
const router = useRouter(); | ||
|
||
return ( | ||
<div className="flex flex-col gap-2"> | ||
<motion.div | ||
transition={{ delay: 0.3, duration: 0.4 }} | ||
initial={{ opacity: 0 }} | ||
animate={{ opacity: 1 }} | ||
> | ||
<h1 className="text-center text-4xl font-bold tracking-tight"> | ||
{session.status === "authenticated" | ||
? `Welcome, ${name.length > 0 ? name : getUserQuery.data?.name}` | ||
: "Welcome to Pullout.so"} | ||
</h1> | ||
<h2 className="text-center text-xl text-muted-foreground"> | ||
Change your name or avatar so we can personalize your experience | ||
</h2> | ||
</motion.div> | ||
<motion.div | ||
transition={{ delay: 0.4, duration: 0.4 }} | ||
initial={{ x: "-5px", opacity: 0 }} | ||
animate={{ x: 0, opacity: 1 }} | ||
className="mx-auto flex w-fit gap-2 " | ||
> | ||
<Input | ||
className="mx-auto max-w-[200px]" | ||
value={name} | ||
onChange={(e) => setName(e.target.value)} | ||
/> | ||
<Button | ||
disabled={updateUserMutation.isPending} | ||
onClick={() => { | ||
updateUserMutation.mutate({ name }); | ||
}} | ||
className="mx-auto w-fit" | ||
> | ||
{updateUserMutation.isPending ? ( | ||
<Loader2 className="mr-2 h-4 w-4 animate-spin" /> | ||
) : ( | ||
<ChevronRight className="mr-2 h-4 w-4" /> | ||
)} | ||
Next | ||
</Button> | ||
</motion.div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Onboarding; |
This file contains 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 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
Oops, something went wrong.