Skip to content

Commit

Permalink
Add same as relation to persons
Browse files Browse the repository at this point in the history
  • Loading branch information
katharinawuensche committed Jul 4, 2024
1 parent fb29b9f commit 5bb9a18
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
3 changes: 2 additions & 1 deletion messages/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@
"born": "Geboren",
"died": "Gestorben",
"gender": "Geschlecht",
"alternative_names": "Alternative Namen"
"alternative_names": "Alternative Namen",
"same_as": "Möglicherweise identisch mit"
},
"event": {
"title": "Suche - Events",
Expand Down
3 changes: 2 additions & 1 deletion messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@
"start_date": "From",
"end_date": "To",
"gender": "Gender",
"alternative_names": "Alternative names"
"alternative_names": "Alternative names",
"same_as": "Might be identical with"
},
"event": {
"title": "Search - Events",
Expand Down
22 changes: 22 additions & 0 deletions pages/detail/person/[id].vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { loadAndGroupRelations } from "@/lib/group-relations.ts";
import type { TimelineObject } from "@/types/timeline";
const t = useTranslations();
const localePath = useLocalePath();
const route = useRoute();
const id = Number(route.params.id);
Expand Down Expand Up @@ -58,6 +59,15 @@ const flattenedRelations = computed(() => {
.sort((r) => new Date(String(r.start_date)).valueOf());
return res;
});
const sameAs = computed(() => {
if (!data.value.relations.data) return [];
return (
data.value.relations.data.person
?.filter((r) => r.name === "ist möglicherweise identisch mit")
.map((r) => r.to) ?? []
);
});
</script>

<template>
Expand Down Expand Up @@ -106,6 +116,18 @@ const flattenedRelations = computed(() => {
<div class="col-span-2 my-2 border-t"></div>
<span>{{ t("Pages.searchviews.person.alternative_names") }}:</span>
<span>{{ data.entity.data?.alternative_label }}</span>
<div v-if="sameAs.length > 0" class="col-span-2 my-2 border-t"></div>
<span v-if="sameAs.length > 0">{{ t("Pages.searchviews.person.same_as") }}:</span>
<span>
<NuxtLink
v-for="person in sameAs"
:key="person.id"
:to="localePath(`/detail/person/${person.id}`)"
class="-ml-1 -mt-1 block p-1 hover:bg-primary-50 active:bg-primary-50 dark:hover:bg-primary-950 dark:active:bg-primary-950"
>
{{ person.name }}
</NuxtLink>
</span>
</template>
<template #right>
<div v-if="data.entity.data" class="flex flex-col gap-3">
Expand Down

0 comments on commit 5bb9a18

Please sign in to comment.