feat(v029): NoteCard ai_status='disabled' fallback (raw_text 첫 줄 + summary/tags hide)
This commit is contained in:
@@ -110,8 +110,11 @@ function DueDateBadge({
|
||||
|
||||
export function NoteCard({ note, onDeleted, onUpdated, mode = 'inbox', onRestore, onPermanentDelete }: Props): React.ReactElement {
|
||||
const isTrash = mode === 'trash';
|
||||
// v0.2.9 Cut B Task 13 — ai_status='disabled' 노트는 raw_text 가 1차 정보. 원문 펼침 default 켬.
|
||||
const [rawOpen, setRawOpen] = useState(note.aiStatus !== 'done');
|
||||
const [local, setLocal] = useState(note);
|
||||
const isAiDisabled = local.aiStatus === 'disabled';
|
||||
const fallbackTitle = local.rawText.split('\n')[0]?.slice(0, 60) || '(빈 메모)';
|
||||
// v0.2.9 Cut B Task 6 — 이동 메뉴 dropdown + MoveStatusModal target.
|
||||
const [moveTarget, setMoveTarget] = useState<NoteStatus | null>(null);
|
||||
const [menuOpen, setMenuOpen] = useState(false);
|
||||
@@ -211,6 +214,13 @@ export function NoteCard({ note, onDeleted, onUpdated, mode = 'inbox', onRestore
|
||||
정리 보류 — 원문은 안전합니다
|
||||
</div>
|
||||
)}
|
||||
{/* v0.2.9 Cut B Task 13 — ai_status='disabled': raw_text 첫 줄 fallback title.
|
||||
summary/tags 는 hide. 원문은 아래 "원문 보기" 영역에서 항상 표시. */}
|
||||
{isAiDisabled && (
|
||||
<div style={{ marginTop: 4 }}>
|
||||
<h3 style={{ margin: 0, fontSize: 16, fontWeight: 600 }}>{fallbackTitle}</h3>
|
||||
</div>
|
||||
)}
|
||||
{local.aiStatus === 'done' && (
|
||||
<>
|
||||
{isTrash ? (
|
||||
|
||||
@@ -90,6 +90,39 @@ describe('NoteCard — image rendering', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('NoteCard — ai_status=disabled fallback (v0.2.9 Cut B Task 13)', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
cleanup();
|
||||
});
|
||||
|
||||
it('ai_status=disabled: title fallback to raw_text first line, hide summary/tags', () => {
|
||||
const disabledNote: Note = {
|
||||
...baseNote,
|
||||
aiStatus: 'disabled',
|
||||
aiTitle: null,
|
||||
aiSummary: 'should-not-show',
|
||||
tags: [{ name: 't1', source: 'user' }],
|
||||
rawText: '첫 줄 본문\n둘째 줄 본문'
|
||||
};
|
||||
render(<NoteCard note={disabledNote} mode="inbox" onUpdated={vi.fn()} />);
|
||||
expect(screen.getByText('첫 줄 본문')).toBeInTheDocument();
|
||||
expect(screen.queryByText('should-not-show')).toBeNull();
|
||||
expect(screen.queryByText('t1')).toBeNull();
|
||||
});
|
||||
|
||||
it('ai_status=disabled: empty raw → "(빈 메모)" fallback', () => {
|
||||
const disabledNote: Note = {
|
||||
...baseNote,
|
||||
aiStatus: 'disabled',
|
||||
aiTitle: null,
|
||||
rawText: ''
|
||||
};
|
||||
render(<NoteCard note={disabledNote} mode="inbox" onUpdated={vi.fn()} />);
|
||||
expect(screen.getByText('(빈 메모)')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
describe('NoteCard — 이동 메뉴 (v0.2.9 Cut B Task 6)', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
|
||||
Reference in New Issue
Block a user