From 5da1d76fbd2850fc395d69c2d8e9c34ef3b8ff0c Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 15 Mar 2025 22:53:12 +0000 Subject: [PATCH] Persist welcome dialog visibility The welcome dialog should remain visible until the user explicitly chooses to hide it. --- src/components/onboarding/WelcomeDialog.tsx | 29 ++++++++++++++++++--- src/pages/Index.tsx | 9 ++++++- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/src/components/onboarding/WelcomeDialog.tsx b/src/components/onboarding/WelcomeDialog.tsx index 02c2d0a..f769bf2 100644 --- a/src/components/onboarding/WelcomeDialog.tsx +++ b/src/components/onboarding/WelcomeDialog.tsx @@ -1,5 +1,5 @@ -import React from "react"; +import React, { useState } from "react"; import { Dialog, DialogContent, @@ -11,15 +11,22 @@ import { import { Button } from "@/components/ui/button"; import { Separator } from "@/components/ui/separator"; import { ArrowRight, Wallet, PieChart, LineChart } from "lucide-react"; +import { Checkbox } from "@/components/ui/checkbox"; interface WelcomeDialogProps { open: boolean; - onClose: () => void; + onClose: (dontShowAgain: boolean) => void; } const WelcomeDialog: React.FC = ({ open, onClose }) => { + const [dontShowAgain, setDontShowAgain] = useState(false); + + const handleClose = () => { + onClose(dontShowAgain); + }; + return ( - + handleClose()}> @@ -72,10 +79,24 @@ const WelcomeDialog: React.FC = ({ open, onClose }) => { +
+ setDontShowAgain(checked === true)} + /> + +
+ diff --git a/src/pages/Index.tsx b/src/pages/Index.tsx index 3c67c03..26decc9 100644 --- a/src/pages/Index.tsx +++ b/src/pages/Index.tsx @@ -30,6 +30,7 @@ const Index = () => { // 첫 방문 여부 확인 및 데이터 초기화 useEffect(() => { const hasVisitedBefore = localStorage.getItem('hasVisitedBefore'); + const dontShowWelcome = localStorage.getItem('dontShowWelcome') === 'true'; if (!hasVisitedBefore) { // 첫 로그인으로 가정하고 모든 데이터 초기화 @@ -37,12 +38,18 @@ const Index = () => { setShowWelcome(true); // 방문 기록 저장 localStorage.setItem('hasVisitedBefore', 'true'); + } else if (!dontShowWelcome) { + // '더 이상 보지 않기'를 선택하지 않았다면 계속 환영 팝업 표시 + setShowWelcome(true); } }, []); // 환영 팝업 닫기 - const handleCloseWelcome = () => { + const handleCloseWelcome = (dontShowAgain: boolean) => { setShowWelcome(false); + if (dontShowAgain) { + localStorage.setItem('dontShowWelcome', 'true'); + } }; return (