mirror of
https://github.com/immich-app/immich.git
synced 2026-05-14 11:32:15 -04:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9d052bd995 | |||
| 96b97d9b6f | |||
| 09791092da |
+22
-2
@@ -8,8 +8,9 @@
|
||||
import { assetMultiSelectManager } from '$lib/managers/asset-multi-select-manager.svelte';
|
||||
import { Route } from '$lib/route';
|
||||
import { getAssetBulkActions } from '$lib/services/asset.service';
|
||||
import { AssetVisibility } from '@immich/sdk';
|
||||
import { ActionButton, CommandPaletteDefaultProvider } from '@immich/ui';
|
||||
import { handleError } from '$lib/utils/handle-error';
|
||||
import { AssetVisibility, updatePartner } from '@immich/sdk';
|
||||
import { ActionButton, CommandPaletteDefaultProvider, Field, Switch, Text } from '@immich/ui';
|
||||
import { mdiArrowLeft } from '@mdi/js';
|
||||
import { t } from 'svelte-i18n';
|
||||
import type { PageData } from './$types';
|
||||
@@ -20,6 +21,8 @@
|
||||
|
||||
let { data }: Props = $props();
|
||||
|
||||
let inTimeline = $derived(data.inTimeline);
|
||||
|
||||
const options = $derived({
|
||||
userId: data.partner.id,
|
||||
visibility: AssetVisibility.Timeline,
|
||||
@@ -32,6 +35,15 @@
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
const handleToggleInTimeline = async (status: boolean) => {
|
||||
try {
|
||||
await updatePartner({ id: data.partner.id, partnerUpdateDto: { inTimeline: status } });
|
||||
inTimeline = status;
|
||||
} catch (error) {
|
||||
handleError(error, $t('errors.unable_to_update_timeline_display_status'));
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<main class="relative h-dvh overflow-hidden px-2 pt-(--navbar-height) max-md:pt-(--navbar-height-md) md:px-6">
|
||||
@@ -53,5 +65,13 @@
|
||||
{$t('partner_list_user_photos', { values: { user: data.partner.name } })}
|
||||
</p>
|
||||
{/snippet}
|
||||
{#snippet trailing()}
|
||||
<Field class="flex w-full place-content-center place-items-center gap-2">
|
||||
<Text size="small">
|
||||
{$t('show_in_timeline')}
|
||||
</Text>
|
||||
<Switch bind:checked={inTimeline} onCheckedChange={handleToggleInTimeline} />
|
||||
</Field>
|
||||
{/snippet}
|
||||
</ControlAppBar>
|
||||
{/if}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { getUser } from '@immich/sdk';
|
||||
import { getPartners, getUser, PartnerDirection } from '@immich/sdk';
|
||||
import { authenticate } from '$lib/utils/auth';
|
||||
import { getFormatter } from '$lib/utils/i18n';
|
||||
import type { PageLoad } from './$types';
|
||||
@@ -6,11 +6,16 @@ import type { PageLoad } from './$types';
|
||||
export const load = (async ({ params, url }) => {
|
||||
await authenticate(url);
|
||||
|
||||
const partner = await getUser({ id: params.userId });
|
||||
const [partner, sharedWith] = await Promise.all([
|
||||
getUser({ id: params.userId }),
|
||||
getPartners({ direction: PartnerDirection.SharedWith }),
|
||||
]);
|
||||
const inTimeline = sharedWith.find((p) => p.id === params.userId)?.inTimeline ?? false;
|
||||
const $t = await getFormatter();
|
||||
|
||||
return {
|
||||
partner,
|
||||
inTimeline,
|
||||
meta: {
|
||||
title: $t('partner'),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user