Merge branch 'main' into infinite-scroll
This commit is contained in:
commit
0da8d729f6
30 files changed
+400
-193
No files matched your search
+79
-125
@@ -4,7 +4,8 @@ import {
|
|||||||
} from '$lib/components/lemmy/moderation/moderation.js'
|
} from '$lib/components/lemmy/moderation/moderation.js'
|
||||||
import { toast } from 'mono-svelte'
|
import { toast } from 'mono-svelte'
|
||||||
import { DEFAULT_INSTANCE_URL, instance } from '$lib/instance.js'
|
import { DEFAULT_INSTANCE_URL, instance } from '$lib/instance.js'
|
||||||
import { client, getClient, site } from '$lib/lemmy.js'
|
import { client, getClient } from '$lib/lemmy.js'
|
||||||
|
import { site } from './lemmy'
|
||||||
import { userSettings } from '$lib/settings.js'
|
import { userSettings } from '$lib/settings.js'
|
||||||
import { instanceToURL, moveItem } from '$lib/util.js'
|
import { instanceToURL, moveItem } from '$lib/util.js'
|
||||||
import {
|
import {
|
||||||
@@ -13,7 +14,7 @@ import {
|
|||||||
type MyUserInfo,
|
type MyUserInfo,
|
||||||
type Community,
|
type Community,
|
||||||
} from 'lemmy-js-client'
|
} from 'lemmy-js-client'
|
||||||
import { get, writable } from 'svelte/store'
|
import { derived, get, writable, type Writable } from 'svelte/store'
|
||||||
import { MINIMUM_VERSION, versionIsSupported } from '$lib/version.js'
|
import { MINIMUM_VERSION, versionIsSupported } from '$lib/version.js'
|
||||||
import { browser } from '$app/environment'
|
import { browser } from '$app/environment'
|
||||||
import { env } from '$env/dynamic/public'
|
import { env } from '$env/dynamic/public'
|
||||||
@@ -57,12 +58,12 @@ interface ProfileData {
|
|||||||
defaultInstance?: string
|
defaultInstance?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface PersonData extends MyUserInfo {
|
interface PersonData extends MyUserInfo {}
|
||||||
notifications: {
|
|
||||||
|
interface Notifications {
|
||||||
inbox: number
|
inbox: number
|
||||||
reports: number
|
reports: number
|
||||||
applications: number
|
applications: number
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const getCookie = (key: string): string | undefined => {
|
const getCookie = (key: string): string | undefined => {
|
||||||
@@ -91,19 +92,75 @@ export let profileData = writable<ProfileData>(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
// stupid hack to get dev server working
|
let fetchingUser = false
|
||||||
// why does this always happen to me
|
|
||||||
|
|
||||||
let initialInstance = get(profileData).defaultInstance
|
export let profile = derived<Writable<ProfileData>, Profile>(
|
||||||
|
profileData,
|
||||||
|
(pd) => {
|
||||||
|
const profile =
|
||||||
|
pd.profiles.find((p) => p.id == pd.profile) ?? getDefaultProfile()
|
||||||
|
|
||||||
|
if (profile?.jwt) {
|
||||||
|
if (!profile.user && !fetchingUser) {
|
||||||
|
site.set(undefined)
|
||||||
|
|
||||||
|
fetchingUser = true
|
||||||
|
|
||||||
|
notifications.set({ applications: 0, inbox: 0, reports: 0 })
|
||||||
|
|
||||||
|
userFromJwt(profile.jwt, profile.instance)
|
||||||
|
.then((res) => {
|
||||||
|
if (!res?.user)
|
||||||
|
toast({
|
||||||
|
content: 'Your login has expired. Re-login to fix this issue.',
|
||||||
|
type: 'warning',
|
||||||
|
})
|
||||||
|
|
||||||
|
site.set(res?.site)
|
||||||
|
|
||||||
|
profile.user = res?.user
|
||||||
|
profile.avatar = res?.user.local_user_view.person.avatar
|
||||||
|
|
||||||
|
checkInbox()
|
||||||
|
|
||||||
|
fetchingUser = false
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
fetchingUser = false
|
||||||
|
toast({ content: e, type: 'error' })
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
site.set(undefined)
|
||||||
|
client({ instanceURL: profile.instance })
|
||||||
|
.getSite()
|
||||||
|
.then((res) => site.set(res))
|
||||||
|
}
|
||||||
|
|
||||||
|
instance.set(profile.instance)
|
||||||
|
|
||||||
|
return profile
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
export let notifications = writable<Notifications>({
|
||||||
|
applications: 0,
|
||||||
|
inbox: 0,
|
||||||
|
reports: 0,
|
||||||
|
})
|
||||||
|
|
||||||
profileData.subscribe(async (pd) => {
|
profileData.subscribe(async (pd) => {
|
||||||
setFromStorage('profileData', pd)
|
const serialized: ProfileData = {
|
||||||
|
...pd,
|
||||||
|
profiles: pd.profiles.map((p) => serializeUser(p)),
|
||||||
|
}
|
||||||
|
|
||||||
if (pd.profile == -1 && initialInstance != pd.defaultInstance) {
|
setFromStorage('profileData', serialized)
|
||||||
initialInstance = get(profileData).defaultInstance ?? DEFAULT_INSTANCE_URL
|
|
||||||
|
if (serialized.profile == -1) {
|
||||||
instance?.set(get(profileData).defaultInstance ?? DEFAULT_INSTANCE_URL)
|
instance?.set(get(profileData).defaultInstance ?? DEFAULT_INSTANCE_URL)
|
||||||
}
|
}
|
||||||
if (pd.profiles.length == 0) {
|
if (serialized.profiles.length == 0) {
|
||||||
profileData.update((pd) => ({
|
profileData.update((pd) => ({
|
||||||
...pd,
|
...pd,
|
||||||
profiles: [
|
profiles: [
|
||||||
@@ -145,43 +202,6 @@ if (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export let profile = writable<Profile | undefined>(getProfile())
|
|
||||||
|
|
||||||
profile.subscribe(async (p) => {
|
|
||||||
if (p?.id == -1) {
|
|
||||||
instance?.set(get(profileData).defaultInstance ?? DEFAULT_INSTANCE_URL)
|
|
||||||
}
|
|
||||||
if (!p) return
|
|
||||||
|
|
||||||
instance.set(p.instance)
|
|
||||||
// fetch the user because p.user is undefined
|
|
||||||
if (p?.jwt && !p?.user) {
|
|
||||||
const user = await userFromJwt(p.jwt, p.instance)
|
|
||||||
.then((user) => {
|
|
||||||
if (!user?.user)
|
|
||||||
toast({
|
|
||||||
content: 'Your login has expired. Re-login to fix this issue.',
|
|
||||||
type: 'warning',
|
|
||||||
})
|
|
||||||
site.set(user?.site)
|
|
||||||
|
|
||||||
return user
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
toast({ content: err as any, type: 'error' })
|
|
||||||
})
|
|
||||||
|
|
||||||
if (!user?.user) return
|
|
||||||
|
|
||||||
profile.update(() => ({
|
|
||||||
...p,
|
|
||||||
user: user!.user,
|
|
||||||
username: user?.user.local_user_view.person.name,
|
|
||||||
avatar: user?.user.local_user_view.person.avatar,
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
export async function setUser(jwt: string, inst: string, username: string) {
|
export async function setUser(jwt: string, inst: string, username: string) {
|
||||||
try {
|
try {
|
||||||
new URL(instanceToURL(inst))
|
new URL(instanceToURL(inst))
|
||||||
@@ -217,11 +237,6 @@ export async function setUser(jwt: string, inst: string, username: string) {
|
|||||||
avatar: user.user.local_user_view.person.avatar,
|
avatar: user.user.local_user_view.person.avatar,
|
||||||
}
|
}
|
||||||
|
|
||||||
profile.set({
|
|
||||||
...newProfile,
|
|
||||||
user: user!.user,
|
|
||||||
})
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
profile: id,
|
profile: id,
|
||||||
profiles: [newProfile, ...pd.profiles],
|
profiles: [newProfile, ...pd.profiles],
|
||||||
@@ -261,32 +276,12 @@ async function userFromJwt(
|
|||||||
if (!myUser) return undefined
|
if (!myUser) return undefined
|
||||||
|
|
||||||
return {
|
return {
|
||||||
user: {
|
user: myUser,
|
||||||
notifications: {
|
|
||||||
applications: 0,
|
|
||||||
inbox: 0,
|
|
||||||
reports: 0,
|
|
||||||
},
|
|
||||||
...myUser,
|
|
||||||
},
|
|
||||||
site: site,
|
site: site,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getProfile() {
|
|
||||||
const id = get(profileData).profile
|
|
||||||
|
|
||||||
if (id == -1) {
|
|
||||||
return getDefaultProfile()
|
|
||||||
}
|
|
||||||
|
|
||||||
const pd = get(profileData)
|
|
||||||
|
|
||||||
return pd.profiles.find((p) => p.id == id)
|
|
||||||
}
|
|
||||||
|
|
||||||
export function resetProfile() {
|
export function resetProfile() {
|
||||||
profile.set(getDefaultProfile())
|
|
||||||
profileData.update((p) => ({ ...p, profile: -1 }))
|
profileData.update((p) => ({ ...p, profile: -1 }))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -308,10 +303,12 @@ export function deleteProfile(id: number) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const serializeUser = (user: Profile): Profile => ({
|
function serializeUser(user: Profile): Profile {
|
||||||
|
return {
|
||||||
...user,
|
...user,
|
||||||
user: undefined,
|
user: undefined,
|
||||||
})
|
}
|
||||||
|
}
|
||||||
|
|
||||||
instance.subscribe(async (i) => {
|
instance.subscribe(async (i) => {
|
||||||
try {
|
try {
|
||||||
@@ -324,35 +321,8 @@ instance.subscribe(async (i) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
export async function setUserID(id: number) {
|
export async function setUserID(id: number) {
|
||||||
const pd = get(profileData)
|
|
||||||
if (id == -1) {
|
|
||||||
resetProfile()
|
|
||||||
instance.set(DEFAULT_INSTANCE_URL)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
let prof = pd.profiles.find((p) => p.id == id)
|
|
||||||
|
|
||||||
if (!prof) return profile.update(() => getDefaultProfile())
|
|
||||||
prof = serializeUser(prof)
|
|
||||||
|
|
||||||
profileData.update((p) => ({ ...p, profile: id }))
|
profileData.update((p) => ({ ...p, profile: id }))
|
||||||
|
return get(profile)
|
||||||
if (prof?.jwt) {
|
|
||||||
const user = await userFromJwt(prof.jwt, prof.instance)
|
|
||||||
.then((u) => u)
|
|
||||||
.catch((err) => {
|
|
||||||
toast({ content: err as any, type: 'error' })
|
|
||||||
})
|
|
||||||
instance.set(prof.instance)
|
|
||||||
prof.user = user?.user
|
|
||||||
prof.avatar = user?.user.local_user_view.person.avatar
|
|
||||||
site.set(user?.site)
|
|
||||||
}
|
|
||||||
|
|
||||||
profile.update(() => prof ?? getDefaultProfile())
|
|
||||||
|
|
||||||
return prof
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function moveProfile(id: number, up: boolean) {
|
export function moveProfile(id: number, up: boolean) {
|
||||||
@@ -369,11 +339,7 @@ export function moveProfile(id: number, up: boolean) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const getNotificationCount = async (
|
async function getNotificationCount(jwt: string, mod: boolean, admin: boolean) {
|
||||||
jwt: string,
|
|
||||||
mod: boolean,
|
|
||||||
admin: boolean
|
|
||||||
) => {
|
|
||||||
const unreads = await getClient().getUnreadCount()
|
const unreads = await getClient().getUnreadCount()
|
||||||
|
|
||||||
let reports: number = 0
|
let reports: number = 0
|
||||||
@@ -419,26 +385,14 @@ async function checkInbox() {
|
|||||||
const notifs = await getNotificationCount(
|
const notifs = await getNotificationCount(
|
||||||
jwt,
|
jwt,
|
||||||
amModOfAny(user) ?? false,
|
amModOfAny(user) ?? false,
|
||||||
isAdmin(user)
|
user ? isAdmin(user) : false
|
||||||
)
|
)
|
||||||
|
|
||||||
user.notifications = {
|
notifications.set({
|
||||||
inbox: notifs.unreads,
|
inbox: notifs.unreads,
|
||||||
applications: notifs.applications,
|
applications: notifs.applications,
|
||||||
reports: notifs.reports,
|
reports: notifs.reports,
|
||||||
}
|
})
|
||||||
|
|
||||||
profile.update((p) => ({
|
|
||||||
...p!,
|
|
||||||
user: user,
|
|
||||||
}))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setInterval(checkInbox, 4 * 60 * 1000)
|
setInterval(checkInbox, 4 * 60 * 1000)
|
||||||
|
|
||||||
let prevId: number | undefined = -2
|
|
||||||
profile.subscribe((p) => {
|
|
||||||
if (p?.id == prevId || !p?.user) return
|
|
||||||
prevId = p?.id
|
|
||||||
if (p.id != -1) checkInbox()
|
|
||||||
})
|
|
||||||
@@ -55,6 +55,11 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
@component
|
||||||
|
This is the sole component for displaying posts.
|
||||||
|
It adapts to all kinds of form factors for different contexts, such as feeds, full post view, and crosspost list.
|
||||||
|
-->
|
||||||
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
||||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||||
<Material
|
<Material
|
||||||
|
|||||||
@@ -14,6 +14,10 @@
|
|||||||
$: richURL = parseURL(url)
|
$: richURL = parseURL(url)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
@component
|
||||||
|
For embed-type posts. Displays embed card or a compact link.
|
||||||
|
-->
|
||||||
{#if embed_title && !compact}
|
{#if embed_title && !compact}
|
||||||
<Material color="distinct" class="flex flex-row gap-4">
|
<Material color="distinct" class="flex flex-row gap-4">
|
||||||
<div class="flex flex-col gap-2">
|
<div class="flex flex-col gap-2">
|
||||||
|
|||||||
@@ -45,6 +45,10 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
@component
|
||||||
|
This component will build two different things: a post's meta block and the title.
|
||||||
|
-->
|
||||||
<div
|
<div
|
||||||
class="grid w-full meta {community
|
class="grid w-full meta {community
|
||||||
? 'grid-rows-2'
|
? 'grid-rows-2'
|
||||||
@@ -184,6 +188,8 @@
|
|||||||
>
|
>
|
||||||
<Markdown source={title} inline noStyle class="leading-[1.3]"></Markdown>
|
<Markdown source={title} inline noStyle class="leading-[1.3]"></Markdown>
|
||||||
</a>
|
</a>
|
||||||
|
{:else}
|
||||||
|
<div style="grid-area: title; margin: 0;"></div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ export const bestImageURL = (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (compact && post.thumbnail_url)
|
if (compact && post.thumbnail_url)
|
||||||
return `${post.thumbnail_url}?thumbnail=256&format=webp`
|
return `${post.thumbnail_url}?thumbnail=512&format=webp`
|
||||||
else if (compact && post.url) return `${post.url}?thumbnail=256&format=webp`
|
else if (compact && post.url) return `${post.url}?thumbnail=512&format=webp`
|
||||||
|
|
||||||
if (post.url) return `${post.url}?thumbnail=${width}&format=webp`
|
if (post.url) return `${post.url}?thumbnail=${width}&format=webp`
|
||||||
else if (post.thumbnail_url)
|
else if (post.thumbnail_url)
|
||||||
@@ -37,7 +37,7 @@ export const optimizeImageURL = (
|
|||||||
url.searchParams.append('format', 'webp')
|
url.searchParams.append('format', 'webp')
|
||||||
url.searchParams.append(
|
url.searchParams.append(
|
||||||
'thumbnail',
|
'thumbnail',
|
||||||
findClosestNumber([128, 256, 512, 1024], width).toString()
|
findClosestNumber([128, 256, 512, 728, 1024, 1536], width).toString()
|
||||||
)
|
)
|
||||||
return url.toString()
|
return url.toString()
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@@ -92,6 +92,10 @@
|
|||||||
$: embedUrl = urlToEmbed(url)
|
$: embedUrl = urlToEmbed(url)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
@component
|
||||||
|
Displays a video file or embedded video iframe.
|
||||||
|
-->
|
||||||
{#if opened}
|
{#if opened}
|
||||||
{#if type == 'video'}
|
{#if type == 'video'}
|
||||||
<!-- svelte-ignore a11y-media-has-caption -->
|
<!-- svelte-ignore a11y-media-has-caption -->
|
||||||
|
|||||||
@@ -23,6 +23,12 @@
|
|||||||
let showAltText = false
|
let showAltText = false
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
@component
|
||||||
|
This component will show either
|
||||||
|
- A media item (pictures, videos) (large form factor posts only)
|
||||||
|
- Embed link/card.
|
||||||
|
-->
|
||||||
{#if type == 'image'}
|
{#if type == 'image'}
|
||||||
{#if view == 'card' || view == 'cozy'}
|
{#if view == 'card' || view == 'cozy'}
|
||||||
<!--disabled preloads here since most people will hover over every image while scrolling-->
|
<!--disabled preloads here since most people will hover over every image while scrolling-->
|
||||||
@@ -39,9 +45,9 @@
|
|||||||
>
|
>
|
||||||
<!-- svelte-ignore a11y-missing-attribute -->
|
<!-- svelte-ignore a11y-missing-attribute -->
|
||||||
<img
|
<img
|
||||||
src={bestImageURL(post, false, 256)}
|
src={bestImageURL(post, false, 64)}
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
class="-z-10 absolute top-0 left-0 w-full h-full object-cover blur-xl opacity-50"
|
class="-z-10 absolute top-0 left-0 w-full h-full object-cover blur-xl opacity-40"
|
||||||
/>
|
/>
|
||||||
<picture class="max-h-[inherit]">
|
<picture class="max-h-[inherit]">
|
||||||
<source
|
<source
|
||||||
|
|||||||
@@ -17,6 +17,10 @@
|
|||||||
export let type: MediaType = 'none'
|
export let type: MediaType = 'none'
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
@component
|
||||||
|
Thumbnails for compact and list view posts.
|
||||||
|
-->
|
||||||
{#if view == 'compact' || (view == 'list' && type != 'none')}
|
{#if view == 'compact' || (view == 'list' && type != 'none')}
|
||||||
<div
|
<div
|
||||||
class="w-24 sm:w-32 h-24 relative group/media {$$props.class ?? ''}"
|
class="w-24 sm:w-32 h-24 relative group/media {$$props.class ?? ''}"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import { createAvatar } from '@dicebear/core'
|
import { createAvatar } from '@dicebear/core'
|
||||||
import * as initials from '@dicebear/initials'
|
import * as initials from '@dicebear/initials'
|
||||||
|
|
||||||
const sizes = [48, 64, 128, 256, 512]
|
const sizes = [16, 32, 48, 64, 128, 256, 512]
|
||||||
|
|
||||||
export let url: string | undefined
|
export let url: string | undefined
|
||||||
export let alt: string = ''
|
export let alt: string = ''
|
||||||
|
|||||||
@@ -68,7 +68,11 @@
|
|||||||
|
|
||||||
<svelte:window bind:innerWidth={screenWidth} />
|
<svelte:window bind:innerWidth={screenWidth} />
|
||||||
|
|
||||||
<div class="shell {$$props.class}" style={colorsToVars($colors)}>
|
<div
|
||||||
|
{...$$restProps}
|
||||||
|
class="shell {$$props.class}"
|
||||||
|
style={colorsToVars($colors)}
|
||||||
|
>
|
||||||
<slot />
|
<slot />
|
||||||
<div
|
<div
|
||||||
class="
|
class="
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { profile, profileData } from '$lib/auth.js'
|
import { notifications, profile, profileData } from '$lib/auth.js'
|
||||||
import Link from '$lib/components/input/Link.svelte'
|
import Link from '$lib/components/input/Link.svelte'
|
||||||
import ShieldIcon from '$lib/components/lemmy/moderation/ShieldIcon.svelte'
|
import ShieldIcon from '$lib/components/lemmy/moderation/ShieldIcon.svelte'
|
||||||
import {
|
import {
|
||||||
@@ -112,7 +112,7 @@
|
|||||||
class="relative"
|
class="relative"
|
||||||
isSelectedFilter={(path) => path.startsWith('/admin')}
|
isSelectedFilter={(path) => path.startsWith('/admin')}
|
||||||
>
|
>
|
||||||
{#if ($profile?.user?.notifications.applications ?? 0) > 0}
|
{#if ($notifications.applications ?? 0) > 0}
|
||||||
<div
|
<div
|
||||||
class="rounded-full w-2 h-2 bg-red-500 absolute -top-1 -left-1"
|
class="rounded-full w-2 h-2 bg-red-500 absolute -top-1 -left-1"
|
||||||
/>
|
/>
|
||||||
@@ -125,7 +125,7 @@
|
|||||||
label={$t('nav.moderation')}
|
label={$t('nav.moderation')}
|
||||||
class="relative"
|
class="relative"
|
||||||
>
|
>
|
||||||
{#if ($profile?.user?.notifications.reports ?? 0) > 0}
|
{#if ($notifications.reports ?? 0) > 0}
|
||||||
<div
|
<div
|
||||||
class="rounded-full w-2 h-2 bg-red-500 absolute -top-1 -left-1"
|
class="rounded-full w-2 h-2 bg-red-500 absolute -top-1 -left-1"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { profile } from '$lib/auth'
|
import { notifications, profile } from '$lib/auth'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Badge,
|
Badge,
|
||||||
@@ -73,7 +73,7 @@
|
|||||||
alt={$profile.user.local_user_view.person.name}
|
alt={$profile.user.local_user_view.person.name}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{#if $profile.user.notifications.inbox > 0}
|
{#if $notifications.inbox > 0}
|
||||||
<div
|
<div
|
||||||
class="rounded-full w-2 h-2 bg-red-500 absolute top-0 left-0 z-10"
|
class="rounded-full w-2 h-2 bg-red-500 absolute top-0 left-0 z-10"
|
||||||
/>
|
/>
|
||||||
@@ -104,9 +104,9 @@
|
|||||||
<MenuButton link href="/inbox">
|
<MenuButton link href="/inbox">
|
||||||
<Icon src={Inbox} mini width={16} slot="prefix" />
|
<Icon src={Inbox} mini width={16} slot="prefix" />
|
||||||
{$t('profile.inbox')}
|
{$t('profile.inbox')}
|
||||||
{#if $profile.user.notifications.inbox > 0}
|
{#if $notifications.inbox > 0}
|
||||||
<Badge color="red-subtle" class="text-xs ml-auto font-bold !py-0.5">
|
<Badge color="red-subtle" class="text-xs ml-auto font-bold !py-0.5">
|
||||||
{$profile.user.notifications.inbox}
|
{$notifications.inbox}
|
||||||
</Badge>
|
</Badge>
|
||||||
{/if}
|
{/if}
|
||||||
</MenuButton>
|
</MenuButton>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
UserCircle,
|
UserCircle,
|
||||||
UserGroup,
|
UserGroup,
|
||||||
} from 'svelte-hero-icons'
|
} from 'svelte-hero-icons'
|
||||||
import { profile, profileData } from '$lib/auth.js'
|
import { notifications, profile, profileData } from '$lib/auth.js'
|
||||||
import { userSettings } from '$lib/settings.js'
|
import { userSettings } from '$lib/settings.js'
|
||||||
import SidebarButton from '$lib/components/ui/sidebar/SidebarButton.svelte'
|
import SidebarButton from '$lib/components/ui/sidebar/SidebarButton.svelte'
|
||||||
import CommunityList from '$lib/components/ui/sidebar/CommunityList.svelte'
|
import CommunityList from '$lib/components/ui/sidebar/CommunityList.svelte'
|
||||||
@@ -70,12 +70,12 @@
|
|||||||
<SidebarButton icon={Inbox} href="/inbox">
|
<SidebarButton icon={Inbox} href="/inbox">
|
||||||
<span slot="label" class="flex items-center gap-2">
|
<span slot="label" class="flex items-center gap-2">
|
||||||
{$t('profile.inbox')}
|
{$t('profile.inbox')}
|
||||||
{#if $profile?.user?.notifications.inbox}
|
{#if $notifications.inbox}
|
||||||
<Badge
|
<Badge
|
||||||
class="w-5 h-5 !p-0 grid place-items-center ml-auto"
|
class="w-5 h-5 !p-0 grid place-items-center ml-auto"
|
||||||
color="red-subtle"
|
color="red-subtle"
|
||||||
>
|
>
|
||||||
{$profile?.user?.notifications.inbox}
|
{$notifications.inbox}
|
||||||
</Badge>
|
</Badge>
|
||||||
{/if}
|
{/if}
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -582,7 +582,11 @@
|
|||||||
"fi": "Finnish",
|
"fi": "Finnish",
|
||||||
"pt": "Portuguese",
|
"pt": "Portuguese",
|
||||||
"auto": "Auto",
|
"auto": "Auto",
|
||||||
"credits": "Credits"
|
"credits": "Credits",
|
||||||
|
"useRtl": {
|
||||||
|
"title": "Use RTL layout",
|
||||||
|
"description": "Use an RTL layout for RTL languages."
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"view": {
|
"view": {
|
||||||
"title": "Post style",
|
"title": "Post style",
|
||||||
|
|||||||
+15
-3
@@ -115,7 +115,7 @@
|
|||||||
"slurFilter": "Kielletyt sanat (regex)",
|
"slurFilter": "Kielletyt sanat (regex)",
|
||||||
"federation": "Federointi päällä",
|
"federation": "Federointi päällä",
|
||||||
"captcha": {
|
"captcha": {
|
||||||
"enabled": "Päällä"
|
"enabled": "CAPTCHA Päällä"
|
||||||
},
|
},
|
||||||
"emailAdminsOnApplication": "Lähetä ylläpitäjille sähköposti-ilmoitus hakemuksista",
|
"emailAdminsOnApplication": "Lähetä ylläpitäjille sähköposti-ilmoitus hakemuksista",
|
||||||
"federationDebug": "Federoinnin vianetsintätila"
|
"federationDebug": "Federoinnin vianetsintätila"
|
||||||
@@ -357,7 +357,8 @@
|
|||||||
"generateTitle": "Hae otsikko",
|
"generateTitle": "Hae otsikko",
|
||||||
"create": "Luo julkaisu",
|
"create": "Luo julkaisu",
|
||||||
"edit": "Muokkaa julkaisua",
|
"edit": "Muokkaa julkaisua",
|
||||||
"url": "URL"
|
"url": "URL",
|
||||||
|
"altText": "Vaihtoehtoinen teksti"
|
||||||
},
|
},
|
||||||
"profile": {
|
"profile": {
|
||||||
"2fa": {
|
"2fa": {
|
||||||
@@ -601,6 +602,10 @@
|
|||||||
"placeholders": {
|
"placeholders": {
|
||||||
"title": "Satunnaiset paikkamerkit",
|
"title": "Satunnaiset paikkamerkit",
|
||||||
"description": "Näytä satunnaisia paikkamerkkejä tyhjillä tekstikentillä."
|
"description": "Näytä satunnaisia paikkamerkkejä tyhjillä tekstikentillä."
|
||||||
|
},
|
||||||
|
"colorscheme": {
|
||||||
|
"title": "Väritila",
|
||||||
|
"description": "Valitse väritila."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"title": "Asetukset",
|
"title": "Asetukset",
|
||||||
@@ -620,6 +625,10 @@
|
|||||||
"on": "Päällä",
|
"on": "Päällä",
|
||||||
"off": "Pois päältä",
|
"off": "Pois päältä",
|
||||||
"adaptive": "Mukautuva"
|
"adaptive": "Mukautuva"
|
||||||
|
},
|
||||||
|
"pins": {
|
||||||
|
"title": "Kiinnitykset",
|
||||||
|
"description": "Lisää kiinnityksiä sivupalkkiin napsauttamalla kuvaketta. Napsauta oikealla poistaaksesi sen."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lemmy": {
|
"lemmy": {
|
||||||
@@ -688,6 +697,9 @@
|
|||||||
"description": "Näytä vianetsintätiedot"
|
"description": "Näytä vianetsintätiedot"
|
||||||
},
|
},
|
||||||
"title": "Muut"
|
"title": "Muut"
|
||||||
}
|
},
|
||||||
|
"desktop": "Työpöytä",
|
||||||
|
"tablet": "Tabletti",
|
||||||
|
"mobile": "Mobiili"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+182
-1
@@ -1 +1,182 @@
|
|||||||
{}
|
{
|
||||||
|
"filter": {
|
||||||
|
"unread": "לא נקרא",
|
||||||
|
"location": {
|
||||||
|
"label": "מיקום",
|
||||||
|
"all": "הכל",
|
||||||
|
"local": "מקומי",
|
||||||
|
"subscribed": "רשום",
|
||||||
|
"moderator": "מנהל",
|
||||||
|
"global": "גלובלי"
|
||||||
|
},
|
||||||
|
"sort": {
|
||||||
|
"label": "מיון",
|
||||||
|
"active": "פעיל",
|
||||||
|
"hot": "חם",
|
||||||
|
"top": {
|
||||||
|
"time": {
|
||||||
|
"label": "זמן",
|
||||||
|
"all": "הכל",
|
||||||
|
"9months": "9 חודשים",
|
||||||
|
"6months": "6 חודשים",
|
||||||
|
"3months": "3 חודשים",
|
||||||
|
"month": "חודש",
|
||||||
|
"week": "שבוע",
|
||||||
|
"day": "יום",
|
||||||
|
"12hours": "12 שעות",
|
||||||
|
"6hours": "6 שעות",
|
||||||
|
"hour": "שעה"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"new": "חדש",
|
||||||
|
"old": "ישן",
|
||||||
|
"controversial": "שנוי במחלוקת",
|
||||||
|
"mostcomments": "תגובות",
|
||||||
|
"newcomments": "תגובות חדשות"
|
||||||
|
},
|
||||||
|
"view": {
|
||||||
|
"label": "פריסה",
|
||||||
|
"cozy": "נוח",
|
||||||
|
"list": "רשימה",
|
||||||
|
"compact": "דחוס",
|
||||||
|
"legacy": "ישן"
|
||||||
|
},
|
||||||
|
"type": "סוג",
|
||||||
|
"filter": "סינון",
|
||||||
|
"inbox": {
|
||||||
|
"messages": "הודעות",
|
||||||
|
"replies": "תגובות",
|
||||||
|
"mentions": "אזכורים"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"form": {
|
||||||
|
"profile": {
|
||||||
|
"showBots": "הצגת בוטים",
|
||||||
|
"2fa": {
|
||||||
|
"paste": "נא להדביק את זה באפליקציית ה-authenticator שלך.",
|
||||||
|
"totp": "TOTP",
|
||||||
|
"2fa": "2FA"
|
||||||
|
},
|
||||||
|
"displayName": "כינוי",
|
||||||
|
"bio": "אודות",
|
||||||
|
"avatar": "תמונת פרופיל",
|
||||||
|
"banner": "באנר",
|
||||||
|
"email": "אימייל",
|
||||||
|
"matrix": "משתמש Matrix",
|
||||||
|
"showNSFW": "הצגת תוכן למבוגרים",
|
||||||
|
"bot": "חשבון בוט",
|
||||||
|
"currentPassword": "סיסמה נוכחית",
|
||||||
|
"newPassword": "סיסמה חדשה",
|
||||||
|
"verifyNewPassword": "אימות סיסמה חדשה",
|
||||||
|
"deleteAccount": {
|
||||||
|
"label": "מחיקת חשבון",
|
||||||
|
"deleteContent": "מחיקת תוכן"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"confirmPassword": "אישור סיסמה",
|
||||||
|
"post": {
|
||||||
|
"title": "כותרת",
|
||||||
|
"altText": "טקסט חלופי",
|
||||||
|
"create": "יצירת פוסט",
|
||||||
|
"edit": "עריכת פוסט",
|
||||||
|
"community": "קהילה",
|
||||||
|
"url": "קישור",
|
||||||
|
"body": "גוף",
|
||||||
|
"nsfw": "תוכן למבוגרים",
|
||||||
|
"generateTitle": "יצירת כותרת",
|
||||||
|
"uploadImage": "העלאת תמונה"
|
||||||
|
},
|
||||||
|
"signup": {
|
||||||
|
"application": {
|
||||||
|
"info": "כדי להצטרף לשרת זה, חובה למלא את בקשת ההצטרפות ולחכות לקבלה. ישלח אימייל כאשר בקשתך התקבלה.",
|
||||||
|
"label": "בקשה להצטרפות"
|
||||||
|
},
|
||||||
|
"title": "הרשמה",
|
||||||
|
"description": "נא לבחור שרת שמעניין אותך, או לכתוב קישור באופן ידני.",
|
||||||
|
"chooseInstance": "בחירת שרת",
|
||||||
|
"closed": {
|
||||||
|
"title": "רישומים סגורים",
|
||||||
|
"description": "בשרת זה הרישומים סגורים. נא למצוא שרת אחר.",
|
||||||
|
"anotherInstance": "מציאת שרת אחר"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"email": "אימייל",
|
||||||
|
"description": "תיאור",
|
||||||
|
"username": "שם משתמש",
|
||||||
|
"name": "שם",
|
||||||
|
"password": "סיסמה",
|
||||||
|
"2fa": "קוד 2FA",
|
||||||
|
"forgotpassword": "שכחתי את הסיסמה",
|
||||||
|
"submit": "שליחה",
|
||||||
|
"edit": "עריכה",
|
||||||
|
"preview": "תצוגה מקדימה"
|
||||||
|
},
|
||||||
|
"profile": {
|
||||||
|
"profile": "פרופיל",
|
||||||
|
"inbox": "דואר נכנס",
|
||||||
|
"saved": "שמורים"
|
||||||
|
},
|
||||||
|
"routes": {
|
||||||
|
"frontpage": {
|
||||||
|
"footer": "{{users:number}} {{users; 1:משתמש; default:משתמשים;}} {{users; 1:פעיל; default:פעילים;}}",
|
||||||
|
"title": "דף הבית"
|
||||||
|
},
|
||||||
|
"modlog": "יומן הנהלה",
|
||||||
|
"instances": "שרתים",
|
||||||
|
"legal": {
|
||||||
|
"title": "משפטי",
|
||||||
|
"noLegal": "לשרת זה אין מידע משפטי."
|
||||||
|
},
|
||||||
|
"profile": {
|
||||||
|
"user": "משתמש",
|
||||||
|
"settings": "הגדרות"
|
||||||
|
},
|
||||||
|
"translators": "מתרגמים",
|
||||||
|
"accounts": "חשבונות",
|
||||||
|
"communities": "קהילות",
|
||||||
|
"search": {
|
||||||
|
"title": "חיפוש"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nav": {
|
||||||
|
"home": "בית",
|
||||||
|
"admin": "מנהל",
|
||||||
|
"moderation": "מנהל",
|
||||||
|
"communities": "קהילות",
|
||||||
|
"search": "חיפוש",
|
||||||
|
"create": {
|
||||||
|
"label": "יצירה",
|
||||||
|
"community": "קהילה",
|
||||||
|
"logingate": "חובה עליך להתחבר כדי ליצור תוכן."
|
||||||
|
},
|
||||||
|
"menu": {
|
||||||
|
"label": "פרופיל",
|
||||||
|
"app": "אפליקציה",
|
||||||
|
"settings": "הגדרות",
|
||||||
|
"colorscheme": {
|
||||||
|
"label": "צבעים",
|
||||||
|
"system": "מערכת",
|
||||||
|
"dark": "כהה",
|
||||||
|
"light": "בהיר"
|
||||||
|
},
|
||||||
|
"theme": "סגנון",
|
||||||
|
"about": "אודות",
|
||||||
|
"source": "מקור",
|
||||||
|
"donate": "תרומה",
|
||||||
|
"instance": "שרת"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"account": {
|
||||||
|
"login": "התחברות",
|
||||||
|
"logout": "התנתקות",
|
||||||
|
"signup": "הרשמה",
|
||||||
|
"accounts": "חשבונות",
|
||||||
|
"changeinstance": "שינוי שרת",
|
||||||
|
"resetColor": "איפוס צבעים",
|
||||||
|
"addGuest": "הוספת אורח",
|
||||||
|
"moveUp": "הזזה למעלה",
|
||||||
|
"moveDown": "הזזה למטה",
|
||||||
|
"guest": "אורח",
|
||||||
|
"versionGate": "הגרסה הזו של Photon תומכת בשרתים המריצים {{version}} או גרסה עדכנית יותר."
|
||||||
|
}
|
||||||
|
}
|
||||||
+21
-15
@@ -48,7 +48,7 @@ async function customFetch(
|
|||||||
if (auth && url) url.searchParams.set('auth', auth)
|
if (auth && url) url.searchParams.set('auth', auth)
|
||||||
|
|
||||||
const res = await f(url ?? input, init)
|
const res = await f(url ?? input, init)
|
||||||
if (!res.ok) error(res.status, await res.text());
|
if (!res.ok) error(res.status, await res.text())
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,27 +101,33 @@ export async function validateInstance(instance: string): Promise<boolean> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function mayBeIncompatible(minVersion: string, availableVersion: string) {
|
export function mayBeIncompatible(
|
||||||
if (minVersion.valueOf() === availableVersion.valueOf()) return false;
|
minVersion: string,
|
||||||
|
availableVersion: string
|
||||||
|
) {
|
||||||
|
if (minVersion.valueOf() === availableVersion.valueOf()) return false
|
||||||
|
|
||||||
const versionFormatter = /[\d.]/;
|
const versionFormatter = /[\d.]/
|
||||||
if (!minVersion.match(versionFormatter) || !availableVersion.match(availableVersion)) {
|
if (
|
||||||
return true;
|
!minVersion.match(versionFormatter) ||
|
||||||
|
!availableVersion.match(availableVersion)
|
||||||
|
) {
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
const splitMinVersion = minVersion.split('.');
|
const splitMinVersion = minVersion.split('.')
|
||||||
const splitAvailableVersion = availableVersion.split('.');
|
const splitAvailableVersion = availableVersion.split('.')
|
||||||
|
|
||||||
if (splitMinVersion.length !== splitAvailableVersion.length) return true;
|
if (splitMinVersion.length !== splitAvailableVersion.length) return true
|
||||||
|
|
||||||
for (let i = 0; i < splitMinVersion.length; ++i) {
|
for (let i = 0; i < splitMinVersion.length; ++i) {
|
||||||
const minVersionDigit = parseInt(splitMinVersion[i]);
|
const minVersionDigit = parseInt(splitMinVersion[i])
|
||||||
const availableVersionDigit = parseInt(splitAvailableVersion[i]);
|
const availableVersionDigit = parseInt(splitAvailableVersion[i])
|
||||||
|
|
||||||
if (availableVersionDigit === undefined) return true;
|
if (availableVersionDigit === undefined) return true
|
||||||
if (minVersionDigit < availableVersionDigit) return false;
|
if (minVersionDigit < availableVersionDigit) return false
|
||||||
if (availableVersionDigit < minVersionDigit) return true;
|
if (availableVersionDigit < minVersionDigit) return true
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false
|
||||||
}
|
}
|
||||||
@@ -90,6 +90,7 @@ interface Settings {
|
|||||||
}
|
}
|
||||||
infiniteScroll: boolean
|
infiniteScroll: boolean
|
||||||
language: string | null
|
language: string | null
|
||||||
|
useRtl: boolean
|
||||||
translator: string | undefined
|
translator: string | undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,6 +159,7 @@ export const defaultSettings: Settings = {
|
|||||||
},
|
},
|
||||||
infiniteScroll: true,
|
infiniteScroll: true,
|
||||||
language: env.PUBLIC_LANGUAGE ?? null,
|
language: env.PUBLIC_LANGUAGE ?? null,
|
||||||
|
useRtl: false,
|
||||||
translator: env.PUBLIC_TRANSLATOR ?? undefined,
|
translator: env.PUBLIC_TRANSLATOR ?? undefined,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,11 @@ const config: Config = {
|
|||||||
key: '',
|
key: '',
|
||||||
loader: async () => (await import('./i18n/de.json')).default,
|
loader: async () => (await import('./i18n/de.json')).default,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
locale: 'he',
|
||||||
|
key: '',
|
||||||
|
loader: async () => (await import('./i18n/he.json')).default,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
locale: 'pt',
|
locale: 'pt',
|
||||||
key: '',
|
key: '',
|
||||||
|
|||||||
+2
-1
@@ -5,7 +5,8 @@ import { get } from 'svelte/store'
|
|||||||
import type { SubscribedType } from 'lemmy-js-client'
|
import type { SubscribedType } from 'lemmy-js-client'
|
||||||
import { page } from '$app/stores'
|
import { page } from '$app/stores'
|
||||||
import { feature } from '$lib/version.js'
|
import { feature } from '$lib/version.js'
|
||||||
import { client, site } from '$lib/lemmy.js'
|
import { client } from '$lib/lemmy.js'
|
||||||
|
import { site } from './lemmy'
|
||||||
|
|
||||||
export const findClosestNumber = (numbers: number[], target: number): number =>
|
export const findClosestNumber = (numbers: number[], target: number): number =>
|
||||||
numbers.reduce((prev, curr) =>
|
numbers.reduce((prev, curr) =>
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
import { site } from '$lib/lemmy.js'
|
import { site } from '$lib/lemmy.js'
|
||||||
import ExpandableImage from '$lib/components/ui/ExpandableImage.svelte'
|
import ExpandableImage from '$lib/components/ui/ExpandableImage.svelte'
|
||||||
import { LINKED_INSTANCE_URL } from '$lib/instance'
|
import { LINKED_INSTANCE_URL } from '$lib/instance'
|
||||||
|
import { locale } from '$lib/translations'
|
||||||
|
|
||||||
nProgress.configure({
|
nProgress.configure({
|
||||||
minimum: 0.4,
|
minimum: 0.4,
|
||||||
@@ -105,6 +106,7 @@
|
|||||||
Skip Navigation
|
Skip Navigation
|
||||||
</Button>
|
</Button>
|
||||||
<Shell
|
<Shell
|
||||||
|
dir={$locale == 'he' && $userSettings.useRtl ? 'rtl' : 'ltr'}
|
||||||
class="min-h-screen {$userSettings.font == 'inter'
|
class="min-h-screen {$userSettings.font == 'inter'
|
||||||
? 'font-inter'
|
? 'font-inter'
|
||||||
: $userSettings.font == 'system'
|
: $userSettings.font == 'system'
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
<script>
|
<script>
|
||||||
import { goto } from '$app/navigation'
|
import { goto } from '$app/navigation'
|
||||||
import { page } from '$app/stores'
|
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 MultiSelect from '$lib/components/input/Switch.svelte'
|
||||||
import { t } from '$lib/translations'
|
import { t } from '$lib/translations'
|
||||||
import { Badge } from 'mono-svelte'
|
import { Badge } from 'mono-svelte'
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if ($profile?.user?.notifications.applications ?? 0) > 0}
|
{#if $notifications.applications > 0}
|
||||||
<span class="flex flex-row text-red-500 gap-2">
|
<span class="flex flex-row text-red-500 gap-2">
|
||||||
<Badge color="red-subtle" class="w-max">
|
<Badge color="red-subtle" class="w-max">
|
||||||
{$profile?.user?.notifications.applications}
|
{$notifications.applications}
|
||||||
</Badge> unread applications
|
</Badge> unread applications
|
||||||
</span>
|
</span>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { profile } from '$lib/auth.js'
|
import { profile } from '$lib/auth.js'
|
||||||
import { get } from 'svelte/store'
|
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 }) {
|
export async function load({ fetch }) {
|
||||||
if (!get(profile)) return
|
if (!get(profile)) return
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script lang="ts">
|
<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 UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||||
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
||||||
import { Material, toast } from 'mono-svelte'
|
import { Material, toast } from 'mono-svelte'
|
||||||
@@ -60,7 +60,7 @@
|
|||||||
application.admin = $profile.user!.local_user_view.person
|
application.admin = $profile.user!.local_user_view.person
|
||||||
application.registration_application.deny_reason = denyReason
|
application.registration_application.deny_reason = denyReason
|
||||||
|
|
||||||
$profile.user!.notifications.applications -= 1
|
$notifications.applications -= 1
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
toast({
|
toast({
|
||||||
content: err as any,
|
content: err as any,
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
import { goto } from '$app/navigation'
|
import { goto } from '$app/navigation'
|
||||||
import { page } from '$app/stores'
|
import { page } from '$app/stores'
|
||||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
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 Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||||
import { fly } from 'svelte/transition'
|
import { fly } from 'svelte/transition'
|
||||||
import { searchParam } from '$lib/util.js'
|
import { searchParam } from '$lib/util.js'
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
const response = await getClient().markAllAsRead()
|
const response = await getClient().markAllAsRead()
|
||||||
|
|
||||||
$profile.user.notifications.inbox = 0
|
$notifications.inbox = 0
|
||||||
|
|
||||||
goto($page.url, {
|
goto($page.url, {
|
||||||
invalidateAll: true,
|
invalidateAll: true,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import Comment from '$lib/components/lemmy/comment/Comment.svelte'
|
import Comment from '$lib/components/lemmy/comment/Comment.svelte'
|
||||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||||
import { getClient } from '$lib/lemmy.js'
|
import { getClient } from '$lib/lemmy.js'
|
||||||
import { profile } from '$lib/auth.js'
|
import { notifications, profile } from '$lib/auth.js'
|
||||||
import {
|
import {
|
||||||
ArrowUturnLeft,
|
ArrowUturnLeft,
|
||||||
ArrowUturnUp,
|
ArrowUturnUp,
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
item.read = isRead
|
item.read = isRead
|
||||||
if ($profile.user) $profile.user.notifications.inbox += isRead ? -1 : 1
|
if ($profile.user) $notifications.inbox += isRead ? -1 : 1
|
||||||
|
|
||||||
loading = false
|
loading = false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,10 +34,6 @@
|
|||||||
username: form.username,
|
username: form.username,
|
||||||
}
|
}
|
||||||
|
|
||||||
profile.set({
|
|
||||||
...newProfile,
|
|
||||||
})
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
profile: id,
|
profile: id,
|
||||||
profiles: [...pd.profiles, newProfile],
|
profiles: [...pd.profiles, newProfile],
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
PrivateMessageReportView,
|
PrivateMessageReportView,
|
||||||
} from 'lemmy-js-client'
|
} from 'lemmy-js-client'
|
||||||
import { Check, Icon } from 'svelte-hero-icons'
|
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 { Button } from 'mono-svelte'
|
||||||
import type { ReportView } from '$lib/lemmy/report.js'
|
import type { ReportView } from '$lib/lemmy/report.js'
|
||||||
import PrivateMessage from '$lib/components/lemmy/inbox/PrivateMessage.svelte'
|
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) {
|
} catch (err) {
|
||||||
toast({
|
toast({
|
||||||
content: err as any,
|
content: err as any,
|
||||||
|
|||||||
@@ -48,17 +48,19 @@
|
|||||||
|
|
||||||
let post = data.post
|
let post = data.post
|
||||||
|
|
||||||
// onMount(async () => {
|
onMount(async () => {
|
||||||
// if (
|
if (
|
||||||
// !(post.post_view.read && $userSettings.markPostsAsRead) &&
|
!(post.post_view.read && $userSettings.markPostsAsRead) &&
|
||||||
// $profile?.jwt
|
$profile?.jwt
|
||||||
// ) {
|
) {
|
||||||
// getClient().markPostAsRead({
|
getClient().markPostAsRead({
|
||||||
// read: $userSettings.markPostsAsRead,
|
read: $userSettings.markPostsAsRead,
|
||||||
// post_id: post.post_view.post.id,
|
post_ids: [post.post_view.post.id],
|
||||||
// })
|
// @ts-ignore
|
||||||
// }
|
post_id: post.post_view.post.id,
|
||||||
// })
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
afterNavigate(async () => {
|
afterNavigate(async () => {
|
||||||
// reactivity hack
|
// reactivity hack
|
||||||
@@ -333,7 +335,7 @@ flex-wrap gap-4 sticky top-20 w-full box-border z-20 mt-4"
|
|||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
{:then comments}
|
{:then comments}
|
||||||
{#if $profile?.user}
|
{#if $profile?.jwt}
|
||||||
<CommentForm
|
<CommentForm
|
||||||
postId={post.post_view.post.id}
|
postId={post.post_view.post.id}
|
||||||
on:comment={(comment) =>
|
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 &&
|
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
|
$profile?.user?.moderates
|
||||||
.map((c) => c.community.id)
|
.map((c) => c.community.id)
|
||||||
.includes(data.post.community_view.community.id)
|
.includes(data.post.community_view.community.id)
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
import { DOMAIN_REGEX_FORMS, removeItem } from '$lib/util.js'
|
import { DOMAIN_REGEX_FORMS, removeItem } from '$lib/util.js'
|
||||||
import Section from './Section.svelte'
|
import Section from './Section.svelte'
|
||||||
import ToggleSetting from './ToggleSetting.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'
|
import { defaultLinks, iconOfLink } from '$lib/components/ui/navbar/link'
|
||||||
|
|
||||||
let pin: string = ''
|
let pin: string = ''
|
||||||
@@ -135,6 +135,7 @@
|
|||||||
</Section>
|
</Section>
|
||||||
|
|
||||||
<Section title={$t('settings.app.title')}>
|
<Section title={$t('settings.app.title')}>
|
||||||
|
<div class="flex flex-col gap-2">
|
||||||
<Setting>
|
<Setting>
|
||||||
<span slot="title" class="inline-flex items-center gap-2">
|
<span slot="title" class="inline-flex items-center gap-2">
|
||||||
{$t('settings.app.lang.title')}
|
{$t('settings.app.lang.title')}
|
||||||
@@ -161,6 +162,13 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</Select>
|
</Select>
|
||||||
</Setting>
|
</Setting>
|
||||||
|
{#if $locale == 'he'}
|
||||||
|
<ToggleSetting
|
||||||
|
bind:checked={$userSettings.useRtl}
|
||||||
|
title={$t('settings.app.lang.useRtl.title')}
|
||||||
|
></ToggleSetting>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
<Setting>
|
<Setting>
|
||||||
<span slot="title">{$t('settings.app.view.title')}</span>
|
<span slot="title">{$t('settings.app.view.title')}</span>
|
||||||
<ViewSelect showLabel={false} />
|
<ViewSelect showLabel={false} />
|
||||||
|
|||||||
Reference in new issue
Block a user