diff --git a/src/app.d.ts b/src/app.d.ts index 2c93e142..a7591ab4 100644 --- a/src/app.d.ts +++ b/src/app.d.ts @@ -1,7 +1,5 @@ // See https://kit.svelte.dev/docs/types#app -import type { Action } from '$comp/ui/navbar/commands/actions.svelte' - // for information about these interfaces declare global { namespace App { diff --git a/src/lib/api/client.svelte.ts b/src/lib/api/client.svelte.ts index 0f55c1b3..db9f26ce 100644 --- a/src/lib/api/client.svelte.ts +++ b/src/lib/api/client.svelte.ts @@ -1,11 +1,11 @@ import { profile } from '$lib/app/auth.svelte' -import { DEFAULT_INSTANCE_URL } from '$lib/instance.svelte.js' -import { instanceToURL } from '$lib/util.svelte' +import { DEFAULT_INSTANCE_URL } from '$lib/app/instance.svelte' +import { instanceToURL } from '$lib/app/util.svelte' import { error } from '@sveltejs/kit' -import { type GetSiteResponse } from '$lib/client/types' +import { BaseClient, DEFAULT_CLIENT_TYPE, type ClientType } from './base' import { LemmyClient } from './lemmy/adapter' import { PiefedClient } from './piefed/adapter' -import { DEFAULT_CLIENT_TYPE, type ClientType, BaseClient } from './base' +import type { GetSiteResponse } from './types' class SiteData { #data = $state() diff --git a/src/lib/api/lemmy/adapter.ts b/src/lib/api/lemmy/adapter.ts index b6d0534e..460c7d79 100644 --- a/src/lib/api/lemmy/adapter.ts +++ b/src/lib/api/lemmy/adapter.ts @@ -1,4 +1,3 @@ -import { LemmyHttp } from 'lemmy-js-client' import type { BaseClient, ClientType } from '../base' import { fromGetPosts, toListingType } from './rewrite' diff --git a/src/lib/api/lemmy/rewrite.ts b/src/lib/api/lemmy/rewrite.ts index 5fdc5cb7..01137b25 100644 --- a/src/lib/api/lemmy/rewrite.ts +++ b/src/lib/api/lemmy/rewrite.ts @@ -1,5 +1,5 @@ -import * as lemmy from 'lemmy-js-client' import type { GetPosts, ListingType } from '../types' +import * as lemmy from '../types' export function fromGetPosts(getPosts: GetPosts): lemmy.GetPosts { return { diff --git a/src/lib/api/piefed/adapter.ts b/src/lib/api/piefed/adapter.ts index e48dc163..ed793c0a 100644 --- a/src/lib/api/piefed/adapter.ts +++ b/src/lib/api/piefed/adapter.ts @@ -1,10 +1,11 @@ import createClient from 'openapi-fetch' -import type { +import { BaseClient, - ClientType, - NullableFnArg, - NullableFnReturn, + type ClientType, + type NullableFnArg, + type NullableFnReturn, } from '../base' +import type { SubscribedType } from '../types' import { fromCreateComment, fromCreatePost, @@ -33,7 +34,6 @@ import { toTopicView, } from './rewrite' import type { paths } from './schema' -import type { SubscribedType } from '../types' export class PiefedClient implements BaseClient { type: ClientType = { name: 'piefed', baseUrl: '/api/alpha' } diff --git a/src/lib/api/piefed/rewrite.ts b/src/lib/api/piefed/rewrite.ts index 29a413a0..d662b7e7 100644 --- a/src/lib/api/piefed/rewrite.ts +++ b/src/lib/api/piefed/rewrite.ts @@ -1,5 +1,6 @@ +import { Post } from '$lib/feature/post' +import { Search } from 'mono-svelte' import type { - Comment, CommentReplyView, CommentSortType, CommentView, @@ -18,10 +19,8 @@ import type { Person, PersonMentionView, PersonView, - Post, PostView, PrivateMessageView, - Search, SortType, SubscribedType, TopicView, diff --git a/src/lib/app/auth.svelte.ts b/src/lib/app/auth.svelte.ts index c9c7d432..4595ab4d 100644 --- a/src/lib/app/auth.svelte.ts +++ b/src/lib/app/auth.svelte.ts @@ -1,16 +1,16 @@ import { browser } from '$app/environment' import { env } from '$env/dynamic/public' -import { amModOfAny, isAdmin } from '$comp/lemmy/moderation/moderation.js' -import { DEFAULT_INSTANCE_URL } from '$lib/instance.svelte.js' +import { DEFAULT_CLIENT_TYPE, type ClientType } from '$lib/api/base' import { client, getClient, site } from '$lib/api/client.svelte' -import { instanceToURL, moveItem } from '$lib/util.svelte' +import type { Community, GetSiteResponse, MyUserInfo } from '$lib/api/types' +import { amModOfAny, isAdmin } from '$lib/feature/moderation/moderation' +import { publishedToDate } from '$lib/ui/util/date' import { toast } from 'mono-svelte' import { writable } from 'svelte/store' -import { t } from './i18n' import { errorMessage } from './error' -import { publishedToDate } from '../ui/util/date' -import type { Community, GetSiteResponse, MyUserInfo } from '../api/types' -import { DEFAULT_CLIENT_TYPE, type ClientType } from '../api/base' +import { t } from './i18n' +import { DEFAULT_INSTANCE_URL } from './instance.svelte' +import { instanceToURL, moveItem } from './util.svelte' function getFromStorage(key: string): T | undefined { if (typeof localStorage == 'undefined') return undefined diff --git a/src/lib/app/error.ts b/src/lib/app/error.ts index 75bc4650..8a682e8c 100644 --- a/src/lib/app/error.ts +++ b/src/lib/app/error.ts @@ -1,5 +1,3 @@ -import { t } from '$lib/app/i18n/translations' - // eslint-disable-next-line export function errorMessage(error: any, instance?: string): string { try { diff --git a/src/lib/app/i18n/index.ts b/src/lib/app/i18n/index.ts index dacf4204..4b80dba8 100644 --- a/src/lib/app/i18n/index.ts +++ b/src/lib/app/i18n/index.ts @@ -1,4 +1,4 @@ -import i18n, { type Config, type Parser } from 'sveltekit-i18n' +import { default as i18n, type Config, type Parser } from 'sveltekit-i18n' const config: Config = { loaders: [ diff --git a/src/lib/app/markdown/Markdown.svelte b/src/lib/app/markdown/Markdown.svelte index 1c6a6356..739806af 100644 --- a/src/lib/app/markdown/Markdown.svelte +++ b/src/lib/app/markdown/Markdown.svelte @@ -1,7 +1,33 @@ - -{#each items.toSorted( (a, b) => a.title.localeCompare(b.title), ) as follow (follow.id)} -
-
- {#if profile && !hasFavorite(profile.current, follow.id)} - - {:else if isFavorites && profile && hasFavorite(profile.current, follow.id)} - - {/if} - -
- - {#snippet label()} -
- {follow.title} - - {new URL(follow.actor_id).hostname} - -
- {/snippet} -
-
-{/each} diff --git a/src/lib/feature/community/CommunityTitle.svelte b/src/lib/feature/community/CommunityTitle.svelte index 25352d75..479a1de0 100644 --- a/src/lib/feature/community/CommunityTitle.svelte +++ b/src/lib/feature/community/CommunityTitle.svelte @@ -1,7 +1,4 @@ {#if $modals.reporting.open} - {#await import('$comp/lemmy/moderation/ReportModal.svelte') then { default: ReportModal }} + {#await import('./ReportModal.svelte') then { default: ReportModal }} {/await} {/if} diff --git a/src/lib/feature/moderation/ModerationMenu.svelte b/src/lib/feature/moderation/ModerationMenu.svelte index 0c130aa4..5fe4e975 100644 --- a/src/lib/feature/moderation/ModerationMenu.svelte +++ b/src/lib/feature/moderation/ModerationMenu.svelte @@ -1,10 +1,9 @@ {#if uploadingImage} - {#await import('$comp/form/ImageInputModal.svelte') then { default: UploadModal }} + {#await import('$lib/ui/form/ImageInputModal.svelte') then { default: UploadModal }} '', (v) => (data.url = v)} diff --git a/src/lib/feature/post/PostLink.svelte b/src/lib/feature/post/PostLink.svelte index b2efb25e..3aea1901 100644 --- a/src/lib/feature/post/PostLink.svelte +++ b/src/lib/feature/post/PostLink.svelte @@ -1,9 +1,9 @@ {#snippet siteSnippet()} {#if site.data} - + import Avatar from '$lib/ui/generic/Avatar.svelte' import { Button } from 'mono-svelte' - import { ArrowUturnDown, Icon, QuestionMarkCircle } from 'svelte-hero-icons' - import type { HTMLButtonAttributes } from 'svelte/elements' - import Avatar from '../../Avatar.svelte' - import type { Action } from './actions.svelte' import type { Snippet } from 'svelte' + import { + ArrowUturnDown, + Icon, + QuestionMarkCircle, + } from 'svelte-hero-icons/dist' + import type { HTMLButtonAttributes } from 'svelte/elements' + import type { Action } from './actions.svelte' interface Props { action: Action diff --git a/src/lib/ui/navbar/commands/Commands.svelte b/src/lib/ui/navbar/commands/Commands.svelte index 2cc11a2f..4bdeda05 100644 --- a/src/lib/ui/navbar/commands/Commands.svelte +++ b/src/lib/ui/navbar/commands/Commands.svelte @@ -4,15 +4,15 @@ import { page } from '$app/state' import { profile } from '$lib/app/auth.svelte' import { t } from '$lib/app/i18n' - import { resumables } from '$lib/lemmy/item' import { theme } from '$lib/app/theme/theme.svelte' - import { fuzzySearch } from '$lib/util.svelte' + import { fuzzySearch } from '$lib/app/util.svelte' + import { resumables } from '$lib/feature/legacy/item' + import { CommonList } from '$lib/ui/layout' + import EndPlaceholder from '$lib/ui/layout/EndPlaceholder.svelte' import { TextInput } from 'mono-svelte' import { createEventDispatcher, onMount } from 'svelte' - import { Home, Icon, MagnifyingGlass } from 'svelte-hero-icons' - import EndPlaceholder from '../../EndPlaceholder.svelte' - import CommonList from '../../layout/CommonList.svelte' - import { getGroups, type Action, type Group } from './actions.svelte' + import { Home, Icon, MagnifyingGlass } from 'svelte-hero-icons/dist' + import { type Action, type Group, getGroups } from './actions.svelte' import CommandItem from './CommandItem.svelte' interface Props { diff --git a/src/lib/ui/navbar/commands/actions.svelte.ts b/src/lib/ui/navbar/commands/actions.svelte.ts index 67a8341e..aa8dbc3a 100644 --- a/src/lib/ui/navbar/commands/actions.svelte.ts +++ b/src/lib/ui/navbar/commands/actions.svelte.ts @@ -4,12 +4,12 @@ import { profile as currentProfile, type ProfileInfo, } from '$lib/app/auth.svelte' -import { amModOfAny, isAdmin } from '$comp/lemmy/moderation/moderation' -import { t } from '$lib/app/i18n/translations' -import { type ResumableItem } from '$lib/lemmy/item' -import { settings } from '$lib/settings.svelte' +import { t } from '$lib/app/i18n' +import { settings } from '$lib/app/settings.svelte' import { theme, type ThemeData } from '$lib/app/theme/theme.svelte' -import { fullCommunityName } from '$lib/util.svelte' +import { fullCommunityName } from '$lib/app/util.svelte' +import type { ResumableItem } from '$lib/feature/legacy/item' +import { amModOfAny, isAdmin } from '$lib/feature/moderation/moderation' import { ArrowRightOnRectangle, ArrowTrendingDown, @@ -44,7 +44,7 @@ import { UserGroup, ViewColumns, type IconSource, -} from 'svelte-hero-icons' +} from '@xylightdev/svelte-hero-icons' import { SvelteURL } from 'svelte/reactivity' export interface Group { diff --git a/src/lib/ui/navbar/link.ts b/src/lib/ui/navbar/link.ts deleted file mode 100644 index 94cc0c3f..00000000 --- a/src/lib/ui/navbar/link.ts +++ /dev/null @@ -1,115 +0,0 @@ -import { t } from '$lib/app/i18n/translations' -import { - type IconSource, - Home, - ChartBar, - Cog6Tooth, - Newspaper, - GlobeAmericas, - GlobeAlt, - MagnifyingGlass, - ShieldCheck, - ServerStack, - PencilSquare, - MapPin, - Fire, - ArrowTrendingUp, - Star, -} from 'svelte-hero-icons' - -export interface Link { - url: string - label?: string -} - -export const getDefaultLinks = (): Link[] => [ - { - url: '/', - label: t.get('nav.home'), - }, - { - url: '/?type=All', - label: t.get('filter.location.all'), - }, - { - url: '/?type=Local', - label: t.get('filter.location.local'), - }, - { - url: '/?type=Subscribed', - label: t.get('filter.location.subscribed'), - }, - { - url: '/?type=All&sort=Hot', - label: t.get('filter.sort.hot'), - }, - { - url: '/?type=All&sort=Active', - label: t.get('filter.sort.active'), - }, - { - url: '/?type=All&sort=TopDay', - label: t.get('filter.sort.top.time.day'), - }, - { - url: '/?type=All&sort=New', - label: t.get('filter.sort.new'), - }, - { - url: '/communities', - label: t.get('nav.communities'), - }, - { - url: '/search', - label: t.get('nav.search'), - }, - { - url: '/moderation', - label: t.get('moderation.label'), - }, - { - url: '/admin', - label: t.get('admin.label'), - }, - { - url: '/settings', - label: t.get('nav.menu.settings'), - }, - { - url: '/create/post', - label: t.get('form.post.create'), - }, -] - -export const iconOfLink = (url: string): IconSource => { - switch (url) { - case '/': - return Home - case '/?type=All': - return GlobeAmericas - case '/?type=Subscribed': - return Newspaper - case '/?type=Local': - return MapPin - case '/?type=All&sort=Hot': - return Fire - case '/?type=All&sort=Active': - return ArrowTrendingUp - case '/?type=All&sort=TopDay': - return ChartBar - case '/?type=All&sort=New': - return Star - case '/communities': - return GlobeAlt - case '/search': - return MagnifyingGlass - case '/moderation': - return ShieldCheck - case '/admin': - return ServerStack - case '/settings': - return Cog6Tooth - case '/create/post': - return PencilSquare - } -} diff --git a/src/lib/ui/shared/button/Button.svelte b/src/lib/ui/shared/button/Button.svelte index bbd6eafb..0f66aac5 100644 --- a/src/lib/ui/shared/button/Button.svelte +++ b/src/lib/ui/shared/button/Button.svelte @@ -1,4 +1,13 @@ {#if $shownModal} @@ -19,7 +9,7 @@ title={$shownModal.title} dismissable={$shownModal.dismissable} ondismissed={() => shownModal.set(undefined)} - bind:open + bind:open={$shownModal} > {#if $shownModal.snippet} {@render $shownModal.snippet()} diff --git a/src/lib/ui/shared/modal/modal.ts b/src/lib/ui/shared/modal/modal.ts index d6f0676e..b70e2004 100644 --- a/src/lib/ui/shared/modal/modal.ts +++ b/src/lib/ui/shared/modal/modal.ts @@ -1,6 +1,6 @@ -import { t } from '$lib/app/i18n/translations' -import { type Snippet } from 'svelte' -import type { IconSource } from 'svelte-hero-icons' +import { t } from '$lib/app/i18n' +import type { IconSource } from '@xylightdev/svelte-hero-icons' +import type { Snippet } from 'svelte' import { writable } from 'svelte/store' export const shownModal = writable() diff --git a/src/lib/ui/shared/note/Note.svelte b/src/lib/ui/shared/note/Note.svelte index b17d877c..d4a46149 100644 --- a/src/lib/ui/shared/note/Note.svelte +++ b/src/lib/ui/shared/note/Note.svelte @@ -1,7 +1,7 @@
+ import { locale } from '$lib/app/i18n' + import { settings } from '$lib/app/settings.svelte' + export function formatRelativeDate( date: Date, options: Intl.RelativeTimeFormatOptions, @@ -47,9 +50,6 @@ - -
-
- - Photon -
-

About

-

- Photon - is a replacement user interface for Lemmy, with more features and modern design. -

-

Links

-
    -
  • - Github -
  • -
  • - - Community - -
  • -
  • - Xylight's portfolio -
  • -
  • - Donate -
  • -
-

Credits

-
- - - - - - - - - - - - - - - - - - - ...and you, for using this app! -
-
diff --git a/src/routes/about/Profile.svelte b/src/routes/about/Profile.svelte deleted file mode 100644 index 23390dc4..00000000 --- a/src/routes/about/Profile.svelte +++ /dev/null @@ -1,34 +0,0 @@ - - - diff --git a/src/routes/accounts/+page.svelte b/src/routes/accounts/+page.svelte index 375deb89..6a0439ce 100644 --- a/src/routes/accounts/+page.svelte +++ b/src/routes/accounts/+page.svelte @@ -1,17 +1,16 @@ diff --git a/src/routes/accounts/login/guest/+page.svelte b/src/routes/accounts/login/guest/+page.svelte index 3faf60bc..78f81665 100644 --- a/src/routes/accounts/login/guest/+page.svelte +++ b/src/routes/accounts/login/guest/+page.svelte @@ -1,8 +1,8 @@ diff --git a/src/routes/activitypub/externalInteraction/+page.svelte b/src/routes/activitypub/externalInteraction/+page.svelte index b0e08469..d3966621 100644 --- a/src/routes/activitypub/externalInteraction/+page.svelte +++ b/src/routes/activitypub/externalInteraction/+page.svelte @@ -1,11 +1,11 @@ diff --git a/src/routes/c/[name]/settings/team/+page.svelte b/src/routes/c/[name]/settings/team/+page.svelte index 04bfa228..2680c918 100644 --- a/src/routes/c/[name]/settings/team/+page.svelte +++ b/src/routes/c/[name]/settings/team/+page.svelte @@ -1,15 +1,14 @@ diff --git a/src/routes/create/community/+page.svelte b/src/routes/create/community/+page.svelte index fee47082..c4ea9bd4 100644 --- a/src/routes/create/community/+page.svelte +++ b/src/routes/create/community/+page.svelte @@ -1,5 +1,5 @@ diff --git a/src/routes/create/post/+page.svelte b/src/routes/create/post/+page.svelte index 7edb958b..6b8a3aed 100644 --- a/src/routes/create/post/+page.svelte +++ b/src/routes/create/post/+page.svelte @@ -1,8 +1,8 @@ diff --git a/src/routes/inbox/+page.svelte b/src/routes/inbox/+page.svelte index 74303401..dd6327c6 100644 --- a/src/routes/inbox/+page.svelte +++ b/src/routes/inbox/+page.svelte @@ -1,18 +1,16 @@ diff --git a/src/routes/instances/+layout.ts b/src/routes/instances/+layout.ts index 5cab2741..8a5fd2a1 100644 --- a/src/routes/instances/+layout.ts +++ b/src/routes/instances/+layout.ts @@ -1,4 +1,4 @@ -import { getClient } from '$lib/client/lemmy.svelte' +import { getClient } from '$lib/api/client.svelte' export async function load({ fetch }) { return (await getClient(undefined, fetch).getFederatedInstances()) diff --git a/src/routes/instances/[instance]/+page.svelte b/src/routes/instances/[instance]/+page.svelte deleted file mode 100644 index e69de29b..00000000 diff --git a/src/routes/instances/blocked/+page.svelte b/src/routes/instances/blocked/+page.svelte index ae4be3b3..34ae3966 100644 --- a/src/routes/instances/blocked/+page.svelte +++ b/src/routes/instances/blocked/+page.svelte @@ -1,11 +1,11 @@ diff --git a/src/routes/login/+page.svelte b/src/routes/login/+page.svelte index 5e8e0376..4ca3ec6f 100644 --- a/src/routes/login/+page.svelte +++ b/src/routes/login/+page.svelte @@ -1,28 +1,28 @@ diff --git a/src/routes/moderation/+page.svelte b/src/routes/moderation/+page.svelte index d8868d46..7907b2ad 100644 --- a/src/routes/moderation/+page.svelte +++ b/src/routes/moderation/+page.svelte @@ -1,21 +1,24 @@
@@ -38,7 +37,6 @@ }, subscribed: 'NotSubscribed', }} - class="py-1 -mx-4 px-4" >