load in optimization and error correction
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { type Component, createEffect, createSignal, For, createMemo, onCleanup, Show } from "solid-js";
|
||||
import { Sheet, SheetContent } from "@/components/ui/sheet";
|
||||
import { type Task, removeTask, restoreTask, updateTask, saveTaskAsTemplate, loadTaskContent, currentTaskContext, cleanupTaskAttachments, getFavoriteTag, now } from "@/store";
|
||||
import { type Task, removeTask, restoreTask, updateTask, saveTaskAsTemplate, loadTaskContent, currentTaskContext, cleanupTaskAttachments, getFavoriteTag, now, isCurrentUserContextTag } from "@/store";
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
||||
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
|
||||
import { ArrowUpCircle, Clock, Calendar, Type, Trash2, X, Copy, MoreHorizontal, Gauge, Star, FileText } from "lucide-solid";
|
||||
@@ -170,8 +170,17 @@ export const TaskDetail: Component<TaskDetailProps> = (props) => {
|
||||
|
||||
const updateTags = (tags: string[]) => {
|
||||
const ctx = currentTaskContext();
|
||||
const currentTags = props.task.tags || [];
|
||||
let newTags = [...tags];
|
||||
|
||||
currentTags
|
||||
.filter(tag => isCurrentUserContextTag(tag))
|
||||
.forEach(tag => {
|
||||
if (!newTags.some(existing => existing.toLowerCase() === tag.toLowerCase())) {
|
||||
newTags.push(tag);
|
||||
}
|
||||
});
|
||||
|
||||
// If in a bucket view, ensure the bucket tag is preserved (it was hidden from the UI so it's missing from 'tags')
|
||||
if (typeof ctx === 'object' && 'bucketId' in ctx) {
|
||||
const bucketContext = store.contexts.find(context => context.id === ctx.bucketId);
|
||||
@@ -204,10 +213,10 @@ export const TaskDetail: Component<TaskDetailProps> = (props) => {
|
||||
if (typeof ctx === 'object' && 'bucketId' in ctx) {
|
||||
const bucketContext = store.contexts.find(context => context.id === ctx.bucketId);
|
||||
const bucketTagName = buildShareTag(bucketContext?.displayName || ctx.name).toLowerCase();
|
||||
return tags.filter(t => t.toLowerCase() !== bucketTagName && !t.endsWith("_favorite__"));
|
||||
return tags.filter(t => t.toLowerCase() !== bucketTagName && !t.endsWith("_favorite__") && !isCurrentUserContextTag(t));
|
||||
}
|
||||
|
||||
return tags.filter(t => !t.endsWith("_favorite__"));
|
||||
return tags.filter(t => !t.endsWith("_favorite__") && !isCurrentUserContextTag(t));
|
||||
});
|
||||
|
||||
const statusOptions = createMemo(() => getStatusOptionsForTask(props.task.recurrence));
|
||||
@@ -692,7 +701,10 @@ export const TaskDetail: Component<TaskDetailProps> = (props) => {
|
||||
fallback={<p class="text-[0.6875rem] text-muted-foreground/70">No shared contexts on this task.</p>}
|
||||
>
|
||||
<div class="flex flex-wrap gap-1.5">
|
||||
<For each={props.task.shareRefs}>
|
||||
<For each={props.task.shareRefs.filter(ref => {
|
||||
const context = store.contexts.find(existing => existing.id === ref.contextId) || store.contexts.find(existing => existing.key === ref.key);
|
||||
return !isCurrentUserContextTag(`@${context?.displayName || ref.key}`);
|
||||
})}>
|
||||
{(ref) => {
|
||||
const context = store.contexts.find(existing => existing.id === ref.contextId) || store.contexts.find(existing => existing.key === ref.key);
|
||||
const label = `@${context?.displayName || ref.key}`;
|
||||
|
||||
Reference in New Issue
Block a user