auto tag bsed on bucket viewing

This commit is contained in:
2026-02-17 19:01:41 -06:00
parent 1a24165975
commit 07febd7dc7
+23 -1
View File
@@ -1,5 +1,5 @@
import { type Component, createSignal, createEffect, onCleanup, onMount, For, Show } from "solid-js"; import { type Component, createSignal, createEffect, onCleanup, onMount, For, Show } from "solid-js";
import { addTask, calculateDateFromUrgency, calculateUrgencyFromDate, store, upsertTagDefinition, type TaskTemplate } from "@/store"; import { addTask, calculateDateFromUrgency, calculateUrgencyFromDate, store, upsertTagDefinition, currentTaskContext, type TaskTemplate } from "@/store";
import { Search, Command, Clock, ArrowUpCircle, Plus, Copy, ChevronDown, Gauge, X } from "lucide-solid"; import { Search, Command, Clock, ArrowUpCircle, Plus, Copy, ChevronDown, Gauge, X } from "lucide-solid";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import { Badge } from "@/components/ui/badge"; import { Badge } from "@/components/ui/badge";
@@ -30,6 +30,28 @@ export const QuickEntry: Component = () => {
const [editorInstance, setEditorInstance] = createSignal<any>(null); const [editorInstance, setEditorInstance] = createSignal<any>(null);
const [size, setSize] = createSignal<string>("5"); const [size, setSize] = createSignal<string>("5");
// Autofill tags based on context when opening
createEffect(() => {
if (isOpen()) {
const ctx = currentTaskContext();
if (typeof ctx === 'object') {
if ('bucketId' in ctx) {
// Bucket View: Autofill bucket name
const bucketName = ctx.name;
if (bucketName && !tags().includes(bucketName)) {
setTags(prev => [...prev, bucketName]);
}
} else if ('userId' in ctx) {
// Shared User View: Autofill user name (assuming name IS the tag for sharing)
const userName = ctx.name;
if (userName && !tags().includes(userName)) {
setTags(prev => [...prev, userName]);
}
}
}
}
});
// Reactive shorthand parsing // Reactive shorthand parsing
createEffect(() => { createEffect(() => {
const text = input(); const text = input();