tag hiding in buckets to prevent orphaning

This commit is contained in:
2026-02-19 17:36:04 -06:00
parent 96ee1168b1
commit 9d8e80a2bf
2 changed files with 49 additions and 9 deletions
+17 -3
View File
@@ -1,5 +1,5 @@
import { type Component, createMemo, For } from "solid-js";
import { type Task, calculateUrgencyFromDate, setActiveTaskId, store, copyTask, updateTask } from "@/store";
import { type Task, calculateUrgencyFromDate, setActiveTaskId, store, copyTask, updateTask, currentTaskContext } from "@/store";
import { cn } from "@/lib/utils";
import { Clock, ArrowUpCircle, Copy, Users2 } from "lucide-solid";
import { Badge } from "@/components/ui/badge";
@@ -26,6 +26,20 @@ export const TaskCard: Component<{ task: Task }> = (props) => {
return date.toLocaleDateString(undefined, { month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' });
};
// Filter out bucket tags if we are currently INSIDE that bucket view
const visibleTags = createMemo(() => {
const tags = props.task.tags || [];
const ctx = currentTaskContext();
if (typeof ctx === 'object' && 'bucketId' in ctx) {
// We are in a bucket view. Hide the tag that matches this bucket's name.
const bucketName = (ctx as { name: string }).name.toLowerCase();
return tags.filter(t => t.toLowerCase() !== bucketName);
}
return tags;
});
return (
<div
class={cn(
@@ -126,9 +140,9 @@ export const TaskCard: Component<{ task: Task }> = (props) => {
})()}
{/* Tags */}
{props.task.tags && props.task.tags.length > 0 && (
{visibleTags().length > 0 && (
<div class="flex flex-wrap items-center gap-1 min-w-0">
<For each={props.task.tags}>
<For each={visibleTags()}>
{(tag) => (
<Badge
variant="secondary"