From 836679753e133f9ee56343b0757f14dad4070d51 Mon Sep 17 00:00:00 2001 From: corpi Date: Wed, 4 Mar 2026 21:56:51 +0900 Subject: [PATCH] =?UTF-8?q?refactor(feedback):=20=EC=A0=84=EC=97=AD=20?= =?UTF-8?q?=ED=86=A0=EC=8A=A4=ED=8A=B8=20=EC=A0=9C=EA=B1=B0=20=EB=B0=8F=20?= =?UTF-8?q?HUD=20=EC=98=A4=EB=B2=84=EB=A0=88=EC=9D=B4=20=ED=94=BC=EB=93=9C?= =?UTF-8?q?=EB=B0=B1=20=EB=8F=84=EC=9E=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/shared/ui/Toast.tsx | 54 +------------------ .../ui/SpaceFocusHudWidget.tsx | 2 - .../ui/SpaceTimerHudWidget.tsx | 48 +++++++++-------- .../ui/SpaceToolsDockWidget.tsx | 46 +--------------- .../ui/SpaceWorkspaceWidget.tsx | 8 --- 5 files changed, 30 insertions(+), 128 deletions(-) diff --git a/src/shared/ui/Toast.tsx b/src/shared/ui/Toast.tsx index 3234c8e..5a39a61 100644 --- a/src/shared/ui/Toast.tsx +++ b/src/shared/ui/Toast.tsx @@ -1,8 +1,7 @@ 'use client'; import type { ReactNode } from 'react'; -import { createContext, useCallback, useContext, useMemo, useState } from 'react'; -import { cn } from '@/shared/lib/cn'; +import { createContext, useCallback, useContext, useMemo } from 'react'; interface ToastPayload { title: string; @@ -14,10 +13,6 @@ interface ToastPayload { }; } -interface ToastItem extends ToastPayload { - id: number; -} - interface ToastContextValue { pushToast: (payload: ToastPayload) => void; } @@ -25,58 +20,13 @@ interface ToastContextValue { const ToastContext = createContext(null); export const ToastProvider = ({ children }: { children: ReactNode }) => { - const [toasts, setToasts] = useState([]); - - const removeToast = useCallback((id: number) => { - setToasts((current) => current.filter((toast) => toast.id !== id)); - }, []); - - const pushToast = useCallback((payload: ToastPayload) => { - const id = Date.now() + Math.floor(Math.random() * 10000); - const durationMs = payload.durationMs ?? 2400; - - setToasts((current) => [...current, { id, ...payload }]); - - window.setTimeout(() => { - removeToast(id); - }, durationMs); - }, [removeToast]); + const pushToast = useCallback((_payload: ToastPayload) => {}, []); const value = useMemo(() => ({ pushToast }), [pushToast]); return ( {children} -
- {toasts.map((toast) => ( -
-

{toast.title}

- {toast.description ? ( -

{toast.description}

- ) : null} - {toast.action ? ( -
- -
- ) : null} -
- ))} -
); }; diff --git a/src/widgets/space-focus-hud/ui/SpaceFocusHudWidget.tsx b/src/widgets/space-focus-hud/ui/SpaceFocusHudWidget.tsx index 804699d..65d207f 100644 --- a/src/widgets/space-focus-hud/ui/SpaceFocusHudWidget.tsx +++ b/src/widgets/space-focus-hud/ui/SpaceFocusHudWidget.tsx @@ -131,7 +131,6 @@ export const SpaceFocusHudWidget = ({ onClose={() => setSheetOpen(false)} onRest={() => { setSheetOpen(false); - onStatusMessage({ message: '좋아요. 5분 뒤에 다시 알려드릴게요.' }); if (restReminderTimerRef.current) { window.clearTimeout(restReminderTimerRef.current); @@ -145,7 +144,6 @@ export const SpaceFocusHudWidget = ({ onConfirm={(nextGoal) => { onGoalUpdate(nextGoal); setSheetOpen(false); - onStatusMessage({ message: '다음 한 조각으로 이어갑니다.' }); triggerFlash(1200); }} /> diff --git a/src/widgets/space-timer-hud/ui/SpaceTimerHudWidget.tsx b/src/widgets/space-timer-hud/ui/SpaceTimerHudWidget.tsx index 547e6f3..91fffc2 100644 --- a/src/widgets/space-timer-hud/ui/SpaceTimerHudWidget.tsx +++ b/src/widgets/space-timer-hud/ui/SpaceTimerHudWidget.tsx @@ -37,7 +37,7 @@ export const SpaceTimerHudWidget = ({ onGoalCompleteRequest, onStatusAction, }: SpaceTimerHudWidgetProps) => { - const { isBreatheMode, hintMessage, triggerRestart } = useRestart30s(); + const { isBreatheMode, triggerRestart } = useRestart30s(); const normalizedGoal = goal.trim().length > 0 ? goal.trim() : '이번 한 조각을 설정해 주세요.'; return ( @@ -55,7 +55,7 @@ export const SpaceTimerHudWidget = ({ />
- {statusLine ? ( -
-

- {statusLine.message} -

- {statusLine.actionLabel ? ( - - ) : null} -
- ) : hintMessage ? ( -

- {hintMessage} -

- ) : null}
@@ -152,6 +132,30 @@ export const SpaceTimerHudWidget = ({ />
+
+
+ {statusLine?.message ?? ''} + {statusLine?.actionLabel ? ( + + ) : null} +
+
); diff --git a/src/widgets/space-tools-dock/ui/SpaceToolsDockWidget.tsx b/src/widgets/space-tools-dock/ui/SpaceToolsDockWidget.tsx index cb9d517..b0f233e 100644 --- a/src/widgets/space-tools-dock/ui/SpaceToolsDockWidget.tsx +++ b/src/widgets/space-tools-dock/ui/SpaceToolsDockWidget.tsx @@ -39,7 +39,6 @@ interface SpaceToolsDockWidgetProps { onDeleteThought: (thoughtId: string) => RecentThought | null; onSetThoughtCompleted: (thoughtId: string, isCompleted: boolean) => RecentThought | null; onRestoreThought: (thought: RecentThought) => void; - onRestoreThoughts: (thoughts: RecentThought[]) => void; onClearInbox: () => RecentThought[]; onStatusMessage: (payload: HudStatusLinePayload) => void; onExitRequested: () => void; @@ -65,7 +64,6 @@ export const SpaceToolsDockWidget = ({ onDeleteThought, onSetThoughtCompleted, onRestoreThought, - onRestoreThoughts, onClearInbox, onStatusMessage, onExitRequested, @@ -194,26 +192,7 @@ export const SpaceToolsDockWidget = ({ }; const handleInboxComplete = (thought: RecentThought) => { - const previousThought = onSetThoughtCompleted(thought.id, !thought.isCompleted); - - if (!previousThought) { - return; - } - - const willBeCompleted = !thought.isCompleted; - - onStatusMessage({ - message: willBeCompleted ? '완료 처리됨' : '완료 해제됨', - durationMs: 4200, - priority: 'undo', - action: { - label: '실행취소', - onClick: () => { - onRestoreThought(previousThought); - onStatusMessage({ message: willBeCompleted ? '완료 처리를 취소했어요.' : '완료 해제를 취소했어요.' }); - }, - }, - }); + onSetThoughtCompleted(thought.id, !thought.isCompleted); }; const handleInboxDelete = (thought: RecentThought) => { @@ -238,25 +217,7 @@ export const SpaceToolsDockWidget = ({ }; const handleInboxClear = () => { - const snapshot = onClearInbox(); - - if (snapshot.length === 0) { - onStatusMessage({ message: '인박스가 비어 있어요.' }); - return; - } - - onStatusMessage({ - message: '모두 비워짐', - durationMs: 4200, - priority: 'undo', - action: { - label: '실행취소', - onClick: () => { - onRestoreThoughts(snapshot); - onStatusMessage({ message: '인박스를 복구했어요.' }); - }, - }, - }); + onClearInbox(); }; const handlePlanPillClick = () => { @@ -284,9 +245,6 @@ export const SpaceToolsDockWidget = ({ packId, onTimerSelect, onSelectPreset, - onApplied: (message) => { - onStatusMessage({ message, durationMs: 1200 }); - }, }); const showVolumeFeedback = (nextVolume: number) => { diff --git a/src/widgets/space-workspace/ui/SpaceWorkspaceWidget.tsx b/src/widgets/space-workspace/ui/SpaceWorkspaceWidget.tsx index ef8e0eb..db2cf7b 100644 --- a/src/widgets/space-workspace/ui/SpaceWorkspaceWidget.tsx +++ b/src/widgets/space-workspace/ui/SpaceWorkspaceWidget.tsx @@ -17,7 +17,6 @@ import { } from '@/entities/session'; import { useSoundPresetSelection } from '@/features/sound-preset'; import { useHudStatusLine } from '@/shared/lib/useHudStatusLine'; -import { useToast } from '@/shared/ui'; import { SpaceFocusHudWidget } from '@/widgets/space-focus-hud'; import { SpaceSetupDrawerWidget } from '@/widgets/space-setup-drawer'; import { SpaceToolsDockWidget } from '@/widgets/space-tools-dock'; @@ -55,7 +54,6 @@ const resolveInitialTimerLabel = (timerLabelFromQuery: string | null) => { export const SpaceWorkspaceWidget = () => { const searchParams = useSearchParams(); - const { pushToast } = useToast(); const { thoughts, thoughtCount, @@ -63,7 +61,6 @@ export const SpaceWorkspaceWidget = () => { removeThought, clearThoughts, restoreThought, - restoreThoughts, setThoughtCompleted, } = useThoughtInbox(); @@ -124,14 +121,10 @@ export const SpaceWorkspaceWidget = () => { } setWorkspaceMode('focus'); - pushStatusLine({ - message: `목표: ${goalInput.trim()} 시작해요.`, - }); }; const handleExitRequested = () => { setWorkspaceMode('setup'); - pushToast({ title: '준비 모드로 돌아왔어요.' }); }; useEffect(() => { @@ -212,7 +205,6 @@ export const SpaceWorkspaceWidget = () => { onDeleteThought={removeThought} onSetThoughtCompleted={setThoughtCompleted} onRestoreThought={restoreThought} - onRestoreThoughts={restoreThoughts} onClearInbox={clearThoughts} onStatusMessage={pushStatusLine} onExitRequested={handleExitRequested}