diff --git a/src/features/onboarding/steps/step-preferences.tsx b/src/features/onboarding/steps/step-preferences.tsx new file mode 100644 index 00000000..031177e4 --- /dev/null +++ b/src/features/onboarding/steps/step-preferences.tsx @@ -0,0 +1,55 @@ +"use client"; + +import { useState } from "react"; +import { useOnboarding } from "@onboardjs/react"; +import { Button } from "@/components/ui/button"; +import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"; + +export const StepPreferences = () => { + const { next, updateContext, state } = useOnboarding(); + const [theme, setTheme] = useState<"light" | "dark">("dark"); + const [avatarDataUrl, setAvatarDataUrl] = useState(undefined); + + const onFileChange = (e: React.ChangeEvent) => { + const file = e.target.files?.[0]; + if (!file) return; + const reader = new FileReader(); + reader.onload = () => setAvatarDataUrl(reader.result as string); + reader.readAsDataURL(file); + }; + + const onContinue = async () => { + await updateContext({ flowData: { ...state?.context.flowData, preferences: { theme, avatarDataUrl } } }); + await next(); + }; + + return ( +
+
+

Make yourself at home

+

Pick your theme and add a profile photo.

+
+
+ + + ? + + +
+
+ + +
+ +
+ ); +};