refactor: prefer barrel exports
This commit is contained in:
64 files changed
+181
-249
No files matched your search
@@ -1,11 +0,0 @@
|
||||
<script>
|
||||
/**
|
||||
* @typedef {Object} Props
|
||||
* @property {import('svelte').Snippet<[any]>} [children]
|
||||
*/
|
||||
|
||||
/** @type {Props & { [key: string]: any }} */
|
||||
let { children, ...rest } = $props()
|
||||
</script>
|
||||
|
||||
{@render children?.({ ...rest })}
|
||||
@@ -90,7 +90,7 @@
|
||||
disabled={loading}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Trash} size="16" mini color="text-red-500" />
|
||||
<Icon src={Trash} size="16" mini class="text-red-500" />
|
||||
{/snippet}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -3,25 +3,25 @@
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import ImageInputUpload from '$lib/components/form/ImageInputUpload.svelte'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { getClient, site } from '$lib/client/lemmy.svelte'
|
||||
import { client, site } from '$lib/client/lemmy.svelte'
|
||||
import { errorMessage } from '$lib/lemmy/error'
|
||||
import { addSubscription } from '$lib/lemmy/user.js'
|
||||
import {
|
||||
Badge,
|
||||
Button,
|
||||
Label,
|
||||
MenuButton,
|
||||
Switch,
|
||||
TextInput,
|
||||
toast,
|
||||
Option,
|
||||
Select,
|
||||
Material,
|
||||
Menu
|
||||
} from 'mono-svelte'
|
||||
import Option from 'mono-svelte/forms/select/Option.svelte'
|
||||
import Select from 'mono-svelte/forms/select/Select.svelte'
|
||||
import Material from 'mono-svelte/materials/Material.svelte'
|
||||
import Menu from 'mono-svelte/popover/Menu.svelte'
|
||||
import { GlobeAlt, Icon, MapPin, Plus } from 'svelte-hero-icons'
|
||||
import { Header } from '$lib/components/ui/layout'
|
||||
|
||||
interface Props {
|
||||
/**
|
||||
@@ -68,7 +68,7 @@
|
||||
|
||||
try {
|
||||
const res = edit
|
||||
? await getClient().editCommunity({
|
||||
? await client().editCommunity({
|
||||
title: formData.displayName,
|
||||
description: formData.sidebar,
|
||||
nsfw: formData.nsfw,
|
||||
@@ -79,7 +79,7 @@
|
||||
visibility: formData.visibility,
|
||||
discussion_languages: formData.languages,
|
||||
})
|
||||
: await getClient().createCommunity({
|
||||
: await client().createCommunity({
|
||||
name: formData.name,
|
||||
title: formData.displayName,
|
||||
description: formData.sidebar,
|
||||
@@ -146,7 +146,7 @@
|
||||
class="flex flex-col gap-4 h-full w-full"
|
||||
>
|
||||
{#if formtitle}{@render formtitle()}{:else}
|
||||
<Header>{$t('routes.createCommunity')}</Header>
|
||||
<Header>{$t('form.post.community')}</Header>
|
||||
{/if}
|
||||
<TextInput
|
||||
required
|
||||
@@ -188,7 +188,7 @@
|
||||
</Select>
|
||||
|
||||
<div class="space-y-1">
|
||||
<SectionTitle>{$t('form.profile.languages.title')}</SectionTitle>
|
||||
<Label>{$t('form.profile.languages.title')}</Label>
|
||||
<Material rounding="xl" color="uniform" class="dark:bg-zinc-950">
|
||||
{#if site.data}
|
||||
<div class="flex gap-2 flex-wrap flex-row">
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import CommunityCard from '$lib/components/lemmy/community/CommunityCard.svelte'
|
||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||
import LabelStat from '$lib/components/ui/LabelStat.svelte'
|
||||
import FormattedNumber from '$lib/components/util/FormattedNumber.svelte'
|
||||
@@ -23,6 +22,7 @@
|
||||
Trash,
|
||||
} from 'svelte-hero-icons'
|
||||
import Subscribe from '../../../../routes/communities/Subscribe.svelte'
|
||||
import { CommunityCard } from '.'
|
||||
|
||||
interface Props {
|
||||
community: CommunityView
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
export { default as CommunityCard } from './CommunityCard.svelte'
|
||||
export { default as CommunityFlair } from './CommunityFlair.svelte'
|
||||
export { default as CommunityForm } from './CommunityForm.svelte'
|
||||
export { default as CommunityHeader } from './CommunityHeader.svelte'
|
||||
export { default as CommunityItem } from './CommunityItem.svelte'
|
||||
export { default as CommunityLink } from './CommunityLink.svelte'
|
||||
export { default as CommunityTitle } from './CommunityTitle.svelte'
|
||||
+6
-6
@@ -13,12 +13,12 @@
|
||||
ServerStack,
|
||||
} from 'svelte-hero-icons'
|
||||
import type { ClassValue, HTMLAttributes } from 'svelte/elements'
|
||||
import EndPlaceholder from '../ui/EndPlaceholder.svelte'
|
||||
import Expandable from '../ui/Expandable.svelte'
|
||||
import LabelStat from '../ui/LabelStat.svelte'
|
||||
import SidebarButton from '../ui/sidebar/SidebarButton.svelte'
|
||||
import ItemList from './generic/ItemList.svelte'
|
||||
import { optimizeImageURL } from './post/helpers'
|
||||
import EndPlaceholder from '../../ui/EndPlaceholder.svelte'
|
||||
import Expandable from '../../ui/Expandable.svelte'
|
||||
import LabelStat from '../../ui/LabelStat.svelte'
|
||||
import SidebarButton from '../../ui/sidebar/SidebarButton.svelte'
|
||||
import ItemList from '../generic/ItemList.svelte'
|
||||
import { optimizeImageURL } from '../post/helpers'
|
||||
|
||||
interface Props extends HTMLAttributes<HTMLDivElement> {
|
||||
site: SiteView
|
||||
@@ -1,18 +1,14 @@
|
||||
<script lang="ts">
|
||||
import { preventDefault } from 'svelte/legacy'
|
||||
|
||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||
import type { Community, Person } from '$lib/client/types'
|
||||
import { getClient } from '$lib/client/lemmy.svelte'
|
||||
import { toast } from 'mono-svelte'
|
||||
import { client } from '$lib/client/lemmy.svelte'
|
||||
import { Label, toast, Button, Checkbox, Modal } from 'mono-svelte'
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import { Button, Checkbox, Modal } from 'mono-svelte'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import CommunityLink from '../community/CommunityLink.svelte'
|
||||
import Duration from '$lib/components/form/Duration.svelte'
|
||||
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
||||
import { errorMessage } from '$lib/lemmy/error'
|
||||
import { CommunityLink } from '../community'
|
||||
|
||||
interface Props {
|
||||
open?: boolean
|
||||
@@ -57,7 +53,7 @@
|
||||
}
|
||||
|
||||
if (community) {
|
||||
await getClient().banFromCommunity({
|
||||
await client().banFromCommunity({
|
||||
ban: !banned,
|
||||
community_id: community.id,
|
||||
person_id: item.id,
|
||||
@@ -66,7 +62,7 @@
|
||||
expires: date,
|
||||
})
|
||||
} else {
|
||||
await getClient().banPerson({
|
||||
await client().banPerson({
|
||||
ban: !banned,
|
||||
person_id: item.id,
|
||||
reason: reason || undefined,
|
||||
@@ -99,7 +95,13 @@
|
||||
title={banned ? $t('moderation.ban.unbanning') : $t('moderation.ban.banning')}
|
||||
>
|
||||
{#if item}
|
||||
<form class="flex flex-col gap-4" onsubmit={preventDefault(submit)}>
|
||||
<form
|
||||
class="flex flex-col gap-4"
|
||||
onsubmit={(e) => {
|
||||
e.preventDefault()
|
||||
submit()
|
||||
}}
|
||||
>
|
||||
<div class="flex items-center gap-1">
|
||||
<Avatar url={item.avatar} alt={item.name} width={24} />
|
||||
<span class="font-bold">{item.name}</span>
|
||||
@@ -119,10 +121,9 @@
|
||||
{$t('moderation.ban.warning')}
|
||||
{/snippet}
|
||||
</Checkbox>
|
||||
<div>
|
||||
<SectionTitle>{$t('moderation.ban.expires')}</SectionTitle>
|
||||
<Label text={$t('moderation.ban.expires')}>
|
||||
<Duration bind:value={expires}></Duration>
|
||||
</div>
|
||||
</Label>
|
||||
{/if}
|
||||
<Button submit color="primary" {loading} disabled={loading} size="lg">
|
||||
{$t('form.submit')}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { client } from '$lib/client/lemmy.svelte'
|
||||
import type {
|
||||
Comment,
|
||||
CommentView,
|
||||
Community,
|
||||
MyUserInfo,
|
||||
|
||||
@@ -43,7 +43,6 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import CommunityLink from '$lib/components/lemmy/community/CommunityLink.svelte'
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||
@@ -70,6 +69,7 @@
|
||||
type IconSource,
|
||||
} from 'svelte-hero-icons'
|
||||
import Material from 'mono-svelte/materials/Material.svelte'
|
||||
import { CommunityLink } from '../community'
|
||||
|
||||
interface Props {
|
||||
community?: Community
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
<script lang="ts">
|
||||
import type { HTMLAttributes } from 'svelte/elements'
|
||||
|
||||
interface Props extends HTMLAttributes<HTMLSpanElement> {
|
||||
small?: boolean
|
||||
class?: string
|
||||
children?: import('svelte').Snippet
|
||||
}
|
||||
|
||||
let { small = false, class: clazz = '', children, ...rest }: Props = $props()
|
||||
</script>
|
||||
|
||||
<span {...rest} class="{!small ? 'text-lg' : 'text-xs'} font-medium {clazz}">
|
||||
{@render children?.()}
|
||||
</span>
|
||||
@@ -1,16 +0,0 @@
|
||||
<script lang="ts">
|
||||
interface Props {
|
||||
class?: string
|
||||
children?: import('svelte').Snippet
|
||||
}
|
||||
|
||||
let { class: clazz = '', children }: Props = $props()
|
||||
</script>
|
||||
|
||||
<aside
|
||||
class="break-words flex shrink
|
||||
flex-col gap-4 px-6 max-w-full w-full h-full
|
||||
overflow-auto text-sm border-slate-200 dark:border-zinc-800 {clazz}"
|
||||
>
|
||||
{@render children?.()}
|
||||
</aside>
|
||||
File renamed without changes.
@@ -0,0 +1,38 @@
|
||||
<script lang="ts">
|
||||
import { navigating } from '$app/state'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { Button, TextInput } from 'mono-svelte'
|
||||
import { Icon, MagnifyingGlass } from 'svelte-hero-icons'
|
||||
|
||||
interface Props {
|
||||
query?: string | null
|
||||
}
|
||||
|
||||
let { query = $bindable() }: Props = $props()
|
||||
|
||||
let searchElement = $state<HTMLInputElement>()
|
||||
</script>
|
||||
|
||||
<div class="flex gap-2 flex-row items-center w-full text-base h-10">
|
||||
<TextInput
|
||||
bind:value={query}
|
||||
bind:element={searchElement}
|
||||
name="q"
|
||||
placeholder={$t('routes.search.query')}
|
||||
size="lg"
|
||||
class="flex-1 rounded-full! h-full text-base!"
|
||||
/>
|
||||
<Button
|
||||
submit
|
||||
color="primary"
|
||||
size="custom"
|
||||
class="shrink-0 h-full aspect-square shadow-md"
|
||||
title="Search"
|
||||
rounding="pill"
|
||||
loading={navigating.to?.route.id == '/search'}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={MagnifyingGlass} size="16" micro />
|
||||
{/snippet}
|
||||
</Button>
|
||||
</div>
|
||||
@@ -0,0 +1,6 @@
|
||||
export { default as Header } from './pages/Header.svelte'
|
||||
export { default as Tabs } from './pages/Tabs.svelte'
|
||||
export { default as CommonList } from './CommonList.svelte'
|
||||
export { default as SearchBar } from './SearchBar.svelte'
|
||||
export { default as Shell } from './Shell.svelte'
|
||||
export { default as Pageination } from './Pageination.svelte'
|
||||
@@ -6,7 +6,7 @@
|
||||
isAdmin,
|
||||
} from '$lib/components/lemmy/moderation/moderation'
|
||||
|
||||
import SiteCard from '$lib/components/lemmy/SiteCard.svelte'
|
||||
import SiteCard from '$lib/components/lemmy/instance/InstanceCard.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { site } from '$lib/client/lemmy.svelte'
|
||||
import { settings } from '$lib/settings.svelte'
|
||||
|
||||
Reference in new issue
Block a user