fix(workspace): sort daily memory by date and inline into file grid

- Sort daily memory list by filename (YYYY-MM-DD.md) instead of mtime
  so editing an older file no longer bumps it to the top
- Move daily memory card inline with workspace MD file buttons
- Shorten card description across all locales
- Defer file creation until user actually saves (no empty file on create)
This commit is contained in:
Jason
2026-02-20 10:40:58 +08:00
parent 4440a14082
commit 7532308519
6 changed files with 12 additions and 23 deletions
+5 -11
View File
@@ -100,7 +100,7 @@ const DailyMemoryPanel: React.FC<DailyMemoryPanelProps> = ({
[t],
);
// Create today's note
// Create today's note (deferred — file is only persisted on save)
const handleCreateToday = useCallback(async () => {
const filename = getTodayFilename();
// Check if already exists in the list
@@ -110,16 +110,10 @@ const DailyMemoryPanel: React.FC<DailyMemoryPanelProps> = ({
await openFile(filename);
return;
}
// Create with empty content, then open
try {
await workspaceApi.writeDailyMemoryFile(filename, "");
await loadFiles();
await openFile(filename);
} catch (err) {
console.error("Failed to create daily memory file:", err);
toast.error(t("workspace.dailyMemory.createFailed"));
}
}, [files, openFile, loadFiles, t]);
// Open editor with empty content — no file created until user saves
setEditingFile(filename);
setContent("");
}, [files, openFile]);
// Save current file
const handleSave = useCallback(async () => {