From 6214d510d661d7eb0972db601d545ba5b66ed75e Mon Sep 17 00:00:00 2001 From: martin <74269598+martabal@users.noreply.github.com> Date: Tue, 14 Nov 2023 23:55:03 +0100 Subject: [PATCH] fix(web): back button from person detail page (#5047) * feat: return button to the main page * add album route * feat: do not use explicit routes --- web/src/lib/components/asset-viewer/asset-viewer.svelte | 1 + web/src/lib/components/asset-viewer/detail-panel.svelte | 8 +++++++- web/src/lib/utils/navigation.ts | 3 +++ web/src/routes/(user)/people/[personId]/+page.svelte | 3 ++- 4 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 web/src/lib/utils/navigation.ts diff --git a/web/src/lib/components/asset-viewer/asset-viewer.svelte b/web/src/lib/components/asset-viewer/asset-viewer.svelte index 0194596f6a..45202a7c47 100644 --- a/web/src/lib/components/asset-viewer/asset-viewer.svelte +++ b/web/src/lib/components/asset-viewer/asset-viewer.svelte @@ -733,6 +733,7 @@ > ($isShowDetail = false)} on:close-viewer={handleCloseViewer} diff --git a/web/src/lib/components/asset-viewer/detail-panel.svelte b/web/src/lib/components/asset-viewer/detail-panel.svelte index 8c36df2d8b..366c4e9301 100644 --- a/web/src/lib/components/asset-viewer/detail-panel.svelte +++ b/web/src/lib/components/asset-viewer/detail-panel.svelte @@ -20,9 +20,11 @@ } from '@mdi/js'; import Icon from '$lib/components/elements/icon.svelte'; import Map from '../shared-components/map/map.svelte'; + import { AppRoute } from '$lib/constants'; export let asset: AssetResponseDto; export let albums: AlbumResponseDto[] = []; + export let albumId: string | null = null; let textarea: HTMLTextAreaElement; let description: string; @@ -136,7 +138,11 @@
{#each people as person (person.id)} - dispatch('close-viewer')}> + dispatch('close-viewer')} + > { + return new URL(url).origin !== location.origin; +}; diff --git a/web/src/routes/(user)/people/[personId]/+page.svelte b/web/src/routes/(user)/people/[personId]/+page.svelte index a453a1e257..d93cb83fc2 100644 --- a/web/src/routes/(user)/people/[personId]/+page.svelte +++ b/web/src/routes/(user)/people/[personId]/+page.svelte @@ -34,6 +34,7 @@ import { assetViewingStore } from '$lib/stores/asset-viewing.store'; import LoadingSpinner from '$lib/components/shared-components/loading-spinner.svelte'; import { mdiPlus, mdiDotsVertical, mdiArrowLeft } from '@mdi/js'; + import { isExternalUrl } from '$lib/utils/navigation'; export let data: PageData; @@ -126,7 +127,7 @@ onMount(() => { const action = $page.url.searchParams.get('action'); const getPreviousRoute = $page.url.searchParams.get('previousRoute'); - if (getPreviousRoute) { + if (getPreviousRoute && !isExternalUrl(getPreviousRoute)) { previousRoute = getPreviousRoute; } if (action == 'merge') {