fix(space): Quick Controls 사운드 복원과 HUD 피드백 정합성 수정
This commit is contained in:
@@ -7,7 +7,6 @@ import { ExitHoldButton } from '@/features/exit-hold';
|
||||
import { ManagePlanSheetContent, PaywallSheetContent } from '@/features/paywall-sheet';
|
||||
import { PlanPill } from '@/features/plan-pill';
|
||||
import type { HudStatusLinePayload } from '@/shared/lib/useHudStatusLine';
|
||||
import { useToast } from '@/shared/ui';
|
||||
import { cn } from '@/shared/lib/cn';
|
||||
import { ControlCenterSheetWidget } from '@/widgets/control-center-sheet';
|
||||
import { SpaceSideSheet } from '@/widgets/space-sheet-shell';
|
||||
@@ -40,6 +39,7 @@ interface SpaceToolsDockWidgetProps {
|
||||
onDeleteThought: (thoughtId: string) => RecentThought | null;
|
||||
onSetThoughtCompleted: (thoughtId: string, isCompleted: boolean) => RecentThought | null;
|
||||
onRestoreThought: (thought: RecentThought) => void;
|
||||
onRestoreThoughts: (thoughts: RecentThought[]) => void;
|
||||
onClearInbox: () => RecentThought[];
|
||||
onResetToSceneRecommended: () => void;
|
||||
onStatusMessage: (payload: HudStatusLinePayload) => void;
|
||||
@@ -68,12 +68,12 @@ export const SpaceToolsDockWidget = ({
|
||||
onDeleteThought,
|
||||
onSetThoughtCompleted,
|
||||
onRestoreThought,
|
||||
onRestoreThoughts,
|
||||
onClearInbox,
|
||||
onResetToSceneRecommended,
|
||||
onStatusMessage,
|
||||
onExitRequested,
|
||||
}: SpaceToolsDockWidgetProps) => {
|
||||
const { pushToast } = useToast();
|
||||
const [openPopover, setOpenPopover] = useState<SpaceAnchorPopoverId | null>(null);
|
||||
const [utilityPanel, setUtilityPanel] = useState<SpaceUtilityPanelId | null>(null);
|
||||
const [autoHideControls, setAutoHideControls] = useState(true);
|
||||
@@ -121,8 +121,23 @@ export const SpaceToolsDockWidget = ({
|
||||
}, [openPopover]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!isFocusMode || openPopover || utilityPanel) {
|
||||
if (isFocusMode) {
|
||||
return;
|
||||
}
|
||||
|
||||
const rafId = window.requestAnimationFrame(() => {
|
||||
setOpenPopover(null);
|
||||
setUtilityPanel(null);
|
||||
setIdle(false);
|
||||
});
|
||||
|
||||
return () => {
|
||||
window.cancelAnimationFrame(rafId);
|
||||
};
|
||||
}, [isFocusMode]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!isFocusMode || openPopover || utilityPanel) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -197,6 +212,7 @@ export const SpaceToolsDockWidget = ({
|
||||
}, [autoHideControls, utilityPanel]);
|
||||
|
||||
const openUtilityPanel = (panel: SpaceUtilityPanelId) => {
|
||||
setIdle(false);
|
||||
setOpenPopover(null);
|
||||
setUtilityPanel(panel);
|
||||
};
|
||||
@@ -260,7 +276,25 @@ export const SpaceToolsDockWidget = ({
|
||||
};
|
||||
|
||||
const handleInboxClear = () => {
|
||||
onClearInbox();
|
||||
const snapshot = onClearInbox();
|
||||
|
||||
if (snapshot.length === 0) {
|
||||
onStatusMessage({ message: '비울 항목이 없어요.' });
|
||||
return;
|
||||
}
|
||||
|
||||
onStatusMessage({
|
||||
message: '모두 비워짐',
|
||||
durationMs: 4200,
|
||||
priority: 'undo',
|
||||
action: {
|
||||
label: '실행취소',
|
||||
onClick: () => {
|
||||
onRestoreThoughts(snapshot);
|
||||
onStatusMessage({ message: '복원했어요.' });
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const handlePlanPillClick = () => {
|
||||
@@ -273,13 +307,13 @@ export const SpaceToolsDockWidget = ({
|
||||
};
|
||||
|
||||
const handleLockedClick = (source: string) => {
|
||||
pushToast({ title: `${source}은(는) PRO 기능이에요.` });
|
||||
onStatusMessage({ message: `${source}은(는) PRO 기능이에요.` });
|
||||
openUtilityPanel('paywall');
|
||||
};
|
||||
|
||||
const handleStartPro = () => {
|
||||
setPlan('pro');
|
||||
pushToast({ title: '결제(더미)' });
|
||||
onStatusMessage({ message: '결제(더미)' });
|
||||
openUtilityPanel('control-center');
|
||||
};
|
||||
|
||||
@@ -321,7 +355,7 @@ export const SpaceToolsDockWidget = ({
|
||||
|
||||
return (
|
||||
<>
|
||||
{openPopover ? (
|
||||
{isFocusMode && openPopover ? (
|
||||
<button
|
||||
type="button"
|
||||
aria-label="팝오버 닫기"
|
||||
@@ -364,7 +398,10 @@ export const SpaceToolsDockWidget = ({
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setOpenPopover((current) => (current === 'notes' ? null : 'notes'))}
|
||||
onClick={() => {
|
||||
setIdle(false);
|
||||
setOpenPopover((current) => (current === 'notes' ? null : 'notes'));
|
||||
}}
|
||||
className="inline-flex items-center gap-1.5 rounded-full border border-white/14 bg-black/24 px-2.5 py-1.5 text-[11px] text-white/88 backdrop-blur-md transition-opacity hover:opacity-100"
|
||||
>
|
||||
<span aria-hidden className="text-white/82">{ANCHOR_ICON.notes}</span>
|
||||
@@ -396,7 +433,10 @@ export const SpaceToolsDockWidget = ({
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setOpenPopover((current) => (current === 'sound' ? null : 'sound'))}
|
||||
onClick={() => {
|
||||
setIdle(false);
|
||||
setOpenPopover((current) => (current === 'sound' ? null : 'sound'));
|
||||
}}
|
||||
className="inline-flex items-center gap-1.5 rounded-full border border-white/14 bg-black/24 px-2.5 py-1.5 text-[11px] text-white/88 backdrop-blur-md transition-opacity hover:opacity-100"
|
||||
>
|
||||
<span aria-hidden className="text-white/82">{ANCHOR_ICON.sound}</span>
|
||||
@@ -431,7 +471,7 @@ export const SpaceToolsDockWidget = ({
|
||||
) : null}
|
||||
|
||||
<SpaceSideSheet
|
||||
open={utilityPanel !== null}
|
||||
open={isFocusMode && utilityPanel !== null}
|
||||
title={utilityPanel ? UTILITY_PANEL_TITLE[utilityPanel] : ''}
|
||||
subtitle={utilityPanel === 'control-center' ? '배경 · 타이머 · 사운드를 그 자리에서 바꿔요.' : undefined}
|
||||
headerAction={
|
||||
@@ -449,6 +489,7 @@ export const SpaceToolsDockWidget = ({
|
||||
rooms={rooms}
|
||||
selectedRoomId={selectedRoomId}
|
||||
selectedTimerLabel={selectedTimerLabel}
|
||||
selectedSoundPresetId={selectedPresetId}
|
||||
sceneRecommendedSoundLabel={sceneRecommendedSoundLabel}
|
||||
sceneRecommendedTimerLabel={sceneRecommendedTimerLabel}
|
||||
timerPresets={timerPresets}
|
||||
@@ -460,6 +501,7 @@ export const SpaceToolsDockWidget = ({
|
||||
onSelectTimer={(label) => {
|
||||
onTimerSelect(label);
|
||||
}}
|
||||
onSelectSound={onQuickSoundSelect}
|
||||
onLockedClick={handleLockedClick}
|
||||
onResetToRecommended={onResetToSceneRecommended}
|
||||
/>
|
||||
@@ -484,8 +526,8 @@ export const SpaceToolsDockWidget = ({
|
||||
{utilityPanel === 'manage-plan' ? (
|
||||
<ManagePlanSheetContent
|
||||
onClose={() => setUtilityPanel(null)}
|
||||
onManage={() => pushToast({ title: '구독 관리(더미)' })}
|
||||
onRestore={() => pushToast({ title: '구매 복원(더미)' })}
|
||||
onManage={() => onStatusMessage({ message: '구독 관리(더미)' })}
|
||||
onRestore={() => onStatusMessage({ message: '구매 복원(더미)' })}
|
||||
/>
|
||||
) : null}
|
||||
</SpaceSideSheet>
|
||||
|
||||
Reference in New Issue
Block a user