feat: make tag rules customizable

This commit is contained in:
Xylight committed 2024-07-09 13:25:35 -07:00
1 parent 3e563ad1cc
commit 7877c97aeb
4 files changed
+40 -2

No files matched your search

+1 -1
View File
@@ -150,7 +150,7 @@
/>
{/if}
{/key}
{#if post.post.body && !post.post.nsfw && view != 'compact' && !hideBody}
{#if post.post.body && !post.post.nsfw && view != 'compact' && !hideBody && rule != 'hide'}
<PostBody body={post.post.body} {view} style="grid-area: body" />
{/if}
{#if actions}
+7 -1
View File
@@ -639,7 +639,13 @@
},
"titleTags": {
"title": "Parse tags in title",
"description": "Take text in [brackets] and turn it into tags that you can click to search for."
"description": "Take text in [brackets] and turn it into tags that you can click to search for.",
"rules": {
"title": "Rules",
"blur": "Blur",
"hide": "Hide",
"show": "Show"
}
}
},
"embeds": {
+3
View File
@@ -91,6 +91,7 @@ interface Settings {
language: string | null
useRtl: boolean
translator: string | undefined
parseTags: boolean
tagRules: {
[key: string]: 'hide' | 'blur'
}
@@ -162,9 +163,11 @@ export const defaultSettings: Settings = {
language: env.PUBLIC_LANGUAGE ?? null,
useRtl: false,
translator: env.PUBLIC_TRANSLATOR ?? undefined,
parseTags: true,
tagRules: {
cw: 'blur',
nsfl: 'blur',
nsfw: 'blur',
},
}
+29
View File
@@ -295,6 +295,35 @@
pattern={DOMAIN_REGEX_FORMS}
/>
</Setting>
<div>
<ToggleSetting
title={$t('settings.app.titleTags.title')}
description={$t('settings.app.titleTags.description')}
bind:checked={$userSettings.parseTags}
/>
<Setting>
<svelte:fragment slot="title">
{$t('settings.app.titleTags.rules.title')}
</svelte:fragment>
<div
class="flex flex-col divide-y [&>*]:py-2 items-end divide-slate-200 dark:divide-zinc-800"
>
{#each Object.keys($userSettings.tagRules) as rule}
<div class="flex flex-row flex-wrap items-center gap-2">
<span class="text-lg font-medium">{rule}</span>
<MultiSelect
bind:selected={$userSettings.tagRules[rule]}
options={['blur', 'hide']}
optionNames={[
$t('settings.app.titleTags.rules.blur'),
$t('settings.app.titleTags.rules.hide'),
]}
/>
</div>
{/each}
</div>
</Setting>
</div>
</Section>
<Section title={$t('settings.embeds.title')}>