diff --git a/src/lib/components/ui/layout/pages/Tabs.svelte b/src/lib/components/ui/layout/pages/Tabs.svelte index 0643782d..25e10161 100644 --- a/src/lib/components/ui/layout/pages/Tabs.svelte +++ b/src/lib/components/ui/layout/pages/Tabs.svelte @@ -10,7 +10,8 @@ diff --git a/src/lib/i18n/en.json b/src/lib/i18n/en.json index c2aa36e1..714c6551 100644 --- a/src/lib/i18n/en.json +++ b/src/lib/i18n/en.json @@ -184,7 +184,13 @@ "blocks": "Blocks", "credentials": "Credentials", "moderates": "Moderating", - "favorites": "Favorites" + "favorites": "Favorites", + "upvoted": "Upvoted", + "downvoted": "Downvoted", + "media": { + "title": "Media", + "download": "Download" + } }, "translators": "Translators", "accounts": "Accounts", diff --git a/src/routes/profile/+layout.svelte b/src/routes/profile/+layout.svelte index fa19c689..4fd2d8ba 100644 --- a/src/routes/profile/+layout.svelte +++ b/src/routes/profile/+layout.svelte @@ -6,6 +6,14 @@ import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte' import { contentPadding } from '$lib/components/ui/layout/Shell.svelte' import { t } from '$lib/translations' + import { Button, Menu, MenuButton } from 'mono-svelte' + import { + ArrowDown, + ArrowUp, + EllipsisHorizontal, + Icon, + Photo, + } from 'svelte-hero-icons' @@ -14,10 +22,11 @@
+ + + + + {$t('routes.profile.media.title')} + + + + {$t('routes.profile.upvoted')} + + + + {$t('routes.profile.downvoted')} + +
diff --git a/src/routes/profile/+layout.ts b/src/routes/profile/+layout.ts index b16dc99b..88777560 100644 --- a/src/routes/profile/+layout.ts +++ b/src/routes/profile/+layout.ts @@ -1,16 +1,18 @@ import { profile } from '$lib/auth.js' -import { getClient } from '$lib/lemmy.js' +import { client, getClient } from '$lib/lemmy.js' import { getItemPublished } from '$lib/lemmy/item.js' import type { SortType } from 'lemmy-js-client' import { get } from 'svelte/store' export async function load({ params, url, fetch }) { - const my_user = (await getClient().getSite()).my_user + const my_user = + get(profile)?.user ?? + (await client({ auth: get(profile)?.jwt }).getSite()).my_user return { my_user: my_user, community_blocks: my_user?.community_blocks, person_blocks: my_user?.person_blocks, - follows: my_user?.follows + follows: my_user?.follows, } } diff --git a/src/routes/profile/media/+page.svelte b/src/routes/profile/media/+page.svelte new file mode 100644 index 00000000..52467928 --- /dev/null +++ b/src/routes/profile/media/+page.svelte @@ -0,0 +1,63 @@ + + +
{$t('routes.profile.media.title')}
+
+ {#each data.images as image (image.local_image.pictrs_delete_token)} +
+ { + data.images = data.images.toSpliced( + data.images.findIndex( + (i) => + i.local_image.pictrs_delete_token == + image.local_image.pictrs_delete_token + ), + 1 + ) + }} + /> +
+ {/each} +
+{#if data.images.length == 20} + { + searchParam($page.url, 'page', p.detail.toString()) + }} + /> +{/if} + + diff --git a/src/routes/profile/media/+page.ts b/src/routes/profile/media/+page.ts new file mode 100644 index 00000000..521f554e --- /dev/null +++ b/src/routes/profile/media/+page.ts @@ -0,0 +1,16 @@ +import { profile } from '$lib/auth.js' +import { client } from '$lib/lemmy.js' +import { get } from 'svelte/store' + +export async function load({ fetch, url }) { + const { jwt } = get(profile) + + let page = Number(url.searchParams.get('page')) || 1 + + const res = await client({ func: fetch, auth: jwt }).listMedia({ + limit: 20, + page: page, + }) + + return { images: res.images } +} diff --git a/src/routes/profile/media/PictrsImage.svelte b/src/routes/profile/media/PictrsImage.svelte new file mode 100644 index 00000000..074362b6 --- /dev/null +++ b/src/routes/profile/media/PictrsImage.svelte @@ -0,0 +1,69 @@ + + +
+ pictrs +
+ + + +
+