Fix welcome dialog persistence
The "Don't show again" checkbox on the welcome dialog was not working correctly. This commit ensures that the dialog remains hidden after the user checks the box, even after navigating to other screens.
This commit is contained in:
@@ -96,10 +96,21 @@ const Index = () => {
|
||||
}
|
||||
|
||||
// 환영 다이얼로그 표시 여부 결정 (데이터 초기화 후)
|
||||
const dontShowWelcome = localStorage.getItem('dontShowWelcome') === 'true';
|
||||
if (!dontShowWelcome) {
|
||||
setShowWelcome(true);
|
||||
}
|
||||
const checkWelcomeDialogState = () => {
|
||||
const dontShowWelcome = localStorage.getItem('dontShowWelcome');
|
||||
console.log('Index 페이지 로딩 시 dontShowWelcome 값:', dontShowWelcome);
|
||||
|
||||
// 명시적으로 'true' 문자열인 경우에만 숨김 처리
|
||||
if (dontShowWelcome === 'true') {
|
||||
console.log('환영 메시지 표시하지 않음 (저장된 설정)');
|
||||
setShowWelcome(false);
|
||||
} else {
|
||||
console.log('환영 메시지 표시함');
|
||||
setShowWelcome(true);
|
||||
}
|
||||
};
|
||||
|
||||
checkWelcomeDialogState();
|
||||
|
||||
// 방문 기록 저장 (초기화 후에 저장)
|
||||
localStorage.setItem('hasVisitedBefore', 'true');
|
||||
@@ -108,9 +119,18 @@ const Index = () => {
|
||||
// 환영 팝업 닫기
|
||||
const handleCloseWelcome = (dontShowAgain: boolean) => {
|
||||
setShowWelcome(false);
|
||||
|
||||
// 사용자가 더 이상 보지 않기를 선택한 경우
|
||||
if (dontShowAgain) {
|
||||
localStorage.setItem('dontShowWelcome', 'true');
|
||||
console.log('환영 팝업 더 이상 표시하지 않기 설정됨');
|
||||
console.log('환영 팝업 더 이상 표시하지 않기 설정됨:', dontShowAgain);
|
||||
|
||||
// 설정 확인
|
||||
const savedValue = localStorage.getItem('dontShowWelcome');
|
||||
console.log('설정 후 dontShowWelcome 저장값:', savedValue);
|
||||
} else {
|
||||
// 체크하지 않은 경우 명시적으로 false 저장
|
||||
localStorage.setItem('dontShowWelcome', 'false');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user