diff --git a/.prettierrc b/.prettierrc index c62afff6..5a1003a6 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,17 +1,17 @@ { - "arrowParens": "always", - "tabWidth": 2, - "semi": false, - "singleQuote": true, - "htmlWhitespaceSensitivity": "css", - "plugins": ["prettier-plugin-svelte"], - "overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }], - "trailingComma": "all", - "bracketSameLine": false, - "svelteAllowShorthand": true, - "svelteBracketNewLine": true, - "svelteIndentScriptAndStyle": true, - "svelteSortOrder": "scripts-options-markup-styles", - "svelteStrictMode": false, - "useTabs": false + "arrowParens": "always", + "tabWidth": 2, + "semi": false, + "singleQuote": true, + "htmlWhitespaceSensitivity": "ignore", + "plugins": ["prettier-plugin-svelte"], + "overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }], + "trailingComma": "all", + "bracketSameLine": false, + "svelteAllowShorthand": true, + "svelteBracketNewLine": true, + "svelteIndentScriptAndStyle": true, + "svelteSortOrder": "scripts-options-markup-styles", + "svelteStrictMode": false, + "useTabs": false } diff --git a/src/lib/components/lemmy/post/Post.svelte b/src/lib/components/lemmy/post/Post.svelte index ab0cb6d8..a359812f 100644 --- a/src/lib/components/lemmy/post/Post.svelte +++ b/src/lib/components/lemmy/post/Post.svelte @@ -61,6 +61,7 @@ content: i.flair_title, color: i.background_color, icon: null, + type: 'flair' as 'flair' | 'custom', })) ?? []), ], } diff --git a/src/lib/components/lemmy/post/PostItem.svelte b/src/lib/components/lemmy/post/PostItem.svelte index 24c1f8f4..1c723446 100644 --- a/src/lib/components/lemmy/post/PostItem.svelte +++ b/src/lib/components/lemmy/post/PostItem.svelte @@ -9,4 +9,4 @@ let { post }: Props = $props() - + diff --git a/src/lib/components/lemmy/post/PostMeta.svelte b/src/lib/components/lemmy/post/PostMeta.svelte index d649104b..c10853e7 100644 --- a/src/lib/components/lemmy/post/PostMeta.svelte +++ b/src/lib/components/lemmy/post/PostMeta.svelte @@ -12,12 +12,14 @@ content: string color?: string icon?: IconSource | null + textColor?: string + type: 'flair' | 'custom' } export const textToTag: Map = new Map([ - ['OC', { content: 'OC', color: '#03A8F240' }], - ['NSFL', { content: 'NSFL', color: '#ff000040' }], - ['CW', { content: 'CW', color: '#ff000040' }], + ['OC', { content: 'OC', color: '#03A8F240', type: 'custom' }], + ['NSFL', { content: 'NSFL', color: '#ff000040', type: 'custom' }], + ['CW', { content: 'CW', color: '#ff000040', type: 'custom' }], ]) export const parseTags = ( @@ -38,6 +40,7 @@ extracted.push( textToTag.get(content) ?? { content: content, + type: 'custom', }, ) }) @@ -308,28 +311,34 @@ {/if}
{#if tags} {#each tags as tag} - {#snippet icon()} {#if tag.icon} - {:else if tag !== null} + {:else if tag === undefined} {/if} {/snippet} {tag.content} - + {/each} {/if} {#each Object.keys(badges) @@ -339,8 +348,8 @@ .map((i) => badgeToData.get(i as BadgeType)) // remove null .filter((i) => i != undefined) as badge} - {#snippet icon()} + + {#snippet icon()} {/snippet}{badge.label} {/each} @@ -420,5 +429,6 @@ :global(.badge-tag-color) { background-color: var(--tag-color) !important; + color: var(--tag-text-color, #000) !important; } diff --git a/src/lib/components/lemmy/user/UserLink.svelte b/src/lib/components/lemmy/user/UserLink.svelte index d78410cc..b1b19e1c 100644 --- a/src/lib/components/lemmy/user/UserLink.svelte +++ b/src/lib/components/lemmy/user/UserLink.svelte @@ -142,7 +142,9 @@ {/if} {/if} {#if user.flair} - {user.flair} + + {user.flair} + {/if} {@render extraBadges?.()} {/if} diff --git a/src/lib/mono/badge/Badge.svelte b/src/lib/mono/badge/Badge.svelte index 7e3813f3..3b22383b 100644 --- a/src/lib/mono/badge/Badge.svelte +++ b/src/lib/mono/badge/Badge.svelte @@ -54,13 +54,13 @@ {@render icon?.()} diff --git a/src/routes/accounts/+page.svelte b/src/routes/accounts/+page.svelte index 0647c4ef..1367c853 100644 --- a/src/routes/accounts/+page.svelte +++ b/src/routes/accounts/+page.svelte @@ -131,7 +131,7 @@ animate={false} > {#snippet item(p, index)} -

- +

(title = i?.title ?? '')) + data.topic.then((i) => (title = i?.name ?? ''))