Skip to content

Commit de0c614

Browse files
author
Antonio Maiolo
authored
feat(app): add edit button for notes in memory card (#89)
1 parent d4dfcc3 commit de0c614

3 files changed

Lines changed: 31 additions & 0 deletions

File tree

.changeset/note-edit-button.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"think-app": minor
3+
---
4+
5+
feat: add edit button for notes in memory card
6+
7+
Add a pencil icon button on note memory cards that opens the editor
8+
directly, without having to go through the detail panel first.

app/src/components/MemoryCard.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
X,
66
Link as LinkIcon,
77
PanelRight,
8+
Pencil,
89
} from "lucide-react";
910
import { cn } from "@/lib/utils";
1011

@@ -28,6 +29,7 @@ interface MemoryCardProps {
2829
memory: Memory;
2930
onRemoveTag: (memoryId: number, tagId: number) => void;
3031
onExpand: (id: number) => void;
32+
onEdit?: (id: number) => void;
3133
formatDate: (date: string) => string;
3234
}
3335

@@ -65,6 +67,7 @@ export function MemoryCard({
6567
memory,
6668
onRemoveTag,
6769
onExpand,
70+
onEdit,
6871
formatDate,
6972
}: MemoryCardProps) {
7073
return (
@@ -89,6 +92,17 @@ export function MemoryCard({
8992
"transition-opacity duration-200"
9093
)}
9194
>
95+
{memory.type === "note" && onEdit && (
96+
<Button
97+
variant="ghost"
98+
size="icon"
99+
onClick={() => onEdit(memory.id)}
100+
className="h-7 w-7 text-muted-foreground hover:text-foreground"
101+
title="Edit Note"
102+
>
103+
<Pencil className="h-3.5 w-3.5" />
104+
</Button>
105+
)}
92106
<Button
93107
variant="ghost"
94108
size="icon"

app/src/pages/MemoriesPage.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,14 @@ export default function MemoriesPage() {
292292
setIsPanelOpen(true);
293293
};
294294

295+
// Open note editor directly from card
296+
const handleEdit = (id: number) => {
297+
const memory = memories.find((m) => m.id === id);
298+
if (memory) {
299+
openNoteEditor(memory);
300+
}
301+
};
302+
295303
// Close detail panel
296304
const closePanel = () => {
297305
setIsPanelOpen(false);
@@ -532,6 +540,7 @@ export default function MemoriesPage() {
532540
memory={memory}
533541
onRemoveTag={handleRemoveTag}
534542
onExpand={handleExpand}
543+
onEdit={handleEdit}
535544
formatDate={formatDate}
536545
/>
537546
</div>

0 commit comments

Comments
 (0)