mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
refactor: album service (#23768)
This commit is contained in:
+8
-6
@@ -8,6 +8,7 @@
|
||||
import AlbumTitle from '$lib/components/album-page/album-title.svelte';
|
||||
import ActivityStatus from '$lib/components/asset-viewer/activity-status.svelte';
|
||||
import ActivityViewer from '$lib/components/asset-viewer/activity-viewer.svelte';
|
||||
import OnEvents from '$lib/components/OnEvents.svelte';
|
||||
import ButtonContextMenu from '$lib/components/shared-components/context-menu/button-context-menu.svelte';
|
||||
import MenuOption from '$lib/components/shared-components/context-menu/menu-option.svelte';
|
||||
import ControlAppBar from '$lib/components/shared-components/control-app-bar.svelte';
|
||||
@@ -36,7 +37,6 @@
|
||||
import AlbumUsersModal from '$lib/modals/AlbumUsersModal.svelte';
|
||||
import SharedLinkCreateModal from '$lib/modals/SharedLinkCreateModal.svelte';
|
||||
import { handleConfirmAlbumDelete, handleDownloadAlbum } from '$lib/services/album.service';
|
||||
import { handleViewSharedLinkQrCode } from '$lib/services/shared-link.service';
|
||||
import { AssetInteraction } from '$lib/stores/asset-interaction.svelte';
|
||||
import { assetViewingStore } from '$lib/stores/asset-viewing.store';
|
||||
import { featureFlags } from '$lib/stores/server-config.store';
|
||||
@@ -384,12 +384,12 @@
|
||||
}
|
||||
};
|
||||
|
||||
const onSharedLinkCreate = async () => {
|
||||
await refreshAlbum();
|
||||
};
|
||||
|
||||
const handleShareLink = async () => {
|
||||
const sharedLink = await modalManager.show(SharedLinkCreateModal, { albumId: album.id });
|
||||
if (sharedLink) {
|
||||
await refreshAlbum();
|
||||
await handleViewSharedLinkQrCode(sharedLink);
|
||||
}
|
||||
await modalManager.show(SharedLinkCreateModal, { albumId: album.id });
|
||||
};
|
||||
|
||||
const handleEditUsers = async () => {
|
||||
@@ -424,6 +424,8 @@
|
||||
};
|
||||
</script>
|
||||
|
||||
<OnEvents {onSharedLinkCreate} />
|
||||
|
||||
<div class="flex overflow-hidden" use:scrollMemoryClearer={{ routeStartsWith: AppRoute.ALBUMS }}>
|
||||
<div class="relative w-full shrink">
|
||||
<main class="relative h-dvh overflow-hidden px-2 md:px-6 max-md:pt-(--navbar-height-md) pt-(--navbar-height)">
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import { goto } from '$app/navigation';
|
||||
import { page } from '$app/state';
|
||||
import UserPageLayout from '$lib/components/layouts/user-page-layout.svelte';
|
||||
import OnEvents from '$lib/components/OnEvents.svelte';
|
||||
import SharedLinkCard from '$lib/components/sharedlinks-page/shared-link-card.svelte';
|
||||
import { AppRoute } from '$lib/constants';
|
||||
import GroupTab from '$lib/elements/GroupTab.svelte';
|
||||
@@ -50,18 +51,6 @@
|
||||
}
|
||||
};
|
||||
|
||||
const handleEditDone = async (updatedLink?: SharedLinkResponseDto) => {
|
||||
if (updatedLink) {
|
||||
const index = sharedLinks.findIndex((link) => link.id === updatedLink.id);
|
||||
if (index !== -1) {
|
||||
sharedLinks[index] = updatedLink;
|
||||
}
|
||||
} else {
|
||||
await refresh();
|
||||
}
|
||||
await goto(AppRoute.SHARED_LINKS);
|
||||
};
|
||||
|
||||
type Filter = 'all' | 'album' | 'individual';
|
||||
|
||||
const filterMap: Record<Filter, string> = {
|
||||
@@ -91,8 +80,17 @@
|
||||
(type === SharedLinkType.Individual && selectedTab === 'individual'),
|
||||
),
|
||||
);
|
||||
|
||||
const onSharedLinkUpdate = (sharedLink: SharedLinkResponseDto) => {
|
||||
const index = sharedLinks.findIndex((link) => link.id === sharedLink.id);
|
||||
if (index !== -1) {
|
||||
sharedLinks[index] = sharedLink;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<OnEvents {onSharedLinkUpdate} />
|
||||
|
||||
<UserPageLayout title={data.meta.title}>
|
||||
{#snippet buttons()}
|
||||
<div class="hidden xl:block h-10">
|
||||
@@ -116,7 +114,7 @@
|
||||
{/if}
|
||||
|
||||
{#if sharedLink}
|
||||
<SharedLinkCreateModal editingLink={sharedLink} onClose={handleEditDone} />
|
||||
<SharedLinkCreateModal editingLink={sharedLink} onClose={() => goto(AppRoute.SHARED_LINKS)} />
|
||||
{/if}
|
||||
</div>
|
||||
</UserPageLayout>
|
||||
|
||||
Reference in New Issue
Block a user