refactor(v024): NoteCard onDeleted optional + trash mode 미전달 (backlog #13)

- onDeleted: () => void → onDeleted?: () => void (inbox mode 전용 명시)
- handleDelete 내부 onDeleted() → onDeleted?.()
- App.tsx 의 trash mode NoteCard 가 onDeleted prop 미전달 (dead-code 제거)
- API 시그니처 정리 — trash mode 는 onPermanentDelete/onRestore 만 의미

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
altair823
2026-05-05 00:12:56 +09:00
parent ef5d3daf4c
commit c87c248e89
2 changed files with 2 additions and 3 deletions

View File

@@ -147,7 +147,6 @@ export function App(): React.ReactElement {
trashNotes.map((n) => (
<NoteCard
key={n.id} note={n} mode="trash"
onDeleted={() => removeNote(n.id)}
onUpdated={(u) => upsertNote(u)}
onRestore={() => void restoreNote(n.id)}
onPermanentDelete={() => void permanentDeleteNote(n.id)}

View File

@@ -8,7 +8,7 @@ import { pushTagUndo } from './TagUndoToast.js';
interface Props {
note: Note;
onDeleted: () => void;
onDeleted?: () => void; // inbox mode 전용 (trash mode 에서 미사용)
onUpdated: (n: Note) => void;
mode?: 'inbox' | 'trash'; // default 'inbox'
onRestore?: () => void;
@@ -119,7 +119,7 @@ export function NoteCard({ note, onDeleted, onUpdated, mode = 'inbox', onRestore
async function handleDelete() {
if (!window.confirm('이 기억을 버릴까요? 되돌릴 수 없습니다.')) return;
await inboxApi.deleteNote(note.id);
onDeleted();
onDeleted?.();
}
async function saveTitle(next: string) {