feat(v029): 헤더 4탭 (Inbox/완료/보관/휴지통) + count badge
- App.tsx: 기존 2탭 (Inbox/휴지통) → 4탭. setView/counts 사용.
- onNavigate 도 setView 로 위임 (mirror state 동기 갱신).
- App.test: 4탭 렌더 + 클릭 → setView('completed') + aria-pressed (3 cases).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -23,6 +23,10 @@ export function App(): React.ReactElement {
|
||||
} = useInbox();
|
||||
const showSettings = useInbox((s) => s.showSettings);
|
||||
const setShowSettings = useInbox((s) => s.setShowSettings);
|
||||
// v0.2.9 Cut B Task 5 — 4탭 (Inbox/완료/보관/휴지통).
|
||||
const view = useInbox((s) => s.view);
|
||||
const counts = useInbox((s) => s.counts);
|
||||
const setView = useInbox((s) => s.setView);
|
||||
const [recoveryDismissed, setRecoveryDismissed] = useState(isRecoveryDismissedToday());
|
||||
|
||||
useEffect(() => {
|
||||
@@ -35,15 +39,8 @@ export function App(): React.ReactElement {
|
||||
useInbox.setState({ ollamaStatus: status });
|
||||
});
|
||||
const unsubNav = inboxApi.onNavigate((view) => {
|
||||
if (view === 'settings') {
|
||||
useInbox.getState().setShowSettings(true);
|
||||
} else if (view === 'inbox') {
|
||||
useInbox.getState().setShowSettings(false);
|
||||
if (useInbox.getState().showTrash) void useInbox.getState().toggleShowTrash();
|
||||
} else if (view === 'trash') {
|
||||
useInbox.getState().setShowSettings(false);
|
||||
if (!useInbox.getState().showTrash) void useInbox.getState().toggleShowTrash();
|
||||
}
|
||||
// v0.2.9 Cut B Task 4 — setView 가 mirror state (showTrash/showSettings) 동기 갱신.
|
||||
useInbox.getState().setView(view);
|
||||
});
|
||||
const onFocus = () => { void refreshMeta(); };
|
||||
window.addEventListener('focus', onFocus);
|
||||
@@ -72,20 +69,23 @@ export function App(): React.ReactElement {
|
||||
<div className="header">
|
||||
<h1 style={{ fontSize: 18, margin: 0 }}>Inkling</h1>
|
||||
<div style={{ display: 'flex', gap: 6, marginLeft: 12 }}>
|
||||
<button
|
||||
onClick={() => { if (showTrash) void toggleShowTrash(); }}
|
||||
aria-pressed={!showTrash}
|
||||
style={tabBtnStyle(!showTrash)}
|
||||
>
|
||||
Inbox({notes.length})
|
||||
</button>
|
||||
<button
|
||||
onClick={() => { if (!showTrash) void toggleShowTrash(); }}
|
||||
aria-pressed={showTrash}
|
||||
style={tabBtnStyle(showTrash)}
|
||||
>
|
||||
휴지통({trashCount})
|
||||
</button>
|
||||
{(
|
||||
[
|
||||
{ key: 'inbox', label: 'Inbox', count: counts.active },
|
||||
{ key: 'completed', label: '완료', count: counts.completed },
|
||||
{ key: 'archived', label: '보관', count: counts.archived },
|
||||
{ key: 'trash', label: '휴지통', count: counts.trashed }
|
||||
] as const
|
||||
).map((t) => (
|
||||
<button
|
||||
key={t.key}
|
||||
onClick={() => setView(t.key)}
|
||||
aria-pressed={view === t.key}
|
||||
style={tabBtnStyle(view === t.key)}
|
||||
>
|
||||
{t.label}({t.count})
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'flex-end', gap: 2, marginLeft: 'auto' }}>
|
||||
<ContinuityBadge />
|
||||
|
||||
Reference in New Issue
Block a user