cleanup: use context api for select menus and options
This commit is contained in:
1 parent
ee08787afc
commit
dd9abe5345
20 files changed
+271
-336
No files matched your search
@@ -13,9 +13,10 @@
|
|||||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||||
import ImagePreviewInput from '$lib/components/input/ImagePreviewInput.svelte'
|
import ImagePreviewInput from '$lib/components/input/ImagePreviewInput.svelte'
|
||||||
import Label from 'mono-svelte/forms/Label.svelte'
|
import Label from 'mono-svelte/forms/Label.svelte'
|
||||||
import { DocumentPlus, Icon } from 'svelte-hero-icons'
|
import { DocumentPlus, GlobeAlt, Icon, MapPin } from 'svelte-hero-icons'
|
||||||
import ImageUploadModal from '../modal/ImageUploadModal.svelte'
|
import ImageUploadModal from '../modal/ImageUploadModal.svelte'
|
||||||
import Select from 'mono-svelte/forms/select/Select.svelte'
|
import Select from 'mono-svelte/forms/select/Select.svelte'
|
||||||
|
import Option from 'mono-svelte/forms/select/Option.svelte'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
/**
|
/**
|
||||||
@@ -221,8 +222,8 @@
|
|||||||
Only moderators can post
|
Only moderators can post
|
||||||
</Switch>
|
</Switch>
|
||||||
<Select label="Visibility" class="w-max" bind:value={formData.visibility}>
|
<Select label="Visibility" class="w-max" bind:value={formData.visibility}>
|
||||||
<option value="Public">Public</option>
|
<Option icon={GlobeAlt} value="Public">Public</Option>
|
||||||
<option value="LocalOnly">Local Only</option>
|
<Option icon={MapPin} value="LocalOnly">Local Only</Option>
|
||||||
</Select>
|
</Select>
|
||||||
<Button
|
<Button
|
||||||
submit
|
submit
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
} from 'svelte-hero-icons'
|
} from 'svelte-hero-icons'
|
||||||
import { amModOfAny } from '../moderation/moderation'
|
import { amModOfAny } from '../moderation/moderation'
|
||||||
import { t } from '$lib/translations'
|
import { t } from '$lib/translations'
|
||||||
|
import Option from 'mono-svelte/forms/select/Option.svelte'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
selected: string
|
selected: string
|
||||||
@@ -45,42 +46,22 @@
|
|||||||
</span>
|
</span>
|
||||||
{/if}
|
{/if}
|
||||||
{/snippet}
|
{/snippet}
|
||||||
<option value="All">
|
<Option value="All" icon={GlobeAmericas}>
|
||||||
<Icon
|
|
||||||
src={GlobeAmericas}
|
|
||||||
size="16"
|
|
||||||
micro
|
|
||||||
class="text-slate-600 dark:text-zinc-400"
|
|
||||||
/>
|
|
||||||
{$t('filter.location.all')}
|
{$t('filter.location.all')}
|
||||||
</option>
|
</Option>
|
||||||
<option value="Local">
|
<Option value="Local" icon={MapPin}>{$t('filter.location.local')}</Option>
|
||||||
<Icon
|
<Option
|
||||||
src={MapPin}
|
value="Subscribed"
|
||||||
size="16"
|
disabled={$profile?.jwt == undefined}
|
||||||
micro
|
icon={Newspaper}
|
||||||
class="text-slate-600 dark:text-zinc-400"
|
>
|
||||||
/>{$t('filter.location.local')}
|
|
||||||
</option>
|
|
||||||
<option value="Subscribed" disabled={$profile?.jwt == undefined}>
|
|
||||||
<Icon
|
|
||||||
src={Newspaper}
|
|
||||||
size="16"
|
|
||||||
micro
|
|
||||||
class="text-slate-600 dark:text-zinc-400"
|
|
||||||
/>
|
|
||||||
{$t('filter.location.subscribed')}
|
{$t('filter.location.subscribed')}
|
||||||
</option>
|
</Option>
|
||||||
<option
|
<Option
|
||||||
value="ModeratorView"
|
value="ModeratorView"
|
||||||
disabled={!$profile?.jwt || !amModOfAny($profile?.user)}
|
disabled={!$profile?.jwt || !amModOfAny($profile?.user)}
|
||||||
|
icon={ShieldCheck}
|
||||||
>
|
>
|
||||||
<Icon
|
|
||||||
src={ShieldCheck}
|
|
||||||
size="16"
|
|
||||||
micro
|
|
||||||
class="text-slate-600 dark:text-zinc-400"
|
|
||||||
/>
|
|
||||||
{$t('filter.location.moderator')}
|
{$t('filter.location.moderator')}
|
||||||
</option>
|
</Option>
|
||||||
</Select>
|
</Select>
|
||||||
@@ -1,11 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { run } from 'svelte/legacy'
|
|
||||||
|
|
||||||
import { page } from '$app/stores'
|
import { page } from '$app/stores'
|
||||||
import { settings } from '$lib/settings.svelte'
|
|
||||||
import { t } from '$lib/translations'
|
import { t } from '$lib/translations'
|
||||||
import { searchParam } from '$lib/util.svelte.js'
|
import { searchParam } from '$lib/util.svelte.js'
|
||||||
import type { SortType } from 'lemmy-js-client'
|
|
||||||
import { Select } from 'mono-svelte'
|
import { Select } from 'mono-svelte'
|
||||||
import {
|
import {
|
||||||
ArrowTrendingDown,
|
ArrowTrendingDown,
|
||||||
@@ -26,6 +22,7 @@
|
|||||||
} from 'svelte-hero-icons'
|
} from 'svelte-hero-icons'
|
||||||
import { backOut } from 'svelte/easing'
|
import { backOut } from 'svelte/easing'
|
||||||
import { fly, slide } from 'svelte/transition'
|
import { fly, slide } from 'svelte/transition'
|
||||||
|
import Option from 'mono-svelte/forms/select/Option.svelte'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
selected: string
|
selected: string
|
||||||
@@ -63,87 +60,33 @@
|
|||||||
{$t('filter.sort.label')}
|
{$t('filter.sort.label')}
|
||||||
</span>
|
</span>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
<option value="Active">
|
<Option value="Active" icon={ArrowTrendingUp}>
|
||||||
<Icon
|
|
||||||
src={ArrowTrendingUp}
|
|
||||||
size="16"
|
|
||||||
micro
|
|
||||||
class="text-slate-600 dark:text-zinc-400"
|
|
||||||
/>
|
|
||||||
{$t('filter.sort.active')}
|
{$t('filter.sort.active')}
|
||||||
</option>
|
</Option>
|
||||||
<option value="Hot">
|
<Option value="Hot" icon={Fire}>
|
||||||
<Icon
|
|
||||||
src={Fire}
|
|
||||||
size="16"
|
|
||||||
micro
|
|
||||||
class="text-slate-600 dark:text-zinc-400"
|
|
||||||
/>
|
|
||||||
{$t('filter.sort.hot')}
|
{$t('filter.sort.hot')}
|
||||||
</option>
|
</Option>
|
||||||
<option value="Scaled">
|
<Option value="Scaled" icon={Scale}>
|
||||||
<Icon
|
|
||||||
src={Scale}
|
|
||||||
size="16"
|
|
||||||
micro
|
|
||||||
class="text-slate-600 dark:text-zinc-400"
|
|
||||||
/>
|
|
||||||
{$t('filter.sort.scaled')}
|
{$t('filter.sort.scaled')}
|
||||||
</option>
|
</Option>
|
||||||
<option value="TopAll">
|
<Option value="TopAll" icon={Trophy}>
|
||||||
<Icon
|
|
||||||
src={Trophy}
|
|
||||||
size="16"
|
|
||||||
micro
|
|
||||||
class="text-slate-600 dark:text-zinc-400"
|
|
||||||
/>
|
|
||||||
{$t('filter.sort.top.label')}
|
{$t('filter.sort.top.label')}
|
||||||
</option>
|
</Option>
|
||||||
<option value="New">
|
<Option value="New" icon={Star}>
|
||||||
<Icon
|
|
||||||
src={Star}
|
|
||||||
size="16"
|
|
||||||
micro
|
|
||||||
class="text-slate-600 dark:text-zinc-400"
|
|
||||||
/>
|
|
||||||
{$t('filter.sort.new')}
|
{$t('filter.sort.new')}
|
||||||
</option>
|
</Option>
|
||||||
<option value="Old">
|
<Option value="Old" icon={Clock}>
|
||||||
<Icon
|
|
||||||
src={Clock}
|
|
||||||
size="16"
|
|
||||||
micro
|
|
||||||
class="text-slate-600 dark:text-zinc-400"
|
|
||||||
/>
|
|
||||||
{$t('filter.sort.old')}
|
{$t('filter.sort.old')}
|
||||||
</option>
|
</Option>
|
||||||
<option value="Controversial">
|
<Option value="Controversial" icon={ArrowTrendingDown}>
|
||||||
<Icon
|
|
||||||
src={ArrowTrendingDown}
|
|
||||||
size="16"
|
|
||||||
micro
|
|
||||||
class="text-slate-600 dark:text-zinc-400"
|
|
||||||
/>
|
|
||||||
{$t('filter.sort.controversial')}
|
{$t('filter.sort.controversial')}
|
||||||
</option>
|
</Option>
|
||||||
<option value="MostComments">
|
<Option value="MostComments" icon={ChatBubbleOvalLeft}>
|
||||||
<Icon
|
|
||||||
src={ChatBubbleOvalLeft}
|
|
||||||
size="16"
|
|
||||||
micro
|
|
||||||
class="text-slate-600 dark:text-zinc-400"
|
|
||||||
/>
|
|
||||||
{$t('filter.sort.mostcomments')}
|
{$t('filter.sort.mostcomments')}
|
||||||
</option>
|
</Option>
|
||||||
<option value="NewComments">
|
<Option value="NewComments" icon={ChatBubbleLeftRight}>
|
||||||
<Icon
|
|
||||||
src={ChatBubbleLeftRight}
|
|
||||||
size="16"
|
|
||||||
micro
|
|
||||||
class="text-slate-600 dark:text-zinc-400"
|
|
||||||
/>
|
|
||||||
{$t('filter.sort.newcomments')}
|
{$t('filter.sort.newcomments')}
|
||||||
</option>
|
</Option>
|
||||||
</Select>
|
</Select>
|
||||||
{#if selected?.startsWith('Top')}
|
{#if selected?.startsWith('Top')}
|
||||||
<div transition:fly={{ easing: backOut, x: 2 }}>
|
<div transition:fly={{ easing: backOut, x: 2 }}>
|
||||||
@@ -162,89 +105,36 @@
|
|||||||
{$t('filter.sort.top.time.label')}
|
{$t('filter.sort.top.time.label')}
|
||||||
</span>
|
</span>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
<option value="TopAll">
|
<Option value="TopAll" icon={PlusCircle}>
|
||||||
<Icon
|
{$t('filter.sort.top.time.all')}
|
||||||
src={PlusCircle}
|
</Option>
|
||||||
size="16"
|
<Option value="TopNineMonths" icon={Calendar}>
|
||||||
micro
|
|
||||||
class="text-slate-600 dark:text-zinc-400"
|
|
||||||
/>{$t('filter.sort.top.time.all')}
|
|
||||||
</option>
|
|
||||||
<option value="TopNineMonths">
|
|
||||||
<Icon
|
|
||||||
src={Calendar}
|
|
||||||
size="16"
|
|
||||||
micro
|
|
||||||
class="text-slate-600 dark:text-zinc-400"
|
|
||||||
/>
|
|
||||||
{$t('filter.sort.top.time.9months')}
|
{$t('filter.sort.top.time.9months')}
|
||||||
</option>
|
</Option>
|
||||||
<option value="TopSixMonths">
|
<Option value="TopSixMonths" icon={Calendar}>
|
||||||
<Icon
|
|
||||||
src={Calendar}
|
|
||||||
size="16"
|
|
||||||
micro
|
|
||||||
class="text-slate-600 dark:text-zinc-400"
|
|
||||||
/>
|
|
||||||
{$t('filter.sort.top.time.6months')}
|
{$t('filter.sort.top.time.6months')}
|
||||||
</option>
|
</Option>
|
||||||
<option value="TopThreeMonths">
|
<Option value="TopThreeMonths" icon={Calendar}>
|
||||||
<Icon
|
|
||||||
src={Calendar}
|
|
||||||
size="16"
|
|
||||||
micro
|
|
||||||
class="text-slate-600 dark:text-zinc-400"
|
|
||||||
/>
|
|
||||||
{$t('filter.sort.top.time.3months')}
|
{$t('filter.sort.top.time.3months')}
|
||||||
</option>
|
</Option>
|
||||||
<option value="TopMonth">
|
<Option value="TopMonth" icon={CalendarDays}>
|
||||||
<Icon
|
{$t('filter.sort.top.time.month')}
|
||||||
src={CalendarDays}
|
</Option>
|
||||||
size="16"
|
<Option value="TopWeek" icon={CalendarDays}>
|
||||||
micro
|
{$t('filter.sort.top.time.week')}
|
||||||
class="text-slate-600 dark:text-zinc-400"
|
</Option>
|
||||||
/>{$t('filter.sort.top.time.month')}
|
<Option value="TopDay" icon={Sun}>
|
||||||
</option>
|
{$t('filter.sort.top.time.day')}
|
||||||
<option value="TopWeek">
|
</Option>
|
||||||
<Icon
|
<Option value="TopTwelveHour" icon={Clock}>
|
||||||
src={CalendarDays}
|
{$t('filter.sort.top.time.12hours')}
|
||||||
size="16"
|
</Option>
|
||||||
micro
|
<Option value="TopSixHour" icon={Clock}>
|
||||||
class="text-slate-600 dark:text-zinc-400"
|
{$t('filter.sort.top.time.6hours')}
|
||||||
/>{$t('filter.sort.top.time.week')}
|
</Option>
|
||||||
</option>
|
<Option value="TopHour" icon={Clock}>
|
||||||
<option value="TopDay">
|
{$t('filter.sort.top.time.hour')}
|
||||||
<Icon
|
</Option>
|
||||||
src={Sun}
|
|
||||||
size="16"
|
|
||||||
micro
|
|
||||||
class="text-slate-600 dark:text-zinc-400"
|
|
||||||
/>{$t('filter.sort.top.time.day')}
|
|
||||||
</option>
|
|
||||||
<option value="TopTwelveHour">
|
|
||||||
<Icon
|
|
||||||
src={Clock}
|
|
||||||
size="16"
|
|
||||||
micro
|
|
||||||
class="text-slate-600 dark:text-zinc-400"
|
|
||||||
/>{$t('filter.sort.top.time.12hours')}
|
|
||||||
</option>
|
|
||||||
<option value="TopSixHour">
|
|
||||||
<Icon
|
|
||||||
src={Clock}
|
|
||||||
size="16"
|
|
||||||
micro
|
|
||||||
class="text-slate-600 dark:text-zinc-400"
|
|
||||||
/>{$t('filter.sort.top.time.6hours')}
|
|
||||||
</option>
|
|
||||||
<option value="TopHour">
|
|
||||||
<Icon
|
|
||||||
src={Clock}
|
|
||||||
size="16"
|
|
||||||
micro
|
|
||||||
class="text-slate-600 dark:text-zinc-400"
|
|
||||||
/>{$t('filter.sort.top.time.hour')}
|
|
||||||
</option>
|
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import { settings } from '$lib/settings.svelte.js'
|
import { settings } from '$lib/settings.svelte.js'
|
||||||
import { t } from '$lib/translations'
|
import { t } from '$lib/translations'
|
||||||
import { Select } from 'mono-svelte'
|
import { Select } from 'mono-svelte'
|
||||||
|
import Option from 'mono-svelte/forms/select/Option.svelte'
|
||||||
import {
|
import {
|
||||||
Bars3,
|
Bars3,
|
||||||
Clock,
|
Clock,
|
||||||
@@ -30,31 +31,13 @@
|
|||||||
</span>
|
</span>
|
||||||
{/if}
|
{/if}
|
||||||
{/snippet}
|
{/snippet}
|
||||||
<option value="cozy">
|
<Option value="cozy" icon={RectangleGroup}>
|
||||||
<Icon
|
|
||||||
src={RectangleGroup}
|
|
||||||
size="16"
|
|
||||||
micro
|
|
||||||
class="text-slate-600 dark:text-zinc-400"
|
|
||||||
/>
|
|
||||||
{$t('filter.view.cozy')}
|
{$t('filter.view.cozy')}
|
||||||
</option>
|
</Option>
|
||||||
<option value="list">
|
<Option value="list" icon={QueueList}>
|
||||||
<Icon
|
|
||||||
src={QueueList}
|
|
||||||
size="16"
|
|
||||||
micro
|
|
||||||
class="text-slate-600 dark:text-zinc-400"
|
|
||||||
/>
|
|
||||||
{$t('filter.view.list')}
|
{$t('filter.view.list')}
|
||||||
</option>
|
</Option>
|
||||||
<option value="compact">
|
<Option value="compact" icon={Bars3}>
|
||||||
<Icon
|
|
||||||
src={Bars3}
|
|
||||||
size="16"
|
|
||||||
micro
|
|
||||||
class="text-slate-600 dark:text-zinc-400"
|
|
||||||
/>
|
|
||||||
{$t('filter.view.compact')}
|
{$t('filter.view.compact')}
|
||||||
</option>
|
</Option>
|
||||||
</Select>
|
</Select>
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
import { profile } from '$lib/auth.svelte.js'
|
import { profile } from '$lib/auth.svelte.js'
|
||||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||||
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
||||||
|
import TextProps from '$lib/components/ui/text/TextProps.svelte'
|
||||||
import type { PrivateMessageView } from 'lemmy-js-client'
|
import type { PrivateMessageView } from 'lemmy-js-client'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@@ -34,5 +35,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
<Markdown source={message.private_message.content} />
|
<TextProps wrap="no-wrap">
|
||||||
|
<Markdown source={message.private_message.content} />
|
||||||
|
</TextProps>
|
||||||
</div>
|
</div>
|
||||||
@@ -17,6 +17,7 @@
|
|||||||
import { amMod, isAdmin } from './moderation'
|
import { amMod, isAdmin } from './moderation'
|
||||||
import { Button, Checkbox, Modal } from 'mono-svelte'
|
import { Button, Checkbox, Modal } from 'mono-svelte'
|
||||||
import { t } from '$lib/translations'
|
import { t } from '$lib/translations'
|
||||||
|
import Option from 'mono-svelte/forms/select/Option.svelte'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
open: boolean
|
open: boolean
|
||||||
@@ -230,9 +231,9 @@
|
|||||||
{$t('comment.reply')}
|
{$t('comment.reply')}
|
||||||
<Select bind:value={preset} placeholder="No preset">
|
<Select bind:value={preset} placeholder="No preset">
|
||||||
{#each settings.moderation.presets as preset}
|
{#each settings.moderation.presets as preset}
|
||||||
<option value={preset.content}>
|
<Option value={preset.content}>
|
||||||
{preset.title}
|
{preset.title}
|
||||||
</option>
|
</Option>
|
||||||
{/each}
|
{/each}
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
} from '$lib/components/error/ErrorContainer.svelte'
|
} from '$lib/components/error/ErrorContainer.svelte'
|
||||||
import { errorMessage } from '$lib/lemmy/error'
|
import { errorMessage } from '$lib/lemmy/error'
|
||||||
import FreeTextInput from '$lib/components/input/FreeTextInput.svelte'
|
import FreeTextInput from '$lib/components/input/FreeTextInput.svelte'
|
||||||
|
import Option from 'mono-svelte/forms/select/Option.svelte'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
edit?: boolean
|
edit?: boolean
|
||||||
@@ -437,12 +438,12 @@
|
|||||||
label={$t('settings.app.lang.title')}
|
label={$t('settings.app.lang.title')}
|
||||||
bind:value={data.language_id}
|
bind:value={data.language_id}
|
||||||
>
|
>
|
||||||
<option value={undefined}>
|
<Option value={undefined}>
|
||||||
<Icon src={XMark} size="16" micro />
|
<Icon src={XMark} size="16" micro />
|
||||||
{$t('form.post.unset')}
|
{$t('form.post.unset')}
|
||||||
</option>
|
</Option>
|
||||||
{#each $site?.all_languages as language}
|
{#each $site?.all_languages as language}
|
||||||
<option value={language.id.toString()}>{language.name}</option>
|
<Option value={language.id.toString()}>{language.name}</Option>
|
||||||
{/each}
|
{/each}
|
||||||
</Select>
|
</Select>
|
||||||
{:else}
|
{:else}
|
||||||
|
|||||||
@@ -39,6 +39,7 @@
|
|||||||
import SiteCard from '$lib/components/lemmy/SiteCard.svelte'
|
import SiteCard from '$lib/components/lemmy/SiteCard.svelte'
|
||||||
import { t } from '$lib/translations'
|
import { t } from '$lib/translations'
|
||||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||||
|
import Option from 'mono-svelte/forms/select/Option.svelte'
|
||||||
|
|
||||||
let showInstance = $state(false)
|
let showInstance = $state(false)
|
||||||
|
|
||||||
@@ -164,18 +165,15 @@
|
|||||||
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
||||||
<div class="contents" onclick={stopPropagation(() => {})}>
|
<div class="contents" onclick={stopPropagation(() => {})}>
|
||||||
<Select bind:value={$colorScheme} class="ml-auto my-auto w-24" size="sm">
|
<Select bind:value={$colorScheme} class="ml-auto my-auto w-24" size="sm">
|
||||||
<option value="system">
|
<Option value="system" icon={ComputerDesktop}>
|
||||||
<Icon src={ComputerDesktop} size="16" micro />
|
|
||||||
{$t('nav.menu.colorscheme.system')}
|
{$t('nav.menu.colorscheme.system')}
|
||||||
</option>
|
</Option>
|
||||||
<option value="light">
|
<Option value="light" icon={Sun}>
|
||||||
<Icon src={Sun} size="16" micro />
|
|
||||||
{$t('nav.menu.colorscheme.light')}
|
{$t('nav.menu.colorscheme.light')}
|
||||||
</option>
|
</Option>
|
||||||
<option value="dark">
|
<Option value="dark" icon={Moon}>
|
||||||
<Icon src={Moon} size="16" micro />
|
|
||||||
{$t('nav.menu.colorscheme.dark')}
|
{$t('nav.menu.colorscheme.dark')}
|
||||||
</option>
|
</Option>
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
</MenuButton>
|
</MenuButton>
|
||||||
|
|||||||
@@ -226,10 +226,10 @@
|
|||||||
afterNavigate(() => {
|
afterNavigate(() => {
|
||||||
// open = false
|
// open = false
|
||||||
})
|
})
|
||||||
run(() => {
|
$effect(() => {
|
||||||
if (open) search = ''
|
if (open) search = ''
|
||||||
})
|
})
|
||||||
run(() => {
|
$effect(() => {
|
||||||
groups = getGroups(
|
groups = getGroups(
|
||||||
$resumables,
|
$resumables,
|
||||||
$profile,
|
$profile,
|
||||||
@@ -241,7 +241,7 @@
|
|||||||
let flattenedActions = $derived(
|
let flattenedActions = $derived(
|
||||||
filteredGroups.flatMap((group) => group.actions),
|
filteredGroups.flatMap((group) => group.actions),
|
||||||
)
|
)
|
||||||
run(() => {
|
$effect(() => {
|
||||||
debouncedSearch(search)
|
debouncedSearch(search)
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -68,6 +68,7 @@
|
|||||||
import type { HTMLButtonAttributes } from 'svelte/elements'
|
import type { HTMLButtonAttributes } from 'svelte/elements'
|
||||||
|
|
||||||
import Spinner from '../loader/Spinner.svelte'
|
import Spinner from '../loader/Spinner.svelte'
|
||||||
|
import type { Snippet } from 'svelte'
|
||||||
|
|
||||||
type ButtonRoundness = 'pill' | 'xl' | 'lg' | 'md' | 'none'
|
type ButtonRoundness = 'pill' | 'xl' | 'lg' | 'md' | 'none'
|
||||||
type ButtonRoundingSide = 'all' | 'left' | 'right' | 'top' | 'bottom'
|
type ButtonRoundingSide = 'all' | 'left' | 'right' | 'top' | 'bottom'
|
||||||
@@ -114,7 +115,7 @@
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Props {
|
interface Props extends Omit<HTMLButtonAttributes, 'prefix'> {
|
||||||
loading?: boolean
|
loading?: boolean
|
||||||
submit?: boolean
|
submit?: boolean
|
||||||
color?: ButtonColor
|
color?: ButtonColor
|
||||||
@@ -128,9 +129,9 @@
|
|||||||
loaderWidth?: number | undefined
|
loaderWidth?: number | undefined
|
||||||
href?: string | undefined
|
href?: string | undefined
|
||||||
class?: string
|
class?: string
|
||||||
prefix?: import('svelte').Snippet
|
prefix?: Snippet
|
||||||
children?: import('svelte').Snippet
|
children?: Snippet
|
||||||
suffix?: import('svelte').Snippet
|
suffix?: Snippet
|
||||||
onclick?: HTMLButtonAttributes['onclick']
|
onclick?: HTMLButtonAttributes['onclick']
|
||||||
[key: string]: any
|
[key: string]: any
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
<script lang="ts" generics="T">
|
||||||
|
import { getContext, onMount, type Snippet } from 'svelte'
|
||||||
|
import type { HTMLAttributes, HTMLOptionAttributes } from 'svelte/elements'
|
||||||
|
import type { IconSource } from 'svelte-hero-icons'
|
||||||
|
|
||||||
|
interface Props extends Omit<HTMLOptionAttributes, 'prefix'> {
|
||||||
|
children: Snippet
|
||||||
|
icon?: IconSource
|
||||||
|
}
|
||||||
|
let { children, icon, ...rest }: Props = $props()
|
||||||
|
|
||||||
|
let optionElement = $state<HTMLOptionElement>()
|
||||||
|
let option: any = $derived({
|
||||||
|
value: optionElement?.value ?? '',
|
||||||
|
label: optionElement?.innerText?.trim() ?? '',
|
||||||
|
icon: icon,
|
||||||
|
disabled: false,
|
||||||
|
})
|
||||||
|
|
||||||
|
interface SelectContext {
|
||||||
|
options: {
|
||||||
|
value: string
|
||||||
|
label: string
|
||||||
|
icon?: IconSource
|
||||||
|
disabled: boolean
|
||||||
|
}[]
|
||||||
|
}
|
||||||
|
|
||||||
|
const context = getContext<SelectContext>('select')
|
||||||
|
|
||||||
|
$effect(() => {
|
||||||
|
if (!context.options.find((v) => v == option)) {
|
||||||
|
context.options.push(option)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<option {...rest} bind:this={optionElement}>
|
||||||
|
{@render children()}
|
||||||
|
</option>
|
||||||
@@ -20,25 +20,23 @@
|
|||||||
ChevronDown,
|
ChevronDown,
|
||||||
ChevronUpDown,
|
ChevronUpDown,
|
||||||
Icon,
|
Icon,
|
||||||
|
type IconSource,
|
||||||
} from 'svelte-hero-icons'
|
} from 'svelte-hero-icons'
|
||||||
import { browser } from '$app/environment'
|
|
||||||
import { writable } from 'svelte/store'
|
|
||||||
|
|
||||||
let open = $state(false)
|
let open = $state(false)
|
||||||
let element: HTMLSelectElement | undefined = $state()
|
let element: HTMLSelectElement | undefined = $state()
|
||||||
|
|
||||||
let options: { value: any; label: string | null; disabled: boolean }[] =
|
interface SelectContext {
|
||||||
$state([])
|
options: {
|
||||||
|
value: string
|
||||||
|
label: string
|
||||||
|
icon?: IconSource
|
||||||
|
disabled?: boolean
|
||||||
|
}[]
|
||||||
|
}
|
||||||
|
|
||||||
// Capture all options from the select element
|
const context = setContext<SelectContext>('select', {
|
||||||
$effect(() => {
|
options: [],
|
||||||
options = element?.options
|
|
||||||
? Array.from(element?.options).map((option) => ({
|
|
||||||
value: option.value,
|
|
||||||
label: option.innerHTML,
|
|
||||||
disabled: option.disabled,
|
|
||||||
}))
|
|
||||||
: []
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const dispatcher = createEventDispatcher<{
|
const dispatcher = createEventDispatcher<{
|
||||||
@@ -46,8 +44,9 @@
|
|||||||
contextmenu: any
|
contextmenu: any
|
||||||
input: any
|
input: any
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
value?: T | undefined
|
value?: T | string | undefined
|
||||||
placeholder?: string | undefined
|
placeholder?: string | undefined
|
||||||
label?: string | undefined
|
label?: string | undefined
|
||||||
size?: ButtonSize
|
size?: ButtonSize
|
||||||
@@ -112,7 +111,7 @@
|
|||||||
</select>
|
</select>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
|
|
||||||
{#each options as option}
|
{#each context.options as option}
|
||||||
{#if customOption}{@render customOption({
|
{#if customOption}{@render customOption({
|
||||||
option,
|
option,
|
||||||
selected: option.value == value,
|
selected: option.value == value,
|
||||||
@@ -129,6 +128,14 @@
|
|||||||
? '!bg-slate-100 dark:!bg-zinc-800'
|
? '!bg-slate-100 dark:!bg-zinc-800'
|
||||||
: ''}"
|
: ''}"
|
||||||
>
|
>
|
||||||
|
{#if option.icon}
|
||||||
|
<Icon
|
||||||
|
src={option.icon}
|
||||||
|
size="16"
|
||||||
|
micro
|
||||||
|
class="text-slate-600 dark:text-zinc-400"
|
||||||
|
/>
|
||||||
|
{/if}
|
||||||
{@html option.label}
|
{@html option.label}
|
||||||
{#if option.value == value}
|
{#if option.value == value}
|
||||||
<Icon
|
<Icon
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
import { DocumentPlus, Icon } from 'svelte-hero-icons'
|
import { DocumentPlus, Icon } from 'svelte-hero-icons'
|
||||||
import { t } from '$lib/translations.js'
|
import { t } from '$lib/translations.js'
|
||||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||||
|
import Option from 'mono-svelte/forms/select/Option.svelte'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
data: PageData
|
data: PageData
|
||||||
@@ -149,15 +150,15 @@
|
|||||||
bind:value={formData.registration_mode}
|
bind:value={formData.registration_mode}
|
||||||
class="w-max"
|
class="w-max"
|
||||||
>
|
>
|
||||||
<option value="Open">
|
<Option value="Open">
|
||||||
{$t('routes.admin.config.registration.open')}
|
{$t('routes.admin.config.registration.open')}
|
||||||
</option>
|
</Option>
|
||||||
<option value="RequireApplication">
|
<Option value="RequireApplication">
|
||||||
{$t('routes.admin.config.registration.application')}
|
{$t('routes.admin.config.registration.application')}
|
||||||
</option>
|
</Option>
|
||||||
<option value="Closed">
|
<Option value="Closed">
|
||||||
{$t('routes.admin.config.registration.closed')}
|
{$t('routes.admin.config.registration.closed')}
|
||||||
</option>
|
</Option>
|
||||||
</Select>
|
</Select>
|
||||||
{#if formData.registration_mode == 'RequireApplication'}
|
{#if formData.registration_mode == 'RequireApplication'}
|
||||||
<MarkdownEditor
|
<MarkdownEditor
|
||||||
@@ -192,10 +193,10 @@
|
|||||||
bind:value={formData.default_post_listing_type}
|
bind:value={formData.default_post_listing_type}
|
||||||
class="w-max"
|
class="w-max"
|
||||||
>
|
>
|
||||||
<option value="All">{$t('routes.admin.config.listingType.all')}</option>
|
<Option value="All">{$t('routes.admin.config.listingType.all')}</Option>
|
||||||
<option value="Local">
|
<Option value="Local">
|
||||||
{$t('routes.admin.config.listingType.local')}
|
{$t('routes.admin.config.listingType.local')}
|
||||||
</option>
|
</Option>
|
||||||
</Select>
|
</Select>
|
||||||
<Switch bind:checked={formData.private_instance} defaultValue={true}>
|
<Switch bind:checked={formData.private_instance} defaultValue={true}>
|
||||||
{$t('routes.admin.config.private')}
|
{$t('routes.admin.config.private')}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
import { Button, Material, Select } from 'mono-svelte'
|
import { Button, Material, Select } from 'mono-svelte'
|
||||||
import { t } from '$lib/translations'
|
import { t } from '$lib/translations'
|
||||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||||
|
import Option from 'mono-svelte/forms/select/Option.svelte'
|
||||||
|
|
||||||
let { data = $bindable() } = $props()
|
let { data = $bindable() } = $props()
|
||||||
|
|
||||||
@@ -40,8 +41,8 @@
|
|||||||
{$t('filter.filter')}
|
{$t('filter.filter')}
|
||||||
</span>
|
</span>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
<option value="all">{$t('filter.location.all')}</option>
|
<Option value="all">{$t('filter.location.all')}</Option>
|
||||||
<option value="unread">{$t('filter.unread')}</option>
|
<Option value="unread">{$t('filter.unread')}</Option>
|
||||||
</Select>
|
</Select>
|
||||||
<Button href="/modlog" class="h-max ml-auto">
|
<Button href="/modlog" class="h-max ml-auto">
|
||||||
<Icon src={Newspaper} size="16" mini />
|
<Icon src={Newspaper} size="16" mini />
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||||
import { isAdmin } from '$lib/components/lemmy/moderation/moderation.js'
|
import { isAdmin } from '$lib/components/lemmy/moderation/moderation.js'
|
||||||
import { browser } from '$app/environment'
|
import { browser } from '$app/environment'
|
||||||
|
import Option from 'mono-svelte/forms/select/Option.svelte'
|
||||||
|
|
||||||
let { data = $bindable() } = $props()
|
let { data = $bindable() } = $props()
|
||||||
|
|
||||||
@@ -50,40 +51,40 @@
|
|||||||
on:change={(e) => searchParam($page.url, 'type', data.type, 'page')}
|
on:change={(e) => searchParam($page.url, 'type', data.type, 'page')}
|
||||||
class="w-48"
|
class="w-48"
|
||||||
>
|
>
|
||||||
{#snippet label()}
|
{#snippet customLabel()}
|
||||||
<span class="flex gap-1 items-center">
|
<span class="flex gap-1 items-center">
|
||||||
<Icon src={Bars3BottomRight} size="15" mini />
|
<Icon src={Bars3BottomRight} size="15" mini />
|
||||||
Type
|
Type
|
||||||
</span>
|
</span>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
<option value="All">All</option>
|
<Option value="All">All</Option>
|
||||||
<option value="ModRemovePost">Remove Post</option>
|
<Option value="ModRemovePost">Remove Post</Option>
|
||||||
<option value="ModLockPost">Lock Post</option>
|
<Option value="ModLockPost">Lock Post</Option>
|
||||||
<option value="ModFeaturePost">Feature Post</option>
|
<Option value="ModFeaturePost">Feature Post</Option>
|
||||||
<option value="ModRemoveComment">Remove Comment</option>
|
<Option value="ModRemoveComment">Remove Comment</Option>
|
||||||
<option value="ModRemoveCommunity">Remove Community</option>
|
<Option value="ModRemoveCommunity">Remove Community</Option>
|
||||||
<option value="ModBanFromCommunity">Ban From Community</option>
|
<Option value="ModBanFromCommunity">Ban From Community</Option>
|
||||||
<option value="ModAddCommunity">Add Moderator</option>
|
<Option value="ModAddCommunity">Add Moderator</Option>
|
||||||
<option value="ModTransferCommunity">Transfer Community</option>
|
<Option value="ModTransferCommunity">Transfer Community</Option>
|
||||||
<option value="ModAdd">Add Admin</option>
|
<Option value="ModAdd">Add Admin</Option>
|
||||||
<option value="ModBan">Ban Admin</option>
|
<Option value="ModBan">Ban Admin</Option>
|
||||||
<option value="ModHideCommunity">Hide Community</option>
|
<Option value="ModHideCommunity">Hide Community</Option>
|
||||||
<option value="AdminPurgePerson">Purge User</option>
|
<Option value="AdminPurgePerson">Purge User</Option>
|
||||||
<option value="AdminPurgeCommunity">Purge Community</option>
|
<Option value="AdminPurgeCommunity">Purge Community</Option>
|
||||||
<option value="AdminPurgePost">Purge Post</option>
|
<Option value="AdminPurgePost">Purge Post</Option>
|
||||||
<option value="AdminPurgeComment">Purge Comment</option>
|
<Option value="AdminPurgeComment">Purge Comment</Option>
|
||||||
</Select>
|
</Select>
|
||||||
|
|
||||||
<Select bind:value={view} class="w-36">
|
<Select bind:value={view} class="w-36">
|
||||||
{#snippet label()}
|
{#snippet customLabel()}
|
||||||
<span class="flex gap-1 items-center">
|
<span class="flex gap-1 items-center">
|
||||||
<Icon src={ViewColumns} size="15" mini />
|
<Icon src={ViewColumns} size="15" mini />
|
||||||
View
|
View
|
||||||
</span>
|
</span>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
<option value="false">Table</option>
|
<Option value="false">Table</Option>
|
||||||
<option value="true">Cards</option>
|
<Option value="true">Cards</Option>
|
||||||
<option value="undefined">Default</option>
|
<Option value="undefined">Default</Option>
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col md:flex-row md:items-center gap-2 w-full">
|
<div class="flex flex-col md:flex-row md:items-center gap-2 w-full">
|
||||||
|
|||||||
@@ -22,6 +22,11 @@
|
|||||||
BookmarkSlash,
|
BookmarkSlash,
|
||||||
ArrowUp,
|
ArrowUp,
|
||||||
ArrowDown,
|
ArrowDown,
|
||||||
|
Fire,
|
||||||
|
Trophy,
|
||||||
|
Star,
|
||||||
|
Clock,
|
||||||
|
ArrowTrendingDown,
|
||||||
} from 'svelte-hero-icons'
|
} from 'svelte-hero-icons'
|
||||||
import PostMeta, {
|
import PostMeta, {
|
||||||
parseTags,
|
parseTags,
|
||||||
@@ -49,6 +54,7 @@
|
|||||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||||
import { fly } from 'svelte/transition'
|
import { fly } from 'svelte/transition'
|
||||||
import { expoOut } from 'svelte/easing'
|
import { expoOut } from 'svelte/easing'
|
||||||
|
import Option from 'mono-svelte/forms/select/Option.svelte'
|
||||||
|
|
||||||
let { data = $bindable() } = $props()
|
let { data = $bindable() } = $props()
|
||||||
|
|
||||||
@@ -404,13 +410,17 @@
|
|||||||
bind:value={commentSort}
|
bind:value={commentSort}
|
||||||
on:change={reloadComments}
|
on:change={reloadComments}
|
||||||
>
|
>
|
||||||
<option value="Hot">{$t('filter.sort.hot')}</option>
|
<Option icon={Fire} value="Hot">{$t('filter.sort.hot')}</Option>
|
||||||
<option value="Top">{$t('filter.sort.top.label')}</option>
|
<Option icon={Trophy} value="Top">
|
||||||
<option value="New">{$t('filter.sort.new')}</option>
|
{$t('filter.sort.top.label')}
|
||||||
<option value="Old">{$t('filter.sort.old')}</option>
|
</Option>
|
||||||
<option value="Controversial">
|
<Option icon={Star} value="New">{$t('filter.sort.new')}</Option>
|
||||||
|
<Option icon={Clock} value="Old">
|
||||||
|
{$t('filter.sort.old')}
|
||||||
|
</Option>
|
||||||
|
<Option icon={ArrowTrendingDown} value="Controversial">
|
||||||
{$t('filter.sort.controversial')}
|
{$t('filter.sort.controversial')}
|
||||||
</option>
|
</Option>
|
||||||
</Select>
|
</Select>
|
||||||
<Button size="square-md" onclick={reloadComments}>
|
<Button size="square-md" onclick={reloadComments}>
|
||||||
{#snippet prefix()}
|
{#snippet prefix()}
|
||||||
@@ -450,13 +460,17 @@
|
|||||||
{#if commenting || !$profile.jwt}
|
{#if commenting || !$profile.jwt}
|
||||||
<div class="gap-2 flex items-center">
|
<div class="gap-2 flex items-center">
|
||||||
<Select size="md" bind:value={commentSort} on:change={reloadComments}>
|
<Select size="md" bind:value={commentSort} on:change={reloadComments}>
|
||||||
<option value="Hot">{$t('filter.sort.hot')}</option>
|
<Option icon={Fire} value="Hot">{$t('filter.sort.hot')}</Option>
|
||||||
<option value="Top">{$t('filter.sort.top.label')}</option>
|
<Option icon={Trophy} value="Top">
|
||||||
<option value="New">{$t('filter.sort.new')}</option>
|
{$t('filter.sort.top.label')}
|
||||||
<option value="Old">{$t('filter.sort.old')}</option>
|
</Option>
|
||||||
<option value="Controversial">
|
<Option icon={Star} value="New">{$t('filter.sort.new')}</Option>
|
||||||
|
<Option icon={Clock} value="Old">
|
||||||
|
{$t('filter.sort.old')}
|
||||||
|
</Option>
|
||||||
|
<Option icon={ArrowTrendingDown} value="Controversial">
|
||||||
{$t('filter.sort.controversial')}
|
{$t('filter.sort.controversial')}
|
||||||
</option>
|
</Option>
|
||||||
</Select>
|
</Select>
|
||||||
<Button size="square-md" onclick={reloadComments}>
|
<Button size="square-md" onclick={reloadComments}>
|
||||||
{#snippet prefix()}
|
{#snippet prefix()}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
ChatBubbleOvalLeft,
|
ChatBubbleOvalLeft,
|
||||||
AdjustmentsHorizontal,
|
AdjustmentsHorizontal,
|
||||||
} from 'svelte-hero-icons'
|
} from 'svelte-hero-icons'
|
||||||
|
import Option from 'mono-svelte/forms/select/Option.svelte'
|
||||||
|
|
||||||
let { data } = $props()
|
let { data } = $props()
|
||||||
|
|
||||||
@@ -51,18 +52,15 @@
|
|||||||
{$t('filter.filter')}
|
{$t('filter.filter')}
|
||||||
</div>
|
</div>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
<option value="all">
|
<Option icon={Bars3} value="all">
|
||||||
<Icon src={Bars3} micro size="15" />
|
|
||||||
{$t('content.all')}
|
{$t('content.all')}
|
||||||
</option>
|
</Option>
|
||||||
<option value="posts">
|
<Option icon={PencilSquare} value="posts">
|
||||||
<Icon src={PencilSquare} micro size="15" />
|
|
||||||
{$t('content.posts')}
|
{$t('content.posts')}
|
||||||
</option>
|
</Option>
|
||||||
<option value="comments">
|
<Option icon={ChatBubbleOvalLeft} value="comments">
|
||||||
<Icon src={ChatBubbleOvalLeft} micro size="15" />
|
|
||||||
{$t('content.comments')}
|
{$t('content.comments')}
|
||||||
</option>
|
</Option>
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
||||||
import { contentPadding } from '$lib/components/ui/layout/Shell.svelte'
|
import { contentPadding } from '$lib/components/ui/layout/Shell.svelte'
|
||||||
import { goto } from '$app/navigation'
|
import { goto } from '$app/navigation'
|
||||||
|
import Option from 'mono-svelte/forms/select/Option.svelte'
|
||||||
|
|
||||||
type Result = PostView | CommentView | PersonView | CommunityView
|
type Result = PostView | CommentView | PersonView | CommunityView
|
||||||
|
|
||||||
@@ -111,11 +112,11 @@
|
|||||||
{$t('filter.type')}
|
{$t('filter.type')}
|
||||||
</span>
|
</span>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
<option value="All">{$t('content.all')}</option>
|
<Option value="All">{$t('content.all')}</Option>
|
||||||
<option value="Posts">{$t('content.posts')}</option>
|
<Option value="Posts">{$t('content.posts')}</Option>
|
||||||
<option value="Comments">{$t('content.comments')}</option>
|
<Option value="Comments">{$t('content.comments')}</Option>
|
||||||
<option value="Communities">{$t('content.communities')}</option>
|
<Option value="Communities">{$t('content.communities')}</Option>
|
||||||
<option value="Users">{$t('content.users')}</option>
|
<Option value="Users">{$t('content.users')}</Option>
|
||||||
</Select>
|
</Select>
|
||||||
<Sort navigate bind:selected={data.sort} />
|
<Sort navigate bind:selected={data.sort} />
|
||||||
{#snippet summary()}
|
{#snippet summary()}
|
||||||
|
|||||||
@@ -33,6 +33,11 @@
|
|||||||
Plus,
|
Plus,
|
||||||
Trash,
|
Trash,
|
||||||
ArrowTopRightOnSquare,
|
ArrowTopRightOnSquare,
|
||||||
|
Fire,
|
||||||
|
Trophy,
|
||||||
|
Star,
|
||||||
|
Clock,
|
||||||
|
ArrowTrendingDown,
|
||||||
} from 'svelte-hero-icons'
|
} from 'svelte-hero-icons'
|
||||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||||
import { removalTemplate } from '$lib/components/lemmy/moderation/moderation.js'
|
import { removalTemplate } from '$lib/components/lemmy/moderation/moderation.js'
|
||||||
@@ -47,6 +52,7 @@
|
|||||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||||
import { profile } from '$lib/auth.svelte'
|
import { profile } from '$lib/auth.svelte'
|
||||||
import AccountPage from '../profile/(local_user)/settings/+page.svelte'
|
import AccountPage from '../profile/(local_user)/settings/+page.svelte'
|
||||||
|
import Option from 'mono-svelte/forms/select/Option.svelte'
|
||||||
let importing = $state(false)
|
let importing = $state(false)
|
||||||
let importText = $state('')
|
let importText = $state('')
|
||||||
|
|
||||||
@@ -227,20 +233,20 @@
|
|||||||
{/snippet}
|
{/snippet}
|
||||||
<!--@ts-ignore-->
|
<!--@ts-ignore-->
|
||||||
<Select bind:value={settings.language}>
|
<Select bind:value={settings.language}>
|
||||||
<option value={null}>
|
<Option value={null}>
|
||||||
<Icon src={Language} size="16" mini />
|
<Icon src={Language} size="16" mini />
|
||||||
{$t('settings.app.lang.auto')}
|
{$t('settings.app.lang.auto')}
|
||||||
</option>
|
</Option>
|
||||||
{#each $locales as locale}
|
{#each $locales as locale}
|
||||||
{@const mapped = localeMap.get(locale) ?? {
|
{@const mapped = localeMap.get(locale) ?? {
|
||||||
flag: '',
|
flag: '',
|
||||||
translated: 1,
|
translated: 1,
|
||||||
name: locale,
|
name: locale,
|
||||||
}}
|
}}
|
||||||
<option value={locale}>
|
<Option value={locale}>
|
||||||
{mapped?.flag}
|
{mapped?.flag}
|
||||||
{mapped?.name}
|
{mapped?.name}
|
||||||
</option>
|
</Option>
|
||||||
{/each}
|
{/each}
|
||||||
</Select>
|
</Select>
|
||||||
</Setting>
|
</Setting>
|
||||||
@@ -292,14 +298,14 @@
|
|||||||
{$t('filter.location.label')}
|
{$t('filter.location.label')}
|
||||||
</span>
|
</span>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
<option value="All">{$t('filter.location.all')}</option>
|
<Option value="All">{$t('filter.location.all')}</Option>
|
||||||
<option value="Local">{$t('filter.location.local')}</option>
|
<Option value="Local">{$t('filter.location.local')}</Option>
|
||||||
<option value="Subscribed">
|
<Option value="Subscribed">
|
||||||
{$t('filter.location.subscribed')}
|
{$t('filter.location.subscribed')}
|
||||||
</option>
|
</Option>
|
||||||
<option value="Moderator">
|
<Option value="Moderator">
|
||||||
{$t('filter.location.moderator')}
|
{$t('filter.location.moderator')}
|
||||||
</option>
|
</Option>
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
<div class="max-w-full">
|
<div class="max-w-full">
|
||||||
@@ -314,9 +320,15 @@
|
|||||||
</span>
|
</span>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
|
|
||||||
<option value="Hot">{$t('filter.sort.hot')}</option>
|
<Option icon={Fire} value="Hot">{$t('filter.sort.hot')}</Option>
|
||||||
<option value="Top">{$t('filter.sort.top.label')}</option>
|
<Option icon={Trophy} value="Top">
|
||||||
<option value="New">{$t('filter.sort.new')}</option>
|
{$t('filter.sort.top.label')}
|
||||||
|
</Option>
|
||||||
|
<Option icon={Star} value="New">{$t('filter.sort.new')}</Option>
|
||||||
|
<Option icon={Clock} value="Old">{$t('filter.sort.old')}</Option>
|
||||||
|
<Option icon={ArrowTrendingDown} value="Controversial">
|
||||||
|
{$t('filter.sort.controversial')}
|
||||||
|
</Option>
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -369,10 +381,10 @@
|
|||||||
<span>{$t('settings.app.font.description')}</span>
|
<span>{$t('settings.app.font.description')}</span>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
<Select bind:value={settings.font}>
|
<Select bind:value={settings.font}>
|
||||||
<option value="inter">Inter</option>
|
<Option value="inter">Inter</Option>
|
||||||
<option value="satoshi/nunito">Satoshi + Nunito</option>
|
<Option value="satoshi/nunito">Satoshi + Nunito</Option>
|
||||||
<option value="system">System UI</option>
|
<Option value="system">System UI</Option>
|
||||||
<option value="browser">Browser</option>
|
<Option value="browser">Browser</Option>
|
||||||
</Select>
|
</Select>
|
||||||
</Setting>
|
</Setting>
|
||||||
<Setting>
|
<Setting>
|
||||||
@@ -491,9 +503,9 @@
|
|||||||
</span>
|
</span>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
<Select bind:value={settings.embeds.youtube}>
|
<Select bind:value={settings.embeds.youtube}>
|
||||||
<option value="youtube">YouTube</option>
|
<Option value="youtube">YouTube</Option>
|
||||||
<option value="invidious">Invidious</option>
|
<Option value="invidious">Invidious</Option>
|
||||||
<option value="piped">Piped</option>
|
<Option value="piped">Piped</Option>
|
||||||
</Select>
|
</Select>
|
||||||
</Setting>
|
</Setting>
|
||||||
{#if settings.embeds.youtube == 'invidious'}
|
{#if settings.embeds.youtube == 'invidious'}
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
import EntityHeader from '$lib/components/ui/EntityHeader.svelte'
|
import EntityHeader from '$lib/components/ui/EntityHeader.svelte'
|
||||||
import { publishedToDate } from '$lib/components/util/date.js'
|
import { publishedToDate } from '$lib/components/util/date.js'
|
||||||
import { formatRelativeDate } from '$lib/components/util/RelativeDate.svelte'
|
import { formatRelativeDate } from '$lib/components/util/RelativeDate.svelte'
|
||||||
|
import Option from 'mono-svelte/forms/select/Option.svelte'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
data: any
|
data: any
|
||||||
@@ -303,9 +304,9 @@
|
|||||||
{$t('filter.type')}
|
{$t('filter.type')}
|
||||||
</span>
|
</span>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
<option value="all">{$t('content.all')}</option>
|
<Option value="all">{$t('content.all')}</Option>
|
||||||
<option value="posts">{$t('content.posts')}</option>
|
<Option value="posts">{$t('content.posts')}</Option>
|
||||||
<option value="comments">{$t('content.comments')}</option>
|
<Option value="comments">{$t('content.comments')}</Option>
|
||||||
</Select>
|
</Select>
|
||||||
<Select
|
<Select
|
||||||
bind:value={data.sort}
|
bind:value={data.sort}
|
||||||
@@ -317,9 +318,9 @@
|
|||||||
{$t('filter.sort.label')}
|
{$t('filter.sort.label')}
|
||||||
</span>
|
</span>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
<option value="New">{$t('filter.sort.new')}</option>
|
<Option value="New">{$t('filter.sort.new')}</Option>
|
||||||
<option value="TopAll">{$t('filter.sort.top.label')}</option>
|
<Option value="TopAll">{$t('filter.sort.top.label')}</Option>
|
||||||
<option value="Old">{$t('filter.sort.old')}</option>
|
<Option value="Old">{$t('filter.sort.old')}</Option>
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
{#if data.items.length == 0}
|
{#if data.items.length == 0}
|
||||||
|
|||||||
Reference in new issue
Block a user