fix: Fix lint errors (#559)
* cleanup: postactions styling * misc: fix first round of errors * pkg: remove vitest * fix: fix lint errors stage 2 * fix: fix lint errors stage 3 * fix: fix lint errors, stage 3 * misc: update eslint rules to warn for writable derived
This commit is contained in:
1 parent
1824245f13
commit
76c581123a
225 files changed
+1553
-2352
No files matched your search
@@ -1,15 +1,14 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation'
|
||||
import { page } from '$app/state'
|
||||
import { errorMessage } from '$lib/lemmy/error'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { errorMessage } from '$lib/lemmy/error'
|
||||
import { Button } from 'mono-svelte'
|
||||
import { Icon, XMark } from 'svelte-hero-icons'
|
||||
|
||||
function getError(message: string): { string: string; code: boolean } {
|
||||
try {
|
||||
return { string: errorMessage(JSON.parse(message)), code: false }
|
||||
} catch (e) {
|
||||
} catch {
|
||||
return { string: message, code: true }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { aliases, loadTranslations, locales } from '$lib/i18n/translations.js'
|
||||
import { get } from 'svelte/store'
|
||||
|
||||
export const load = async ({ url, request }) => {
|
||||
export const load = async ({ request }) => {
|
||||
const languages = request.headers.get('Accept-Language')?.split(',')
|
||||
const availableLangs = get(locales)
|
||||
|
||||
|
||||
+15
-21
@@ -1,30 +1,24 @@
|
||||
<script lang="ts">
|
||||
import Navbar from '$lib/components/ui/navbar/Navbar.svelte'
|
||||
import '../style/app.css'
|
||||
import { browser } from '$app/environment'
|
||||
import { navigating, page } from '$app/state'
|
||||
import Moderation from '$lib/components/lemmy/moderation/Moderation.svelte'
|
||||
import SiteCard from '$lib/components/lemmy/SiteCard.svelte'
|
||||
import ExpandableImage from '$lib/components/ui/ExpandableImage.svelte'
|
||||
import Shell from '$lib/components/ui/layout/Shell.svelte'
|
||||
import Navbar from '$lib/components/ui/navbar/Navbar.svelte'
|
||||
import Sidebar from '$lib/components/ui/sidebar/Sidebar.svelte'
|
||||
import { locale } from '$lib/i18n/translations'
|
||||
import { LINKED_INSTANCE_URL } from '$lib/instance.svelte'
|
||||
import { site } from '$lib/lemmy.svelte.js'
|
||||
import { settings } from '$lib/settings.svelte.js'
|
||||
import { inDarkColorScheme, rgbToHex, theme } from '$lib/ui/colors.svelte.js'
|
||||
import { getDefaultColors } from '$lib/ui/presets'
|
||||
import { Button, ModalContainer, Spinner, ToastContainer } from 'mono-svelte'
|
||||
import nProgress from 'nprogress'
|
||||
import 'nprogress/nprogress.css'
|
||||
import Moderation from '$lib/components/lemmy/moderation/Moderation.svelte'
|
||||
import Sidebar from '$lib/components/ui/sidebar/Sidebar.svelte'
|
||||
import { inDarkColorScheme, rgbToHex, theme } from '$lib/ui/colors.svelte.js'
|
||||
import { settings } from '$lib/settings.svelte.js'
|
||||
import {
|
||||
Button,
|
||||
ModalContainer,
|
||||
Spinner,
|
||||
toast,
|
||||
ToastContainer,
|
||||
} from 'mono-svelte'
|
||||
import { onMount } from 'svelte'
|
||||
import { browser } from '$app/environment'
|
||||
import { Forward, Icon } from 'svelte-hero-icons'
|
||||
import Shell from '$lib/components/ui/layout/Shell.svelte'
|
||||
import SiteCard from '$lib/components/lemmy/SiteCard.svelte'
|
||||
import { site } from '$lib/lemmy.svelte.js'
|
||||
import ExpandableImage from '$lib/components/ui/ExpandableImage.svelte'
|
||||
import { LINKED_INSTANCE_URL } from '$lib/instance.svelte'
|
||||
import { locale } from '$lib/i18n/translations'
|
||||
import { getDefaultColors } from '$lib/ui/presets'
|
||||
import '../style/app.css'
|
||||
interface Props {
|
||||
children?: import('svelte').Snippet
|
||||
}
|
||||
|
||||
@@ -2,11 +2,10 @@ import { browser } from '$app/environment'
|
||||
import { env } from '$env/dynamic/public'
|
||||
import { settings } from '$lib/settings.svelte'
|
||||
import { aliases, loadTranslations } from '$lib/i18n/translations.js'
|
||||
import { get } from 'svelte/store'
|
||||
|
||||
export let ssr = (env.PUBLIC_SSR_ENABLED?.toLowerCase() ?? 'false') == 'true'
|
||||
export const ssr = (env.PUBLIC_SSR_ENABLED?.toLowerCase() ?? 'false') == 'true'
|
||||
|
||||
export const load = async ({}) => {
|
||||
export const load = async () => {
|
||||
if (browser) {
|
||||
const initLocale = settings.language ?? navigator?.language ?? 'en'
|
||||
|
||||
|
||||
+10
-15
@@ -1,21 +1,17 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/state'
|
||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||
import { browser } from '$app/environment'
|
||||
import Location from '$lib/components/lemmy/dropdowns/Location.svelte'
|
||||
import Sort from '$lib/components/lemmy/dropdowns/Sort.svelte'
|
||||
import ViewSelect from '$lib/components/lemmy/dropdowns/ViewSelect.svelte'
|
||||
import { searchParam } from '$lib/util.svelte.js'
|
||||
import { ArrowRight, ChartBar, Icon } from 'svelte-hero-icons'
|
||||
import { site } from '$lib/lemmy.svelte.js'
|
||||
import Location from '$lib/components/lemmy/dropdowns/Location.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { t } from '$lib/i18n/translations.js'
|
||||
import { settings } from '$lib/settings.svelte.js'
|
||||
import { browser } from '$app/environment'
|
||||
import VirtualFeed from '$lib/components/lemmy/post/feed/VirtualFeed.svelte'
|
||||
import PostFeed from '$lib/components/lemmy/post/feed/PostFeed.svelte'
|
||||
import type { ListingType } from 'lemmy-js-client'
|
||||
import { get } from 'svelte/store'
|
||||
import VirtualFeed from '$lib/components/lemmy/post/feed/VirtualFeed.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||
import { t } from '$lib/i18n/translations.js'
|
||||
import { site } from '$lib/lemmy.svelte.js'
|
||||
import { settings } from '$lib/settings.svelte.js'
|
||||
import Button from 'mono-svelte/button/Button.svelte'
|
||||
import { ArrowRight, ChartBar, Icon } from 'svelte-hero-icons'
|
||||
|
||||
let { data = $bindable() } = $props()
|
||||
|
||||
@@ -74,14 +70,13 @@
|
||||
>
|
||||
<Pageination
|
||||
cursor={{ next: data.feed.value.cursor.next }}
|
||||
href={(page) =>
|
||||
href={page =>
|
||||
typeof page == 'number' ? `?page=${page}` : `?cursor=${page}`}
|
||||
back={false}
|
||||
>
|
||||
<span class="flex flex-row items-center gap-1">
|
||||
<Icon src={ChartBar} size="16" mini />
|
||||
{$t('routes.frontpage.footer', {
|
||||
// @ts-ignore
|
||||
users: site.data?.site_view?.counts?.users_active_day ?? '??',
|
||||
})}
|
||||
</span>
|
||||
|
||||
+4
-9
@@ -1,17 +1,12 @@
|
||||
import { settings } from '$lib/settings.svelte'
|
||||
import type { GetPostsResponse, ListingType, SortType } from 'lemmy-js-client'
|
||||
import {
|
||||
postFeed,
|
||||
postFeeds,
|
||||
shouldReload,
|
||||
} from '$lib/lemmy/postfeed.svelte.js'
|
||||
import { t } from '$lib/i18n/translations.js'
|
||||
import { ChevronDoubleUp } from 'svelte-hero-icons'
|
||||
import { postFeed } from '$lib/lemmy/postfeed.svelte.js'
|
||||
import { ReactiveState } from '$lib/promise.svelte.js'
|
||||
import { settings } from '$lib/settings.svelte'
|
||||
import type { ListingType, SortType } from 'lemmy-js-client'
|
||||
import { ChevronDoubleUp } from 'svelte-hero-icons'
|
||||
|
||||
export async function load({ url, fetch }) {
|
||||
const cursor = url.searchParams.get('cursor') as string | undefined
|
||||
const prevCursor = url.searchParams.get('cursorPrev') as string | undefined
|
||||
|
||||
const sort: SortType =
|
||||
(url.searchParams.get('sort') as SortType) || settings.defaultSort.sort
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
<script lang="ts">
|
||||
import {
|
||||
profileData,
|
||||
setUserID,
|
||||
profile as currentProfile,
|
||||
deleteProfile,
|
||||
moveProfile,
|
||||
type Profile,
|
||||
profile,
|
||||
profileData,
|
||||
setUserID,
|
||||
} from '$lib/auth.svelte.js'
|
||||
import { Menu, MenuButton, Modal } from 'mono-svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import DebugObject from '$lib/components/util/debug/DebugObject.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { LINKED_INSTANCE_URL } from '$lib/instance.svelte.js'
|
||||
import ProfileAvatar from '$lib/lemmy/ProfileAvatar.svelte'
|
||||
import { settings } from '$lib/settings.svelte.js'
|
||||
import { Button, TextInput } from 'mono-svelte'
|
||||
import { Button, Menu, MenuButton, Modal } from 'mono-svelte'
|
||||
import {
|
||||
ArrowLeftOnRectangle,
|
||||
ArrowRightOnRectangle,
|
||||
ArrowsRightLeft,
|
||||
ArrowUturnLeft,
|
||||
BugAnt,
|
||||
Check,
|
||||
ChevronDown,
|
||||
@@ -26,13 +26,9 @@
|
||||
EllipsisHorizontal,
|
||||
Icon,
|
||||
Identification,
|
||||
PaintBrush,
|
||||
Plus,
|
||||
} from 'svelte-hero-icons'
|
||||
import { flip } from 'svelte/animate'
|
||||
import { expoOut } from 'svelte/easing'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { fly } from 'svelte/transition'
|
||||
|
||||
let debugging = $state(false)
|
||||
@@ -158,7 +154,7 @@
|
||||
{/snippet}
|
||||
</Header>
|
||||
<div>
|
||||
{#each profileData.profiles as profile, index}
|
||||
{#each profileData.profiles as profile, index (profile.id)}
|
||||
<div
|
||||
class="flex flex-row gap-2 items-center py-3"
|
||||
transition:fly={{ duration: 500, y: -12, easing: expoOut }}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { getClient } from '$lib/lemmy.svelte.js'
|
||||
import { site as siteStore } from '$lib/lemmy.svelte.js'
|
||||
import { getClient, site as siteStore } from '$lib/lemmy.svelte.js'
|
||||
|
||||
export async function load({ fetch }) {
|
||||
let site = siteStore
|
||||
const site = siteStore
|
||||
|
||||
if (!site.data) {
|
||||
const res = await getClient(undefined, fetch).getSite()
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/state'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import { searchParam } from '$lib/util.svelte.js'
|
||||
import { ClipboardDocumentCheck, Icon } from 'svelte-hero-icons'
|
||||
import Application from './Application.svelte'
|
||||
import MultiSelect from '$lib/components/input/Switch.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { Option, Select } from 'mono-svelte'
|
||||
import { ClipboardDocumentCheck } from 'svelte-hero-icons'
|
||||
import Application from './Application.svelte'
|
||||
|
||||
let { data } = $props()
|
||||
|
||||
@@ -16,12 +13,6 @@
|
||||
</script>
|
||||
|
||||
<Header pageHeader>{$t('routes.admin.applications.title')}</Header>
|
||||
<!-- <MultiSelect
|
||||
options={[false, true]}
|
||||
selected={data.unreadOnly ?? true}
|
||||
optionNames={[$t('filter.location.all'), $t('filter.unread')]}
|
||||
onselect={(e) => searchParam(page.url, 'unreadOnly', e.toString(), 'page')}
|
||||
/> -->
|
||||
<form bind:this={selectForm} action="/admin/applications" class="w-max">
|
||||
<Select
|
||||
name="unreadOnly"
|
||||
@@ -40,7 +31,7 @@
|
||||
</div>
|
||||
{#if data.applications?.value.length >= 40}
|
||||
<div class="mt-auto">
|
||||
<Pageination page={data.page} href={(page) => `?page=${page}`} />
|
||||
<Pageination page={data.page} href={page => `?page=${page}`} />
|
||||
</div>
|
||||
{/if}
|
||||
{:else}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { profile } from '$lib/auth.svelte'
|
||||
import { getClient } from '$lib/lemmy.svelte.js'
|
||||
import { ReactiveState } from '$lib/promise.svelte.js'
|
||||
import { get } from 'svelte/store'
|
||||
|
||||
export async function load({ data, fetch, url }) {
|
||||
export async function load({ fetch, url }) {
|
||||
if (!profile) return
|
||||
|
||||
const { jwt } = profile.data!
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
<script lang="ts">
|
||||
import { notifications, profile } from '$lib/auth.svelte.js'
|
||||
import ApplicationDenyModal from '$lib/components/lemmy/modal/ApplicationDenyModal.svelte'
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
||||
import { Material, toast } from 'mono-svelte'
|
||||
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
|
||||
import { publishedToDate } from '$lib/components/util/date'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { getClient } from '$lib/lemmy.svelte.js'
|
||||
import { errorMessage } from '$lib/lemmy/error'
|
||||
import type {
|
||||
ApproveRegistrationApplication,
|
||||
RegistrationApplicationView,
|
||||
} from 'lemmy-js-client'
|
||||
import { Button } from 'mono-svelte'
|
||||
import { Button, Material, toast } from 'mono-svelte'
|
||||
import {
|
||||
Check,
|
||||
Icon,
|
||||
@@ -16,12 +20,6 @@
|
||||
ShieldExclamation,
|
||||
XMark,
|
||||
} from 'svelte-hero-icons'
|
||||
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
|
||||
import { publishedToDate } from '$lib/components/util/date'
|
||||
import ApplicationDenyModal from '$lib/components/lemmy/modal/ApplicationDenyModal.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { removalTemplate } from '$lib/components/lemmy/moderation/moderation'
|
||||
import { fullCommunityName } from '$lib/util.svelte'
|
||||
|
||||
interface Props {
|
||||
application: RegistrationApplicationView
|
||||
@@ -47,7 +45,7 @@
|
||||
} else {
|
||||
reviewing = true
|
||||
while (reviewing) {
|
||||
await new Promise((res) => setTimeout(res, 1000))
|
||||
await new Promise(res => setTimeout(res, 1000))
|
||||
}
|
||||
if (!denying) {
|
||||
denyReason = ''
|
||||
@@ -75,7 +73,7 @@
|
||||
$notifications.applications -= 1
|
||||
} catch (err) {
|
||||
toast({
|
||||
content: err as any,
|
||||
content: errorMessage(err as string),
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,25 +1,28 @@
|
||||
<script lang="ts">
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import ImageUploadModal from '$lib/components/lemmy/modal/ImageUploadModal.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.js'
|
||||
import { getClient, site } from '$lib/lemmy.svelte.js'
|
||||
import type { EditSite } from 'lemmy-js-client'
|
||||
import {
|
||||
Badge,
|
||||
Button,
|
||||
Label,
|
||||
Material,
|
||||
Menu,
|
||||
MenuButton,
|
||||
Select,
|
||||
Switch,
|
||||
TextInput,
|
||||
toast,
|
||||
} from 'mono-svelte'
|
||||
import { getClient, site } from '$lib/lemmy.svelte.js'
|
||||
import type { EditSite } from 'lemmy-js-client'
|
||||
import type { PageData } from './$types.js'
|
||||
import { Button, Checkbox, Select, TextInput } from 'mono-svelte'
|
||||
import ImageUploadModal from '$lib/components/lemmy/modal/ImageUploadModal.svelte'
|
||||
import { DocumentPlus, Icon, Plus } from 'svelte-hero-icons'
|
||||
import { t } from '$lib/i18n/translations.js'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import Option from 'mono-svelte/forms/select/Option.svelte'
|
||||
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
||||
import { DocumentPlus, Icon, Plus } from 'svelte-hero-icons'
|
||||
import type { PageData } from './$types.js'
|
||||
import { errorMessage } from '$lib/lemmy/error.js'
|
||||
|
||||
interface Props {
|
||||
data: PageData
|
||||
@@ -42,7 +45,6 @@
|
||||
if (!profile.data?.jwt) return
|
||||
|
||||
saving = true
|
||||
const { jwt } = profile.data
|
||||
|
||||
try {
|
||||
await getClient().editSite({
|
||||
@@ -54,7 +56,7 @@
|
||||
})
|
||||
} catch (err) {
|
||||
toast({
|
||||
content: err as any,
|
||||
content: errorMessage(err as string),
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
@@ -257,7 +259,7 @@
|
||||
</Badge>
|
||||
</button>
|
||||
{/snippet}
|
||||
{#each site.data.all_languages.filter(l => !formData.discussion_languages?.includes(l.id)) as language, index}
|
||||
{#each site.data.all_languages.filter(l => !formData.discussion_languages?.includes(l.id)) as language (language.id)}
|
||||
<MenuButton
|
||||
class="min-h-[16px] py-0"
|
||||
onclick={() => {
|
||||
@@ -268,7 +270,7 @@
|
||||
</MenuButton>
|
||||
{/each}
|
||||
</Menu>
|
||||
{#each formData.discussion_languages ?? [] as languageId, index}
|
||||
{#each formData.discussion_languages ?? [] as languageId, index (languageId)}
|
||||
{@const language = site.data.all_languages.find(
|
||||
l => l.id == languageId,
|
||||
)}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<script lang="ts">
|
||||
import { run, preventDefault } from 'svelte/legacy'
|
||||
import { preventDefault, run } from 'svelte/legacy'
|
||||
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
|
||||
import { publishedToDate } from '$lib/components/util/date.js'
|
||||
import { getClient } from '$lib/lemmy.svelte.js'
|
||||
import { t } from '$lib/i18n/translations.js'
|
||||
import { getClient } from '$lib/lemmy.svelte.js'
|
||||
import { trycatch } from '$lib/util.svelte.js'
|
||||
import type { Instance } from 'lemmy-js-client'
|
||||
import {
|
||||
@@ -22,13 +22,11 @@
|
||||
Check,
|
||||
ExclamationTriangle,
|
||||
Icon,
|
||||
InformationCircle,
|
||||
Plus,
|
||||
XMark,
|
||||
} from 'svelte-hero-icons'
|
||||
import { flip } from 'svelte/animate'
|
||||
import { expoInOut, expoOut } from 'svelte/easing'
|
||||
import { slide } from 'svelte/transition'
|
||||
import { expoOut } from 'svelte/easing'
|
||||
|
||||
let { data = $bindable() } = $props()
|
||||
|
||||
@@ -56,14 +54,10 @@
|
||||
else allowInstance.loading = true
|
||||
|
||||
const blockedInstances =
|
||||
data.federated_instances.federated_instances.blocked.map(
|
||||
(i) => i.domain,
|
||||
)
|
||||
data.federated_instances.federated_instances.blocked.map(i => i.domain)
|
||||
|
||||
const allowedInstances =
|
||||
data.federated_instances.federated_instances.allowed.map(
|
||||
(i) => i.domain,
|
||||
)
|
||||
data.federated_instances.federated_instances.allowed.map(i => i.domain)
|
||||
|
||||
if (blocked) blockedInstances.push(instance)
|
||||
if (!blocked) allowedInstances.push(instance)
|
||||
@@ -95,13 +89,9 @@
|
||||
saving = true
|
||||
|
||||
const blockedInstances =
|
||||
data.federated_instances.federated_instances.blocked.map(
|
||||
(i) => i.domain,
|
||||
)
|
||||
data.federated_instances.federated_instances.blocked.map(i => i.domain)
|
||||
const allowedInstances =
|
||||
data.federated_instances.federated_instances.allowed.map(
|
||||
(i) => i.domain,
|
||||
)
|
||||
data.federated_instances.federated_instances.allowed.map(i => i.domain)
|
||||
|
||||
return await getClient().editSite({
|
||||
allowed_instances: allowedInstances,
|
||||
@@ -125,7 +115,7 @@
|
||||
|
||||
const reader = new FileReader()
|
||||
|
||||
reader.onload = (e) => {
|
||||
reader.onload = e => {
|
||||
if (!data.federated_instances?.federated_instances?.blocked)
|
||||
throw new Error('Missing instance')
|
||||
const content = e.target?.result
|
||||
@@ -152,12 +142,12 @@
|
||||
}
|
||||
|
||||
data.federated_instances.federated_instances.blocked = instances
|
||||
} catch (err) {
|
||||
} catch {
|
||||
toast({ content: $t('toast.failCSV'), type: 'error' })
|
||||
}
|
||||
}
|
||||
|
||||
reader.onerror = (e) =>
|
||||
reader.onerror = () =>
|
||||
toast({ content: $t('toast.failCSV'), type: 'error' })
|
||||
|
||||
reader.readAsText(files[0])
|
||||
@@ -188,9 +178,7 @@
|
||||
{$t('routes.admin.federation.csv')}
|
||||
</Button>
|
||||
{/snippet}
|
||||
{#snippet choose()}
|
||||
{''}
|
||||
{/snippet}
|
||||
{#snippet choose()}{/snippet}
|
||||
</FileInput>
|
||||
<div class="flex flex-col md:flex-row gap-4">
|
||||
<div class="flex-1 w-full max-h-168 h-full flex flex-col gap-2">
|
||||
@@ -244,7 +232,7 @@
|
||||
|
||||
data.federated_instances.federated_instances.blocked =
|
||||
data.federated_instances?.federated_instances?.blocked.filter(
|
||||
(i) => i.id != instance.id,
|
||||
i => i.id != instance.id,
|
||||
)
|
||||
}}
|
||||
>
|
||||
@@ -328,7 +316,7 @@
|
||||
|
||||
data.federated_instances.federated_instances.allowed =
|
||||
data.federated_instances?.federated_instances?.allowed.filter(
|
||||
(i) => i.id != instance.id,
|
||||
i => i.id != instance.id,
|
||||
)
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import { profile } from '$lib/auth.svelte'
|
||||
import { getClient } from '$lib/lemmy.svelte.js'
|
||||
import { get } from 'svelte/store'
|
||||
|
||||
export async function load({ fetch, parent }) {
|
||||
export async function load({ fetch }) {
|
||||
const instances = await getClient(undefined, fetch).getFederatedInstances()
|
||||
|
||||
return {
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import { toast } from 'mono-svelte'
|
||||
import { t } from '$lib/i18n/translations.js'
|
||||
import { getClient } from '$lib/lemmy.svelte.js'
|
||||
import type { Tagline } from 'lemmy-js-client'
|
||||
import { Button } from 'mono-svelte'
|
||||
import { Icon, Plus, QuestionMarkCircle, Trash } from 'svelte-hero-icons'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { t } from '$lib/i18n/translations.js'
|
||||
import { Button, toast } from 'mono-svelte'
|
||||
import { Icon, Plus, Trash } from 'svelte-hero-icons'
|
||||
import { errorMessage } from '$lib/lemmy/error.js'
|
||||
|
||||
let { data } = $props()
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
})
|
||||
} catch (err) {
|
||||
toast({
|
||||
content: err as any,
|
||||
content: errorMessage(err as string),
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
@@ -61,7 +61,7 @@
|
||||
</Header>
|
||||
|
||||
<ul>
|
||||
{#each taglines as tagline}
|
||||
{#each taglines as tagline (tagline)}
|
||||
<div class="flex py-3">
|
||||
<Markdown source={tagline} inline />
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
<Button
|
||||
onclick={() => {
|
||||
taglines.splice(
|
||||
taglines.findIndex((i) => i == tagline),
|
||||
taglines.findIndex(i => i == tagline),
|
||||
1,
|
||||
)
|
||||
|
||||
|
||||
@@ -3,16 +3,15 @@
|
||||
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import { toast } from 'mono-svelte'
|
||||
import { t } from '$lib/i18n/translations.js'
|
||||
import { instance } from '$lib/instance.svelte.js'
|
||||
import { getClient } from '$lib/lemmy.svelte.js'
|
||||
import { addAdmin } from '$lib/lemmy/user.js'
|
||||
import { removeItem, trycatch } from '$lib/util.svelte.js'
|
||||
import { Button, TextInput } from 'mono-svelte'
|
||||
import { trycatch } from '$lib/util.svelte.js'
|
||||
import { Button, TextInput, toast } from 'mono-svelte'
|
||||
import { Icon, Plus, QuestionMarkCircle, Trash } from 'svelte-hero-icons'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { t } from '$lib/i18n/translations.js'
|
||||
|
||||
let { data: pageData } = $props()
|
||||
let data = $state(pageData)
|
||||
@@ -20,7 +19,10 @@
|
||||
let newAdmin: string = $state(''),
|
||||
adding: boolean = $state(false)
|
||||
|
||||
async function removeAdmin(id: number, confirm: boolean): Promise<any> {
|
||||
async function removeAdmin(
|
||||
id: number,
|
||||
confirm: boolean,
|
||||
): Promise<void | number> {
|
||||
if (!confirm)
|
||||
return toast({
|
||||
content: $t('toast.removeAdminWarning'),
|
||||
@@ -56,7 +58,7 @@
|
||||
description={$t('routes.admin.team.empty.description')}
|
||||
/>
|
||||
{:else}
|
||||
{#each data.site?.admins ?? [] as admin}
|
||||
{#each data.site?.admins ?? [] as admin (admin.person.id)}
|
||||
<div class="py-3 flex items-center justify-between">
|
||||
<UserLink avatar showInstance={false} user={admin.person} />
|
||||
<Button
|
||||
@@ -78,11 +80,7 @@
|
||||
if (!profile.data?.jwt || newAdmin == '') return
|
||||
adding = true
|
||||
|
||||
const r = await addAdmin(
|
||||
`${newAdmin}@${instance.data}`,
|
||||
true,
|
||||
profile.data.jwt,
|
||||
)
|
||||
const r = await addAdmin(`${newAdmin}@${instance.data}`, true)
|
||||
if (!r) return
|
||||
|
||||
toast({
|
||||
|
||||
@@ -2,9 +2,9 @@ import CommunityCard from '$lib/components/lemmy/community/CommunityCard.svelte'
|
||||
import { getClient } from '$lib/lemmy.svelte.js'
|
||||
import { ReactiveState } from '$lib/promise.svelte'
|
||||
|
||||
export async function load(req: any) {
|
||||
const community = await getClient(undefined, req.fetch).getCommunity({
|
||||
name: req.params.name,
|
||||
export async function load({ fetch, params }) {
|
||||
const community = await getClient(undefined, fetch).getCommunity({
|
||||
name: params.name,
|
||||
})
|
||||
|
||||
return {
|
||||
|
||||
@@ -1,25 +1,23 @@
|
||||
<script lang="ts">
|
||||
import { run } from 'svelte/legacy'
|
||||
|
||||
import { browser } from '$app/environment'
|
||||
import { navigating, page } from '$app/state'
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import CommunityCard from '$lib/components/lemmy/community/CommunityCard.svelte'
|
||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||
import CommunityHeader from '$lib/components/lemmy/community/CommunityHeader.svelte'
|
||||
import Sort from '$lib/components/lemmy/dropdowns/Sort.svelte'
|
||||
import { onDestroy, onMount } from 'svelte'
|
||||
import { setSessionStorage } from '$lib/session.js'
|
||||
import PostFeed from '$lib/components/lemmy/post/feed/PostFeed.svelte'
|
||||
import VirtualFeed from '$lib/components/lemmy/post/feed/VirtualFeed.svelte'
|
||||
import { Badge, Button, Modal, Note, toast } from 'mono-svelte'
|
||||
import { browser } from '$app/environment'
|
||||
import { ArrowRight, ChartBar, Icon, Plus, XMark } from 'svelte-hero-icons'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import { t } from '$lib/i18n/translations.js'
|
||||
import { settings } from '$lib/settings.svelte.js'
|
||||
import { site } from '$lib/lemmy.svelte.js'
|
||||
import { resumables } from '$lib/lemmy/item'
|
||||
import CommunityHeader from '$lib/components/lemmy/community/CommunityHeader.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import { setSessionStorage } from '$lib/session.js'
|
||||
import { settings } from '$lib/settings.svelte.js'
|
||||
import { Badge, Button, Modal, Note } from 'mono-svelte'
|
||||
import { onDestroy, onMount } from 'svelte'
|
||||
import { ArrowRight, ChartBar, Icon, Plus, XMark } from 'svelte-hero-icons'
|
||||
|
||||
let { data } = $props()
|
||||
|
||||
@@ -81,9 +79,9 @@
|
||||
</Header>
|
||||
|
||||
{#if profile.data.user}
|
||||
{#if !data.community.value.discussion_languages.every( (l) => profile.data.user?.discussion_languages.includes(l), ) && profile.data.user.discussion_languages.length > 0}
|
||||
{#if !data.community.value.discussion_languages.every( l => profile.data.user?.discussion_languages.includes(l), ) && profile.data.user.discussion_languages.length > 0}
|
||||
{@const missing = data.community.value.discussion_languages.filter(
|
||||
(i) => !profile.data.user?.discussion_languages.includes(i),
|
||||
i => !profile.data.user?.discussion_languages.includes(i),
|
||||
)}
|
||||
<Note class="p-1! pl-3! flex-col md:flex-row">
|
||||
<div>{$t('routes.community.languageWarning')}</div>
|
||||
@@ -103,11 +101,11 @@
|
||||
<div class="flex flex-row gap-4 flex-wrap -mt-2">
|
||||
{#if site.data?.all_languages}
|
||||
{@const allLanguages = site.data.all_languages}
|
||||
{#each missing as language}
|
||||
{#each missing as language (language)}
|
||||
<a href="/profile/settings#languages" class="inline-block w-max">
|
||||
<Badge color="blue-subtle">
|
||||
<Icon src={Plus} size="16" micro />
|
||||
{allLanguages.find((i) => language == i.id)?.name}
|
||||
{allLanguages.find(i => language == i.id)?.name}
|
||||
</Badge>
|
||||
</a>
|
||||
{/each}
|
||||
@@ -146,13 +144,12 @@
|
||||
<Pageination
|
||||
page={data.page}
|
||||
cursor={{ next: data.cursor.next }}
|
||||
href={(page) =>
|
||||
href={page =>
|
||||
typeof page == 'number' ? `?page=${page}` : `?cursor=${page}`}
|
||||
>
|
||||
<span class="flex flex-row items-center gap-1">
|
||||
<Icon src={ChartBar} size="16" mini />
|
||||
{$t('routes.frontpage.footer', {
|
||||
// @ts-ignore
|
||||
users: site.data?.site_view.counts.users_active_day ?? '??',
|
||||
})}
|
||||
</span>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { postFeed } from '$lib/lemmy/postfeed.svelte.js'
|
||||
import { settings } from '$lib/settings.svelte'
|
||||
import type { SortType } from 'lemmy-js-client'
|
||||
import { get } from 'svelte/store'
|
||||
|
||||
export async function load({ params, fetch, url }) {
|
||||
const cursor: string | undefined = url.searchParams.get('cursor') as
|
||||
|
||||
@@ -32,8 +32,6 @@
|
||||
languages: data.community.value.discussion_languages,
|
||||
}}
|
||||
>
|
||||
{#snippet formtitle()}
|
||||
{''}
|
||||
{/snippet}
|
||||
{#snippet formtitle()}{/snippet}
|
||||
</CommunityForm>
|
||||
</div>
|
||||
@@ -1,15 +1,15 @@
|
||||
<script lang="ts">
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||
import { Icon, Plus, Trash } from 'svelte-hero-icons'
|
||||
import type { PageData } from './$types.js'
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import { toast } from 'mono-svelte'
|
||||
import { client, getClient } from '$lib/lemmy.svelte.js'
|
||||
import { flip } from 'svelte/animate'
|
||||
import { Button, TextInput } from 'mono-svelte'
|
||||
import { t } from '$lib/i18n/translations.js'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { t } from '$lib/i18n/translations.js'
|
||||
import { getClient } from '$lib/lemmy.svelte.js'
|
||||
import { Button, TextInput, toast } from 'mono-svelte'
|
||||
import { Icon, Plus, Trash } from 'svelte-hero-icons'
|
||||
import { flip } from 'svelte/animate'
|
||||
import type { PageData } from './$types.js'
|
||||
import { errorMessage } from '$lib/lemmy/error.js'
|
||||
|
||||
interface Props {
|
||||
data: PageData
|
||||
@@ -71,7 +71,7 @@
|
||||
}
|
||||
} catch (err) {
|
||||
toast({
|
||||
content: err as any,
|
||||
content: errorMessage(err as string),
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
@@ -97,7 +97,7 @@
|
||||
})
|
||||
} catch (err) {
|
||||
toast({
|
||||
content: err as any,
|
||||
content: errorMessage(err as string),
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
@@ -139,7 +139,7 @@
|
||||
{/each}
|
||||
</ul>
|
||||
<form
|
||||
onsubmit={(e) => {
|
||||
onsubmit={e => {
|
||||
e.preventDefault()
|
||||
addModerator()
|
||||
}}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { instance } from '$lib/instance.svelte'
|
||||
import { redirect } from '@sveltejs/kit'
|
||||
import { get } from 'svelte/store'
|
||||
|
||||
export function load({ params }) {
|
||||
// If you somehow got to /comment/instance, it likely means you passed in an ID, not an instance.
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import ProfileButton from '$lib/components/ui/sidebar/ProfileButton.svelte'
|
||||
import SidebarButton from '$lib/components/ui/sidebar/SidebarButton.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { client } from '$lib/lemmy.svelte'
|
||||
import { errorMessage } from '$lib/lemmy/error'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { toast } from 'mono-svelte'
|
||||
import Button from 'mono-svelte/button/Button.svelte'
|
||||
import Material from 'mono-svelte/materials/Material.svelte'
|
||||
@@ -49,7 +49,6 @@
|
||||
</Header>
|
||||
<p>
|
||||
{$t('routes.postRedirect.description', {
|
||||
// @ts-ignore
|
||||
homeInstance: fetched,
|
||||
})}
|
||||
</p>
|
||||
@@ -65,7 +64,6 @@
|
||||
onclick={fetchOnHome}
|
||||
>
|
||||
{$t('routes.postRedirect.actions.fetch', {
|
||||
// @ts-ignore
|
||||
homeInstance: fetched,
|
||||
})}
|
||||
</Button>
|
||||
@@ -81,7 +79,6 @@
|
||||
<div class="space-y-1">
|
||||
<div class="font-medium text-sm">
|
||||
{$t('routes.postRedirect.actions.switch', {
|
||||
// @ts-ignore
|
||||
destInstance: page.params.instance,
|
||||
})}
|
||||
</div>
|
||||
@@ -91,7 +88,7 @@
|
||||
rounding="2xl"
|
||||
class="dark:bg-zinc-950 max-h-96 overflow-auto"
|
||||
>
|
||||
{#each filtered as profile, index}
|
||||
{#each filtered as profile, index (profile.id)}
|
||||
<ProfileButton prof={profile} {index} />
|
||||
{/each}
|
||||
<SidebarButton
|
||||
|
||||
@@ -1,36 +1,19 @@
|
||||
<script lang="ts">
|
||||
import { preventDefault } from 'svelte/legacy'
|
||||
|
||||
import { navigating, page } from '$app/state'
|
||||
import {
|
||||
GlobeAmericas,
|
||||
Icon,
|
||||
InformationCircle,
|
||||
MagnifyingGlass,
|
||||
QuestionMarkCircle,
|
||||
} from 'svelte-hero-icons'
|
||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||
import { searchParam } from '$lib/util.svelte.js'
|
||||
import {
|
||||
Button,
|
||||
Material,
|
||||
Popover,
|
||||
Select,
|
||||
Spinner,
|
||||
TextInput,
|
||||
} from 'mono-svelte'
|
||||
import Sort from '$lib/components/lemmy/dropdowns/Sort.svelte'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import CommunityItem from '$lib/components/lemmy/community/CommunityItem.svelte'
|
||||
import Location from '$lib/components/lemmy/dropdowns/Location.svelte'
|
||||
import { t } from '$lib/i18n/translations.js'
|
||||
import Sort from '$lib/components/lemmy/dropdowns/Sort.svelte'
|
||||
import Skeleton from '$lib/components/ui/generic/Skeleton.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
||||
import { t } from '$lib/i18n/translations.js'
|
||||
import { Button, Material, TextInput } from 'mono-svelte'
|
||||
import { Icon, MagnifyingGlass, QuestionMarkCircle } from 'svelte-hero-icons'
|
||||
import { expoOut } from 'svelte/easing'
|
||||
import { fly } from 'svelte/transition'
|
||||
import { backOut, expoOut } from 'svelte/easing'
|
||||
import { goto } from '$app/navigation'
|
||||
import Skeleton from '$lib/components/ui/generic/Skeleton.svelte'
|
||||
|
||||
let { data } = $props()
|
||||
|
||||
@@ -46,7 +29,7 @@
|
||||
</script>
|
||||
|
||||
<svelte:window
|
||||
onkeydown={(e) => {
|
||||
onkeydown={e => {
|
||||
if (e.target == document.body) searchElement?.focus()
|
||||
}}
|
||||
/>
|
||||
@@ -104,6 +87,7 @@
|
||||
{#if navigating.to?.route.id == '/communities'}
|
||||
<div class="flex flex-col gap-3 mt-6">
|
||||
{#each new Array(5) as _, index}
|
||||
{_}
|
||||
<div
|
||||
in:fly|global={{
|
||||
duration: 800,
|
||||
@@ -195,7 +179,7 @@
|
||||
<Tabs routes={[]} class="mx-auto">
|
||||
<Pageination
|
||||
page={Number(page.url.searchParams.get('page')) || 1}
|
||||
href={(c) => `?page=${c}`}
|
||||
href={c => `?page=${c}`}
|
||||
/>
|
||||
</Tabs>
|
||||
</div>
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
import { profile } from '$lib/auth.svelte'
|
||||
import { LINKED_INSTANCE_URL } from '$lib/instance.svelte.js'
|
||||
import { client, getClient } from '$lib/lemmy.svelte.js'
|
||||
import { getClient } from '$lib/lemmy.svelte.js'
|
||||
import { ReactiveState } from '$lib/promise.svelte'
|
||||
import {
|
||||
type ListCommunitiesResponse,
|
||||
type ListingType,
|
||||
type SortType,
|
||||
} from 'lemmy-js-client'
|
||||
import { get } from 'svelte/store'
|
||||
import { type ListingType, type SortType } from 'lemmy-js-client'
|
||||
|
||||
export async function load({ url, fetch }) {
|
||||
const type =
|
||||
|
||||
@@ -1,12 +1,27 @@
|
||||
<script lang="ts">
|
||||
import { getClient } from '$lib/lemmy.svelte.js'
|
||||
import type { CommunityView, SubscribedType } from 'lemmy-js-client'
|
||||
import type {
|
||||
CommunityResponse,
|
||||
CommunityView,
|
||||
SubscribedType,
|
||||
} from 'lemmy-js-client'
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import { toast } from 'mono-svelte'
|
||||
import { errorMessage } from '$lib/lemmy/error'
|
||||
|
||||
interface Props {
|
||||
community?: CommunityView | undefined
|
||||
children?: import('svelte').Snippet<[any]>
|
||||
children?: import('svelte').Snippet<
|
||||
[
|
||||
{
|
||||
subscribe: (
|
||||
id?: number,
|
||||
subscribed?: SubscribedType,
|
||||
) => Promise<CommunityResponse | undefined>
|
||||
subscribing: boolean
|
||||
},
|
||||
]
|
||||
>
|
||||
}
|
||||
|
||||
let { community = undefined, children }: Props = $props()
|
||||
@@ -30,8 +45,8 @@
|
||||
|
||||
subscribing = false
|
||||
return res
|
||||
} catch (error) {
|
||||
toast({ content: error as any, type: 'error' })
|
||||
} catch (err) {
|
||||
toast({ content: errorMessage(err as string), type: 'error' })
|
||||
}
|
||||
|
||||
subscribing = false
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation'
|
||||
import PostForm from '$lib/components/lemmy/post/form/PostForm.svelte'
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import { onDestroy, onMount } from 'svelte'
|
||||
import { getSessionStorage, setSessionStorage } from '$lib/session.js'
|
||||
import { t } from '$lib/i18n/translations.js'
|
||||
import PostForm from '$lib/components/lemmy/post/form/PostForm.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { t } from '$lib/i18n/translations.js'
|
||||
import { getSessionStorage, setSessionStorage } from '$lib/session.js'
|
||||
import { onDestroy, onMount } from 'svelte'
|
||||
|
||||
let { data } = $props()
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
setSessionStorage('lastSeenCommunity', undefined)
|
||||
})
|
||||
|
||||
// TODO remove this
|
||||
// eslint-disable-next-line
|
||||
let post = getSessionStorage('postDraft') as any
|
||||
</script>
|
||||
|
||||
@@ -44,7 +46,7 @@
|
||||
url: undefined,
|
||||
}}
|
||||
passedCommunity={community}
|
||||
onsubmit={(e) => goto(`/post/${e.post.id}`)}
|
||||
onsubmit={e => goto(`/post/${e.post.id}`)}
|
||||
>
|
||||
{#snippet formtitle()}
|
||||
<Header class="text-3xl font-bold" pageHeader>
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { getClient } from '$lib/lemmy.svelte.js'
|
||||
|
||||
export const load = ({ url }) => {
|
||||
return { crosspost: Boolean(url.searchParams.get('crosspost')) ?? false }
|
||||
return { crosspost: Boolean(url.searchParams.get('crosspost')) }
|
||||
}
|
||||
@@ -1,28 +1,18 @@
|
||||
<script lang="ts">
|
||||
import InboxItem from './InboxItem.svelte'
|
||||
import {
|
||||
AdjustmentsHorizontal,
|
||||
ArrowPath,
|
||||
Bars3BottomRight,
|
||||
Check,
|
||||
Funnel,
|
||||
Icon,
|
||||
Inbox,
|
||||
} from 'svelte-hero-icons'
|
||||
import { getClient } from '$lib/lemmy.svelte.js'
|
||||
import { goto } from '$app/navigation'
|
||||
import { page } from '$app/state'
|
||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||
import { notifications, profile } from '$lib/auth.svelte.js'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import { fly } from 'svelte/transition'
|
||||
import { searchParam } from '$lib/util.svelte.js'
|
||||
import { Button, Select } from 'mono-svelte'
|
||||
import EndPlaceholder from '$lib/components/ui/EndPlaceholder.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { getClient } from '$lib/lemmy.svelte.js'
|
||||
import { Button } from 'mono-svelte'
|
||||
import { ArrowPath, Check, Icon, Inbox } from 'svelte-hero-icons'
|
||||
import { expoOut } from 'svelte/easing'
|
||||
import { fly } from 'svelte/transition'
|
||||
import InboxItem from './InboxItem.svelte'
|
||||
|
||||
let { data } = $props()
|
||||
|
||||
@@ -192,7 +182,7 @@ items-center px-2 w-max top-6 lg:top-22"
|
||||
!data.inbox || (data.inbox.value?.length ?? 0) < (data?.limit ?? 0)
|
||||
)}
|
||||
page={data.page}
|
||||
href={(page) => `?page=${page}`}
|
||||
href={page => `?page=${page}`}
|
||||
/>
|
||||
</Tabs>
|
||||
</div>
|
||||
|
||||
@@ -7,7 +7,6 @@ import {
|
||||
generalizePrivateMessage,
|
||||
} from '$lib/lemmy/inbox.js'
|
||||
import { ReactiveState } from '$lib/promise.svelte.js'
|
||||
import { get } from 'svelte/store'
|
||||
|
||||
type InboxFeedType = 'replies' | 'mentions' | 'messages' | 'all'
|
||||
|
||||
|
||||
@@ -1,32 +1,17 @@
|
||||
<script lang="ts">
|
||||
import Comment from '$lib/components/lemmy/comment/Comment.svelte'
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
import { getClient } from '$lib/lemmy.svelte.js'
|
||||
import { notifications, profile } from '$lib/auth.svelte.js'
|
||||
import {
|
||||
ArrowUturnLeft,
|
||||
ArrowUturnUp,
|
||||
AtSymbol,
|
||||
ChatBubbleOvalLeft,
|
||||
Check,
|
||||
Envelope,
|
||||
Icon,
|
||||
Eye,
|
||||
EyeSlash,
|
||||
} from 'svelte-hero-icons'
|
||||
import { Material } from 'mono-svelte'
|
||||
import PostMeta from '$lib/components/lemmy/post/PostMeta.svelte'
|
||||
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
||||
import { Button } from 'mono-svelte'
|
||||
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
|
||||
import { publishedToDate } from '$lib/components/util/date.js'
|
||||
import type { InboxItem } from '$lib/lemmy/inbox.js'
|
||||
import CommentItem from '$lib/components/lemmy/comment/CommentItem.svelte'
|
||||
import PrivateMessage from '$lib/components/lemmy/inbox/PrivateMessage.svelte'
|
||||
import PrivateMessageModal from '$lib/components/lemmy/modal/PrivateMessageModal.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import Expandable from '$lib/components/ui/Expandable.svelte'
|
||||
import CommentItem from '$lib/components/lemmy/comment/CommentItem.svelte'
|
||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||
import Expandable from '$lib/components/ui/Expandable.svelte'
|
||||
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
|
||||
import { publishedToDate } from '$lib/components/util/date.js'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { getClient } from '$lib/lemmy.svelte.js'
|
||||
import type { InboxItem } from '$lib/lemmy/inbox.js'
|
||||
import { Button } from 'mono-svelte'
|
||||
import { Eye, EyeSlash, Icon } from 'svelte-hero-icons'
|
||||
|
||||
interface Props {
|
||||
item: InboxItem
|
||||
@@ -35,7 +20,6 @@
|
||||
let { item = $bindable() }: Props = $props()
|
||||
|
||||
let replying = $state(false)
|
||||
let reply = ''
|
||||
let loading = $state(false)
|
||||
|
||||
async function markAsRead(isRead: boolean) {
|
||||
@@ -90,19 +74,16 @@
|
||||
<div class="text-sm font-normal">
|
||||
{#if item.type == 'comment_reply'}
|
||||
{@html $t('routes.inbox.item.reply', {
|
||||
// @ts-ignore
|
||||
user: `<span class="font-medium">${item.creator.name}</span>`,
|
||||
post: `<span class="font-medium">${item.item.post.name}</span>`,
|
||||
})}
|
||||
{:else if item.type == 'person_mention'}
|
||||
{@html $t('routes.inbox.item.mention', {
|
||||
// @ts-ignore
|
||||
user: `<span class="font-medium">${item.creator.name}</span>`,
|
||||
post: `<span class="font-medium">${item.item.post.name}</span>`,
|
||||
})}
|
||||
{:else if item.type == 'private_message'}
|
||||
{@html $t('routes.inbox.item.message', {
|
||||
// @ts-ignore
|
||||
user: `<span class="font-medium">${item.item.creator.name}</span>`,
|
||||
recipient: `<span class="font-medium">${item.item.recipient.name}</span>`,
|
||||
})}
|
||||
@@ -118,7 +99,7 @@
|
||||
color={item.read ? 'secondary' : 'primary'}
|
||||
{loading}
|
||||
disabled={loading}
|
||||
onclick={(e) => {
|
||||
onclick={e => {
|
||||
e.stopPropagation()
|
||||
markAsRead(!item.read)
|
||||
}}
|
||||
@@ -152,7 +133,7 @@
|
||||
color={item.read ? 'secondary' : 'primary'}
|
||||
{loading}
|
||||
disabled={loading}
|
||||
onclick={(e) => {
|
||||
onclick={e => {
|
||||
e.stopPropagation()
|
||||
markAsRead(!item.read)
|
||||
}}
|
||||
@@ -192,15 +173,3 @@
|
||||
{/if}
|
||||
{/snippet}
|
||||
</Expandable>
|
||||
|
||||
<style>
|
||||
.meta {
|
||||
display: grid;
|
||||
grid-template-columns: auto 1fr auto;
|
||||
grid-template-rows: auto 1fr;
|
||||
column-gap: 0.5rem;
|
||||
grid-template-areas:
|
||||
'a b actions'
|
||||
'a title actions';
|
||||
}
|
||||
</style>
|
||||
@@ -4,11 +4,7 @@
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { publishedToDate } from '$lib/components/util/date.js'
|
||||
import { t } from '$lib/i18n/translations.js'
|
||||
import type {
|
||||
Person,
|
||||
PrivateMessageResponse,
|
||||
PrivateMessageView,
|
||||
} from 'lemmy-js-client'
|
||||
import type { Person, PrivateMessageView } from 'lemmy-js-client'
|
||||
import { Spinner } from 'mono-svelte'
|
||||
import { backOut } from 'svelte/easing'
|
||||
import { fly } from 'svelte/transition'
|
||||
@@ -23,7 +19,7 @@
|
||||
|
||||
function filterDuplicates<T, K>(array: T[], predicate: (item: T) => K): T[] {
|
||||
const seen = new Set()
|
||||
return array.filter((element) => {
|
||||
return array.filter(element => {
|
||||
const value = predicate(element)
|
||||
if (seen.has(value)) {
|
||||
return false
|
||||
@@ -37,9 +33,9 @@
|
||||
function conversationPreviews(
|
||||
conversations: PrivateMessageView[],
|
||||
): ConversationPreview[] {
|
||||
const deduplicated = filterDuplicates(conversations, (i) => i.creator.id)
|
||||
const deduplicated = filterDuplicates(conversations, i => i.creator.id)
|
||||
|
||||
return deduplicated.map((i) => ({
|
||||
return deduplicated.map(i => ({
|
||||
user: i.creator,
|
||||
message: {
|
||||
date: publishedToDate(i.private_message.published),
|
||||
@@ -61,13 +57,13 @@
|
||||
{:then data}
|
||||
{@const conversations = data.private_messages}
|
||||
{@const previews = conversationPreviews(conversations).filter(
|
||||
(c) => c.user.id != profile.data?.user?.local_user_view.person.id,
|
||||
c => c.user.id != profile.data?.user?.local_user_view.person.id,
|
||||
)}
|
||||
|
||||
<ul
|
||||
class="flex flex-col divide-y divide-slate-200 dark:divide-zinc-800 w-full mt-6"
|
||||
>
|
||||
{#each previews as preview, index}
|
||||
{#each previews as preview, index (preview)}
|
||||
<a
|
||||
href="/inbox/messages/{preview.user.id}"
|
||||
class="flex flex-row gap-2 py-3 -mx-4 px-4 sm:-mx-6 sm:px-6 w-full min-w-0
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { client } from '$lib/lemmy.svelte.js'
|
||||
import { awaitIfServer } from '$lib/promise.svelte.js'
|
||||
|
||||
export async function load({ fetch, url }) {
|
||||
const page = Number(url.searchParams.get('page')) || 1
|
||||
|
||||
export async function load({ fetch }) {
|
||||
// TODO probably add proper paging
|
||||
const messagePromise = client({ func: fetch }).getPrivateMessages({
|
||||
limit: 50,
|
||||
})
|
||||
|
||||
@@ -1,28 +1,21 @@
|
||||
<script lang="ts">
|
||||
import { run, preventDefault } from 'svelte/legacy'
|
||||
|
||||
import { Button, Material, Spinner, TextInput, toast } from 'mono-svelte'
|
||||
import Message from './Message.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { Icon, PaperAirplane } from 'svelte-hero-icons'
|
||||
import { browser } from '$app/environment'
|
||||
import { report } from '$lib/components/lemmy/moderation/moderation'
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { fly } from 'svelte/transition'
|
||||
import { backOut, expoOut } from 'svelte/easing'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { client } from '$lib/lemmy.svelte'
|
||||
import { errorMessage } from '$lib/lemmy/error'
|
||||
import type { PrivateMessageResponse } from 'lemmy-js-client'
|
||||
import { Button, Material, TextInput, toast } from 'mono-svelte'
|
||||
import { tick } from 'svelte'
|
||||
import { Icon, PaperAirplane } from 'svelte-hero-icons'
|
||||
import { flip } from 'svelte/animate'
|
||||
import { browser } from '$app/environment'
|
||||
import { onMount, tick } from 'svelte'
|
||||
import { report } from '$lib/components/lemmy/moderation/moderation'
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
import Placeholder from 'mono-svelte/placeholder/Placeholder.svelte'
|
||||
import { backOut, expoOut } from 'svelte/easing'
|
||||
import { fly } from 'svelte/transition'
|
||||
import Message from './Message.svelte'
|
||||
|
||||
let { data: pageData } = $props()
|
||||
let data = $state(pageData)
|
||||
$effect(() => {
|
||||
data = pageData
|
||||
})
|
||||
let { data } = $props()
|
||||
|
||||
let textbox = $state({
|
||||
message: '',
|
||||
@@ -41,7 +34,7 @@
|
||||
try {
|
||||
const res = await client().createPrivateMessage({
|
||||
content: message,
|
||||
recipient_id: data.creator.person_view.person.id,
|
||||
recipient_id: data.creator.value.person_view.person.id,
|
||||
})
|
||||
|
||||
textbox.loading = false
|
||||
@@ -49,7 +42,7 @@
|
||||
return res
|
||||
} catch (err) {
|
||||
toast({
|
||||
content: errorMessage(err as any),
|
||||
content: errorMessage(err as string),
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
@@ -58,7 +51,7 @@
|
||||
}
|
||||
|
||||
$effect(() => {
|
||||
if (browser && data.message && chatWindow) {
|
||||
if (browser && data.message.value && chatWindow) {
|
||||
tick().then(() =>
|
||||
chatWindow?.scrollTo({
|
||||
top: chatWindow.scrollHeight,
|
||||
@@ -69,15 +62,15 @@
|
||||
})
|
||||
|
||||
async function deleteMessage(id: number) {
|
||||
const res = await client().deletePrivateMessage({
|
||||
await client().deletePrivateMessage({
|
||||
deleted: true,
|
||||
private_message_id: id,
|
||||
})
|
||||
|
||||
data.message = {
|
||||
private_messages: data.message.private_messages.toSpliced(
|
||||
data.message.private_messages.findLastIndex(
|
||||
(i) => i.private_message.id == id,
|
||||
data.message.value = {
|
||||
private_messages: data.message.value.private_messages.toSpliced(
|
||||
data.message.value.private_messages.findLastIndex(
|
||||
i => i.private_message.id == id,
|
||||
),
|
||||
1,
|
||||
),
|
||||
@@ -88,7 +81,7 @@
|
||||
<Header pageHeader>
|
||||
{$t('filter.inbox.messages')}
|
||||
{#snippet extended()}
|
||||
<UserLink avatar user={data.creator.person_view.person} />
|
||||
<UserLink avatar user={data.creator.value.person_view.person} />
|
||||
{/snippet}
|
||||
</Header>
|
||||
<Material
|
||||
@@ -103,23 +96,22 @@
|
||||
<div class="mt-auto"></div>
|
||||
<p class="mx-auto mt-auto text-slate-400 dark:text-zinc-600">
|
||||
{$t('routes.inbox.messages.conversation', {
|
||||
// @ts-ignore
|
||||
user:
|
||||
data.creator.person_view.person.name +
|
||||
data.creator.value.person_view.person.name +
|
||||
'@' +
|
||||
new URL(data.creator.person_view.person.actor_id).hostname,
|
||||
new URL(data.creator.value.person_view.person.actor_id).hostname,
|
||||
})}
|
||||
</p>
|
||||
{#each data.message.private_messages.toReversed() as private_message, index (private_message.private_message.id)}
|
||||
{#each data.message.value.private_messages.toReversed() as private_message, index (private_message.private_message.id)}
|
||||
<div
|
||||
class={private_message.creator.id ==
|
||||
data.creator.person_view.person.id
|
||||
data.creator.value.person_view.person.id
|
||||
? 'self-start'
|
||||
: 'self-end'}
|
||||
in:fly|global={{
|
||||
duration: 700,
|
||||
easing: backOut,
|
||||
delay: data.message.private_messages.length * 50 - index * 50,
|
||||
delay: data.message.value.private_messages.length * 50 - index * 50,
|
||||
y: -12,
|
||||
}}
|
||||
animate:flip={{ duration: 500, easing: expoOut }}
|
||||
@@ -129,27 +121,27 @@
|
||||
onreport={() => report(private_message)}
|
||||
message={private_message}
|
||||
primary={private_message.creator.id !=
|
||||
data.creator.person_view.person.id}
|
||||
data.creator.value.person_view.person.id}
|
||||
/>
|
||||
</div>
|
||||
{/each}
|
||||
</ul>
|
||||
</div>
|
||||
</Material>
|
||||
{#await data.message then message}
|
||||
{#await data.message.value then message}
|
||||
<div class="sticky bottom-4 p-4">
|
||||
<form
|
||||
class="flex flex-row h-14 items-center w-full
|
||||
border-slate-200 dark:border-zinc-800
|
||||
p-2 gap-2 backdrop-blur-xl
|
||||
bg-white/50 dark:bg-zinc-950/50 border rounded-2xl"
|
||||
onsubmit={async (e) => {
|
||||
onsubmit={async e => {
|
||||
e.preventDefault()
|
||||
|
||||
const res = await sendMessage(textbox.message)
|
||||
if (!res) return
|
||||
|
||||
data.message = {
|
||||
data.message.value = {
|
||||
private_messages: [
|
||||
res.private_message_view,
|
||||
...message.private_messages,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { client } from '$lib/lemmy.svelte.js'
|
||||
import { awaitIfServer } from '$lib/promise.svelte.js'
|
||||
import { ReactiveState } from '$lib/promise.svelte.js'
|
||||
|
||||
export async function load({ fetch, params }) {
|
||||
const creator = Number(params.user_id)
|
||||
@@ -18,7 +18,7 @@ export async function load({ fetch, params }) {
|
||||
const [message, user] = await Promise.all([messagePromise, userPromise])
|
||||
|
||||
return {
|
||||
message: message,
|
||||
creator: user,
|
||||
message: new ReactiveState(message),
|
||||
creator: new ReactiveState(user),
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import type { PrivateMessageView } from 'lemmy-js-client'
|
||||
import { Button, Menu, MenuButton, MenuDivider, Popover } from 'mono-svelte'
|
||||
import { Button, Menu, MenuButton, MenuDivider } from 'mono-svelte'
|
||||
import { EllipsisVertical, Flag, Icon, Trash } from 'svelte-hero-icons'
|
||||
|
||||
interface Props {
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
|
||||
import { publishedToDate } from '$lib/components/util/date.js'
|
||||
import type { Instance } from 'lemmy-js-client'
|
||||
import { Material, Popover } from 'mono-svelte'
|
||||
import { Check, Icon, InformationCircle } from 'svelte-hero-icons'
|
||||
|
||||
@@ -31,7 +30,7 @@
|
||||
color="distinct"
|
||||
>
|
||||
{#if data.linked && data.linked.length > 0}
|
||||
{#each data.linked?.sort((b, a) => b.id - a.id) as instance}
|
||||
{#each data.linked?.sort((b, a) => b.id - a.id) as instance (instance.id)}
|
||||
<div class="flex justify-between items-center first:pt-0 last:pb-0">
|
||||
<div class="flex flex-col">
|
||||
<span class="font-medium">{instance.domain}</span>
|
||||
@@ -73,7 +72,7 @@
|
||||
color="distinct"
|
||||
>
|
||||
{#if data.blocked && data.blocked.length > 0}
|
||||
{#each data.blocked?.sort((b, a) => b.id - a.id) as instance}
|
||||
{#each data.blocked?.sort((b, a) => b.id - a.id) as instance (instance.id)}
|
||||
<div class="flex justify-between items-center first:pt-0 last:pb-0">
|
||||
<div class="flex flex-col">
|
||||
<span class="font-medium">{instance.domain}</span>
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
<script lang="ts">
|
||||
import SiteCard from '$lib/components/lemmy/SiteCard.svelte'
|
||||
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { site } from '$lib/lemmy.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { Button, Modal, Spinner } from 'mono-svelte'
|
||||
|
||||
let siteOpen: boolean = false
|
||||
import { site } from '$lib/lemmy.svelte'
|
||||
import { Spinner } from 'mono-svelte'
|
||||
</script>
|
||||
|
||||
<div class="flex flex-row w-full">
|
||||
|
||||
@@ -2,35 +2,29 @@
|
||||
import { preventDefault } from 'svelte/legacy'
|
||||
|
||||
import { goto } from '$app/navigation'
|
||||
import { page } from '$app/state'
|
||||
import { setUser } from '$lib/auth.svelte.js'
|
||||
import { Note, toast } from 'mono-svelte'
|
||||
import ErrorContainer, {
|
||||
clearErrorScope,
|
||||
pushError,
|
||||
} from '$lib/components/error/ErrorContainer.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import {
|
||||
DEFAULT_INSTANCE_URL,
|
||||
LINKED_INSTANCE_URL,
|
||||
} from '$lib/instance.svelte.js'
|
||||
import {
|
||||
getClient,
|
||||
mayBeIncompatible,
|
||||
site,
|
||||
validateInstance,
|
||||
} from '$lib/lemmy.svelte.js'
|
||||
import { Button, TextInput } from 'mono-svelte'
|
||||
import { getClient, mayBeIncompatible, site } from '$lib/lemmy.svelte.js'
|
||||
import { errorMessage } from '$lib/lemmy/error'
|
||||
import { DOMAIN_REGEX_FORMS } from '$lib/util.svelte.js'
|
||||
import { MINIMUM_VERSION } from '$lib/version.js'
|
||||
import { Button, Note, TextInput, toast } from 'mono-svelte'
|
||||
import {
|
||||
Icon,
|
||||
Identification,
|
||||
QuestionMarkCircle,
|
||||
UserCircle,
|
||||
} from 'svelte-hero-icons'
|
||||
import { DOMAIN_REGEX_FORMS } from '$lib/util.svelte.js'
|
||||
import { MINIMUM_VERSION } from '$lib/version.js'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { errorMessage } from '$lib/lemmy/error'
|
||||
import ErrorContainer, {
|
||||
clearErrorScope,
|
||||
pushError,
|
||||
} from '$lib/components/error/ErrorContainer.svelte'
|
||||
import { page } from '$app/state'
|
||||
|
||||
interface Props {
|
||||
ref?: string
|
||||
@@ -75,7 +69,8 @@
|
||||
} catch (error) {
|
||||
pushError({
|
||||
message:
|
||||
JSON.parse((error as any)?.body?.message ?? '{}')?.error ==
|
||||
// @ts-expect-error cursed json hack
|
||||
JSON.parse((error as object)?.body?.message ?? '{}')?.error ==
|
||||
'incorrect_login'
|
||||
? errorMessage(
|
||||
'incorrect_login' +
|
||||
@@ -104,7 +99,6 @@
|
||||
{#if site.data && mayBeIncompatible(MINIMUM_VERSION, site.data.version.replace('v', ''))}
|
||||
<Note>
|
||||
{$t('account.versionGate', {
|
||||
//@ts-ignore
|
||||
version: `v${MINIMUM_VERSION}`,
|
||||
})}
|
||||
</Note>
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
<script lang="ts">
|
||||
import { preventDefault } from 'svelte/legacy'
|
||||
|
||||
import { site, validateInstance } from '$lib/lemmy.svelte.js'
|
||||
import { Button, Note, TextInput, toast } from 'mono-svelte'
|
||||
import { MINIMUM_VERSION } from '$lib/version'
|
||||
import { mayBeIncompatible } from '$lib/lemmy.svelte'
|
||||
import { DOMAIN_REGEX_FORMS } from '$lib/util.svelte'
|
||||
import { profile, profileData, type Profile } from '$lib/auth.svelte'
|
||||
import { LINKED_INSTANCE_URL } from '$lib/instance.svelte'
|
||||
import { goto } from '$app/navigation'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { page } from '$app/state'
|
||||
import { profileData } from '$lib/auth.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { LINKED_INSTANCE_URL } from '$lib/instance.svelte'
|
||||
import { mayBeIncompatible } from '$lib/lemmy.svelte'
|
||||
import { site, validateInstance } from '$lib/lemmy.svelte.js'
|
||||
import { DOMAIN_REGEX_FORMS } from '$lib/util.svelte'
|
||||
import { MINIMUM_VERSION } from '$lib/version'
|
||||
import { Button, Note, TextInput, toast } from 'mono-svelte'
|
||||
|
||||
interface Props {
|
||||
ref?: string
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
let form = $state({
|
||||
instance: '',
|
||||
username: `${$t('account.guest')} ${profileData.profiles.filter((p) => p.jwt == undefined).length + 1}`,
|
||||
username: `${$t('account.guest')} ${profileData.profiles.filter(p => p.jwt == undefined).length + 1}`,
|
||||
loading: false,
|
||||
})
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
return
|
||||
}
|
||||
|
||||
const id = Math.max(...profileData.profiles.map((i) => i.id)) + 1
|
||||
const id = Math.max(...profileData.profiles.map(i => i.id)) + 1
|
||||
profileData.profiles.push({
|
||||
id: id,
|
||||
instance: form.instance,
|
||||
@@ -59,7 +59,6 @@
|
||||
{#if site.data && mayBeIncompatible(MINIMUM_VERSION, site.data.version.replace('v', ''))}
|
||||
<Note>
|
||||
{$t('account.versionGate', {
|
||||
//@ts-ignore
|
||||
version: `v${MINIMUM_VERSION}`,
|
||||
})}
|
||||
</Note>
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
import { getClient, validateInstance } from '$lib/lemmy.svelte.js'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { Button, TextInput, toast } from 'mono-svelte'
|
||||
import { errorMessage } from '$lib/lemmy/error'
|
||||
|
||||
let instance = $state(LINKED_INSTANCE_URL || currentInstance.data || '')
|
||||
let email = $state('')
|
||||
@@ -31,7 +32,7 @@
|
||||
})
|
||||
} catch (err) {
|
||||
toast({
|
||||
content: err as any,
|
||||
content: errorMessage(err as string),
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,52 +1,39 @@
|
||||
<script lang="ts">
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
import { fly } from 'svelte/transition'
|
||||
import Report from './Report.svelte'
|
||||
import MultiSelect from '$lib/components/input/Switch.svelte'
|
||||
import { goto } from '$app/navigation'
|
||||
import { page } from '$app/state'
|
||||
import {
|
||||
Check,
|
||||
EnvelopeOpen,
|
||||
Funnel,
|
||||
Icon,
|
||||
Inbox,
|
||||
Newspaper,
|
||||
} from 'svelte-hero-icons'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import { searchParam } from '$lib/util.svelte.js'
|
||||
import { Button, Material, Select, toast } from 'mono-svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import ProgressBar from '$lib/components/ui/ProgressBar.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { client } from '$lib/lemmy.svelte'
|
||||
import { searchParam } from '$lib/util.svelte.js'
|
||||
import { Button, Select, toast } from 'mono-svelte'
|
||||
import Option from 'mono-svelte/forms/select/Option.svelte'
|
||||
import { tick } from 'svelte'
|
||||
import ProgressBar from '$lib/components/ui/ProgressBar.svelte'
|
||||
import { client } from '$lib/lemmy.svelte'
|
||||
import { goto } from '$app/navigation'
|
||||
import { Check, Funnel, Icon, Inbox } from 'svelte-hero-icons'
|
||||
import { fly } from 'svelte/transition'
|
||||
import Report from './Report.svelte'
|
||||
|
||||
let { data = $bindable() } = $props()
|
||||
|
||||
let type = $state(data.type)
|
||||
let reports = $state(data.items)
|
||||
$effect(() => {
|
||||
reports = data.items
|
||||
})
|
||||
|
||||
let batch = $state({
|
||||
progress: -1,
|
||||
})
|
||||
async function markAllAsResolved() {
|
||||
if (!reports) return
|
||||
if (!data.items?.value) return
|
||||
batch.progress = 0
|
||||
|
||||
const promises = await Promise.all(
|
||||
reports.map((report) => {
|
||||
await Promise.all(
|
||||
data.items?.value.map(report => {
|
||||
switch (report.type) {
|
||||
case 'comment': {
|
||||
const promise = client().resolveCommentReport({
|
||||
report_id: report.id,
|
||||
resolved: true,
|
||||
})
|
||||
promise.then(() => (batch.progress += 1 / reports!.length))
|
||||
promise.then(
|
||||
() => (batch.progress += 1 / data.items?.value!.length),
|
||||
)
|
||||
return promise
|
||||
}
|
||||
case 'post': {
|
||||
@@ -54,7 +41,9 @@
|
||||
report_id: report.id,
|
||||
resolved: true,
|
||||
})
|
||||
promise.then(() => (batch.progress += 1 / reports!.length))
|
||||
promise.then(
|
||||
() => (batch.progress += 1 / data.items?.value!.length),
|
||||
)
|
||||
return promise
|
||||
}
|
||||
case 'message': {
|
||||
@@ -62,7 +51,9 @@
|
||||
report_id: report.id,
|
||||
resolved: true,
|
||||
})
|
||||
promise.then(() => (batch.progress += 1 / reports!.length))
|
||||
promise.then(
|
||||
() => (batch.progress += 1 / data.items?.value!.length),
|
||||
)
|
||||
return promise
|
||||
}
|
||||
}
|
||||
@@ -82,10 +73,10 @@
|
||||
{#snippet extended()}
|
||||
<div class="flex flex-row gap-2 flex-wrap items-end">
|
||||
<Select
|
||||
bind:value={type}
|
||||
bind:value={data.type}
|
||||
onchange={async () => {
|
||||
await tick()
|
||||
searchParam(page.url, 'type', type, 'page')
|
||||
searchParam(page.url, 'type', data.type, 'page')
|
||||
}}
|
||||
>
|
||||
{#snippet customLabel()}
|
||||
@@ -112,11 +103,11 @@
|
||||
</Header>
|
||||
</div>
|
||||
<ProgressBar progress={batch.progress} />
|
||||
{#if reports && reports.length > 0}
|
||||
{#if data.items?.value && data.items?.value.length > 0}
|
||||
<div
|
||||
class="flex flex-col *:py-4 divide-y divide-slate-200 dark:divide-zinc-800"
|
||||
>
|
||||
{#each reports as item}
|
||||
{#each data.items?.value as item (item.id)}
|
||||
<div
|
||||
in:fly={{ y: -6, opacity: 0, duration: 500 }}
|
||||
class="flex flex-col gap-3 text-sm -mx-4 sm:-mx-6 px-4 sm:px-6"
|
||||
|
||||
@@ -6,17 +6,14 @@ import {
|
||||
generalizePostReport,
|
||||
generalizePrivateMessageReport,
|
||||
} from '$lib/lemmy/report.js'
|
||||
import { get } from 'svelte/store'
|
||||
import { ReactiveState } from '$lib/promise.svelte'
|
||||
|
||||
type ReportListType = 'unread' | 'all'
|
||||
type ReportFilter = 'all' | 'posts' | 'comments' | 'messages'
|
||||
|
||||
export async function load({ url, fetch }) {
|
||||
const page = Number(url.searchParams.get('page')) || 1
|
||||
const type: ReportListType =
|
||||
(url.searchParams.get('type') as ReportListType) || 'unread'
|
||||
const filter: ReportFilter =
|
||||
(url.searchParams.get('filter') as ReportFilter) || 'all'
|
||||
|
||||
const jwt = profile.data?.jwt
|
||||
|
||||
@@ -60,6 +57,6 @@ export async function load({ url, fetch }) {
|
||||
return {
|
||||
type: type,
|
||||
page: page,
|
||||
items: everything,
|
||||
items: new ReactiveState(everything),
|
||||
}
|
||||
}
|
||||
@@ -1,22 +1,16 @@
|
||||
<script lang="ts">
|
||||
import CommentItem from '$lib/components/lemmy/comment/CommentItem.svelte'
|
||||
import Post from '$lib/components/lemmy/post/Post.svelte'
|
||||
import { Material, toast } from 'mono-svelte'
|
||||
import { getClient } from '$lib/lemmy.svelte.js'
|
||||
import { isCommentReport, isPostReport } from '$lib/lemmy/item.js'
|
||||
import type {
|
||||
CommentReportView,
|
||||
PostReportView,
|
||||
PrivateMessageReportView,
|
||||
} from 'lemmy-js-client'
|
||||
import { Check, CheckCircle, Icon } from 'svelte-hero-icons'
|
||||
import { notifications, profile } from '$lib/auth.svelte.js'
|
||||
import { Button } from 'mono-svelte'
|
||||
import type { ReportView } from '$lib/lemmy/report.js'
|
||||
import CommentItem from '$lib/components/lemmy/comment/CommentItem.svelte'
|
||||
import PrivateMessage from '$lib/components/lemmy/inbox/PrivateMessage.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
||||
import Post from '$lib/components/lemmy/post/Post.svelte'
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { getClient } from '$lib/lemmy.svelte.js'
|
||||
import { errorMessage } from '$lib/lemmy/error'
|
||||
import type { ReportView } from '$lib/lemmy/report.js'
|
||||
import { Button, Material, toast } from 'mono-svelte'
|
||||
import { CheckCircle, Icon } from 'svelte-hero-icons'
|
||||
|
||||
interface Props {
|
||||
item: ReportView
|
||||
@@ -91,7 +85,7 @@
|
||||
$notifications.reports += item.resolved ? 1 : -1
|
||||
} catch (err) {
|
||||
toast({
|
||||
content: err as any,
|
||||
content: errorMessage(err as string),
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
<script lang="ts">
|
||||
import { run } from 'svelte/legacy'
|
||||
|
||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||
import { searchParam } from '$lib/util.svelte.js'
|
||||
import { browser } from '$app/environment'
|
||||
import { page } from '$app/state'
|
||||
import ObjectAutocomplete from '$lib/components/lemmy/ObjectAutocomplete.svelte'
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import { isAdmin } from '$lib/components/lemmy/moderation/moderation.js'
|
||||
import ObjectAutocomplete from '$lib/components/lemmy/ObjectAutocomplete.svelte'
|
||||
import UserAutocomplete from '$lib/components/lemmy/user/UserAutocomplete.svelte'
|
||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import { settings } from '$lib/settings.svelte.js'
|
||||
import ModlogItemCard from './item/ModlogItemCard.svelte'
|
||||
import ModlogItemTable from './item/ModlogItemTable.svelte'
|
||||
import { searchParam } from '$lib/util.svelte.js'
|
||||
import { Button, Select } from 'mono-svelte'
|
||||
import Option from 'mono-svelte/forms/select/Option.svelte'
|
||||
import {
|
||||
Bars3BottomRight,
|
||||
Icon,
|
||||
@@ -17,11 +20,8 @@
|
||||
ViewColumns,
|
||||
XMark,
|
||||
} from 'svelte-hero-icons'
|
||||
import UserAutocomplete from '$lib/components/lemmy/user/UserAutocomplete.svelte'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import { isAdmin } from '$lib/components/lemmy/moderation/moderation.js'
|
||||
import { browser } from '$app/environment'
|
||||
import Option from 'mono-svelte/forms/select/Option.svelte'
|
||||
import ModlogItemCard from './item/ModlogItemCard.svelte'
|
||||
import ModlogItemTable from './item/ModlogItemTable.svelte'
|
||||
|
||||
let { data = $bindable() } = $props()
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
label="Instance"
|
||||
class="flex-1"
|
||||
q={page.url.searchParams.get('instance') || ''}
|
||||
onselect={(e) =>
|
||||
onselect={e =>
|
||||
searchParam(
|
||||
page.url,
|
||||
'instance',
|
||||
@@ -115,7 +115,7 @@
|
||||
label="Community"
|
||||
class="flex-1"
|
||||
q={page.url.searchParams.get('community') ? 'Selected' : ''}
|
||||
onselect={(e) =>
|
||||
onselect={e =>
|
||||
searchParam(page.url, 'community', e?.id.toString() ?? '', 'page')}
|
||||
/>
|
||||
<UserAutocomplete
|
||||
@@ -129,7 +129,7 @@
|
||||
q={page.url.searchParams.get('user')
|
||||
? (data.filters.user ?? 'Selected')
|
||||
: ''}
|
||||
onselect={(e) =>
|
||||
onselect={e =>
|
||||
searchParam(page.url, 'user', e?.id.toString() ?? '', 'page')}
|
||||
/>
|
||||
{#if profile.data?.user && isAdmin(profile.data?.user)}
|
||||
@@ -143,7 +143,7 @@
|
||||
q={page.url.searchParams.get('mod_id')
|
||||
? (data.filters.moderator ?? 'Selected')
|
||||
: ''}
|
||||
onselect={(e) =>
|
||||
onselect={e =>
|
||||
searchParam(page.url, 'mod_id', e?.id.toString() ?? '', 'page')}
|
||||
/>
|
||||
{/if}
|
||||
@@ -169,7 +169,7 @@
|
||||
{#if data.modlog && data.modlog.length > 0}
|
||||
{#if settings.modlogCardView ?? !window.matchMedia('(min-width: 1600px)').matches}
|
||||
<div class="flex flex-col gap-4">
|
||||
{#each data.modlog as modlog}
|
||||
{#each data.modlog as modlog (modlog)}
|
||||
<ModlogItemCard item={modlog} />
|
||||
{/each}
|
||||
</div>
|
||||
@@ -202,14 +202,14 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="text-sm">
|
||||
{#each data.modlog as modlog}
|
||||
{#each data.modlog as modlog (modlog)}
|
||||
<ModlogItemTable item={modlog} />
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{/if}
|
||||
<Pageination page={data.page} href={(page) => `?page=${page}`} />
|
||||
<Pageination page={data.page} href={page => `?page=${page}`} />
|
||||
{:else}
|
||||
<Placeholder
|
||||
title="No results"
|
||||
|
||||
@@ -17,10 +17,8 @@ import type {
|
||||
ModRemovePostView,
|
||||
ModTransferCommunityView,
|
||||
ModlogActionType,
|
||||
ModlogListParams,
|
||||
Person,
|
||||
} from 'lemmy-js-client'
|
||||
import { get } from 'svelte/store'
|
||||
|
||||
export type ActionName =
|
||||
| 'ban'
|
||||
@@ -209,12 +207,12 @@ export const _toModLog = (item: ModAction): ModLog => {
|
||||
}
|
||||
|
||||
export async function load({ url }) {
|
||||
let instance = url.searchParams.get('instance') || undefined
|
||||
let community = Number(url.searchParams.get('community')) || undefined
|
||||
let user = Number(url.searchParams.get('user')) || undefined
|
||||
let modId = Number(url.searchParams.get('mod_id')) || undefined
|
||||
const instance = url.searchParams.get('instance') || undefined
|
||||
const community = Number(url.searchParams.get('community')) || undefined
|
||||
const user = Number(url.searchParams.get('user')) || undefined
|
||||
const modId = Number(url.searchParams.get('mod_id')) || undefined
|
||||
const page = Number(url.searchParams.get('page')) || 1
|
||||
let type: ModlogActionType =
|
||||
const type: ModlogActionType =
|
||||
(url.searchParams.get('type') as ModlogActionType) || 'All'
|
||||
|
||||
const results = await getClient(instance).getModlog({
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
CheckCircle,
|
||||
Fire,
|
||||
Icon,
|
||||
InformationCircle,
|
||||
LockClosed,
|
||||
LockOpen,
|
||||
Megaphone,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<script lang="ts">
|
||||
import Link from '$lib/components/input/Link.svelte'
|
||||
import CommunityLink from '$lib/components/lemmy/community/CommunityLink.svelte'
|
||||
import ShieldIcon from '$lib/components/lemmy/moderation/ShieldIcon.svelte'
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
||||
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
import { getClient, validateInstance } from '$lib/lemmy.svelte.js'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { Button, TextInput, toast } from 'mono-svelte'
|
||||
import { errorMessage } from '$lib/lemmy/error'
|
||||
|
||||
interface Props {
|
||||
data: {
|
||||
@@ -45,7 +46,7 @@
|
||||
goto('/login')
|
||||
} catch (err) {
|
||||
toast({
|
||||
content: err as any,
|
||||
content: errorMessage(err as string),
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import { error, redirect } from '@sveltejs/kit'
|
||||
import { get } from 'svelte/store'
|
||||
|
||||
export function load({ params, url }) {
|
||||
if (Number(params.instance)) {
|
||||
|
||||
@@ -1,58 +1,35 @@
|
||||
<script lang="ts">
|
||||
import { buildCommentsTree } from '$lib/components/lemmy/comment/comments.svelte.js'
|
||||
import { isImage } from '$lib/ui/image.js'
|
||||
import { client, getClient } from '$lib/lemmy.svelte.js'
|
||||
import CommentForm from '$lib/components/lemmy/comment/CommentForm.svelte'
|
||||
import { onMount } from 'svelte'
|
||||
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
||||
import { page } from '$app/state'
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import { mediaType } from '$lib/components/lemmy/post/helpers.js'
|
||||
import PostMedia from '$lib/components/lemmy/post/media/PostMedia.svelte'
|
||||
import Post from '$lib/components/lemmy/post/Post.svelte'
|
||||
import PostActions from '$lib/components/lemmy/post/PostActions.svelte'
|
||||
import {
|
||||
ArrowLeft,
|
||||
ArrowPath,
|
||||
ChevronDoubleUp,
|
||||
Icon,
|
||||
InformationCircle,
|
||||
Home,
|
||||
PlusCircle,
|
||||
ChatBubbleLeftRight,
|
||||
Bookmark,
|
||||
BookmarkSlash,
|
||||
ArrowUp,
|
||||
ArrowDown,
|
||||
Fire,
|
||||
Trophy,
|
||||
Star,
|
||||
Clock,
|
||||
ArrowTrendingDown,
|
||||
ArrowRight,
|
||||
} from 'svelte-hero-icons'
|
||||
import PostMeta, {
|
||||
parseTags,
|
||||
} from '$lib/components/lemmy/post/PostMeta.svelte'
|
||||
import { Select, removeToast, toast } from 'mono-svelte'
|
||||
import type { CommentSortType, GetCommentsResponse } from 'lemmy-js-client'
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import { instance } from '$lib/instance.svelte.js'
|
||||
import { afterNavigate, goto } from '$app/navigation'
|
||||
import FormattedNumber from '$lib/components/util/FormattedNumber.svelte'
|
||||
import { Button } from 'mono-svelte'
|
||||
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
||||
import EndPlaceholder from '$lib/components/ui/EndPlaceholder.svelte'
|
||||
import { settings } from '$lib/settings.svelte.js'
|
||||
import { publishedToDate } from '$lib/components/util/date.js'
|
||||
import PostMedia from '$lib/components/lemmy/post/media/PostMedia.svelte'
|
||||
import { mediaType } from '$lib/components/lemmy/post/helpers.js'
|
||||
import Post from '$lib/components/lemmy/post/Post.svelte'
|
||||
import Expandable from '$lib/components/ui/Expandable.svelte'
|
||||
import { Popover } from 'mono-svelte'
|
||||
import { t } from '$lib/i18n/translations.js'
|
||||
import { resumables } from '$lib/lemmy/item.js'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import CommentListVirtualizer from '$lib/components/lemmy/comment/CommentListVirtualizer.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { fly } from 'svelte/transition'
|
||||
import { publishedToDate } from '$lib/components/util/date.js'
|
||||
import FormattedNumber from '$lib/components/util/FormattedNumber.svelte'
|
||||
import { t } from '$lib/i18n/translations.js'
|
||||
import { getClient } from '$lib/lemmy.svelte.js'
|
||||
import { resumables } from '$lib/lemmy/item.js'
|
||||
import { settings } from '$lib/settings.svelte.js'
|
||||
import { isImage } from '$lib/ui/image.js'
|
||||
import { Button, toast } from 'mono-svelte'
|
||||
import { onMount } from 'svelte'
|
||||
import {
|
||||
ArrowLeft,
|
||||
ArrowRight,
|
||||
ChatBubbleLeftRight,
|
||||
ChevronDoubleUp,
|
||||
Icon,
|
||||
} from 'svelte-hero-icons'
|
||||
import { expoOut } from 'svelte/easing'
|
||||
import Option from 'mono-svelte/forms/select/Option.svelte'
|
||||
import { fly } from 'svelte/transition'
|
||||
import CommentProvider from './CommentProvider.svelte'
|
||||
|
||||
let { data } = $props()
|
||||
@@ -65,8 +42,6 @@
|
||||
getClient().markPostAsRead({
|
||||
read: settings.markPostsAsRead,
|
||||
post_ids: [data.post.value.post_view.post.id],
|
||||
// @ts-ignore
|
||||
post_id: data.post.value.post_view.post.id,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -78,7 +53,6 @@
|
||||
})
|
||||
})
|
||||
|
||||
let commentsPage = 1
|
||||
let loading = $state(false)
|
||||
|
||||
async function reloadComments() {
|
||||
@@ -93,7 +67,6 @@
|
||||
})
|
||||
loading = false
|
||||
data.thread.value.singleThread = false
|
||||
commentsPage = 1
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -218,7 +191,7 @@
|
||||
class="divide-y! divide-slate-200 dark:divide-zinc-800 flex flex-col"
|
||||
>
|
||||
{#key crossposts}
|
||||
{#each crossposts as crosspost}
|
||||
{#each crossposts as crosspost (crosspost.post.id)}
|
||||
<Post view="compact" post={crosspost} />
|
||||
{/each}
|
||||
{/key}
|
||||
@@ -270,7 +243,8 @@
|
||||
{/if}
|
||||
{#await data.comments.value}
|
||||
<div class="flex flex-col gap-4">
|
||||
{#each new Array(10) as empty, index}
|
||||
{#each new Array(10) as _, index}
|
||||
{_}
|
||||
<div
|
||||
in:fly|global={{
|
||||
duration: 500,
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import CommunityCard from '$lib/components/lemmy/community/CommunityCard.svelte'
|
||||
import { client, getClient } from '$lib/lemmy.svelte.js'
|
||||
import { awaitIfServer } from '$lib/promise.svelte.js'
|
||||
import { SSR_ENABLED, settings } from '$lib/settings.svelte'
|
||||
import type { GetComments } from 'lemmy-js-client'
|
||||
import { ReactiveState } from '$lib/promise.svelte.js'
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import { redirect } from '@sveltejs/kit'
|
||||
import { resolveRoute } from '$app/paths'
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import CommunityCard from '$lib/components/lemmy/community/CommunityCard.svelte'
|
||||
import { client } from '$lib/lemmy.svelte.js'
|
||||
import { ReactiveState, awaitIfServer } from '$lib/promise.svelte.js'
|
||||
import { settings } from '$lib/settings.svelte'
|
||||
import { redirect } from '@sveltejs/kit'
|
||||
import type { GetComments } from 'lemmy-js-client'
|
||||
|
||||
function buildContext(thread?: string) {
|
||||
let parentId: number | undefined
|
||||
|
||||
@@ -6,14 +6,12 @@
|
||||
import Comments from '$lib/components/lemmy/comment/Comments.svelte'
|
||||
import { buildCommentsTree } from '$lib/components/lemmy/comment/comments.svelte'
|
||||
import EndPlaceholder from '$lib/components/ui/EndPlaceholder.svelte'
|
||||
import { instance } from '$lib/instance.svelte'
|
||||
import { settings } from '$lib/settings.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { instance } from '$lib/instance.svelte'
|
||||
import type {
|
||||
CommentSortType,
|
||||
GetCommentsResponse,
|
||||
GetPostResponse,
|
||||
PostView,
|
||||
} from 'lemmy-js-client'
|
||||
import { Button, Option, Select } from 'mono-svelte'
|
||||
import {
|
||||
@@ -87,14 +85,14 @@
|
||||
{:else}
|
||||
<CommentForm
|
||||
postId={post.post_view.post.id}
|
||||
oncomment={(comment) => {
|
||||
oncomment={comment => {
|
||||
comments.comments = [comment.comment_view, ...comments.comments]
|
||||
}}
|
||||
locked={(post.post_view.post.locked &&
|
||||
!(
|
||||
profile.data?.user?.local_user_view.local_user.admin ||
|
||||
profile.data?.user?.moderates
|
||||
.map((c) => c.community.id)
|
||||
.map(c => c.community.id)
|
||||
.includes(post.community_view.community.id)
|
||||
)) ||
|
||||
page.params.instance.toLowerCase() != instance.data.toLowerCase()}
|
||||
|
||||
@@ -49,7 +49,6 @@
|
||||
</Header>
|
||||
<p>
|
||||
{$t('routes.postRedirect.description', {
|
||||
// @ts-ignore
|
||||
homeInstance: fetched,
|
||||
})}
|
||||
</p>
|
||||
@@ -65,7 +64,6 @@
|
||||
onclick={fetchOnHome}
|
||||
>
|
||||
{$t('routes.postRedirect.actions.fetch', {
|
||||
// @ts-ignore
|
||||
homeInstance: fetched,
|
||||
})}
|
||||
</Button>
|
||||
@@ -76,12 +74,11 @@
|
||||
</div>
|
||||
{#if profileData.profiles}
|
||||
{@const filtered = profileData.profiles.filter(
|
||||
(i) => i.instance == page.params.instance,
|
||||
i => i.instance == page.params.instance,
|
||||
)}
|
||||
<div class="space-y-1">
|
||||
<div class="font-medium text-sm">
|
||||
{$t('routes.postRedirect.actions.switch', {
|
||||
// @ts-ignore
|
||||
destInstance: page.params.instance,
|
||||
})}
|
||||
</div>
|
||||
@@ -91,7 +88,7 @@
|
||||
rounding="2xl"
|
||||
class="dark:bg-zinc-950 max-h-96 overflow-auto"
|
||||
>
|
||||
{#each filtered as profile, index}
|
||||
{#each filtered as profile, index (profile.id)}
|
||||
<ProfileButton prof={profile} {index} />
|
||||
{/each}
|
||||
<SidebarButton
|
||||
|
||||
@@ -1,27 +1,22 @@
|
||||
<script lang="ts">
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import CommunityLink from '$lib/components/lemmy/community/CommunityLink.svelte'
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
import Entity from '$lib/components/ui/Entity.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
||||
import { t } from '$lib/i18n/translations.js'
|
||||
import { getClient } from '$lib/lemmy.svelte.js'
|
||||
import type {
|
||||
CommunityBlockView,
|
||||
InstanceBlockView,
|
||||
PersonBlockView,
|
||||
} from 'lemmy-js-client'
|
||||
import type { PageData } from './$types.js'
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
||||
import { getClient } from '$lib/lemmy.svelte.js'
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import { Check, Icon, Trash, XMark } from 'svelte-hero-icons'
|
||||
import CommunityLink from '$lib/components/lemmy/community/CommunityLink.svelte'
|
||||
import { flip } from 'svelte/animate'
|
||||
import { slide } from 'svelte/transition'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import { Button } from 'mono-svelte'
|
||||
import Entity from '$lib/components/ui/Entity.svelte'
|
||||
import { t } from '$lib/i18n/translations.js'
|
||||
import Switch from '$lib/components/input/Switch.svelte'
|
||||
import UserAutocomplete from '$lib/components/lemmy/user/UserAutocomplete.svelte'
|
||||
import { expoOut } from 'svelte/easing'
|
||||
import Material from 'mono-svelte/materials/Material.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { Check, Icon, XMark } from 'svelte-hero-icons'
|
||||
import type { PageData } from './$types.js'
|
||||
|
||||
interface Props {
|
||||
// sveltekit doesn't feel like making types work right now
|
||||
@@ -38,7 +33,7 @@
|
||||
if (!profile.data?.jwt) return
|
||||
|
||||
data.person_blocks.splice(
|
||||
data.person_blocks.findIndex((i) => i.target.id == item.target.id),
|
||||
data.person_blocks.findIndex(i => i.target.id == item.target.id),
|
||||
1,
|
||||
)
|
||||
// hack to get reactivity working
|
||||
@@ -54,9 +49,7 @@
|
||||
if (!profile.data?.jwt) return
|
||||
|
||||
data.community_blocks.splice(
|
||||
data.community_blocks.findIndex(
|
||||
(i) => i.community.id == item.community.id,
|
||||
),
|
||||
data.community_blocks.findIndex(i => i.community.id == item.community.id),
|
||||
1,
|
||||
)
|
||||
|
||||
@@ -75,7 +68,7 @@
|
||||
|
||||
data.my_user.instance_blocks.splice(
|
||||
data.my_user.instance_blocks.findIndex(
|
||||
(i) => i.instance.id == item.instance.id,
|
||||
i => i.instance.id == item.instance.id,
|
||||
),
|
||||
1,
|
||||
)
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
<script>
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { Button } from 'mono-svelte'
|
||||
|
||||
import SidebarButton from '$lib/components/ui/sidebar/SidebarButton.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { page } from '$app/state'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import SidebarButton from '$lib/components/ui/sidebar/SidebarButton.svelte'
|
||||
/**
|
||||
* @typedef {Object} Props
|
||||
* @property {import('svelte').Snippet} [children]
|
||||
@@ -38,11 +37,11 @@
|
||||
</script>
|
||||
|
||||
<Header pageHeader>
|
||||
{routes.find((r) => page.url.pathname == r.url)?.name}
|
||||
{routes.find(r => page.url.pathname == r.url)?.name}
|
||||
</Header>
|
||||
<div class="flex flex-row gap-12">
|
||||
<nav class="flex flex-col gap-2 flex-1 max-sm:hidden">
|
||||
{#each routes as route}
|
||||
{#each routes as route (route)}
|
||||
<SidebarButton
|
||||
size="lg"
|
||||
rounding="lg"
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation'
|
||||
import { page } from '$app/state'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { client } from '$lib/lemmy.svelte.js'
|
||||
import { t } from '$lib/i18n/translations.js'
|
||||
import { qr } from '@svelte-put/qr/svg'
|
||||
import { Button, Material, TextInput, toast } from 'mono-svelte'
|
||||
import { ClipboardDocument, Icon } from 'svelte-hero-icons'
|
||||
import { errorMessage } from '$lib/lemmy/error.js'
|
||||
|
||||
let { data } = $props()
|
||||
|
||||
// @ts-ignore
|
||||
let totpLink: string | undefined = $state(undefined)
|
||||
let totpLink = $state<string>()
|
||||
let totpEnabled = $state(
|
||||
data.my_user?.local_user_view.local_user.totp_2fa_enabled,
|
||||
)
|
||||
@@ -38,7 +37,7 @@
|
||||
totpEnabled = true
|
||||
}
|
||||
} catch (e) {
|
||||
toast({ content: e as any, type: 'error' })
|
||||
toast({ content: errorMessage(e as string), type: 'error' })
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -77,10 +76,7 @@
|
||||
</span>
|
||||
</TextInput>
|
||||
{/if}
|
||||
<form
|
||||
class="flex flex-col gap-2 w-full"
|
||||
onsubmit={(e) => e.preventDefault()}
|
||||
>
|
||||
<form class="flex flex-col gap-2 w-full" onsubmit={e => e.preventDefault()}>
|
||||
<TextInput
|
||||
bind:value={verify_totp}
|
||||
placeholder="012345"
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
import { deleteProfile, profile, setUser } from '$lib/auth.svelte'
|
||||
import { client } from '$lib/lemmy.svelte'
|
||||
import { instance as currentInstance } from '$lib/instance.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { Button, TextInput, toast } from 'mono-svelte'
|
||||
import { errorMessage } from '$lib/lemmy/error'
|
||||
@@ -25,7 +24,6 @@
|
||||
const { instance, username } = profile.data
|
||||
deleteProfile(profile.data.id)
|
||||
await setUser(res.jwt, instance, username!)
|
||||
$currentInstance = instance
|
||||
|
||||
toast({ content: $t('toast.loginRefresh'), type: 'success' })
|
||||
} else {
|
||||
@@ -35,7 +33,7 @@
|
||||
toast({ content: $t('toast.passwordReset') })
|
||||
} catch (e) {
|
||||
toast({
|
||||
content: errorMessage(e as any),
|
||||
content: errorMessage(e as string),
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
})
|
||||
|
||||
profileData.profiles.splice(
|
||||
profileData.profiles.findIndex((p) => profileData.profile == p.id),
|
||||
profileData.profiles.findIndex(p => profileData.profile == p.id),
|
||||
)
|
||||
|
||||
setUserID(-1)
|
||||
@@ -81,7 +81,7 @@
|
||||
goto('/')
|
||||
} catch (err) {
|
||||
toast({
|
||||
content: err as any,
|
||||
content: err as string,
|
||||
type: 'error',
|
||||
})
|
||||
} finally {
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
<script lang="ts">
|
||||
import { publishedToDate } from '$lib/components/util/date.js'
|
||||
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
|
||||
import { client } from '$lib/lemmy.svelte.js'
|
||||
import { Checkbox, Material } from 'mono-svelte'
|
||||
import { Icon, Key } from 'svelte-hero-icons'
|
||||
import { Material } from 'mono-svelte'
|
||||
|
||||
import { UAParser } from 'ua-parser-js'
|
||||
|
||||
let { data } = $props()
|
||||
|
||||
let checked: {
|
||||
[token: string]: boolean
|
||||
} = $state({})
|
||||
</script>
|
||||
|
||||
<Material
|
||||
@@ -37,7 +31,7 @@
|
||||
class="divide-y *:h-14 divide-slate-200 dark:divide-zinc-800 bg-white dark:bg-zinc-950
|
||||
"
|
||||
>
|
||||
{#each data.tokens as token}
|
||||
{#each data.tokens as token (token)}
|
||||
{@const ua = new UAParser(token.user_agent).getResult()}
|
||||
<tr class="divide-x *:px-3 divide-slate-200 dark:divide-zinc-800">
|
||||
<td>
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import { client } from '$lib/lemmy.svelte.js'
|
||||
|
||||
export async function load({ fetch, parent }) {
|
||||
const user = await parent()
|
||||
|
||||
export async function load({ fetch }) {
|
||||
const response = await client({ func: fetch }).listLogins()
|
||||
|
||||
return {
|
||||
|
||||
@@ -1,26 +1,27 @@
|
||||
<script lang="ts">
|
||||
import { preventDefault } from 'svelte/legacy'
|
||||
|
||||
import { profile, profileData, setUserID } from '$lib/auth.svelte.js'
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
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.js'
|
||||
import { getClient, site } from '$lib/lemmy.svelte.js'
|
||||
import { uploadImage } from '$lib/util.svelte.js'
|
||||
import type { SaveUserSettings } from 'lemmy-js-client'
|
||||
import {
|
||||
Badge,
|
||||
Button,
|
||||
ImageInput,
|
||||
Material,
|
||||
Menu,
|
||||
MenuButton,
|
||||
removeToast,
|
||||
Switch,
|
||||
TextInput,
|
||||
toast,
|
||||
} from 'mono-svelte'
|
||||
import { getClient, site } from '$lib/lemmy.svelte.js'
|
||||
import type { SaveUserSettings } from 'lemmy-js-client'
|
||||
import { Button, Switch, TextInput } from 'mono-svelte'
|
||||
import { uploadImage } from '$lib/util.svelte.js'
|
||||
import { t } from '$lib/i18n/translations.js'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
||||
import type { PageData } from './$types'
|
||||
import { Icon, Plus } from 'svelte-hero-icons'
|
||||
import type { PageData } from './$types'
|
||||
|
||||
interface Props {
|
||||
inline?: boolean
|
||||
@@ -61,7 +62,7 @@
|
||||
)
|
||||
: undefined
|
||||
|
||||
const res = await getClient().saveUserSettings({
|
||||
await getClient().saveUserSettings({
|
||||
...formData,
|
||||
avatar: pfp,
|
||||
banner: banner,
|
||||
@@ -73,7 +74,7 @@
|
||||
})
|
||||
} catch (err) {
|
||||
toast({
|
||||
content: err as any,
|
||||
content: err as string,
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
@@ -142,7 +143,7 @@
|
||||
</Badge>
|
||||
</button>
|
||||
{/snippet}
|
||||
{#each site.data.all_languages.filter(l => !formData.discussion_languages?.includes(l.id)) as language, index}
|
||||
{#each site.data.all_languages.filter(l => !formData.discussion_languages?.includes(l.id)) as language (language.id)}
|
||||
<MenuButton
|
||||
class="min-h-[16px] py-0"
|
||||
onclick={() => {
|
||||
@@ -153,7 +154,7 @@
|
||||
</MenuButton>
|
||||
{/each}
|
||||
</Menu>
|
||||
{#each formData.discussion_languages as languageId, index}
|
||||
{#each formData.discussion_languages as languageId, index (languageId)}
|
||||
{@const language = site.data.all_languages.find(
|
||||
l => l.id == languageId,
|
||||
)}
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
<script>
|
||||
import { goto } from '$app/navigation'
|
||||
import { page } from '$app/state'
|
||||
|
||||
import MultiSelect from '$lib/components/input/Switch.svelte'
|
||||
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
||||
import { site } from '$lib/lemmy.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { site } from '$lib/lemmy.svelte'
|
||||
import { feature } from '$lib/version'
|
||||
import { Button, Menu, MenuButton } from 'mono-svelte'
|
||||
import {
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
import { profile } from '$lib/auth.svelte'
|
||||
import { client, getClient } from '$lib/lemmy.svelte.js'
|
||||
import { getItemPublished } from '$lib/lemmy/item.js'
|
||||
import type { SortType } from 'lemmy-js-client'
|
||||
import { get } from 'svelte/store'
|
||||
import { client } from '$lib/lemmy.svelte.js'
|
||||
|
||||
// disable ssr, as the server cannot be authenticated
|
||||
export let ssr = false
|
||||
export const ssr = false
|
||||
|
||||
export async function load({ params, url, fetch }) {
|
||||
export async function load({ fetch }) {
|
||||
const my_user =
|
||||
// profile.data?.user ??
|
||||
(await client({ auth: profile.data?.jwt, func: fetch }).getSite()).my_user
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
<script lang="ts">
|
||||
import ItemList from '$lib/components/lemmy/generic/ItemList.svelte'
|
||||
import ShieldIcon from '$lib/components/lemmy/moderation/ShieldIcon.svelte'
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
import EntityHeader from '$lib/components/ui/EntityHeader.svelte'
|
||||
import Expandable from '$lib/components/ui/Expandable.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { publishedToDate } from '$lib/components/util/date.js'
|
||||
import { formatRelativeDate } from '$lib/components/util/RelativeDate.svelte'
|
||||
import { t } from '$lib/i18n/translations.js'
|
||||
import { communityLink } from '$lib/lemmy/generic.js'
|
||||
import { settings } from '$lib/settings.svelte.js'
|
||||
import { t } from '$lib/i18n/translations.js'
|
||||
let { data } = $props()
|
||||
|
||||
let my_user = $derived(data.my_user!.local_user_view)
|
||||
@@ -60,7 +59,7 @@
|
||||
<hr class="flex-1 w-full border-slate-200 dark:border-zinc-800 mx-3" />
|
||||
{/snippet}
|
||||
<ItemList
|
||||
items={data.moderates.map((m) => ({
|
||||
items={data.moderates.map(m => ({
|
||||
id: m.community.id,
|
||||
name: m.community.title,
|
||||
url: communityLink(m.community),
|
||||
|
||||
@@ -3,10 +3,9 @@
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { searchParam } from '$lib/util.svelte'
|
||||
import { flip } from 'svelte/animate'
|
||||
import { expoInOut } from 'svelte/easing'
|
||||
import PictrsImage from './PictrsImage.svelte'
|
||||
import { expoInOut, expoOut } from 'svelte/easing'
|
||||
|
||||
let { data = $bindable() } = $props()
|
||||
</script>
|
||||
@@ -20,7 +19,7 @@
|
||||
ondelete={() => {
|
||||
data.images = data.images.toSpliced(
|
||||
data.images.findIndex(
|
||||
(i) =>
|
||||
i =>
|
||||
i.local_image.pictrs_delete_token ==
|
||||
image.local_image.pictrs_delete_token,
|
||||
),
|
||||
@@ -34,7 +33,7 @@
|
||||
{#if data.images.length == 20}
|
||||
<Pageination
|
||||
page={Number(page.url.searchParams.get('page')) || 1}
|
||||
href={(page) => `?page=${page}`}
|
||||
href={page => `?page=${page}`}
|
||||
/>
|
||||
{/if}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import { client } from '$lib/lemmy.svelte.js'
|
||||
export async function load({ fetch, url }) {
|
||||
const { jwt } = profile.data
|
||||
|
||||
let page = Number(url.searchParams.get('page')) || 1
|
||||
const page = Number(url.searchParams.get('page')) || 1
|
||||
|
||||
const res = await client({ func: fetch, auth: jwt }).listMedia({
|
||||
limit: 20,
|
||||
|
||||
@@ -2,14 +2,13 @@
|
||||
import { profile } from '$lib/auth.svelte'
|
||||
import { publishedToDate } from '$lib/components/util/date'
|
||||
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { instance } from '$lib/instance.svelte'
|
||||
import { client } from '$lib/lemmy.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { instanceToURL } from '$lib/util.svelte'
|
||||
import type { LocalImage } from 'lemmy-js-client'
|
||||
import { Button, Material, toast } from 'mono-svelte'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import { ArrowDown, ArrowDownTray, Icon, Trash } from 'svelte-hero-icons'
|
||||
import { Button, toast } from 'mono-svelte'
|
||||
import { ArrowDownTray, Icon, Trash } from 'svelte-hero-icons'
|
||||
|
||||
let loading = $state(false)
|
||||
|
||||
@@ -25,7 +24,7 @@
|
||||
|
||||
ondelete?.(res)
|
||||
} catch (e) {
|
||||
toast({ content: e as any, type: 'error' })
|
||||
toast({ content: e as string, type: 'error' })
|
||||
}
|
||||
loading = false
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { client } from '$lib/lemmy.svelte.js'
|
||||
import { postFeed } from '$lib/lemmy/postfeed.svelte.js'
|
||||
import { error } from '@sveltejs/kit'
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { redirect } from '@sveltejs/kit'
|
||||
|
||||
export function load({}) {
|
||||
export function load() {
|
||||
redirect(302, '/admin/applications')
|
||||
}
|
||||
@@ -1,28 +1,25 @@
|
||||
<script lang="ts">
|
||||
import { run } from 'svelte/legacy'
|
||||
|
||||
import type { CommentView, PostView } from 'lemmy-js-client'
|
||||
import Post from '$lib/components/lemmy/post/Post.svelte'
|
||||
import { fly } from 'svelte/transition'
|
||||
import CommentItem from '$lib/components/lemmy/comment/CommentItem.svelte'
|
||||
import { settings } from '$lib/settings.svelte.js'
|
||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||
import { searchParam } from '$lib/util.svelte.js'
|
||||
import { page } from '$app/state'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import { Bookmark } from 'svelte-hero-icons'
|
||||
import { t } from '$lib/i18n/translations.js'
|
||||
import CommentItem from '$lib/components/lemmy/comment/CommentItem.svelte'
|
||||
import Post from '$lib/components/lemmy/post/Post.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import { t } from '$lib/i18n/translations.js'
|
||||
import { searchParam } from '$lib/util.svelte.js'
|
||||
import type { CommentView, PostView } from 'lemmy-js-client'
|
||||
import { Select } from 'mono-svelte'
|
||||
import {
|
||||
Icon,
|
||||
Bars3,
|
||||
PencilSquare,
|
||||
ChatBubbleOvalLeft,
|
||||
AdjustmentsHorizontal,
|
||||
} from 'svelte-hero-icons'
|
||||
import Option from 'mono-svelte/forms/select/Option.svelte'
|
||||
import {
|
||||
AdjustmentsHorizontal,
|
||||
Bars3,
|
||||
Bookmark,
|
||||
ChatBubbleOvalLeft,
|
||||
Icon,
|
||||
PencilSquare,
|
||||
} from 'svelte-hero-icons'
|
||||
import { fly } from 'svelte/transition'
|
||||
|
||||
let { data } = $props()
|
||||
|
||||
@@ -74,7 +71,7 @@
|
||||
description="Save posts or comments, and they'll be here to refer to them later."
|
||||
/>
|
||||
{:else}
|
||||
{#each data.data as item, index}
|
||||
{#each data.data as item, index (item)}
|
||||
<div in:fly={{ opacity: 0, y: -4, delay: index * 50 }}>
|
||||
{#if isComment(item)}
|
||||
<CommentItem comment={item} />
|
||||
@@ -87,6 +84,6 @@
|
||||
</div>
|
||||
<div class="sticky z-30 mx-auto max-w-full bottom-22 lg:bottom-6">
|
||||
<Tabs routes={[]} class="mx-auto">
|
||||
<Pageination href={(page) => `?page=${page}`} page={data.page} />
|
||||
<Pageination href={page => `?page=${page}`} page={data.page} />
|
||||
</Tabs>
|
||||
</div>
|
||||
@@ -1,48 +1,35 @@
|
||||
<script lang="ts">
|
||||
import { preventDefault } from 'svelte/legacy'
|
||||
|
||||
import { navigating, page } from '$app/state'
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import ObjectAutocomplete from '$lib/components/lemmy/ObjectAutocomplete.svelte'
|
||||
import Sort from '$lib/components/lemmy/dropdowns/Sort.svelte'
|
||||
import CommentItem from '$lib/components/lemmy/comment/CommentItem.svelte'
|
||||
import CommunityItem from '$lib/components/lemmy/community/CommunityItem.svelte'
|
||||
import Sort from '$lib/components/lemmy/dropdowns/Sort.svelte'
|
||||
import Post from '$lib/components/lemmy/post/Post.svelte'
|
||||
import UserItem from '$lib/components/lemmy/user/UserItem.svelte'
|
||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import Skeleton from '$lib/components/ui/generic/Skeleton.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
||||
import { t } from '$lib/i18n/translations.js'
|
||||
import {
|
||||
isCommentView,
|
||||
isCommunityView,
|
||||
isPostView,
|
||||
isUser,
|
||||
} from '$lib/lemmy/item.js'
|
||||
import { settings } from '$lib/settings.svelte.js'
|
||||
import { searchParam } from '$lib/util.svelte.js'
|
||||
import type {
|
||||
CommentView,
|
||||
CommunityView,
|
||||
PersonView,
|
||||
PostView,
|
||||
} from 'lemmy-js-client'
|
||||
import { Button, Disclosure, Select, Spinner, TextInput } from 'mono-svelte'
|
||||
import { Button, Select, Spinner, TextInput } from 'mono-svelte'
|
||||
import Option from 'mono-svelte/forms/select/Option.svelte'
|
||||
import {
|
||||
AdjustmentsHorizontal,
|
||||
Bars3BottomRight,
|
||||
ChevronDown,
|
||||
Icon,
|
||||
MagnifyingGlass,
|
||||
} from 'svelte-hero-icons'
|
||||
import { expoOut } from 'svelte/easing'
|
||||
import { fly, slide } from 'svelte/transition'
|
||||
import { t } from '$lib/i18n/translations.js'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
||||
import { goto, invalidate } from '$app/navigation'
|
||||
import Option from 'mono-svelte/forms/select/Option.svelte'
|
||||
import Skeleton from '$lib/components/ui/generic/Skeleton.svelte'
|
||||
|
||||
type Result = PostView | CommentView | PersonView | CommunityView
|
||||
|
||||
let { data } = $props()
|
||||
|
||||
@@ -55,7 +42,7 @@
|
||||
</script>
|
||||
|
||||
<svelte:window
|
||||
onkeydown={(e) => {
|
||||
onkeydown={e => {
|
||||
if (e.target == document.body) searchElement?.focus()
|
||||
}}
|
||||
/>
|
||||
@@ -133,9 +120,9 @@
|
||||
<ObjectAutocomplete
|
||||
label={$t('nav.create.community')}
|
||||
jwt={profile.data?.jwt}
|
||||
listing_type={'All'}
|
||||
listing_type="All"
|
||||
showWhenEmpty={true}
|
||||
onselect={(c) =>
|
||||
onselect={c =>
|
||||
searchParam(page.url, 'community', c?.id || undefined, 'page')}
|
||||
/>
|
||||
</div>
|
||||
@@ -144,6 +131,7 @@
|
||||
{#if navigating.to?.route.id == '/search'}
|
||||
<div class="flex flex-col gap-3 mt-6">
|
||||
{#each new Array(5) as _, index}
|
||||
{_}
|
||||
<div
|
||||
in:fly|global={{
|
||||
duration: 800,
|
||||
@@ -207,7 +195,7 @@
|
||||
class="flex flex-col mt-4 divide-slate-200 dark:divide-zinc-800 divide-y!"
|
||||
>
|
||||
{#key data.results.value}
|
||||
{#each data.results.value as result}
|
||||
{#each data.results.value as result (result)}
|
||||
{#if isPostView(result)}
|
||||
<Post post={result} />
|
||||
{:else if isCommentView(result)}
|
||||
@@ -230,6 +218,6 @@
|
||||
</div>
|
||||
<div class="mt-4"></div>
|
||||
{#if data.results.value.length > 0}
|
||||
<Pageination bind:page={pageNum} href={(page) => `?page=${page}`} />
|
||||
<Pageination bind:page={pageNum} href={page => `?page=${page}`} />
|
||||
{/if}
|
||||
{/if}
|
||||
@@ -1,18 +1,8 @@
|
||||
import { profile } from '$lib/auth.svelte'
|
||||
import { client, getClient } from '$lib/lemmy.svelte.js'
|
||||
import { getItemPublished, isPostView } from '$lib/lemmy/item.js'
|
||||
import { getItemPublished } from '$lib/lemmy/item.js'
|
||||
import { ReactiveState } from '$lib/promise.svelte.js'
|
||||
import type {
|
||||
CommentView,
|
||||
CommunityView,
|
||||
ListingType,
|
||||
PersonView,
|
||||
PostView,
|
||||
SearchResponse,
|
||||
SearchType,
|
||||
SortType,
|
||||
} from 'lemmy-js-client'
|
||||
import { get } from 'svelte/store'
|
||||
import type { ListingType, SearchType, SortType } from 'lemmy-js-client'
|
||||
|
||||
export async function load({ url, fetch }) {
|
||||
const query = url.searchParams.get('q')
|
||||
|
||||
@@ -1,60 +1,52 @@
|
||||
<script lang="ts">
|
||||
import { defaultSettings, settings } from '$lib/settings.svelte'
|
||||
import Setting from './Setting.svelte'
|
||||
import { env } from '$env/dynamic/public'
|
||||
import { profile } from '$lib/auth.svelte'
|
||||
import Link from '$lib/components/input/Link.svelte'
|
||||
import MultiSelect from '$lib/components/input/Switch.svelte'
|
||||
import Sort from '$lib/components/lemmy/dropdowns/Sort.svelte'
|
||||
import ViewSelect from '$lib/components/lemmy/dropdowns/ViewSelect.svelte'
|
||||
import { removalTemplate } from '$lib/components/lemmy/moderation/moderation.js'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { locale, locales, t } from '$lib/i18n/translations'
|
||||
import { defaultSettings, settings } from '$lib/settings.svelte'
|
||||
import { DOMAIN_REGEX_FORMS } from '$lib/util.svelte.js'
|
||||
import {
|
||||
Badge,
|
||||
Disclosure,
|
||||
Button,
|
||||
Checkbox,
|
||||
Material,
|
||||
Note,
|
||||
Modal,
|
||||
Select,
|
||||
Switch,
|
||||
TextArea,
|
||||
TextInput,
|
||||
toast,
|
||||
Popover,
|
||||
Modal,
|
||||
TextArea,
|
||||
} from 'mono-svelte'
|
||||
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
||||
import Link from '$lib/components/input/Link.svelte'
|
||||
import Option from 'mono-svelte/forms/select/Option.svelte'
|
||||
import {
|
||||
ArrowDownTray,
|
||||
ArrowPath,
|
||||
ArrowRight,
|
||||
ArrowUpOnSquare,
|
||||
ArrowTopRightOnSquare,
|
||||
ArrowTrendingDown,
|
||||
ArrowUpTray,
|
||||
ChatBubbleOvalLeftEllipsis,
|
||||
CheckCircle,
|
||||
ChevronDown,
|
||||
ChevronRight,
|
||||
Clock,
|
||||
Fire,
|
||||
GlobeAmericas,
|
||||
Heart,
|
||||
Icon,
|
||||
Language,
|
||||
Plus,
|
||||
Trash,
|
||||
ArrowTopRightOnSquare,
|
||||
Fire,
|
||||
Trophy,
|
||||
Star,
|
||||
Clock,
|
||||
ArrowTrendingDown,
|
||||
Heart,
|
||||
Trash,
|
||||
Trophy,
|
||||
} from 'svelte-hero-icons'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
import { removalTemplate } from '$lib/components/lemmy/moderation/moderation.js'
|
||||
import { Button, Checkbox, Select, Spinner } from 'mono-svelte'
|
||||
import ViewSelect from '$lib/components/lemmy/dropdowns/ViewSelect.svelte'
|
||||
import { LINKED_INSTANCE_URL } from '$lib/instance.svelte.js'
|
||||
import { DOMAIN_REGEX_FORMS, removeItem } from '$lib/util.svelte.js'
|
||||
import Section from './Section.svelte'
|
||||
import Setting from './Setting.svelte'
|
||||
import ToggleSetting from './ToggleSetting.svelte'
|
||||
import { locale, locales, t } from '$lib/i18n/translations'
|
||||
import { getDefaultLinks, iconOfLink } from '$lib/components/ui/navbar/link'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { profile } from '$lib/auth.svelte'
|
||||
import AccountPage from '../profile/(local_user)/settings/+page.svelte'
|
||||
import Option from 'mono-svelte/forms/select/Option.svelte'
|
||||
import { env } from '$env/dynamic/public'
|
||||
let importing = $state(false)
|
||||
let importText = $state('')
|
||||
|
||||
@@ -107,8 +99,7 @@
|
||||
toast({ content: $t('toast.settingsImport'), type: 'success' })
|
||||
importing = false
|
||||
} catch (err) {
|
||||
// @ts-ignore
|
||||
toast({ content: err, type: 'error' })
|
||||
toast({ content: err as string, type: 'error' })
|
||||
}
|
||||
}}
|
||||
title={$t('routes.theme.import')}
|
||||
@@ -263,7 +254,7 @@
|
||||
<Option icon={Language} value={null}>
|
||||
{$t('settings.app.lang.auto')}
|
||||
</Option>
|
||||
{#each $locales as locale}
|
||||
{#each $locales as locale (locale)}
|
||||
{@const mapped = localeMap.get(locale) ?? {
|
||||
flag: '',
|
||||
translated: 1,
|
||||
@@ -457,7 +448,7 @@
|
||||
<div
|
||||
class="flex flex-col divide-y *:py-2 items-end divide-slate-200 dark:divide-zinc-800"
|
||||
>
|
||||
{#each Object.keys(settings.tagRules) as rule}
|
||||
{#each Object.keys(settings.tagRules) as rule (rule)}
|
||||
<div class="flex flex-row flex-wrap items-center gap-2">
|
||||
<span class="text-lg font-medium">{rule}</span>
|
||||
<MultiSelect
|
||||
@@ -634,7 +625,7 @@
|
||||
</ul>
|
||||
</span>
|
||||
{/snippet}
|
||||
{#each settings.moderation.presets as preset, index}
|
||||
{#each settings.moderation.presets as preset, index (preset)}
|
||||
<Material
|
||||
color="transparent"
|
||||
rounding="xl"
|
||||
@@ -670,7 +661,7 @@
|
||||
label="Content"
|
||||
images={false}
|
||||
previewButton
|
||||
beforePreview={(input) =>
|
||||
beforePreview={input =>
|
||||
removalTemplate(input, {
|
||||
postTitle: '<Example post>',
|
||||
communityLink: '[!community@example.com]()',
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<script lang="ts">
|
||||
import Expandable from '$lib/components/ui/Expandable.svelte'
|
||||
import { ChevronDown, Icon, Minus, Plus } from 'svelte-hero-icons'
|
||||
import { backOut, expoOut } from 'svelte/easing'
|
||||
import { Icon, Minus, Plus } from 'svelte-hero-icons'
|
||||
import { expoOut } from 'svelte/easing'
|
||||
import { slide } from 'svelte/transition'
|
||||
|
||||
interface Props {
|
||||
|
||||
@@ -9,7 +9,11 @@
|
||||
} from 'svelte-hero-icons'
|
||||
|
||||
interface Props {
|
||||
supportedPlatforms?: any
|
||||
supportedPlatforms?: {
|
||||
desktop: boolean
|
||||
tablet: boolean
|
||||
mobile: boolean
|
||||
}
|
||||
mainClass?: string
|
||||
itemsClass?: string
|
||||
optionClass?: string
|
||||
@@ -38,7 +42,7 @@
|
||||
<div
|
||||
class="flex flex-col w-full justify-between gap-2 max-w-full @container/setting {mainClass}"
|
||||
>
|
||||
{#if Object.values(supportedPlatforms).some((v) => v == false)}
|
||||
{#if Object.values(supportedPlatforms).some(v => v == false)}
|
||||
<div class="flex items-center gap-2 flex-wrap">
|
||||
{#if supportedPlatforms.desktop}
|
||||
<Badge>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { Badge, Switch } from 'mono-svelte'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import {
|
||||
ComputerDesktop,
|
||||
DevicePhoneMobile,
|
||||
@@ -14,7 +13,11 @@
|
||||
description?: string | undefined
|
||||
checked?: boolean
|
||||
beta?: boolean
|
||||
supportedPlatforms?: any
|
||||
supportedPlatforms?: {
|
||||
desktop: boolean
|
||||
tablet: boolean
|
||||
mobile: boolean
|
||||
}
|
||||
}
|
||||
|
||||
let {
|
||||
@@ -31,12 +34,12 @@
|
||||
</script>
|
||||
|
||||
<div class="flex flex-col w-full justify-between gap-2 max-w-full">
|
||||
{#if Object.values(supportedPlatforms).some((v) => v == false) || beta}
|
||||
{#if Object.values(supportedPlatforms).some(v => v == false) || beta}
|
||||
<div class="flex items-center gap-2 flex-wrap">
|
||||
{#if beta}
|
||||
<Badge>Beta</Badge>
|
||||
{/if}
|
||||
{#if Object.values(supportedPlatforms).some((v) => v == false)}
|
||||
{#if Object.values(supportedPlatforms).some(v => v == false)}
|
||||
{#if supportedPlatforms.desktop}
|
||||
<Badge>
|
||||
{#snippet icon()}
|
||||
|
||||
@@ -17,14 +17,13 @@
|
||||
import { preventDefault } from 'svelte/legacy'
|
||||
|
||||
import { goto } from '$app/navigation'
|
||||
import { Badge, Material, Spinner, toast } from 'mono-svelte'
|
||||
import { DEFAULT_INSTANCE_URL, instance } from '$lib/instance.svelte.js'
|
||||
import { validateInstance } from '$lib/lemmy.svelte.js'
|
||||
import { Button, TextInput } from 'mono-svelte'
|
||||
import { onMount } from 'svelte'
|
||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { DEFAULT_INSTANCE_URL } from '$lib/instance.svelte.js'
|
||||
import { validateInstance } from '$lib/lemmy.svelte.js'
|
||||
import { Button, Material, Spinner, TextInput, toast } from 'mono-svelte'
|
||||
import { onMount } from 'svelte'
|
||||
|
||||
let selectedInstance: string = $state('')
|
||||
let validating: boolean = $state(false)
|
||||
@@ -36,7 +35,7 @@
|
||||
try {
|
||||
const res: Instance[] = (
|
||||
await fetch(`https://data.lemmyverse.net/data/instance.full.json`).then(
|
||||
(r) => r.json(),
|
||||
r => r.json(),
|
||||
)
|
||||
)
|
||||
.filter((i: Instance) => i.fed)
|
||||
@@ -52,7 +51,7 @@
|
||||
placeholder = instances?.[placeholderIndex].baseurl
|
||||
placeholderIndex++
|
||||
}, 2000)
|
||||
} catch (e) {
|
||||
} catch {
|
||||
toast({
|
||||
content: $t('toast.failFetchInstances'),
|
||||
type: 'error',
|
||||
@@ -76,7 +75,7 @@
|
||||
class="flex flex-col h-full divide-y divide-slate-200 dark:divide-zinc-800"
|
||||
>
|
||||
{#if instances}
|
||||
{#each instances as instance}
|
||||
{#each instances as instance (instance)}
|
||||
<button
|
||||
onclick={() => (selectedInstance = instance.baseurl ?? '')}
|
||||
class="flex flex-row gap-2 text-left py-2 first:pt-0 last:pb-0 items-center
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { run, preventDefault } from 'svelte/legacy'
|
||||
import { preventDefault } from 'svelte/legacy'
|
||||
|
||||
import { goto } from '$app/navigation'
|
||||
import { page } from '$app/state'
|
||||
@@ -21,7 +21,6 @@
|
||||
QuestionMarkCircle,
|
||||
XCircle,
|
||||
} from 'svelte-hero-icons'
|
||||
import { instance as currentInstance } from '$lib/instance.svelte.js'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { t } from '$lib/i18n/translations.js'
|
||||
|
||||
@@ -104,7 +103,7 @@
|
||||
})
|
||||
} catch (err) {
|
||||
toast({
|
||||
content: err as any,
|
||||
content: err as string,
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
<script lang="ts">
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { theme as themeData } from '$lib/ui/colors.svelte'
|
||||
import { getDefaultColors } from '$lib/ui/presets'
|
||||
import {
|
||||
Button,
|
||||
Material,
|
||||
@@ -13,16 +17,10 @@
|
||||
ArrowDownTray,
|
||||
ArrowPath,
|
||||
ArrowUpTray,
|
||||
Bookmark,
|
||||
CheckCircle,
|
||||
Icon,
|
||||
Plus,
|
||||
} from 'svelte-hero-icons'
|
||||
import ColorSwatch from './ColorSwatch.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { theme as themeData } from '$lib/ui/colors.svelte'
|
||||
import { getDefaultColors } from '$lib/ui/presets'
|
||||
import ThemePreset from './ThemePreset.svelte'
|
||||
|
||||
let importing = $state(false)
|
||||
@@ -43,8 +41,7 @@
|
||||
toast({ content: $t('message.success'), type: 'success' })
|
||||
importing = false
|
||||
} catch (err) {
|
||||
// @ts-ignore
|
||||
toast({ content: err, type: 'error' })
|
||||
toast({ content: err as string, type: 'error' })
|
||||
}
|
||||
}}
|
||||
title={$t('routes.theme.import')}
|
||||
@@ -70,13 +67,13 @@
|
||||
class="grid grid-cols-1 @md:grid-cols-2 @xl:grid-cols-3 @3xl:grid-cols-4
|
||||
gap-2"
|
||||
>
|
||||
{#each themeData.data.themes as theme, index}
|
||||
{#each themeData.data.themes as theme, index (theme.id)}
|
||||
<ThemePreset bind:theme={themeData.data.themes[index]} />
|
||||
{/each}
|
||||
<button
|
||||
onclick={() => {
|
||||
const newTheme = {
|
||||
id: Math.max(...themeData.data.themes.map((t) => t.id)) + 1,
|
||||
id: Math.max(...themeData.data.themes.map(t => t.id)) + 1,
|
||||
colors: getDefaultColors(),
|
||||
name: $t('routes.theme.preset.new'),
|
||||
}
|
||||
@@ -170,14 +167,12 @@
|
||||
<h1 class="text-2xl font-bold col-span-2">{$t('routes.theme.accent')}</h1>
|
||||
<ColorSwatch
|
||||
value={themeData.current.colors.primary?.[900]}
|
||||
onchange={(e) => {
|
||||
onchange={e => {
|
||||
themeData.current.colors.primary[900] = e
|
||||
}}
|
||||
oncontextmenu={(e) => {
|
||||
oncontextmenu={e => {
|
||||
e.preventDefault()
|
||||
themeData.current.colors.primary[900] =
|
||||
// @ts-ignore
|
||||
defaultColors.primary[900]
|
||||
themeData.current.colors.primary[900] = defaultColors.primary[900]
|
||||
|
||||
return true
|
||||
}}
|
||||
@@ -185,14 +180,12 @@
|
||||
/>
|
||||
<ColorSwatch
|
||||
value={themeData.current.colors.primary?.[100]}
|
||||
onchange={(e) => {
|
||||
onchange={e => {
|
||||
themeData.current.colors.primary[100] = e
|
||||
}}
|
||||
oncontextmenu={(e) => {
|
||||
oncontextmenu={e => {
|
||||
e.preventDefault()
|
||||
themeData.current.colors.primary[100] =
|
||||
// @ts-ignore
|
||||
defaultColors.primary[100]
|
||||
themeData.current.colors.primary[100] = defaultColors.primary[100]
|
||||
|
||||
return true
|
||||
}}
|
||||
@@ -206,22 +199,21 @@
|
||||
</span>
|
||||
</Material>
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-2">
|
||||
{#each Object.entries(defaultColors) as [category, value]}
|
||||
{#each Object.entries(defaultColors) as [category, value] (category)}
|
||||
<Material color="transparent" class="flex flex-col gap-2">
|
||||
<h1 class="capitalize font-semibold text-lg">{category}</h1>
|
||||
<div class="flex flex-row gap-1 flex-wrap items-center space-evenly">
|
||||
{#each Object.entries(value) as [shade, color]}
|
||||
{#each Object.entries(value) as [shade] (shade)}
|
||||
<div class="flex flex-col gap-0.5 w-10 group">
|
||||
<!--@ts-ignore-->
|
||||
<ColorSwatch
|
||||
bind:value={themeData.current.colors[category][shade]}
|
||||
onchange={(e) => {
|
||||
onchange={e => {
|
||||
themeData.current.colors[category][shade] = e
|
||||
}}
|
||||
oncontextmenu={(e) => {
|
||||
oncontextmenu={e => {
|
||||
e.preventDefault()
|
||||
themeData.current.colors[category][shade] =
|
||||
// @ts-ignore
|
||||
defaultColors[category][shade]
|
||||
|
||||
return true
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
interface Props {
|
||||
value: string
|
||||
class?: string
|
||||
oncontextmenu?: (e: MouseEvent) => any
|
||||
onchange?: (value: string) => any
|
||||
oncontextmenu?: (e: MouseEvent) => void
|
||||
onchange?: (value: string) => void
|
||||
}
|
||||
|
||||
let {
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { preventDefault } from 'svelte/legacy'
|
||||
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import {
|
||||
calculateVars,
|
||||
theme as themeData,
|
||||
type Theme,
|
||||
} from '$lib/ui/colors.svelte'
|
||||
import { theme as themeData, type Theme } from '$lib/ui/colors.svelte'
|
||||
import { action, Button, Material, modal, TextInput } from 'mono-svelte'
|
||||
import { CheckCircle, Icon, Trash } from 'svelte-hero-icons'
|
||||
|
||||
@@ -53,7 +47,12 @@
|
||||
{/if}
|
||||
<div class="px-4 py-2 flex items-center gap-1 justify-between">
|
||||
{#if editingName}
|
||||
<form onsubmit={preventDefault(() => (editingName = false))}>
|
||||
<form
|
||||
onsubmit={e => {
|
||||
e.preventDefault()
|
||||
editingName = false
|
||||
}}
|
||||
>
|
||||
<TextInput bind:value={theme.name}></TextInput>
|
||||
</form>
|
||||
{:else}
|
||||
@@ -85,7 +84,7 @@
|
||||
type: 'danger',
|
||||
action: () => {
|
||||
const index = themeData.data.themes
|
||||
.map((t) => t.id)
|
||||
.map(t => t.id)
|
||||
.indexOf(theme.id)
|
||||
|
||||
themeData.data.themes = themeData.data.themes.toSpliced(
|
||||
|
||||
@@ -1,5 +1,35 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation'
|
||||
import { page } from '$app/state'
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import CommentItem from '$lib/components/lemmy/comment/CommentItem.svelte'
|
||||
import ItemList from '$lib/components/lemmy/generic/ItemList.svelte'
|
||||
import { ban, isAdmin } from '$lib/components/lemmy/moderation/moderation.js'
|
||||
import ShieldIcon from '$lib/components/lemmy/moderation/ShieldIcon.svelte'
|
||||
import Post from '$lib/components/lemmy/post/Post.svelte'
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
import EntityHeader from '$lib/components/ui/EntityHeader.svelte'
|
||||
import Expandable from '$lib/components/ui/Expandable.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import { publishedToDate } from '$lib/components/util/date.js'
|
||||
import { formatRelativeDate } from '$lib/components/util/RelativeDate.svelte'
|
||||
import { t } from '$lib/i18n/translations.js'
|
||||
import { client, getClient } from '$lib/lemmy.svelte.js'
|
||||
import { communityLink } from '$lib/lemmy/generic.js'
|
||||
import { isCommentView } from '$lib/lemmy/item.js'
|
||||
import { isBlocked } from '$lib/lemmy/user.js'
|
||||
import {
|
||||
Button,
|
||||
Menu,
|
||||
MenuButton,
|
||||
Modal,
|
||||
Option,
|
||||
removeToast,
|
||||
Select,
|
||||
toast,
|
||||
} from 'mono-svelte'
|
||||
import {
|
||||
AdjustmentsHorizontal,
|
||||
AtSymbol,
|
||||
@@ -10,33 +40,9 @@
|
||||
Icon,
|
||||
NoSymbol,
|
||||
PencilSquare,
|
||||
ShieldCheck,
|
||||
ShieldExclamation,
|
||||
} from 'svelte-hero-icons'
|
||||
import CommentItem from '$lib/components/lemmy/comment/CommentItem.svelte'
|
||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||
import { page } from '$app/state'
|
||||
import { goto } from '$app/navigation'
|
||||
import { isCommentView } from '$lib/lemmy/item.js'
|
||||
import { client, getClient } from '$lib/lemmy.svelte.js'
|
||||
import { isBlocked } from '$lib/lemmy/user.js'
|
||||
import { Menu, MenuButton, removeToast, toast } from 'mono-svelte'
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import { ban, isAdmin } from '$lib/components/lemmy/moderation/moderation.js'
|
||||
import ShieldIcon from '$lib/components/lemmy/moderation/ShieldIcon.svelte'
|
||||
import { searchParam } from '$lib/util.svelte.js'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import { Button, Modal, Select, Option } from 'mono-svelte'
|
||||
import Expandable from '$lib/components/ui/Expandable.svelte'
|
||||
import { communityLink } from '$lib/lemmy/generic.js'
|
||||
import ItemList from '$lib/components/lemmy/generic/ItemList.svelte'
|
||||
import { t } from '$lib/i18n/translations.js'
|
||||
import EntityHeader from '$lib/components/ui/EntityHeader.svelte'
|
||||
import { publishedToDate } from '$lib/components/util/date.js'
|
||||
import { formatRelativeDate } from '$lib/components/util/RelativeDate.svelte'
|
||||
import type { PageData } from './$types'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
|
||||
interface Props {
|
||||
data: PageData
|
||||
@@ -45,14 +51,12 @@
|
||||
|
||||
let { data, inline = false }: Props = $props()
|
||||
|
||||
let blocking = false
|
||||
let sortForm = $state<HTMLFormElement>()
|
||||
|
||||
async function blockUser(block: number) {
|
||||
if (!profile.data?.user || !profile.data?.jwt)
|
||||
throw new Error('Unauthenticated')
|
||||
|
||||
blocking = true
|
||||
try {
|
||||
const blocked = isBlocked(profile.data.user, block)
|
||||
|
||||
@@ -63,7 +67,7 @@
|
||||
|
||||
if (blocked) {
|
||||
const index = profile.data.user.person_blocks
|
||||
.map((p) => p.target.id)
|
||||
.map(p => p.target.id)
|
||||
.indexOf(block)
|
||||
profile.data.user.person_blocks.splice(index, 1)
|
||||
}
|
||||
@@ -78,11 +82,10 @@
|
||||
})
|
||||
} catch (err) {
|
||||
toast({
|
||||
content: err as any,
|
||||
content: err as string,
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
blocking = false
|
||||
}
|
||||
|
||||
let purgingUser = $state(false)
|
||||
@@ -107,7 +110,7 @@
|
||||
removeToast(purgeToast)
|
||||
toast({ content: $t('toast.purgeUser'), type: 'success' })
|
||||
} catch (e) {
|
||||
toast({ content: e as any, type: 'error' })
|
||||
toast({ content: e as string, type: 'error' })
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -195,7 +198,7 @@
|
||||
/>
|
||||
{/snippet}
|
||||
<ItemList
|
||||
items={data.moderates.value.map((m) => ({
|
||||
items={data.moderates.value.map(m => ({
|
||||
id: m.community.id,
|
||||
name: m.community.title,
|
||||
url: communityLink(m.community),
|
||||
@@ -342,7 +345,7 @@
|
||||
class="divide-y! divide-slate-200 dark:divide-zinc-800 flex flex-col"
|
||||
>
|
||||
{#key data.items}
|
||||
{#each data.items.value as item}
|
||||
{#each data.items.value as item (item)}
|
||||
{#if isCommentView(item) && data.filters.value.type == 'comments'}
|
||||
<CommentItem comment={item} />
|
||||
{:else if !isCommentView(item) && data.filters.value.type == 'posts'}
|
||||
@@ -354,7 +357,7 @@
|
||||
{/if}
|
||||
<Pageination
|
||||
bind:page={data.filters.value.page}
|
||||
href={(page) => `?page=${page}`}
|
||||
href={page => `?page=${page}`}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,5 +1,4 @@
|
||||
import { getClient } from '$lib/lemmy.svelte.js'
|
||||
import { getItemPublished } from '$lib/lemmy/item.js'
|
||||
import { ReactiveState } from '$lib/promise.svelte.js'
|
||||
import type { CommentView, PostView, SortType } from 'lemmy-js-client'
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation'
|
||||
import { page } from '$app/state'
|
||||
import MultiSelect from '$lib/components/input/Switch.svelte'
|
||||
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
||||
interface Props {
|
||||
children?: import('svelte').Snippet
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { run } from 'svelte/legacy'
|
||||
|
||||
import { photonify } from '$lib/components/markdown/renderers/plugins'
|
||||
import { photonify } from '$lib/components/markdown/renderers/plugins.js'
|
||||
import { TextInput } from 'mono-svelte'
|
||||
|
||||
let link = $state('')
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { getClient } from '$lib/lemmy.svelte.js'
|
||||
import { error } from '@sveltejs/kit'
|
||||
|
||||
export async function load({ fetch, params }) {
|
||||
await getClient(undefined, fetch).verifyEmail({
|
||||
|
||||
Reference in new issue
Block a user