tag prefixing via @ and #

This commit is contained in:
2026-02-27 10:22:28 -06:00
parent 3907de048b
commit 3826a2cbe2
6 changed files with 39 additions and 72 deletions
+5 -4
View File
@@ -53,7 +53,8 @@ export const NotepadView: Component<{
await handleUpdateNote(id, { title: newTitle });
// 2. Rename the TagDefinition (preserves color) and propagate to all tagged tasks
await renameTagDefinition(oldTitle, newTitle);
// Use '#' prefix for note tags
await renameTagDefinition(`#${oldTitle}`, `#${newTitle}`);
};
const handleDeleteNote = async (id: string) => {
try {
@@ -86,11 +87,12 @@ export const NotepadView: Component<{
const linkedTasks = createMemo(() => {
const note = activeNote();
if (!note) return [];
const noteTagName = `#${note.title}`;
return store.tasks.filter(t => {
// Explicit relation
if (note.tasks && note.tasks.includes(t.id)) return true;
// Tag relation (case-insensitive title match)
if (t.tags && t.tags.some(tag => tag.toLowerCase() === note.title.toLowerCase())) return true;
// Tag relation (case-insensitive title match with # prefix)
if (t.tags && t.tags.some(tag => tag.toLowerCase() === noteTagName.toLowerCase())) return true;
return false;
});
});
@@ -206,7 +208,6 @@ export const NotepadView: Component<{
<For each={note().tags}>
{(tag) => (
<Badge variant="secondary" class="h-6 px-2 text-xs bg-muted/30 border border-border/50 text-foreground shadow-sm">
<Hash size={10} class="mr-1 opacity-50" />
{tag}
<Show when={canEdit}>
<button