From 7bf0984698e43b9aa2dd879f65951318ed410390 Mon Sep 17 00:00:00 2001 From: Maze <167211895+mazeincoding@users.noreply.github.com> Date: Sat, 31 Jan 2026 00:20:04 +0100 Subject: codebase overhaul (#697) --- apps/web/src/components/editor/onboarding.tsx | 227 +++++++++++++------------- 1 file changed, 113 insertions(+), 114 deletions(-) (limited to 'apps/web/src/components/editor/onboarding.tsx') diff --git a/apps/web/src/components/editor/onboarding.tsx b/apps/web/src/components/editor/onboarding.tsx index 8ee60690..c60c2de5 100644 --- a/apps/web/src/components/editor/onboarding.tsx +++ b/apps/web/src/components/editor/onboarding.tsx @@ -1,138 +1,137 @@ "use client"; -import { Dialog, DialogContent, DialogTitle } from "../ui/dialog"; -import { Button } from "../ui/button"; import { ArrowRightIcon } from "lucide-react"; -import { useState, useEffect } from "react"; +import { useState } from "react"; import ReactMarkdown from "react-markdown"; +import { SOCIAL_LINKS } from "@/constants/site-constants"; +import { useLocalStorage } from "@/hooks/storage/use-local-storage"; +import { Button } from "../ui/button"; +import { Dialog, DialogBody, DialogContent, DialogTitle } from "../ui/dialog"; export function Onboarding() { - const [step, setStep] = useState(0); - const [isOpen, setIsOpen] = useState(false); + const [step, setStep] = useState(0); + const [hasSeenOnboarding, setHasSeenOnboarding] = useLocalStorage({ + key: "hasSeenOnboarding", + defaultValue: false, + }); - useEffect(() => { - const hasSeenOnboarding = localStorage.getItem("hasSeenOnboarding"); - if (!hasSeenOnboarding) { - setIsOpen(true); - } - }, []); + const isOpen = !hasSeenOnboarding; - const handleNext = () => { - setStep(step + 1); - }; + const handleNext = () => { + setStep(step + 1); + }; - const handleClose = () => { - setIsOpen(false); - localStorage.setItem("hasSeenOnboarding", "true"); - }; + const handleClose = () => { + setHasSeenOnboarding({ value: true }); + }; - const getStepTitle = () => { - switch (step) { - case 0: - return "Welcome to OpenCut Beta! 🎉"; - case 1: - return "⚠️ This is a super early beta!"; - case 2: - return "🦋 Have fun testing!"; - default: - return "OpenCut Onboarding"; - } - }; + const getStepTitle = () => { + switch (step) { + case 0: + return "Welcome to OpenCut Beta! 🎉"; + case 1: + return "⚠️ This is a super early beta!"; + case 2: + return "🦋 Have fun testing!"; + default: + return "OpenCut Onboarding"; + } + }; - const renderStepContent = () => { - switch (step) { - case 0: - return ( -
{children}
, - a: ({ href, children }) => ( - - {children} - - ), - }} - > - {description} -{children}
, + a: ({ href, children }) => ( + + {children} + + ), + }} + > + {description} +