Merge pull request #646 from Xyphyn/piefed-3

attempt 3: piefed/general fediverse support
This commit is contained in:
Xylight authored and GitHub committed 2025-09-07 05:09:01 +00:00
commit adc8dc9ebc
215 files changed
+10368 -325

No files matched your search

@@ -1,7 +1,7 @@
<script lang="ts">
import Avatar from '$lib/components/ui/Avatar.svelte'
import { getClient } from '$lib/lemmy.svelte.js'
import type { Community, ListingType } from 'lemmy-js-client'
import { getClient } from '$lib/client/lemmy.svelte'
import type { Community, ListingType } from '$lib/client/types'
import { MenuButton, Search } from 'mono-svelte'
import { createEventDispatcher } from 'svelte'
import { Icon, ServerStack, XCircle } from 'svelte-hero-icons'
+2 -2
View File
@@ -4,9 +4,9 @@
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 { client } from '$lib/client/lemmy.svelte'
import { instanceToURL } from '$lib/util.svelte'
import type { LocalImage, Person } from 'lemmy-js-client'
import type { LocalImage, Person } from '$lib/client/types'
import { action, Button, modal, toast } from 'mono-svelte'
import { ArrowDownTray, Icon, Trash } from 'svelte-hero-icons'
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
+1 -1
View File
@@ -4,7 +4,7 @@
import { t } from '$lib/i18n/translations'
import { userLink } from '$lib/lemmy/generic'
import { settings } from '$lib/settings.svelte'
import type { PersonView, SiteView, Tagline } from 'lemmy-js-client'
import type { PersonView, SiteView, Tagline } from '$lib/client/types'
import { Badge } from 'mono-svelte'
import {
BuildingOffice,
@@ -9,7 +9,7 @@
formatRelativeDate,
} from '$lib/components/util/RelativeDate.svelte'
import { t } from '$lib/i18n/translations'
import { getClient } from '$lib/lemmy.svelte.js'
import { getClient } from '$lib/client/lemmy.svelte'
import { errorMessage } from '$lib/lemmy/error'
import { settings } from '$lib/settings.svelte'
import { Button, Modal, toast } from 'mono-svelte'
@@ -10,7 +10,7 @@
import { t } from '$lib/i18n/translations'
import { deleteItem, save } from '$lib/lemmy/contentview.js'
import { settings } from '$lib/settings.svelte'
import type { CommentView } from 'lemmy-js-client'
import type { CommentView } from '$lib/client/types'
import { Button, Menu, MenuButton } from 'mono-svelte'
import {
Bookmark,
@@ -3,10 +3,10 @@
import Markdown from '$lib/components/markdown/Markdown.svelte'
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
import { t } from '$lib/i18n/translations'
import { getClient, site } from '$lib/lemmy.svelte.js'
import { getClient, site } from '$lib/client/lemmy.svelte'
import { errorMessage } from '$lib/lemmy/error'
import { placeholders } from '$lib/util.svelte.js'
import type { CommentResponse } from 'lemmy-js-client'
import type { CommentResponse } from '$lib/client/types'
import { Button, Menu, MenuButton, toast } from 'mono-svelte'
import { Icon, Language, XMark } from 'svelte-hero-icons'
import type { ClassValue, HTMLTextareaAttributes } from 'svelte/elements'
@@ -3,7 +3,7 @@
import PostMeta from '$lib/components/lemmy/post/PostMeta.svelte'
import { publishedToDate } from '$lib/components/util/date.js'
import { t } from '$lib/i18n/translations'
import type { CommentView } from 'lemmy-js-client'
import type { CommentView } from '$lib/client/types'
import { Button, Material } from 'mono-svelte'
import { ArrowUturnUp, Icon } from 'svelte-hero-icons'
import type { ClassValue } from 'svelte/elements'
@@ -1,6 +1,6 @@
<script lang="ts">
import VirtualList from '$lib/components/render/VirtualList.svelte'
import type { Post } from 'lemmy-js-client'
import type { Post } from '$lib/client/types'
import type { CommentNodeI } from './comments.svelte'
import Comments from './CommentTree.svelte'
import { onMount } from 'svelte'
@@ -3,9 +3,9 @@
import { goto } from '$app/navigation'
import { page } from '$app/state'
import { t } from '$lib/i18n/translations'
import { getClient } from '$lib/lemmy.svelte.js'
import { getClient } from '$lib/client/lemmy.svelte'
import { errorMessage } from '$lib/lemmy/error'
import type { Post } from 'lemmy-js-client'
import type { Post } from '$lib/client/types'
import { Button, toast } from 'mono-svelte'
import { ArrowDownCircle, Icon } from 'svelte-hero-icons'
import Comment from './Comment.svelte'
@@ -2,7 +2,7 @@
import { profile } from '$lib/auth.svelte.js'
import FormattedNumber from '$lib/components/util/FormattedNumber.svelte'
import { t } from '$lib/i18n/translations'
import { getClient } from '$lib/lemmy.svelte'
import { getClient } from '$lib/client/lemmy.svelte'
import { buttonColor, toast } from 'mono-svelte'
import { ChevronDown, ChevronUp, Icon } from 'svelte-hero-icons'
import { backOut } from 'svelte/easing'
@@ -1,5 +1,5 @@
import { t } from '$lib/i18n/translations'
import type { Comment, CommentView } from 'lemmy-js-client'
import type { Comment, CommentView } from '$lib/client/types'
import { SvelteMap } from 'svelte/reactivity'
export interface CommentNodeI {
@@ -67,28 +67,31 @@
<script lang="ts">
import { profile } from '$lib/auth.svelte.js'
import { client, getClient } from '$lib/client/lemmy.svelte'
import type { CommunityModeratorView, CommunityView } from '$lib/client/types'
import {
amMod,
isAdmin,
} from '$lib/components/lemmy/moderation/moderation.js'
import Markdown from '$lib/components/markdown/Markdown.svelte'
import Avatar from '$lib/components/ui/Avatar.svelte'
import EndPlaceholder from '$lib/components/ui/EndPlaceholder.svelte'
import Entity from '$lib/components/ui/Entity.svelte'
import Expandable from '$lib/components/ui/Expandable.svelte'
import LabelStat from '$lib/components/ui/LabelStat.svelte'
import SidebarButton from '$lib/components/ui/sidebar/SidebarButton.svelte'
import { t } from '$lib/i18n/translations'
import { client, getClient } from '$lib/lemmy.svelte.js'
import { errorMessage } from '$lib/lemmy/error'
import { userLink } from '$lib/lemmy/generic'
import { addSubscription } from '$lib/lemmy/user.js'
import { settings } from '$lib/settings.svelte'
import { fullCommunityName } from '$lib/util.svelte.js'
import type { CommunityModeratorView, CommunityView } from 'lemmy-js-client'
import {
action,
Button,
Menu,
MenuButton,
Modal,
modal,
removeToast,
Spinner,
@@ -105,10 +108,10 @@
NoSymbol,
Plus,
ShieldCheck,
Tag,
} from 'svelte-hero-icons'
import ItemList from '../generic/ItemList.svelte'
import EndPlaceholder from '$lib/components/ui/EndPlaceholder.svelte'
import SidebarButton from '$lib/components/ui/sidebar/SidebarButton.svelte'
import CommunityFlair from './CommunityFlair.svelte'
let loading = $state({
blocking: false,
@@ -135,6 +138,10 @@
loading.subscribing = false
}
let setFlair = $state(false)
interface Props {
community_view: CommunityView | Promise<CommunityView>
moderators?: CommunityModeratorView[]
@@ -148,6 +155,7 @@
}: Props = $props()
</script>
{#await community_view}
<div
class="w-full h-full grid place-items-center"
@@ -157,6 +165,9 @@
<Spinner width={24} />
</div>
{:then community_view}
<Modal title={$t('cards.community.flair')} bind:open={setFlair}>
<CommunityFlair community={community_view.community.id} onsubmit={() => setFlair = !setFlair} />
</Modal>
<aside
class={[
'min-w-full pt-0 text-slate-600 dark:text-zinc-400 flex flex-col gap-1',
@@ -210,6 +221,14 @@
? $t('cards.community.subscribed')
: $t('cards.community.subscribe')}
</Button>
{#if client().setFlair}
<SidebarButton
onclick={() => setFlair = !setFlair}
rounding="xl"
icon={Tag}
label={$t('cards.community.flair')}
/>
{/if}
{/if}
{#if profile.current?.user && amMod(profile.current.user, community_view.community)}
<SidebarButton
@@ -0,0 +1,46 @@
<script lang="ts">
import { client } from '$lib/client/lemmy.svelte'
import { t } from '$lib/i18n/translations'
import { errorMessage } from '$lib/lemmy/error'
import { Button, TextInput, toast } from 'mono-svelte'
interface Props {
flair?: string
community: number
onsubmit?: (flair: string) => void
}
let { flair: passedFlair = '', community, onsubmit }: Props = $props()
let flair = $state(passedFlair)
let loading = $state(false)
async function submit() {
try {
loading = true
if (!client().setFlair) throw new Error('unsupported')
await client().setFlair!({ community_id: community, flair_text: flair })
onsubmit?.(flair)
} catch (err) {
toast({
content: errorMessage(err as string),
type: 'error',
})
}
loading = false
}
</script>
<form
onsubmit={e => {
e.preventDefault()
submit()
}}
class="contents"
>
<TextInput bind:value={flair} label={$t('nav.commands.content')} required />
<Button {loading} submit color="primary" size="lg">
{$t('form.submit')}
</Button>
</form>
@@ -6,7 +6,7 @@
import Header from '$lib/components/ui/layout/pages/Header.svelte'
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
import { t } from '$lib/i18n/translations'
import { getClient, site } from '$lib/lemmy.svelte.js'
import { getClient, site } from '$lib/client/lemmy.svelte'
import { errorMessage } from '$lib/lemmy/error'
import { addSubscription } from '$lib/lemmy/user.js'
import {
@@ -13,8 +13,8 @@
CommunityAggregates,
CommunityModeratorView,
SubscribedType,
} from 'lemmy-js-client'
import { action, Button, Menu, MenuButton, modal, toast } from 'mono-svelte'
} from '$lib/client/types'
import { action, Button, Menu, MenuButton, Modal, modal, toast } from 'mono-svelte'
import {
BuildingOffice2,
Check,
@@ -26,11 +26,13 @@
NoSymbol,
Plus,
ShieldCheck,
Tag,
} from 'svelte-hero-icons'
import Subscribe from '../../../../routes/communities/Subscribe.svelte'
import ItemList from '../generic/ItemList.svelte'
import { amMod, isAdmin } from '../moderation/moderation'
import { block, blockInstance, purgeCommunity } from './CommunityCard.svelte'
import CommunityFlair from './CommunityFlair.svelte'
interface Props {
community: Community
@@ -55,8 +57,15 @@
compact,
...rest
}: Props = $props()
let setFlair = $state(false)
</script>
<Modal title={$t('cards.community.flair')} bind:open={setFlair}>
<CommunityFlair community={community.id} onsubmit={() => setFlair = !setFlair} />
</Modal>
<EntityHeader
{...rest}
{compact}
@@ -157,6 +166,10 @@
</Button>
{/snippet}
</Subscribe>
<Button size="custom" class="h-9 aspect-square" rounding="pill" onclick={() => setFlair = !setFlair} aria-label={$t('cards.community.flair')}>
<Icon src={Tag} size="16" micro />
</Button>
{/if}
{#if profile.current?.user && profile.current.user.moderates
@@ -5,11 +5,11 @@
import LabelStat from '$lib/components/ui/LabelStat.svelte'
import FormattedNumber from '$lib/components/util/FormattedNumber.svelte'
import { t } from '$lib/i18n/translations'
import { client } from '$lib/lemmy.svelte'
import { client } from '$lib/client/lemmy.svelte'
import { addSubscription } from '$lib/lemmy/user.js'
import { settings } from '$lib/settings.svelte'
import { fullCommunityName, isSubscribed } from '$lib/util.svelte.js'
import type { CommunityView } from 'lemmy-js-client'
import type { CommunityView } from '$lib/client/types'
import { Button, modal } from 'mono-svelte'
import type { Snippet } from 'svelte'
import {
@@ -3,7 +3,7 @@
import { communityLink } from '$lib/lemmy/generic'
import { settings } from '$lib/settings.svelte.js'
import { t } from '$lib/i18n/translations'
import type { Community } from 'lemmy-js-client'
import type { Community } from '$lib/client/types'
import { ExclamationTriangle, Icon } from 'svelte-hero-icons'
import type { HTMLAnchorAttributes } from 'svelte/elements'
@@ -1,6 +1,6 @@
<script lang="ts">
import Avatar from '$lib/components/ui/Avatar.svelte'
import type { Community } from 'lemmy-js-client'
import type { Community } from '$lib/client/types'
interface Props {
community: Community
@@ -4,6 +4,7 @@
import { searchParam } from '$lib/util.svelte'
import { Select } from 'mono-svelte'
import {
ChartBar,
GlobeAmericas,
Icon,
MapPin,
@@ -14,6 +15,8 @@
import { t } from '$lib/i18n/translations'
import Option from 'mono-svelte/forms/select/Option.svelte'
import type { SelectProps } from 'mono-svelte/forms/select/Select.svelte'
import { client } from '$lib/client/lemmy.svelte'
import { PiefedClient } from '$lib/client/piefed/piefed'
interface Props extends SelectProps<string> {
selected: string
@@ -49,6 +52,11 @@
<Option value="All" icon={GlobeAmericas}>
{$t('filter.location.all')}
</Option>
{#if client() instanceof PiefedClient}
<Option value="Popular" icon={ChartBar}>
{$t('filter.location.popular')}
</Option>
{/if}
<Option value="Local" icon={MapPin}>{$t('filter.location.local')}</Option>
<Option
value="Subscribed"
+16 -12
View File
@@ -1,5 +1,7 @@
<script lang="ts">
import { page } from '$app/state'
import { client } from '$lib/client/lemmy.svelte'
import { LemmyClient } from '$lib/client/lemmy/lemmy'
import { t } from '$lib/i18n/translations'
import { searchParam } from '$lib/util.svelte.js'
import { Select } from 'mono-svelte'
@@ -72,18 +74,20 @@
<Option value="New" icon={Star}>
{$t('filter.sort.new')}
</Option>
<Option value="Old" icon={Clock}>
{$t('filter.sort.old')}
</Option>
<Option value="Controversial" icon={ArrowTrendingDown}>
{$t('filter.sort.controversial')}
</Option>
<Option value="MostComments" icon={ChatBubbleOvalLeft}>
{$t('filter.sort.mostcomments')}
</Option>
<Option value="NewComments" icon={ChatBubbleLeftRight}>
{$t('filter.sort.newcomments')}
</Option>
{#if client() instanceof LemmyClient}
<Option value="Old" icon={Clock}>
{$t('filter.sort.old')}
</Option>
<Option value="Controversial" icon={ArrowTrendingDown}>
{$t('filter.sort.controversial')}
</Option>
<Option value="MostComments" icon={ChatBubbleOvalLeft}>
{$t('filter.sort.mostcomments')}
</Option>
<Option value="NewComments" icon={ChatBubbleLeftRight}>
{$t('filter.sort.newcomments')}
</Option>
{/if}
</Select>
{#if selected?.startsWith('Top')}
<Select
@@ -2,7 +2,7 @@
import { profile } from '$lib/auth.svelte.js'
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
import Markdown from '$lib/components/markdown/Markdown.svelte'
import type { PrivateMessageView } from 'lemmy-js-client'
import type { PrivateMessageView } from '$lib/client/types'
interface Props {
message: PrivateMessageView
@@ -4,7 +4,7 @@
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
import { t } from '$lib/i18n/translations'
import type { Person } from 'lemmy-js-client'
import type { Person } from '$lib/client/types'
import { Button, Modal } from 'mono-svelte'
interface Props {
@@ -4,9 +4,9 @@
import { profile } from '$lib/auth.svelte.js'
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
import { getClient } from '$lib/lemmy.svelte.js'
import { getClient } from '$lib/client/lemmy.svelte'
import { t } from '$lib/i18n/translations'
import type { Person } from 'lemmy-js-client'
import type { Person } from '$lib/client/types'
import { Button, Modal, toast } from 'mono-svelte'
import { Icon, PaperAirplane } from 'svelte-hero-icons'
import { errorMessage } from '$lib/lemmy/error'
@@ -2,8 +2,8 @@
import { preventDefault } from 'svelte/legacy'
import Avatar from '$lib/components/ui/Avatar.svelte'
import type { Community, Person } from 'lemmy-js-client'
import { getClient } from '$lib/lemmy.svelte.js'
import type { Community, Person } from '$lib/client/types'
import { getClient } from '$lib/client/lemmy.svelte'
import { toast } from 'mono-svelte'
import { profile } from '$lib/auth.svelte.js'
import { Button, Checkbox, Modal } from 'mono-svelte'
@@ -3,7 +3,7 @@
import ShieldIcon from '$lib/components/lemmy/moderation/ShieldIcon.svelte'
import { t } from '$lib/i18n/translations'
import { isCommentView } from '$lib/lemmy/item.js'
import type { CommentView } from 'lemmy-js-client'
import type { CommentView } from '$lib/client/types'
import { Button, Menu, MenuButton, MenuDivider } from 'mono-svelte'
import {
ArrowsUpDown,
@@ -1,10 +1,10 @@
<script lang="ts">
import { profile } from '$lib/auth.svelte.js'
import { t } from '$lib/i18n/translations'
import { getClient } from '$lib/lemmy.svelte'
import { getClient } from '$lib/client/lemmy.svelte'
import { errorMessage } from '$lib/lemmy/error'
import { isCommentView, isPostView } from '$lib/lemmy/item.js'
import type { CommentView, PostView } from 'lemmy-js-client'
import type { CommentView, PostView } from '$lib/client/types'
import { Menu, MenuButton, MenuDivider, toast } from 'mono-svelte'
import type { Snippet } from 'svelte'
import {
@@ -8,11 +8,11 @@
import Post from '$lib/components/lemmy/post/Post.svelte'
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
import { t } from '$lib/i18n/translations'
import { getClient } from '$lib/lemmy.svelte.js'
import { getClient } from '$lib/client/lemmy.svelte'
import { isCommentView, isPostView } from '$lib/lemmy/item.js'
import { settings } from '$lib/settings.svelte.js'
import { fullCommunityName } from '$lib/util.svelte.js'
import type { CommentView, PostView } from 'lemmy-js-client'
import type { CommentView, PostView } from '$lib/client/types'
import { Button, Modal, Select, Switch, toast } from 'mono-svelte'
import Option from 'mono-svelte/forms/select/Option.svelte'
import { Fire, Icon, Trash } from 'svelte-hero-icons'
@@ -6,12 +6,12 @@
import Post from '$lib/components/lemmy/post/Post.svelte'
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
import { t } from '$lib/i18n/translations'
import { getClient } from '$lib/lemmy.svelte.js'
import { getClient } from '$lib/client/lemmy.svelte'
import type {
CommentView,
PostView,
PrivateMessageView,
} from 'lemmy-js-client'
} from '$lib/client/types'
import { Button, Modal, toast } from 'mono-svelte'
import PrivateMessage from '../inbox/PrivateMessage.svelte'
import { errorMessage } from '$lib/lemmy/error'
@@ -1,8 +1,8 @@
<script lang="ts">
import { t } from '$lib/i18n/translations'
import { client } from '$lib/lemmy.svelte'
import { client } from '$lib/client/lemmy.svelte'
import { isCommentView, isPostView } from '$lib/lemmy/item'
import type { CommentView, PostView, VoteView } from 'lemmy-js-client'
import type { CommentView, PostView, VoteView } from '$lib/client/types'
import { Button, Modal, Spinner } from 'mono-svelte'
import {
ArrowDownCircle,
@@ -1,14 +1,13 @@
import { client } from '$lib/lemmy.svelte'
import type { SubmissionView } from '$lib/lemmy/contentview.js'
import { client } from '$lib/client/lemmy.svelte'
import type {
Comment,
CommentView,
Community,
MyUserInfo,
Person,
PostView,
PrivateMessageView,
} from 'lemmy-js-client'
} from '$lib/client/types'
import type { SubmissionView } from '$lib/lemmy/contentview.js'
import { writable } from 'svelte/store'
interface Modals {
@@ -112,7 +111,7 @@ export const amMod = (me: MyUserInfo, community: Community) =>
export const amModOfAny = (me?: MyUserInfo) =>
me && (me.moderates.length > 0 || isAdmin(me))
export const isAdmin = (me: MyUserInfo) => me.local_user_view.local_user.admin
export const isAdmin = (me: MyUserInfo) => me.local_user_view.person.admin
export const removalTemplate = (
input: string,
+1 -1
View File
@@ -10,7 +10,7 @@
} from '$lib/components/lemmy/post/PostMeta.svelte'
import { publishedToDate } from '$lib/components/util/date.js'
import { settings, type View } from '$lib/settings.svelte.js'
import type { PostView } from 'lemmy-js-client'
import type { PostView } from '$lib/client/types'
import type { ClassValue } from 'svelte/elements'
import PostBody from './PostBody.svelte'
@@ -1,5 +1,5 @@
<script lang="ts">
import type { PostView } from 'lemmy-js-client'
import type { PostView } from '$lib/client/types'
import Post from './Post.svelte'
interface Props {
@@ -54,7 +54,7 @@
import { t } from '$lib/i18n/translations'
import { instance } from '$lib/instance.svelte'
import { settings, type View } from '$lib/settings.svelte'
import type { Community, Person, SubscribedType } from 'lemmy-js-client'
import type { Community, Person, SubscribedType } from '$lib/client/types'
import { Badge, modal, Popover } from 'mono-svelte'
import {
Bookmark,
@@ -19,11 +19,11 @@
import { profile } from '$lib/auth.svelte.js'
import FormattedNumber from '$lib/components/util/FormattedNumber.svelte'
import { t } from '$lib/i18n/translations'
import { site } from '$lib/lemmy.svelte.js'
import { site } from '$lib/client/lemmy.svelte'
import { vote as voteItem } from '$lib/lemmy/contentview.js'
import { errorMessage } from '$lib/lemmy/error'
import { settings } from '$lib/settings.svelte'
import type { Post } from 'lemmy-js-client'
import type { Post } from '$lib/client/types'
import { buttonColor, toast } from 'mono-svelte'
import { ChevronDown, ChevronUp, Icon } from 'svelte-hero-icons'
import { backOut } from 'svelte/easing'
@@ -9,7 +9,7 @@
import { t } from '$lib/i18n/translations'
import { save } from '$lib/lemmy/contentview.js'
import { settings, type View } from '$lib/settings.svelte.js'
import type { PostView } from 'lemmy-js-client'
import type { PostView } from '$lib/client/types'
import { Button, Menu, Modal, Spinner } from 'mono-svelte'
import {
Bookmark,
@@ -6,7 +6,7 @@
import { setSessionStorage } from '$lib/session'
import { settings } from '$lib/settings.svelte'
import { instanceToURL } from '$lib/util.svelte'
import type { PostView } from 'lemmy-js-client'
import type { PostView } from '$lib/client/types'
import { Button, Menu, MenuButton, toast } from 'mono-svelte'
import {
ArrowTopRightOnSquare,
@@ -24,6 +24,8 @@
} from 'svelte-hero-icons'
import { report } from '../../moderation/moderation'
import { hidePost } from '../helpers'
import { client } from '$lib/client/lemmy.svelte'
import { PiefedClient } from '$lib/client/piefed/piefed'
interface Props {
post: PostView
@@ -162,26 +164,28 @@
</MenuButton>
{/if}
{#if profile.current.user?.local_user_view.person.id != post.creator.id}
<MenuButton
onclick={async () => {
if (!profile.current?.jwt) return
const hidden = await hidePost(
post.post.id,
!post.hidden,
profile.current?.jwt,
)
post.hidden = hidden
if (hidden) onhide?.(hidden)
}}
color="danger-subtle"
>
{#snippet prefix()}
<Icon src={XMark} size="16" micro />
{/snippet}
{post.hidden
? $t('post.actions.more.unhide')
: $t('post.actions.more.hide')}
</MenuButton>
{#if !(client() instanceof PiefedClient)}
<MenuButton
onclick={async () => {
if (!profile.current?.jwt) return
const hidden = await hidePost(
post.post.id,
!post.hidden,
profile.current?.jwt,
)
post.hidden = hidden
if (hidden) onhide?.(hidden)
}}
color="danger-subtle"
>
{#snippet prefix()}
<Icon src={XMark} size="16" micro />
{/snippet}
{post.hidden
? $t('post.actions.more.unhide')
: $t('post.actions.more.hide')}
</MenuButton>
{/if}
<MenuButton onclick={() => report(post)} color="danger-subtle">
{#snippet prefix()}
<Icon src={Flag} size="16" micro />
@@ -2,7 +2,7 @@
import Post from '$lib/components/lemmy/post/Post.svelte'
import Placeholder from '$lib/components/ui/Placeholder.svelte'
import { settings } from '$lib/settings.svelte.js'
import type { PostView } from 'lemmy-js-client'
import type { PostView } from '$lib/client/types'
import { Button } from 'mono-svelte'
import type { Snippet } from 'svelte'
import { ArchiveBox, Icon, Plus } from 'svelte-hero-icons'
@@ -5,14 +5,14 @@
import EndPlaceholder from '$lib/components/ui/EndPlaceholder.svelte'
import Placeholder from '$lib/components/ui/Placeholder.svelte'
import { t } from '$lib/i18n/translations'
import { client } from '$lib/lemmy.svelte'
import { client } from '$lib/client/lemmy.svelte'
import {
postFeeds,
type PostFeed,
type PostFeedID,
} from '$lib/lemmy/postfeed.svelte'
import { settings } from '$lib/settings.svelte.js'
import type { PostView } from 'lemmy-js-client'
import type { PostView } from '$lib/client/types'
import { Button } from 'mono-svelte'
import { onDestroy, onMount, untrack } from 'svelte'
import {
@@ -1,5 +1,5 @@
import { settings } from '$lib/settings.svelte'
import type { PostView } from 'lemmy-js-client'
import type { PostView } from '$lib/client/types'
import { SvelteMap, SvelteSet } from 'svelte/reactivity'
export type PostViewWithCrossposts = PostView & {
@@ -10,11 +10,11 @@
import Avatar from '$lib/components/ui/Avatar.svelte'
import Header from '$lib/components/ui/layout/pages/Header.svelte'
import { t } from '$lib/i18n/translations'
import { client, site } from '$lib/lemmy.svelte.js'
import { client, site } from '$lib/client/lemmy.svelte'
import { errorMessage } from '$lib/lemmy/error'
import { getSessionStorage, setSessionStorage } from '$lib/session.js'
import { placeholders } from '$lib/util.svelte.js'
import type { Community, Post, PostView } from 'lemmy-js-client'
import type { Community, Post, PostView } from '$lib/client/types'
import {
Button,
Modal,
+2 -2
View File
@@ -1,8 +1,8 @@
import { instance } from '$lib/instance.svelte'
import { client } from '$lib/lemmy.svelte.js'
import { client } from '$lib/client/lemmy.svelte'
import { isImage, isVideo } from '$lib/ui/image'
import { canParseUrl, findClosestNumber } from '$lib/util.svelte'
import type { CommentView, PersonView, Post } from 'lemmy-js-client'
import type { CommentView, PersonView, Post } from '$lib/client/types'
export const isCommentMutable = (comment: CommentView, me: PersonView) =>
me.person.id == comment.creator.id
@@ -1,7 +1,7 @@
<script lang="ts">
import { showImage } from '$lib/components/ui/ExpandableImage.svelte'
import { settings } from '$lib/settings.svelte'
import type { Post } from 'lemmy-js-client'
import type { Post } from '$lib/client/types'
import { Button, modal } from 'mono-svelte'
import { onMount } from 'svelte'
import { bestImageURL, postLink } from '../helpers'
@@ -5,7 +5,7 @@
} from '$lib/components/lemmy/post/helpers.js'
import PostLink from '$lib/components/lemmy/post/link/PostLink.svelte'
import { settings, type View } from '$lib/settings.svelte.js'
import type { Post } from 'lemmy-js-client'
import type { Post } from '$lib/client/types'
import PostIframe from './PostIframe.svelte'
import PostImage from './PostImage.svelte'
@@ -7,7 +7,7 @@
import { showImage } from '$lib/components/ui/ExpandableImage.svelte'
import { t } from '$lib/i18n/translations'
import { settings, type View } from '$lib/settings.svelte.js'
import type { Post } from 'lemmy-js-client'
import type { Post } from '$lib/client/types'
import { modal } from 'mono-svelte'
import Button from 'mono-svelte/button/Button.svelte'
import {
@@ -1,8 +1,8 @@
<script lang="ts">
import { profile } from '$lib/auth.svelte'
import Avatar from '$lib/components/ui/Avatar.svelte'
import { getClient } from '$lib/lemmy.svelte.js'
import type { ListingType, Person } from 'lemmy-js-client'
import { getClient } from '$lib/client/lemmy.svelte'
import type { ListingType, Person } from '$lib/client/types'
import { MenuButton, Search } from 'mono-svelte'
import { createEventDispatcher } from 'svelte'
import { Icon, XCircle } from 'svelte-hero-icons'
@@ -2,7 +2,7 @@
import Avatar from '$lib/components/ui/Avatar.svelte'
import LabelStat from '$lib/components/ui/LabelStat.svelte'
import { userLink } from '$lib/lemmy/generic'
import type { PersonView } from 'lemmy-js-client'
import type { PersonView } from '$lib/client/types'
interface Props {
user: PersonView
@@ -51,8 +51,9 @@
import Avatar from '$lib/components/ui/Avatar.svelte'
import Logo from '$lib/components/ui/Logo.svelte'
import { settings } from '$lib/settings.svelte.js'
import type { Person } from 'lemmy-js-client'
import type { Person } from '$lib/client/types'
import { Icon, Language, NoSymbol } from 'svelte-hero-icons'
import { Badge } from 'mono-svelte'
interface Props {
user: Person
@@ -140,6 +141,9 @@
/>
{/if}
{/if}
{#if user.flair}
<Badge color="blue-subtle" class="px-1.5! py-0.5!">{user.flair}</Badge>
{/if}
{@render extraBadges?.()}
{/if}
</a>
+14 -12
View File
@@ -20,15 +20,17 @@
}: Props = $props()
</script>
<div class="flex flex-col {clazz}">
<span class="text-slate-600 dark:text-zinc-400 text-xs {labelClass}">
{label}
</span>
<span class="text-base {contentClass}">
{#if formatted}
<FormattedNumber number={Number(content)} />
{:else}
{content}
{/if}
</span>
</div>
{#if content != '-1'}
<div class="flex flex-col {clazz}">
<span class="text-slate-600 dark:text-zinc-400 text-xs {labelClass}">
{label}
</span>
<span class="text-base {contentClass}">
{#if formatted}
<FormattedNumber number={Number(content)} />
{:else}
{content}
{/if}
</span>
</div>
{/if}
+1 -1
View File
@@ -7,7 +7,7 @@
import Avatar from '$lib/components/ui/Avatar.svelte'
import { t } from '$lib/i18n/translations'
import { LINKED_INSTANCE_URL } from '$lib/instance.svelte'
import { site } from '$lib/lemmy.svelte.js'
import { site } from '$lib/client/lemmy.svelte'
import { Menu, Spinner } from 'mono-svelte'
import {
Bars3,
+1 -1
View File
@@ -8,7 +8,7 @@
import SiteCard from '$lib/components/lemmy/SiteCard.svelte'
import { t } from '$lib/i18n/translations'
import { site } from '$lib/lemmy.svelte'
import { site } from '$lib/client/lemmy.svelte'
import { settings } from '$lib/settings.svelte'
import { theme } from '$lib/ui/colors.svelte'
import {
@@ -4,7 +4,7 @@
import SidebarButton from '$lib/components/ui/sidebar/SidebarButton.svelte'
import { addFavorite } from '$lib/lemmy/item'
import { hasFavorite } from '$lib/lemmy/user'
import type { Community } from 'lemmy-js-client'
import type { Community } from '$lib/client/types'
import { Button } from 'mono-svelte'
import { Icon, Star, Trash } from 'svelte-hero-icons'
import { flip } from 'svelte/animate'
@@ -12,6 +12,7 @@
import { goto } from '$app/navigation'
import { page } from '$app/state'
import { t } from '$lib/i18n/translations'
import { DEFAULT_CLIENT_TYPE } from '$lib/client/base'
let { profiles }: { profiles: ProfileInfo[] } = $props()
@@ -45,7 +46,7 @@
<div class="flex-1">
<div class="font-medium">{profile.current.username}</div>
<div class="text-xs text-slate-500 dark:text-zinc-500">
{profile.current.instance}
<span class="capitalize">{profile.current.client?.name ?? DEFAULT_CLIENT_TYPE.name}</span> • {profile.current.instance}
</div>
</div>
{#snippet suffix()}
@@ -70,7 +71,7 @@
<div>
<div class="font-medium text-sm">{p.username}</div>
<div class="text-xs text-slate-500 dark:text-zinc-500">
{p.instance}
<span class="capitalize">{p.client?.name ?? DEFAULT_CLIENT_TYPE.name}</span> • {p.instance}
</div>
</div>
<div class="flex-1"></div>