|
@@ -9,8 +9,11 @@
|
|
import { createEventDispatcher } from 'svelte';
|
|
import { createEventDispatcher } from 'svelte';
|
|
|
|
|
|
export let person: PersonResponseDto;
|
|
export let person: PersonResponseDto;
|
|
|
|
+ export let selectionMode = false;
|
|
|
|
+ export let disableContextMenu = false;
|
|
|
|
|
|
let showContextMenu = false;
|
|
let showContextMenu = false;
|
|
|
|
+
|
|
let dispatch = createEventDispatcher();
|
|
let dispatch = createEventDispatcher();
|
|
|
|
|
|
const onChangeNameClicked = () => {
|
|
const onChangeNameClicked = () => {
|
|
@@ -27,7 +30,7 @@
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<div id="people-card" class="relative">
|
|
<div id="people-card" class="relative">
|
|
- <a href="/people/{person.id}" draggable="false">
|
|
|
|
|
|
+ <a href={!selectionMode ? '/people/{person.id}' : ''} draggable="false">
|
|
<div class="h-48 w-48 rounded-xl brightness-95 filter">
|
|
<div class="h-48 w-48 rounded-xl brightness-95 filter">
|
|
<ImageThumbnail shadow url={api.getPeopleThumbnailUrl(person.id)} altText={person.name} widthStyle="100%" />
|
|
<ImageThumbnail shadow url={api.getPeopleThumbnailUrl(person.id)} altText={person.name} widthStyle="100%" />
|
|
</div>
|
|
</div>
|
|
@@ -38,26 +41,28 @@
|
|
{/if}
|
|
{/if}
|
|
</a>
|
|
</a>
|
|
|
|
|
|
- <button
|
|
|
|
- class="absolute right-2 top-2 z-20"
|
|
|
|
- on:click|stopPropagation|preventDefault={() => {
|
|
|
|
- showContextMenu = !showContextMenu;
|
|
|
|
- }}
|
|
|
|
- data-testid="context-button-parent"
|
|
|
|
- id={`icon-${person.id}`}
|
|
|
|
- >
|
|
|
|
- <IconButton color="transparent-primary">
|
|
|
|
- <DotsVertical size="20" />
|
|
|
|
- </IconButton>
|
|
|
|
|
|
+ {#if !disableContextMenu}
|
|
|
|
+ <button
|
|
|
|
+ class="absolute right-2 top-2 z-20"
|
|
|
|
+ on:click|stopPropagation|preventDefault={() => {
|
|
|
|
+ showContextMenu = !showContextMenu;
|
|
|
|
+ }}
|
|
|
|
+ data-testid="context-button-parent"
|
|
|
|
+ id={`icon-${person.id}`}
|
|
|
|
+ >
|
|
|
|
+ <IconButton color="transparent-primary">
|
|
|
|
+ <DotsVertical size="20" />
|
|
|
|
+ </IconButton>
|
|
|
|
|
|
- {#if showContextMenu}
|
|
|
|
- <ContextMenu on:outclick={() => (showContextMenu = false)}>
|
|
|
|
- <MenuOption on:click={() => onHideFaceClicked()} text="Hide face" />
|
|
|
|
- <MenuOption on:click={() => onChangeNameClicked()} text="Change name" />
|
|
|
|
- <MenuOption on:click={() => onMergeFacesClicked()} text="Merge faces" />
|
|
|
|
- </ContextMenu>
|
|
|
|
- {/if}
|
|
|
|
- </button>
|
|
|
|
|
|
+ {#if showContextMenu}
|
|
|
|
+ <ContextMenu on:outclick={() => (showContextMenu = false)}>
|
|
|
|
+ <MenuOption on:click={() => onHideFaceClicked()} text="Hide face" />
|
|
|
|
+ <MenuOption on:click={() => onChangeNameClicked()} text="Change name" />
|
|
|
|
+ <MenuOption on:click={() => onMergeFacesClicked()} text="Merge faces" />
|
|
|
|
+ </ContextMenu>
|
|
|
|
+ {/if}
|
|
|
|
+ </button>
|
|
|
|
+ {/if}
|
|
</div>
|
|
</div>
|
|
|
|
|
|
{#if showContextMenu}
|
|
{#if showContextMenu}
|