feat: add display names

This commit is contained in:
Xyphyn committed 2023-08-09 11:49:46 -07:00
1 parent 2a901e89d4
commit 8e3c57b6c2
3 files changed
+11 -3

No files matched your search

@@ -30,13 +30,11 @@
class:text-red-500={user.admin} class:text-red-500={user.admin}
class:font-bold={user.admin} class:font-bold={user.admin}
> >
{$userSettings.displayNames ? user.display_name ?? user.name : user.name}
{#if $userSettings.showInstances.user || ($userSettings.showInstances.comments && inComment)} {#if $userSettings.showInstances.user || ($userSettings.showInstances.comments && inComment)}
{user.name}
<span class="text-slate-500 dark:text-zinc-500 font-normal"> <span class="text-slate-500 dark:text-zinc-500 font-normal">
@{new URL(user.actor_id).hostname} @{new URL(user.actor_id).hostname}
</span> </span>
{:else}
{user.name}
{/if} {/if}
</span> </span>
{#if badges && (user.admin || user.banned || user.bot_account)} {#if badges && (user.admin || user.banned || user.bot_account)}
+2
View File
@@ -30,6 +30,7 @@ interface Settings {
// how often to check in the background // how often to check in the background
notifRate: number notifRate: number
} }
displayNames: boolean
} }
const defaultSettings: Settings = { const defaultSettings: Settings = {
@@ -59,6 +60,7 @@ const defaultSettings: Settings = {
pollRate: 60 * 1000, pollRate: 60 * 1000,
notifRate: 10 * 60 * 1000, notifRate: 10 * 60 * 1000,
}, },
displayNames: true,
} }
export const userSettings = writable(defaultSettings) export const userSettings = writable(defaultSettings)
+8
View File
@@ -51,6 +51,14 @@
<Checkbox bind:checked={$userSettings.hidePosts.read}>Read</Checkbox> <Checkbox bind:checked={$userSettings.hidePosts.read}>Read</Checkbox>
</div> </div>
</Setting> </Setting>
<Setting>
<Checkbox slot="title" bind:checked={$userSettings.displayNames}>
Use display name
</Checkbox>
<span slot="description">
Show a user's display name instead of their account username.
</span>
</Setting>
<h2 class="uppercase font-bold opacity-80 text-sm mt-4">UI</h2> <h2 class="uppercase font-bold opacity-80 text-sm mt-4">UI</h2>
<Setting> <Setting>
<Checkbox bind:checked={$userSettings.markReadPosts} slot="title"> <Checkbox bind:checked={$userSettings.markReadPosts} slot="title">