프로그래스바 추가 및 UI 수정
This commit is contained in:
1 parent
6675b5301f
commit
29cee13da7
10 files changed
+232
-136
No files matched your search
@@ -46,14 +46,6 @@ export const tutorialSteps: TutorialStepDef[] = [
|
||||
{
|
||||
key: TUTORIAL_KEYS.LANDING,
|
||||
hints: [
|
||||
// {
|
||||
// targetSelector: '.tutorial-center-anchor',
|
||||
// titleKey: 'tutorial.landing.intro.title',
|
||||
// descriptionKey: 'tutorial.landing.intro.desc',
|
||||
// position: 'bottom',
|
||||
// clickToAdvance: false,
|
||||
// noSpotlight: true,
|
||||
// },
|
||||
{
|
||||
targetSelector: '.hero-dropdown-trigger',
|
||||
titleKey: 'tutorial.landing.dropdown.title',
|
||||
@@ -83,46 +75,6 @@ export const tutorialSteps: TutorialStepDef[] = [
|
||||
},
|
||||
],
|
||||
},
|
||||
// {
|
||||
// key: TUTORIAL_KEYS.ANALYSIS,
|
||||
// hints: [
|
||||
// {
|
||||
// targetSelector: '.bi2-identity-card',
|
||||
// titleKey: 'tutorial.analysis.identity.title',
|
||||
// descriptionKey: 'tutorial.analysis.identity.desc',
|
||||
// position: 'top',
|
||||
// clickToAdvance: false,
|
||||
// },
|
||||
// {
|
||||
// targetSelector: '.bi2-selling-card',
|
||||
// titleKey: 'tutorial.analysis.selling.title',
|
||||
// descriptionKey: 'tutorial.analysis.selling.desc',
|
||||
// position: 'top',
|
||||
// clickToAdvance: false,
|
||||
// },
|
||||
// {
|
||||
// targetSelector: '.bi2-persona-grid',
|
||||
// titleKey: 'tutorial.analysis.persona.title',
|
||||
// descriptionKey: 'tutorial.analysis.persona.desc',
|
||||
// position: 'top',
|
||||
// clickToAdvance: false,
|
||||
// },
|
||||
// {
|
||||
// targetSelector: '.bi2-keyword-tags',
|
||||
// titleKey: 'tutorial.analysis.keywords.title',
|
||||
// descriptionKey: 'tutorial.analysis.keywords.desc',
|
||||
// position: 'top',
|
||||
// clickToAdvance: false,
|
||||
// },
|
||||
// {
|
||||
// targetSelector: '.bi2-generate-btn',
|
||||
// titleKey: 'tutorial.analysis.generate.title',
|
||||
// descriptionKey: 'tutorial.analysis.generate.desc',
|
||||
// position: 'right',
|
||||
// clickToAdvance: true,
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
{
|
||||
key: TUTORIAL_KEYS.ASSET,
|
||||
hints: [
|
||||
@@ -167,7 +119,7 @@ export const tutorialSteps: TutorialStepDef[] = [
|
||||
clickToAdvance: false,
|
||||
},
|
||||
{
|
||||
targetSelector: '.language-selector-wrapper',
|
||||
targetSelector: '.language-grid',
|
||||
titleKey: 'tutorial.sound.language.title',
|
||||
descriptionKey: 'tutorial.sound.language.desc',
|
||||
position: 'top',
|
||||
@@ -393,7 +345,7 @@ export const tutorialSteps: TutorialStepDef[] = [
|
||||
titleKey: 'tutorial.contentCalendar.grid.title',
|
||||
descriptionKey: 'tutorial.contentCalendar.grid.desc',
|
||||
position: 'top',
|
||||
clickToAdvance: true,
|
||||
clickToAdvance: false,
|
||||
},
|
||||
{
|
||||
targetSelector: '.calendar-side-panel',
|
||||
|
||||
@@ -19,6 +19,7 @@ function getGroupProgress(key: string, currentIndex: number): { groupTotal: numb
|
||||
|
||||
const SEEN_KEY = 'ado2_tutorial_seen';
|
||||
const PROGRESS_KEY = 'ado2_tutorial_progress';
|
||||
const ENABLED_KEY = 'ado2_tutorial_enabled';
|
||||
|
||||
// 전역 단일 활성 튜토리얼 관리 — 새 튜토리얼 시작 시 이전 것을 skip 처리
|
||||
let globalSkip: (() => void) | null = null;
|
||||
@@ -66,6 +67,7 @@ function clearProgress(key: string) {
|
||||
|
||||
interface UseTutorialReturn {
|
||||
isActive: boolean;
|
||||
isEnabled: boolean;
|
||||
isRestartPopupVisible: boolean;
|
||||
currentHintIndex: number;
|
||||
hints: TutorialHint[];
|
||||
@@ -75,6 +77,7 @@ interface UseTutorialReturn {
|
||||
nextHint: () => void;
|
||||
prevHint: () => void;
|
||||
skipTutorial: () => void;
|
||||
toggleTutorial: (currentKey: string | null) => void;
|
||||
showRestartPopup: (key: string) => void;
|
||||
confirmRestart: () => void;
|
||||
cancelRestart: () => void;
|
||||
@@ -83,6 +86,7 @@ interface UseTutorialReturn {
|
||||
|
||||
export function useTutorial(): UseTutorialReturn {
|
||||
const [isActive, setIsActive] = useState(false);
|
||||
const [isEnabled, setIsEnabled] = useState(() => localStorage.getItem(ENABLED_KEY) !== 'false');
|
||||
const [isRestartPopupVisible, setIsRestartPopupVisible] = useState(false);
|
||||
const [pendingRestartKey, setPendingRestartKey] = useState<string | null>(null);
|
||||
const [currentHintIndex, setCurrentHintIndex] = useState(0);
|
||||
@@ -91,6 +95,7 @@ export function useTutorial(): UseTutorialReturn {
|
||||
const onCompleteRef = React.useRef<(() => void) | undefined>(undefined);
|
||||
|
||||
const startTutorial = useCallback((key: string, onComplete?: () => void, forceFromStart?: boolean) => {
|
||||
if (localStorage.getItem(ENABLED_KEY) === 'false') return;
|
||||
const step = tutorialSteps.find(s => s.key === key);
|
||||
if (!step || step.hints.length === 0) return;
|
||||
// 다른 인스턴스에서 활성화된 튜토리얼이 있으면 skip 처리
|
||||
@@ -139,6 +144,24 @@ export function useTutorial(): UseTutorialReturn {
|
||||
setCurrentHintIndex(0);
|
||||
}, [tutorialKey, currentHintIndex]);
|
||||
|
||||
const toggleTutorial = useCallback((currentKey: string | null) => {
|
||||
if (isEnabled) {
|
||||
// off: 튜토리얼 중단 + 비활성화
|
||||
setIsActive(false);
|
||||
setIsEnabled(false);
|
||||
localStorage.setItem(ENABLED_KEY, 'false');
|
||||
} else {
|
||||
// on: seen/progress 초기화 + 현재 화면 튜토리얼 시작
|
||||
localStorage.removeItem(SEEN_KEY);
|
||||
localStorage.removeItem(PROGRESS_KEY);
|
||||
localStorage.setItem(ENABLED_KEY, 'true');
|
||||
setIsEnabled(true);
|
||||
if (currentKey) {
|
||||
startTutorial(currentKey, undefined, true);
|
||||
}
|
||||
}
|
||||
}, [isEnabled, startTutorial]);
|
||||
|
||||
// 튜토리얼 다시 보기: 팝업 표시만
|
||||
const showRestartPopup = useCallback((key: string) => {
|
||||
setPendingRestartKey(key);
|
||||
@@ -168,6 +191,7 @@ export function useTutorial(): UseTutorialReturn {
|
||||
|
||||
return {
|
||||
isActive,
|
||||
isEnabled,
|
||||
isRestartPopupVisible,
|
||||
currentHintIndex,
|
||||
hints,
|
||||
@@ -177,6 +201,7 @@ export function useTutorial(): UseTutorialReturn {
|
||||
nextHint,
|
||||
prevHint,
|
||||
skipTutorial,
|
||||
toggleTutorial,
|
||||
showRestartPopup,
|
||||
confirmRestart,
|
||||
cancelRestart,
|
||||
|
||||
Reference in new issue
Block a user