misc: hide instance setting if LINKED_ISNTANCE_URL is set

This commit is contained in:
Xyphyn committed 2023-07-30 11:58:53 -07:00
1 parent ca3496a31f
commit e10957ef94
1 file changed
+34 -24
+34 -24
View File
@@ -3,7 +3,13 @@
import TextInput from '$lib/components/input/TextInput.svelte' import TextInput from '$lib/components/input/TextInput.svelte'
import Card from '$lib/components/ui/Card.svelte' import Card from '$lib/components/ui/Card.svelte'
import { userSettings } from '$lib/settings' import { userSettings } from '$lib/settings'
import { authData, instance, user, validateInstance } from '$lib/lemmy.js' import {
LINKED_INSTANCE_URL,
authData,
instance,
user,
validateInstance,
} from '$lib/lemmy.js'
import { Color } from '$lib/ui/colors.js' import { Color } from '$lib/ui/colors.js'
import Button from '$lib/components/input/Button.svelte' import Button from '$lib/components/input/Button.svelte'
import { ToastType, toast } from '$lib/components/ui/toasts/toasts.js' import { ToastType, toast } from '$lib/components/ui/toasts/toasts.js'
@@ -48,29 +54,31 @@
<div class="flex flex-col"> <div class="flex flex-col">
<h1 class="text-3xl font-bold">Settings</h1> <h1 class="text-3xl font-bold">Settings</h1>
<h2 class="uppercase font-bold opacity-80 text-sm mt-4">General</h2> <h2 class="uppercase font-bold opacity-80 text-sm mt-4">General</h2>
<Setting> {#if !LINKED_INSTANCE_URL}
<span slot="title">Instance</span> <Setting>
<span slot="description">Changing this will log you out.</span> <span slot="title">Instance</span>
<div class="flex gap-2"> <span slot="description">Changing this will log you out.</span>
<TextInput <div class="flex gap-2">
bind:value={data.newInstance} <TextInput
pattern={'(?!-)[A-Za-z0-9-]+([-.]{1}[a-z0-9]+)*.[A-Za-z]{2,6}'} bind:value={data.newInstance}
class="flex-1" pattern={'(?!-)[A-Za-z0-9-]+([-.]{1}[a-z0-9]+)*.[A-Za-z]{2,6}'}
/> class="flex-1"
<div class="w-24"> />
<Button <div class="w-24">
color="primary" <Button
loading={data.loading} color="primary"
disabled={data.loading} loading={data.loading}
on:click={changeInstance} disabled={data.loading}
size="lg" on:click={changeInstance}
class="h-full" size="lg"
> class="h-full"
Change >
</Button> Change
</Button>
</div>
</div> </div>
</div> </Setting>
</Setting> {/if}
<Setting> <Setting>
<span slot="title">Default sort</span> <span slot="title">Default sort</span>
<span slot="description">The default sort to use for feeds.</span> <span slot="description">The default sort to use for feeds.</span>
@@ -116,7 +124,9 @@
</Setting> </Setting>
<Setting> <Setting>
<span slot="title">Show compact posts</span> <span slot="title">Show compact posts</span>
<span slot="description">Show posts with smaller thumbnails and without text bodies.</span> <span slot="description">
Show posts with smaller thumbnails and without text bodies.
</span>
<Switch bind:enabled={$userSettings.showCompactPosts} /> <Switch bind:enabled={$userSettings.showCompactPosts} />
</Setting> </Setting>
</div> </div>