Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/note-edit-button.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"think-app": minor
---

feat: add edit button for notes in memory card

Add a pencil icon button on note memory cards that opens the editor
directly, without having to go through the detail panel first.
14 changes: 14 additions & 0 deletions app/src/components/MemoryCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
X,
Link as LinkIcon,
PanelRight,
Pencil,
} from "lucide-react";
import { cn } from "@/lib/utils";

Expand All @@ -28,6 +29,7 @@ interface MemoryCardProps {
memory: Memory;
onRemoveTag: (memoryId: number, tagId: number) => void;
onExpand: (id: number) => void;
onEdit?: (id: number) => void;
formatDate: (date: string) => string;
}

Expand Down Expand Up @@ -65,6 +67,7 @@ export function MemoryCard({
memory,
onRemoveTag,
onExpand,
onEdit,
formatDate,
}: MemoryCardProps) {
return (
Expand All @@ -89,6 +92,17 @@ export function MemoryCard({
"transition-opacity duration-200"
)}
>
{memory.type === "note" && onEdit && (
<Button
variant="ghost"
size="icon"
onClick={() => onEdit(memory.id)}
className="h-7 w-7 text-muted-foreground hover:text-foreground"
title="Edit Note"
>
<Pencil className="h-3.5 w-3.5" />
</Button>
)}
<Button
variant="ghost"
size="icon"
Expand Down
9 changes: 9 additions & 0 deletions app/src/pages/MemoriesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,14 @@ export default function MemoriesPage() {
setIsPanelOpen(true);
};

// Open note editor directly from card
const handleEdit = (id: number) => {
const memory = memories.find((m) => m.id === id);
if (memory) {
openNoteEditor(memory);
}
};

// Close detail panel
const closePanel = () => {
setIsPanelOpen(false);
Expand Down Expand Up @@ -532,6 +540,7 @@ export default function MemoriesPage() {
memory={memory}
onRemoveTag={handleRemoveTag}
onExpand={handleExpand}
onEdit={handleEdit}
formatDate={formatDate}
/>
</div>
Expand Down