mirror of
https://github.com/immich-app/immich.git
synced 2024-12-25 10:43:13 +02:00
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
This commit is contained in:
parent
ecbe7beb6c
commit
6214d510d6
@ -733,6 +733,7 @@
|
||||
>
|
||||
<DetailPanel
|
||||
{asset}
|
||||
albumId={album?.id}
|
||||
albums={appearsInAlbums}
|
||||
on:close={() => ($isShowDetail = false)}
|
||||
on:close-viewer={handleCloseViewer}
|
||||
|
@ -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 @@
|
||||
|
||||
<div class="mt-4 flex flex-wrap gap-2">
|
||||
{#each people as person (person.id)}
|
||||
<a href="/people/{person.id}" class="w-[90px]" on:click={() => dispatch('close-viewer')}>
|
||||
<a
|
||||
href="/people/{person.id}?previousRoute={albumId ? `${AppRoute.ALBUMS}/${albumId}` : AppRoute.PHOTOS}"
|
||||
class="w-[90px]"
|
||||
on:click={() => dispatch('close-viewer')}
|
||||
>
|
||||
<ImageThumbnail
|
||||
curve
|
||||
shadow
|
||||
|
3
web/src/lib/utils/navigation.ts
Normal file
3
web/src/lib/utils/navigation.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export const isExternalUrl = (url: string): boolean => {
|
||||
return new URL(url).origin !== location.origin;
|
||||
};
|
@ -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') {
|
||||
|
Loading…
Reference in New Issue
Block a user