misc: hide already added languages

This commit is contained in:
James Xylight committed 2025-02-08 13:49:19 -08:00
1 parent 98cb1992d2
commit 6334890530
4 files changed
+11 -10

No files matched your search

+5 -5
View File
@@ -65,16 +65,16 @@
</script> </script>
<div <div
class="border rounded-full border-slate-200 dark:border-zinc-800 bg-slate-50 dark:bg-zinc-950 p-1 flex items-center gap-1" class="border rounded-full border-slate-200 dark:border-zinc-800 bg-slate-50 dark:bg-zinc-950 p-1 flex items-center gap-1 w-max max-w-full z-0 relative overflow-auto"
> >
{#each options as option, index} {#each options as option, index}
{@const slctd = selected == option} {@const slctd = selected == option}
<button <button
class={[ class={[
'px-3 py-1 rounded-full text-sm font-medium transition-colors duration-75', 'px-3 py-1 rounded-full text-sm font-medium transition-colors duration-75 relative',
slctd slctd
? 'bg-primary-900 dark:bg-primary-100 text-slate-50 dark:text-zinc-900' ? 'bg-primary-900 dark:bg-primary-100 text-slate-50 dark:text-zinc-900'
: 'dark:bg-zinc-900/75 bg-white', : 'dark:bg-zinc-900/50 bg-white',
]} ]}
onclick={(e) => { onclick={(e) => {
e.preventDefault() e.preventDefault()
@@ -84,9 +84,9 @@
type="button" type="button"
> >
{optionNames[index] || option} {optionNames[index] || option}
{#if headless && option == selected} {#if slctd}
<div <div
class="absolute -bottom-1 left-0 w-full border-b-2 rounded-t-sm border-black dark:border-white" class="absolute left-0 top-0 w-full h-full blur-xl scale-75 opacity-50 dark:bg-primary-100 -z-10"
></div> ></div>
{/if} {/if}
</button> </button>
@@ -249,7 +249,7 @@
</Badge> </Badge>
</button> </button>
{/snippet} {/snippet}
{#each $site.all_languages as language, index} {#each $site.all_languages.filter((l) => !formData.languages?.includes(l.id)) as language, index}
<MenuButton <MenuButton
class="min-h-[16px] py-0" class="min-h-[16px] py-0"
onclick={() => { onclick={() => {
+4 -3
View File
@@ -33,6 +33,7 @@
? { ? {
...data.site.site_view.local_site, ...data.site.site_view.local_site,
...data.site.site_view.site, ...data.site.site_view.site,
discussion_languages: data.site.discussion_languages,
} }
: undefined, : undefined,
) )
@@ -245,7 +246,7 @@
<SectionTitle>{$t('form.profile.data.languages.title')}</SectionTitle> <SectionTitle>{$t('form.profile.data.languages.title')}</SectionTitle>
<p>{$t('form.profile.data.languages.description')}</p> <p>{$t('form.profile.data.languages.description')}</p>
<Material rounding="xl" color="uniform" class="dark:bg-zinc-950"> <Material rounding="xl" color="uniform" class="dark:bg-zinc-950">
{#if $site && formData.discussion_languages} {#if $site}
<div class="flex gap-2 flex-wrap flex-row"> <div class="flex gap-2 flex-wrap flex-row">
<Menu class="gap-px"> <Menu class="gap-px">
{#snippet target()} {#snippet target()}
@@ -256,7 +257,7 @@
</Badge> </Badge>
</button> </button>
{/snippet} {/snippet}
{#each $site.all_languages as language, index} {#each $site.all_languages.filter((l) => !formData.discussion_languages?.includes(l.id)) as language, index}
<MenuButton <MenuButton
class="min-h-[16px] py-0" class="min-h-[16px] py-0"
onclick={() => { onclick={() => {
@@ -267,7 +268,7 @@
</MenuButton> </MenuButton>
{/each} {/each}
</Menu> </Menu>
{#each formData.discussion_languages as languageId, index} {#each formData.discussion_languages ?? [] as languageId, index}
{@const language = $site.all_languages.find( {@const language = $site.all_languages.find(
(l) => l.id == languageId, (l) => l.id == languageId,
)} )}
@@ -149,7 +149,7 @@
</Badge> </Badge>
</button> </button>
{/snippet} {/snippet}
{#each $site.all_languages as language, index} {#each $site.all_languages.filter((l) => !formData.discussion_languages?.includes(l.id)) as language, index}
<MenuButton <MenuButton
class="min-h-[16px] py-0" class="min-h-[16px] py-0"
onclick={() => { onclick={() => {