auth: rename profile.data -> profile.current

This commit is contained in:
James Xylight committed 2025-07-12 10:26:45 -07:00
1 parent 1edad4ac60
commit 36a9631707
76 files changed
+233 -224

No files matched your search

+1 -1
View File
@@ -14,7 +14,7 @@
let loading = $state(false)
async function deleteImage(image: LocalImage) {
if (!profile.data?.jwt) return
if (!profile.current?.jwt) return
try {
loading = true
@@ -50,7 +50,7 @@
let editingLoad = $state(false)
async function save(type: 'reply' | 'edit') {
if (!profile.data?.jwt || newComment.length <= 0) return
if (!profile.current?.jwt || newComment.length <= 0) return
editingLoad = true
@@ -60,7 +60,7 @@
<Icon src={ChatBubbleOvalLeft} size="14" micro />
<span class="text-xs">{$t('comment.reply')}</span>
</Button>
{#if profile.data?.user && (amMod(profile.data?.user, comment.community) || isAdmin(profile.data.user))}
{#if profile.current?.user && (amMod(profile.current?.user, comment.community) || isAdmin(profile.current.user))}
<CommentModerationMenu bind:item={comment} />
{/if}
<Menu placement="bottom">
@@ -90,8 +90,8 @@
<Icon src={Square2Stack} mini size="16" />
<div>{$t('post.actions.more.share')}</div>
</MenuButton>
{#if profile.data?.jwt}
{#if comment.creator.id == profile.data.user?.local_user_view.person.id}
{#if profile.current?.jwt}
{#if comment.creator.id == profile.current.user?.local_user_view.person.id}
<MenuButton onclick={() => onedit?.(comment)}>
<Icon src={PencilSquare} mini size="16" />
<span>{$t('post.actions.more.edit')}</span>
@@ -99,7 +99,7 @@
{/if}
<MenuButton
onclick={async () => {
if (profile.data?.jwt)
if (profile.current?.jwt)
comment.saved = await save(comment, !comment.saved)
}}
>
@@ -108,11 +108,11 @@
{comment.saved ? $t('post.actions.unsave') : $t('post.actions.save')}
</span>
</MenuButton>
{#if profile.data?.user && profile.data.jwt && profile.data.user.local_user_view.person.id == comment.creator.id}
{#if profile.current?.user && profile.current.jwt && profile.current.user.local_user_view.person.id == comment.creator.id}
<MenuButton
color="danger-subtle"
onclick={async () => {
if (profile.data?.jwt)
if (profile.current?.jwt)
comment.comment.deleted = await deleteItem(
comment,
!comment.comment.deleted,
@@ -127,7 +127,7 @@
</span>
</MenuButton>
{/if}
{#if profile.data.jwt && profile.data.user?.local_user_view.person.id != comment.creator.id}
{#if profile.current.jwt && profile.current.user?.local_user_view.person.id != comment.creator.id}
<MenuButton onclick={() => report(comment)} color="danger-subtle">
<Icon src={Flag} mini size="16" />
<span>{$t('moderation.report')}</span>
@@ -51,7 +51,7 @@
let language: number | undefined = $state()
async function submit() {
if (!profile.data?.user || !profile.data?.jwt || value == '') return
if (!profile.current?.user || !profile.current?.jwt || value == '') return
loading = true
@@ -24,7 +24,7 @@
}: Props = $props()
const castVote = async (newVote: number) => {
if (!profile.data?.jwt) {
if (!profile.current?.jwt) {
toast({ content: $t('toast.loginVoteGate'), type: 'warning' })
return
}
@@ -113,7 +113,7 @@
})
async function subscribe() {
if (!profile.data?.jwt) return
if (!profile.current?.jwt) return
loading.subscribing = true
const subscribed =
community_view.subscribed == 'Subscribed' ||
@@ -227,7 +227,7 @@
{/if}
</div>
<div class="flex flex-row items-center gap-1 sticky bottom-0 w-full">
{#if profile.data?.jwt}
{#if profile.current?.jwt}
<Button
disabled={loading.subscribing}
loading={loading.subscribing}
@@ -252,7 +252,7 @@
: $t('cards.community.subscribe')}
</Button>
{/if}
{#if profile.data?.user && amMod(profile.data.user, community_view.community)}
{#if profile.current?.user && amMod(profile.current.user, community_view.community)}
<Button
href="/c/{fullCommunityName(
community_view.community.name,
@@ -278,7 +278,7 @@
<Icon src={Newspaper} size="16" mini />
{$t('cards.community.modlog')}
</MenuButton>
{#if profile.data?.jwt}
{#if profile.current?.jwt}
<MenuButton
color="danger-subtle"
size="lg"
@@ -292,7 +292,7 @@
? $t('cards.community.unblock')
: $t('cards.community.block')}
</MenuButton>
{#if profile.data?.user}
{#if profile.current?.user}
<MenuButton
color="danger-subtle"
size="lg"
@@ -304,7 +304,7 @@
{$t('cards.community.blockInstance')}
</MenuButton>
{/if}
{#if profile.data?.user && isAdmin(profile.data.user)}
{#if profile.current?.user && isAdmin(profile.current.user)}
<MenuButton
color="danger-subtle"
onclick={() =>
@@ -64,7 +64,7 @@
let formData = $state(passedFormData)
async function submit() {
if (!profile.data?.jwt) return
if (!profile.current?.jwt) return
if ((!edit && formData.name == '') || formData.displayName == '') return
formData.submitting = true
@@ -99,23 +99,23 @@
type: 'success',
})
if (profile.data.user) {
const c = profile.data.user.moderates
if (profile.current.user) {
const c = profile.current.user.moderates
.map(m => m.community.id)
.indexOf(res.community_view.community.id)
if (c != -1) {
profile.data.user.moderates[c] = {
profile.current.user.moderates[c] = {
community: res.community_view.community,
moderator: profile.data.user.local_user_view.person,
moderator: profile.current.user.local_user_view.person,
}
} else {
profile.data.user = {
...profile.data.user,
profile.current.user = {
...profile.current.user,
moderates: [
...profile.data.user.moderates,
...profile.current.user.moderates,
{
community: res.community_view.community,
moderator: profile.data.user.local_user_view.person,
moderator: profile.current.user.local_user_view.person,
},
],
}
@@ -115,7 +115,7 @@
</Expandable>
{/if}
<div class="flex items-center gap-2 h-max w-max">
{#if profile.data?.jwt}
{#if profile.current?.jwt}
<Subscribe
community={{
community: community,
@@ -153,7 +153,7 @@
</Subscribe>
{/if}
{#if profile.data?.user && profile.data.user.moderates
{#if profile.current?.user && profile.current.user.moderates
.map(c => c.community.id)
.includes(community.id)}
<Button
@@ -181,7 +181,7 @@
<Icon src={Newspaper} size="16" mini />
{$t('cards.community.modlog')}
</MenuButton>
{#if profile.data.user && amMod(profile.data.user, community)}
{#if profile.current.user && amMod(profile.current.user, community)}
<MenuButton
color="success-subtle"
href="/moderation?community={community.id}"
@@ -190,7 +190,7 @@
{$t('routes.moderation.feed')}
</MenuButton>
{/if}
{#if profile.data?.jwt}
{#if profile.current?.jwt}
<MenuButton
color="danger-subtle"
size="lg"
@@ -203,7 +203,7 @@
? $t('cards.community.unblock')
: $t('cards.community.block')}
</MenuButton>
{#if profile.data?.user}
{#if profile.current?.user}
<MenuButton
color="danger-subtle"
size="lg"
@@ -215,7 +215,7 @@
{$t('cards.community.blockInstance')}
</MenuButton>
{/if}
{#if profile.data?.user && isAdmin(profile.data.user)}
{#if profile.current?.user && isAdmin(profile.current.user)}
<MenuButton
color="danger-subtle"
onclick={() =>
@@ -155,7 +155,7 @@
<Subscribe {community}>
{#snippet children({ subscribe, subscribing })}
<Button
disabled={subscribing || !profile.data?.jwt}
disabled={subscribing || !profile.current?.jwt}
loading={subscribing}
onclick={async () => {
const res = await subscribe()
@@ -51,14 +51,14 @@
<Option value="Local" icon={MapPin}>{$t('filter.location.local')}</Option>
<Option
value="Subscribed"
disabled={profile.data?.jwt == undefined}
disabled={profile.current?.jwt == undefined}
icon={Newspaper}
>
{$t('filter.location.subscribed')}
</Option>
<Option
value="ModeratorView"
disabled={!profile.data?.jwt || !amModOfAny(profile.data?.user)}
disabled={!profile.current?.jwt || !amModOfAny(profile.current?.user)}
icon={ShieldCheck}
>
{$t('filter.location.moderator')}
@@ -23,7 +23,7 @@
avatar
avatarSize={20}
/>
{#if profile.data?.user?.local_user_view.person.id != message.recipient.id}
{#if profile.current?.user?.local_user_view.person.id != message.recipient.id}
to
<UserLink
showInstance={false}
@@ -32,7 +32,7 @@
)
async function upload() {
if (!profile.data?.jwt || image == null) return
if (!profile.current?.jwt || image == null) return
progress = 0
@@ -40,7 +40,7 @@
const uploaded = (
await Promise.all(
Array.from(image).map(i =>
uploadImage(i, profile.data.instance, profile.data.jwt!)
uploadImage(i, profile.current.instance, profile.current.jwt!)
.then(uploaded => {
progress += 1 / (image?.length ?? 0)
return uploaded
@@ -23,7 +23,7 @@
let loading = $state(false)
async function sendMessage() {
if (!profile.data?.jwt || message == '') return
if (!profile.current?.jwt || message == '') return
loading = true
@@ -45,7 +45,7 @@
})
async function submit() {
if (!item || !profile.data?.user || !profile.data?.jwt) return
if (!item || !profile.current?.user || !profile.current?.jwt) return
loading = true
@@ -34,9 +34,9 @@
<ShieldIcon filled width={14} />
</Button>
{/snippet}
{#if (profile.data?.user && amMod(profile.data.user, item.community)) || (profile.data?.user && isAdmin(profile.data.user))}
{#if (profile.current?.user && amMod(profile.current.user, item.community)) || (profile.current?.user && isAdmin(profile.current.user))}
<MenuDivider>
{#if !item.community.local && !amMod(profile.data.user, item.community)}
{#if !item.community.local && !amMod(profile.current.user, item.community)}
{$t('moderation.labelInstanceOnly')}
{:else}
{$t('moderation.label')}
@@ -52,7 +52,7 @@
: $t('moderation.remove')}
{/if}
</MenuButton>
{#if profile.data?.user && profile.data.user?.local_user_view.person.id != item.creator.id}
{#if profile.current?.user && profile.current.user?.local_user_view.person.id != item.creator.id}
<!--Comment made by someone else-->
<MenuButton
color="danger-subtle"
@@ -71,12 +71,12 @@
<MenuButton
color="success-subtle"
onclick={async () => {
if (!profile.data.jwt) return
if (!profile.current.jwt) return
item.comment = (
await feature(
!item.comment.distinguished,
item.comment,
profile.data.jwt,
profile.current.jwt,
)
).comment_view.comment
}}
@@ -104,7 +104,7 @@
</MenuButton>
{/if}
{#if profile.data?.user && isAdmin(profile.data.user)}
{#if profile.current?.user && isAdmin(profile.current.user)}
<MenuDivider>{$t('admin.label')}</MenuDivider>
<MenuButton color="danger-subtle" onclick={() => remove(item, true)}>
{#snippet prefix()}
@@ -32,7 +32,7 @@
let acting = $derived(locking || pinning)
async function lock(lock: boolean) {
if (!profile.data?.jwt || !isPostView(item)) return
if (!profile.current?.jwt || !isPostView(item)) return
locking = true
try {
@@ -53,7 +53,7 @@
}
async function pin(pinned: boolean, toInstance: boolean = false) {
if (!profile.data?.jwt || !isPostView(item)) return
if (!profile.current?.jwt || !isPostView(item)) return
pinning = true
@@ -88,9 +88,9 @@
<ShieldIcon filled width={16} />
</Button>
{/snippet}
{#if (profile.data?.user && amMod(profile.data.user, item.community)) || (profile.data?.user && isAdmin(profile.data.user))}
{#if (profile.current?.user && amMod(profile.current.user, item.community)) || (profile.current?.user && isAdmin(profile.current.user))}
<MenuDivider>
{#if !item.community.local && !amMod(profile.data.user, item.community)}
{#if !item.community.local && !amMod(profile.current.user, item.community)}
{$t('moderation.labelInstanceOnly')}
{:else}
{$t('moderation.label')}
@@ -124,7 +124,7 @@
? $t('moderation.unfeature')
: $t('moderation.feature')}
</span>
{#if isAdmin(profile.data.user)}
{#if isAdmin(profile.current.user)}
<span class="text-xs opacity-80">{$t('form.post.community')}</span>
{/if}
</div>
@@ -139,7 +139,7 @@
{item.post.removed ? $t('moderation.restore') : $t('moderation.remove')}
{/if}
</MenuButton>
{#if profile.data?.user && profile.data.user.local_user_view.person.id != item.creator.id}
{#if profile.current?.user && profile.current.user.local_user_view.person.id != item.creator.id}
<MenuButton
color="danger-subtle"
onclick={() =>
@@ -164,7 +164,7 @@
{$t('moderation.votes')}
</MenuButton>
{/if}
{#if profile.data?.user && isAdmin(profile.data.user)}
{#if profile.current?.user && isAdmin(profile.current.user)}
<MenuDivider>{$t('admin.label')}</MenuDivider>
<MenuButton
color="success-subtle"
@@ -76,7 +76,7 @@
async function remove() {
if (!item) return
if (!profile.data?.jwt) throw new Error('Unauthenticated')
if (!profile.current?.jwt) throw new Error('Unauthenticated')
loading = true
@@ -216,7 +216,7 @@
bind:value={reason}
/>
{#if !removed && profile.data?.user && (amMod(profile.data.user, item.community) || (isAdmin(profile.data.user) && item.community.local))}
{#if !removed && profile.current?.user && (amMod(profile.current.user, item.community) || (isAdmin(profile.current.user) && item.community.local))}
<Switch bind:checked={commentReason}>
{$t('moderation.removeSubmission.withReason')}
</Switch>
@@ -39,7 +39,7 @@
let reason = $state('')
async function report() {
if (!item || !profile.data?.jwt || reason == '') return
if (!item || !profile.current?.jwt || reason == '') return
loading = true
try {
+1 -1
View File
@@ -117,7 +117,7 @@
user={post.creator}
published={publishedToDate(post.post.published)}
{badges}
subscribed={profile.data?.user?.follows
subscribed={profile.current?.user?.follows
.map(c => c.community.id)
.includes(post.community.id)
? 'Subscribed'
@@ -117,8 +117,8 @@
score={post.counts.score}
upvotes={post.counts.upvotes}
downvotes={post.counts.downvotes}
showCounts={profile.data?.user?.local_user_view?.local_user?.show_scores ??
true}
showCounts={profile.current?.user?.local_user_view?.local_user
?.show_scores ?? true}
/>
<Button
@@ -160,7 +160,7 @@
{/snippet}
</Button>
{/if}
{#if profile.data?.user && (amMod(profile.data.user, post.community) || isAdmin(profile.data.user))}
{#if profile.current?.user && (amMod(profile.current.user, post.community) || isAdmin(profile.current.user))}
<ModerationMenu
size="custom"
color="ghost"
@@ -171,10 +171,10 @@
/>
{/if}
{#if profile.data?.jwt}
{#if profile.current?.jwt}
<Button
onclick={async () => {
if (!profile.data?.jwt) return
if (!profile.current?.jwt) return
saving = true
post.saved = await save(post, !post.saved)
saving = false
@@ -228,7 +228,7 @@
<MenuDivider>
{$t('post.actions.more.actions')}
</MenuDivider>
{#if profile.data?.user && profile.data?.jwt && profile.data.user.local_user_view.person.id == post.creator.id}
{#if profile.current?.user && profile.current?.jwt && profile.current.user.local_user_view.person.id == post.creator.id}
<MenuButton onclick={() => (editing = true)}>
{#snippet prefix()}
<Icon src={PencilSquare} size="16" micro />
@@ -236,10 +236,10 @@
{$t('post.actions.more.edit')}
</MenuButton>
{/if}
{#if profile.data?.jwt}
{#if profile.current?.jwt}
<MenuButton
onclick={async () => {
if (profile.data?.jwt)
if (profile.current?.jwt)
post.read = await markAsRead(post.post, !post.read)
}}
>
@@ -297,7 +297,7 @@
</div>
{/if}
</MenuButton>
{#if profile.data?.jwt}
{#if profile.current?.jwt}
<MenuButton
onclick={() => {
setSessionStorage('postDraft', {
@@ -326,10 +326,10 @@
{/snippet}
{$t('post.actions.more.crosspost')}
</MenuButton>
{#if profile.data.user && post.creator.id == profile.data.user.local_user_view.person.id}
{#if profile.current.user && post.creator.id == profile.current.user.local_user_view.person.id}
<MenuButton
onclick={async () => {
if (profile.data?.jwt)
if (profile.current?.jwt)
post.post.deleted = await deleteItem(post, !post.post.deleted)
}}
color="danger-subtle"
@@ -342,15 +342,15 @@
: $t('post.actions.more.delete')}
</MenuButton>
{/if}
{#if profile.data.user?.local_user_view.person.id != post.creator.id}
{#if profile.current.user?.local_user_view.person.id != post.creator.id}
{#if feature('hidePosts', site.data?.version)}
<MenuButton
onclick={async () => {
if (!profile.data?.jwt) return
if (!profile.current?.jwt) return
const hidden = await hidePost(
post.post.id,
!post.hidden,
profile.data?.jwt,
profile.current?.jwt,
)
post.hidden = hidden
if (hidden) onhide?.(hidden)
@@ -51,7 +51,7 @@
let loading = $state(false)
const castVote = async (newVote: number) => {
if (!profile.data?.jwt) {
if (!profile.current?.jwt) {
toast({ content: $t('toast.loginVoteGate'), type: 'warning' })
return
}
@@ -134,7 +134,7 @@
})
return
}
if (!data.title || !profile.data?.jwt) return
if (!data.title || !profile.current?.jwt) return
if (data.url && data.url != '') {
try {
new URL(data.url)
@@ -275,7 +275,7 @@
<ObjectAutocomplete
bind:q={communitySearch}
items={communities}
jwt={profile.data?.jwt}
jwt={profile.current?.jwt}
listing_type="All"
label={$t('form.post.community')}
required
@@ -42,7 +42,7 @@
).users.map(c => c.person)
if (hideOwnUser) {
const myself = profile.data.user?.local_user_view.person.id
const myself = profile.current.user?.local_user_view.person.id
return users.filter(c => c.id != myself)
}
return users
+14 -14
View File
@@ -86,7 +86,7 @@
style="border-radius: inherit;"
>
<div class="ml-auto"></div>
{#if profile.data?.user && isAdmin(profile.data.user)}
{#if profile.current?.user && isAdmin(profile.current.user)}
<NavButton
href="/admin"
label={$t('nav.admin')}
@@ -95,7 +95,7 @@
isSelectedFilter={path => path.startsWith('/admin')}
/>
{/if}
{#if amModOfAny(profile.data?.user)}
{#if amModOfAny(profile.current?.user)}
<NavButton
href="/moderation"
label={$t('nav.moderation')}
@@ -109,10 +109,10 @@
icon={GlobeAlt}
/>
<NavButton href="/search" label={$t('nav.search')} icon={MagnifyingGlass} />
{#if profile.data.jwt}
{#if profile.current.jwt}
{@const linkOnly =
!profile.data.user ||
!(isAdmin(profile.data.user) || amModOfAny(profile.data.user))}
!profile.current.user ||
!(isAdmin(profile.current.user) || amModOfAny(profile.current.user))}
<Menu manual={linkOnly} placement="top">
{#snippet target()}
<NavButton
@@ -136,7 +136,7 @@
{@render notifBadge($notifications.inbox)}
{/snippet}
</MenuButton>
{#if amModOfAny(profile.data.user)}
{#if amModOfAny(profile.current.user)}
<MenuButton href="/moderation" icon={ShieldCheck}>
{$t('routes.moderation.feed')}
{#snippet suffix()}
@@ -144,7 +144,7 @@
{/snippet}
</MenuButton>
{/if}
{#if profile.data.user && isAdmin(profile.data.user)}
{#if profile.current.user && isAdmin(profile.current.user)}
<MenuButton href="/admin/applications" icon={ServerStack}>
{$t('routes.admin.applications.title')}
{#snippet suffix()}
@@ -156,7 +156,7 @@
{/if}
<Menu
manual={site.data?.site_view.local_site.community_creation_admin_only &&
!(profile.data.user && isAdmin(profile.data.user))}
!(profile.current.user && isAdmin(profile.current.user))}
placement="top"
>
{#snippet target()}
@@ -166,13 +166,13 @@
icon={Plus}
adaptive={false}
href={site.data?.site_view.local_site.community_creation_admin_only &&
!(profile.data.user && isAdmin(profile.data.user))
!(profile.current.user && isAdmin(profile.current.user))
? '/create/post'
: undefined}
/>
{/snippet}
<MenuDivider>{$t('nav.create.label')}</MenuDivider>
<MenuButton link href="/create/post" disabled={!profile.data?.jwt}>
<MenuButton link href="/create/post" disabled={!profile.current?.jwt}>
{#snippet prefix()}
<Icon src={PencilSquare} size="16" micro />
{/snippet}
@@ -181,17 +181,17 @@
<MenuButton
link
href="/create/community"
disabled={!profile.data?.jwt ||
!profile.data?.user ||
disabled={!profile.current?.jwt ||
!profile.current?.user ||
(site.data?.site_view.local_site.community_creation_admin_only &&
!isAdmin(profile.data.user))}
!isAdmin(profile.current.user))}
>
{#snippet prefix()}
<Icon src={Newspaper} size="16" micro />
{/snippet}
{$t('nav.create.community')}
</MenuButton>
{#if !profile.data?.jwt}
{#if !profile.current?.jwt}
<span class="text-sm mx-4 my-1 py-1">
{$t('nav.create.logingate')}
</span>
+4 -4
View File
@@ -72,14 +72,14 @@
hover:bg-slate-200 dark:hover:bg-zinc-700 group cursor-pointer {buttonClass}"
title={$t('profile.profile')}
>
{#if profile.data?.user}
{#if profile.current?.user}
<div
class="w-full h-full aspect-square object-cover rounded-full grid place-items-center group-hover:scale-90 transition-transform group-active:scale-[85%]"
>
<Avatar
url={profile.data.user.local_user_view.person.avatar}
url={profile.current.user.local_user_view.person.avatar}
width={36}
alt={profile.data.user.local_user_view.person.name}
alt={profile.current.user.local_user_view.person.name}
/>
</div>
{:else}
@@ -90,7 +90,7 @@
</button>
{/snippet}
<MenuDivider>{$t('nav.menu.label')}</MenuDivider>
{#if profile.data?.jwt}
{#if profile.current?.jwt}
<MenuButton href="/profile">
{#snippet prefix()}
<Icon src={UserCircle} micro size="16" />
@@ -23,7 +23,7 @@
$effect(() => {
groups = getGroups(
$resumables,
profile.data,
profile.current,
profileData.profiles,
theme.data,
page.data.contextual?.actions,
@@ -25,7 +25,7 @@
animate:flip={{ duration: 500, easing: expoOut }}
>
<div class="flex-none grid group">
{#if profile && !hasFavorite(profile.data, follow.id)}
{#if profile && !hasFavorite(profile.current, follow.id)}
<Button
rounding="pill"
size="custom"
@@ -36,7 +36,7 @@
>
<Icon src={Star} size="16" mini />
</Button>
{:else if isFavorites && profile && hasFavorite(profile.data, follow.id)}
{:else if isFavorites && profile && hasFavorite(profile.current, follow.id)}
<Button
rounding="pill"
size="custom"
@@ -53,7 +53,9 @@
alt={follow.name}
title={follow.title}
width={28}
class={!isFavorites && profile && hasFavorite(profile.data, follow.id)
class={!isFavorites &&
profile &&
hasFavorite(profile.current, follow.id)
? ''
: 'group-hover:hidden'}
/>
@@ -23,11 +23,11 @@
loading={switching}
rounding="lg"
loaderWidth={22}
selected={profile.data?.id == prof.id}
selected={profile.current?.id == prof.id}
onclick={async () => {
switching = true
if (profile.data?.id != prof.id) {
if (profile.current?.id != prof.id) {
await setUserID(prof.id)
}
@@ -37,7 +37,7 @@
switching = false
}}
class="w-full font-normal {profile.data?.id == prof.id
class="w-full font-normal {profile.current?.id == prof.id
? 'bg-slate-100! dark:bg-zinc-900!'
: ''}"
>
@@ -46,11 +46,11 @@
profile={prof}
{index}
{guest}
selected={profile.data?.id == prof.id}
selected={profile.current?.id == prof.id}
/>
{/snippet}
<span
class="inline-flex flex-col gap-0 {profile.data?.id == prof.id
class="inline-flex flex-col gap-0 {profile.current?.id == prof.id
? 'font-semibold'
: ''}"
>
+12 -10
View File
@@ -31,7 +31,7 @@
class={['flex flex-col p-4 overflow-auto gap-1 h-fit max-h-screen', clazz]}
{style}
>
{#if profile.data?.jwt}
{#if profile.current?.jwt}
<SidebarButton icon={UserCircle} href="/profile">
{#snippet label()}
<span>
@@ -120,7 +120,7 @@
</Expandable>
{/if}
<hr class="border-slate-200 dark:border-zinc-900 my-1" />
{#if profile.data?.favorites && profile.data?.favorites.length > 0}
{#if profile.current?.favorites && profile.current?.favorites.length > 0}
<Expandable
class="max-w-full min-w-0 w-full"
bind:open={settings.expand.favorites}
@@ -131,18 +131,18 @@
{$t('routes.profile.favorites')}
{#snippet action()}
<span class="dark:text-white text-black">
{profile.data.favorites?.length}
{profile.current.favorites?.length}
</span>
{/snippet}
</EndPlaceholder>
</span>
{/snippet}
<CommunityList isFavorites items={profile.data.favorites} />
<CommunityList isFavorites items={profile.current.favorites} />
</Expandable>
<hr class="border-slate-200 dark:border-zinc-900 my-1" />
{/if}
{#if profile.data?.user}
{#if profile.data?.user.moderates.length > 0}
{#if profile.current?.user}
{#if profile.current?.user.moderates.length > 0}
<Expandable
class="max-w-full min-w-0 w-full"
bind:open={settings.expand.moderates}
@@ -153,14 +153,14 @@
{$t('routes.profile.moderates')}
{#snippet action()}
<span class="dark:text-white text-black">
{profile.data.user?.moderates.length}
{profile.current.user?.moderates.length}
</span>
{/snippet}
</EndPlaceholder>
</span>
{/snippet}
<CommunityList
items={profile.data.user.moderates.map(i => i.community)}
items={profile.current.user.moderates.map(i => i.community)}
/>
</Expandable>
<hr class="border-slate-200 dark:border-zinc-900 my-1" />
@@ -176,13 +176,15 @@
{$t('profile.subscribed')}
{#snippet action()}
<span class="dark:text-white text-black">
{profile.data.user?.follows.length}
{profile.current.user?.follows.length}
</span>
{/snippet}
</EndPlaceholder>
</span>
{/snippet}
<CommunityList items={profile.data.user.follows.map(i => i.community)} />
<CommunityList
items={profile.current.user.follows.map(i => i.community)}
/>
</Expandable>
{/if}
</nav>