tag list fixes
This commit is contained in:
+10
-10
@@ -1619,8 +1619,8 @@ export const syncSystemTagsAndRules = async () => {
|
|||||||
// --- Sync Bucket Tags ---
|
// --- Sync Bucket Tags ---
|
||||||
for (const bucket of store.buckets) {
|
for (const bucket of store.buckets) {
|
||||||
const bucketTagName = `@${bucket.name}`;
|
const bucketTagName = `@${bucket.name}`;
|
||||||
const tagExists = tagDefinitions.find(t => t.name === bucketTagName);
|
const tagExistsExact = tagDefinitions.find(t => t.name.toLowerCase() === bucketTagName.toLowerCase());
|
||||||
if (!tagExists) {
|
if (!tagExistsExact) {
|
||||||
try {
|
try {
|
||||||
const record = await pb.collection(TAGS_COLLECTION).create({
|
const record = await pb.collection(TAGS_COLLECTION).create({
|
||||||
user: currentUserId,
|
user: currentUserId,
|
||||||
@@ -1641,10 +1641,10 @@ export const syncSystemTagsAndRules = async () => {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(`Failed to create bucket tag ${bucketTagName}`, e);
|
console.error(`Failed to create bucket tag ${bucketTagName}`, e);
|
||||||
}
|
}
|
||||||
} else if (!tagExists.isBucket) {
|
} else if (!tagExistsExact.isBucket) {
|
||||||
try {
|
try {
|
||||||
await pb.collection(TAGS_COLLECTION).update(tagExists.id, { isBucket: true });
|
await pb.collection(TAGS_COLLECTION).update(tagExistsExact.id, { isBucket: true });
|
||||||
setStore("tagDefinitions", d => d.id === tagExists.id, { isBucket: true });
|
setStore("tagDefinitions", d => d.id === tagExistsExact.id, { isBucket: true });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(`Failed to flag tag ${bucketTagName} as bucket`, e);
|
console.error(`Failed to flag tag ${bucketTagName} as bucket`, e);
|
||||||
}
|
}
|
||||||
@@ -1678,8 +1678,8 @@ export const syncSystemTagsAndRules = async () => {
|
|||||||
if (!originalName) continue;
|
if (!originalName) continue;
|
||||||
const userName = `@${originalName}`;
|
const userName = `@${originalName}`;
|
||||||
|
|
||||||
const tagExists = tagDefinitions.find(t => t.name === userName);
|
const tagExistsExact = tagDefinitions.find(t => t.name.toLowerCase() === userName.toLowerCase());
|
||||||
if (!tagExists) {
|
if (!tagExistsExact) {
|
||||||
try {
|
try {
|
||||||
const record = await pb.collection(TAGS_COLLECTION).create({
|
const record = await pb.collection(TAGS_COLLECTION).create({
|
||||||
user: currentUserId,
|
user: currentUserId,
|
||||||
@@ -1700,10 +1700,10 @@ export const syncSystemTagsAndRules = async () => {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
// console.error(`Failed to create user tag ${userName}`, e);
|
// console.error(`Failed to create user tag ${userName}`, e);
|
||||||
}
|
}
|
||||||
} else if (!tagExists.isUser) {
|
} else if (!tagExistsExact.isUser) {
|
||||||
try {
|
try {
|
||||||
await pb.collection(TAGS_COLLECTION).update(tagExists.id, { isUser: true });
|
await pb.collection(TAGS_COLLECTION).update(tagExistsExact.id, { isUser: true });
|
||||||
setStore("tagDefinitions", d => d.id === tagExists.id, { isUser: true });
|
setStore("tagDefinitions", d => d.id === tagExistsExact.id, { isUser: true });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(`Failed to flag tag ${userName} as user`, e);
|
console.error(`Failed to flag tag ${userName} as user`, e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -890,9 +890,9 @@ export const SettingsView: Component<{ setView?: (v: string) => void }> = (props
|
|||||||
<div class="space-y-0.5">
|
<div class="space-y-0.5">
|
||||||
<h3 class="text-base font-semibold flex items-center gap-2">
|
<h3 class="text-base font-semibold flex items-center gap-2">
|
||||||
<Tag size={16} />
|
<Tag size={16} />
|
||||||
Global Tags
|
Tag List
|
||||||
</h3>
|
</h3>
|
||||||
<p class="text-sm text-muted-foreground">Manage your global tag definitions and values.</p>
|
<p class="text-sm text-muted-foreground">Manage tag definitions and values.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="w-8 h-8 rounded-full flex items-center justify-center bg-muted/50 group-hover:bg-muted transition-colors">
|
<div class="w-8 h-8 rounded-full flex items-center justify-center bg-muted/50 group-hover:bg-muted transition-colors">
|
||||||
{isTagsOpen() ? <ChevronDown size={16} /> : <ChevronRight size={16} />}
|
{isTagsOpen() ? <ChevronDown size={16} /> : <ChevronRight size={16} />}
|
||||||
@@ -902,7 +902,7 @@ export const SettingsView: Component<{ setView?: (v: string) => void }> = (props
|
|||||||
<Show when={isTagsOpen()}>
|
<Show when={isTagsOpen()}>
|
||||||
<div class="space-y-2 pt-2 animate-in fade-in slide-in-from-top-2 duration-300">
|
<div class="space-y-2 pt-2 animate-in fade-in slide-in-from-top-2 duration-300">
|
||||||
<div class="space-y-2">
|
<div class="space-y-2">
|
||||||
<For each={store.tagDefinitions.filter(t => !t.isUser && !t.name.startsWith('#') && !store.buckets.some(b => b.name === t.name || `@${b.name} ` === t.name)).sort((a, b) => a.name.localeCompare(b.name))} fallback={
|
<For each={store.tagDefinitions.filter(t => !t.isUser && !t.isBucket && !t.name.startsWith('#') && !t.name.startsWith('@')).sort((a, b) => a.name.localeCompare(b.name))} fallback={
|
||||||
<div class="text-center py-8 text-muted-foreground text-sm italic border border-dashed border-border rounded-xl">
|
<div class="text-center py-8 text-muted-foreground text-sm italic border border-dashed border-border rounded-xl">
|
||||||
No custom tags found.
|
No custom tags found.
|
||||||
</div>
|
</div>
|
||||||
@@ -991,7 +991,7 @@ export const SettingsView: Component<{ setView?: (v: string) => void }> = (props
|
|||||||
System Tags (Users, Buckets & Notes)
|
System Tags (Users, Buckets & Notes)
|
||||||
</summary>
|
</summary>
|
||||||
<div class="pt-2 pl-4 space-y-2 animate-in fade-in slide-in-from-top-1 duration-200">
|
<div class="pt-2 pl-4 space-y-2 animate-in fade-in slide-in-from-top-1 duration-200">
|
||||||
<For each={store.tagDefinitions.filter(t => t.isUser || t.name.startsWith('#') || store.buckets.some(b => b.name === t.name || `@${b.name}` === t.name)).sort((a, b) => a.name.localeCompare(b.name))}>
|
<For each={store.tagDefinitions.filter(t => t.isUser || t.isBucket || t.name.startsWith('#') || t.name.startsWith('@')).sort((a, b) => a.name.localeCompare(b.name))}>
|
||||||
{(tag) => (
|
{(tag) => (
|
||||||
<div class="flex flex-col sm:flex-row sm:items-center justify-between p-2 rounded-lg bg-muted/10 border border-border/20 gap-3 sm:gap-4 group opacity-80">
|
<div class="flex flex-col sm:flex-row sm:items-center justify-between p-2 rounded-lg bg-muted/10 border border-border/20 gap-3 sm:gap-4 group opacity-80">
|
||||||
<div class="flex items-center gap-3 min-w-0 flex-1">
|
<div class="flex items-center gap-3 min-w-0 flex-1">
|
||||||
|
|||||||
Reference in New Issue
Block a user