Merge branch 'main' into infinite-scroll

This commit is contained in:
Xylight committed 2024-07-07 18:20:19 -07:00
commit 0da8d729f6
30 files changed
+431 -224

No files matched your search

+2
View File
@@ -27,6 +27,7 @@
import { site } from '$lib/lemmy.js'
import ExpandableImage from '$lib/components/ui/ExpandableImage.svelte'
import { LINKED_INSTANCE_URL } from '$lib/instance'
import { locale } from '$lib/translations'
nProgress.configure({
minimum: 0.4,
@@ -105,6 +106,7 @@
Skip Navigation
</Button>
<Shell
dir={$locale == 'he' && $userSettings.useRtl ? 'rtl' : 'ltr'}
class="min-h-screen {$userSettings.font == 'inter'
? 'font-inter'
: $userSettings.font == 'system'
+3 -3
View File
@@ -1,16 +1,16 @@
<script>
import { goto } from '$app/navigation'
import { page } from '$app/stores'
import { profile } from '$lib/auth'
import { notifications, profile } from '$lib/auth'
import MultiSelect from '$lib/components/input/Switch.svelte'
import { t } from '$lib/translations'
import { Badge } from 'mono-svelte'
</script>
{#if ($profile?.user?.notifications.applications ?? 0) > 0}
{#if $notifications.applications > 0}
<span class="flex flex-row text-red-500 gap-2">
<Badge color="red-subtle" class="w-max">
{$profile?.user?.notifications.applications}
{$notifications.applications}
</Badge> unread applications
</span>
{/if}
+2 -1
View File
@@ -1,6 +1,7 @@
import { profile } from '$lib/auth.js'
import { get } from 'svelte/store'
import { getClient, site as siteStore } from '$lib/lemmy.js'
import { getClient } from '$lib/lemmy.js'
import { site as siteStore } from '$lib/lemmy'
export async function load({ fetch }) {
if (!get(profile)) return
@@ -1,5 +1,5 @@
<script lang="ts">
import { profile } from '$lib/auth.js'
import { notifications, profile } from '$lib/auth.js'
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
import { Material, toast } from 'mono-svelte'
@@ -60,7 +60,7 @@
application.admin = $profile.user!.local_user_view.person
application.registration_application.deny_reason = denyReason
$profile.user!.notifications.applications -= 1
$notifications.applications -= 1
} catch (err) {
toast({
content: err as any,
+2 -2
View File
@@ -13,7 +13,7 @@
import { goto } from '$app/navigation'
import { page } from '$app/stores'
import Pageination from '$lib/components/ui/Pageination.svelte'
import { profile } from '$lib/auth.js'
import { notifications, profile } from '$lib/auth.js'
import Placeholder from '$lib/components/ui/Placeholder.svelte'
import { fly } from 'svelte/transition'
import { searchParam } from '$lib/util.js'
@@ -36,7 +36,7 @@
const response = await getClient().markAllAsRead()
$profile.user.notifications.inbox = 0
$notifications.inbox = 0
goto($page.url, {
invalidateAll: true,
+2 -2
View File
@@ -2,7 +2,7 @@
import Comment from '$lib/components/lemmy/comment/Comment.svelte'
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
import { getClient } from '$lib/lemmy.js'
import { profile } from '$lib/auth.js'
import { notifications, profile } from '$lib/auth.js'
import {
ArrowUturnLeft,
ArrowUturnUp,
@@ -58,7 +58,7 @@
}
item.read = isRead
if ($profile.user) $profile.user.notifications.inbox += isRead ? -1 : 1
if ($profile.user) $notifications.inbox += isRead ? -1 : 1
loading = false
}
-4
View File
@@ -34,10 +34,6 @@
username: form.username,
}
profile.set({
...newProfile,
})
return {
profile: id,
profiles: [...pd.profiles, newProfile],
+2 -2
View File
@@ -10,7 +10,7 @@
PrivateMessageReportView,
} from 'lemmy-js-client'
import { Check, Icon } from 'svelte-hero-icons'
import { profile } from '$lib/auth.js'
import { notifications, profile } from '$lib/auth.js'
import { Button } from 'mono-svelte'
import type { ReportView } from '$lib/lemmy/report.js'
import PrivateMessage from '$lib/components/lemmy/inbox/PrivateMessage.svelte'
@@ -77,7 +77,7 @@
}
}
$profile.user.notifications.reports += item.resolved ? 1 : -1
$notifications.reports += item.resolved ? 1 : -1
} catch (err) {
toast({
content: err as any,
@@ -48,17 +48,19 @@
let post = data.post
// onMount(async () => {
// if (
// !(post.post_view.read && $userSettings.markPostsAsRead) &&
// $profile?.jwt
// ) {
// getClient().markPostAsRead({
// read: $userSettings.markPostsAsRead,
// post_id: post.post_view.post.id,
// })
// }
// })
onMount(async () => {
if (
!(post.post_view.read && $userSettings.markPostsAsRead) &&
$profile?.jwt
) {
getClient().markPostAsRead({
read: $userSettings.markPostsAsRead,
post_ids: [post.post_view.post.id],
// @ts-ignore
post_id: post.post_view.post.id,
})
}
})
afterNavigate(async () => {
// reactivity hack
@@ -333,7 +335,7 @@ flex-wrap gap-4 sticky top-20 w-full box-border z-20 mt-4"
{/each}
</div>
{:then comments}
{#if $profile?.user}
{#if $profile?.jwt}
<CommentForm
postId={post.post_view.post.id}
on:comment={(comment) =>
@@ -343,7 +345,7 @@ flex-wrap gap-4 sticky top-20 w-full box-border z-20 mt-4"
])}
locked={(post.post_view.post.locked &&
!(
$profile?.user.local_user_view.local_user.admin ||
$profile?.user?.local_user_view.local_user.admin ||
$profile?.user?.moderates
.map((c) => c.community.id)
.includes(data.post.community_view.community.id)
+35 -27
View File
@@ -35,7 +35,7 @@
import { DOMAIN_REGEX_FORMS, removeItem } from '$lib/util.js'
import Section from './Section.svelte'
import ToggleSetting from './ToggleSetting.svelte'
import { locales, t } from '$lib/translations'
import { locale, locales, t } from '$lib/translations'
import { defaultLinks, iconOfLink } from '$lib/components/ui/navbar/link'
let pin: string = ''
@@ -135,32 +135,40 @@
</Section>
<Section title={$t('settings.app.title')}>
<Setting>
<span slot="title" class="inline-flex items-center gap-2">
{$t('settings.app.lang.title')}
<Badge>{$t('settings.beta')}</Badge>
</span>
<p slot="description">
{$t('settings.app.lang.description')}
<Note>
{$t('settings.app.lang.note')}
</Note>
<Link href="/translators" highlight class="text-base font-semibold">
{$t('settings.app.lang.credits')}
</Link>
</p>
<Select bind:value={$userSettings.language}>
<option value={null}>{$t('settings.app.lang.auto')}</option>
{#each $locales as locale}
<option value={locale}>
{$t(`settings.app.lang.${locale}`, { default: locale })}
</option>
{/each}
{#if $userSettings.debugInfo}
<option value="dev">Raw Strings</option>
{/if}
</Select>
</Setting>
<div class="flex flex-col gap-2">
<Setting>
<span slot="title" class="inline-flex items-center gap-2">
{$t('settings.app.lang.title')}
<Badge>{$t('settings.beta')}</Badge>
</span>
<p slot="description">
{$t('settings.app.lang.description')}
<Note>
{$t('settings.app.lang.note')}
</Note>
<Link href="/translators" highlight class="text-base font-semibold">
{$t('settings.app.lang.credits')}
</Link>
</p>
<Select bind:value={$userSettings.language}>
<option value={null}>{$t('settings.app.lang.auto')}</option>
{#each $locales as locale}
<option value={locale}>
{$t(`settings.app.lang.${locale}`, { default: locale })}
</option>
{/each}
{#if $userSettings.debugInfo}
<option value="dev">Raw Strings</option>
{/if}
</Select>
</Setting>
{#if $locale == 'he'}
<ToggleSetting
bind:checked={$userSettings.useRtl}
title={$t('settings.app.lang.useRtl.title')}
></ToggleSetting>
{/if}
</div>
<Setting>
<span slot="title">{$t('settings.app.view.title')}</span>
<ViewSelect showLabel={false} />