Skip to content

Commit

Permalink
Adapt detail page for salaries
Browse files Browse the repository at this point in the history
  • Loading branch information
katharinawuensche committed Apr 22, 2024
1 parent 415dbbc commit e838639
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 23 deletions.
16 changes: 8 additions & 8 deletions lib/create-api-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ const GroupedRelations = z.object({
salary: z.array(SimplifiedRelation).optional(),
});
const Reference = z.object({
pages_start: z.string(),
pages_end: z.string(),
folio: z.string(),
pages_start: z.string().nullable(),
pages_end: z.string().nullable(),
folio: z.string().nullable(),
bibtex: z.object({
id: z.string(),
type: z.string(),
title: z.string(),
archive: z.string(),
archive_location: z.string(),
id: z.string().nullable(),
type: z.string().nullable(),
title: z.string().nullable(),
archive: z.string().nullable(),
archive_location: z.string().nullable(),
}),
});
const Event = z
Expand Down
1 change: 1 addition & 0 deletions messages/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@
"start_date": "Von",
"end_date": "Bis",
"type": "Typ",
"repetition_type": "Wiederholungen",
"alternative_label": "Alternativer Name"
}
}
Expand Down
1 change: 1 addition & 0 deletions messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@
"start_date": "From",
"end_date": "To",
"type": "Type",
"repetition_type": "Repetition",
"alternative_label": "Alternative name"
}
}
Expand Down
28 changes: 13 additions & 15 deletions pages/detail/salary/[id].vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,6 @@ const { data, isLoading } = useQuery({
queryFn: () => endpoint({ params: { id } }),
});
const maxFunctionCount = 3;
const functionNames = computed(() => {
if (isLoading.value) return [];
const fNames = [...new Set(data.value?.relations.function?.map((f) => f.to.name))];
if (fNames.length <= maxFunctionCount) return fNames;
const truncatedFunctionNames = [
...fNames.slice(0, maxFunctionCount),
t("DetailPage.andOthers", { count: fNames.length - maxFunctionCount }),
];
return truncatedFunctionNames;
});
const flattenedRelations = computed(() => {
if (isLoading.value) return [];
const res = Object.entries(data.value?.relations as Record<string, Array<SimplifiedRelationType>>)
Expand All @@ -56,14 +45,23 @@ const flattenedRelations = computed(() => {
{{ data?.first_name }} {{ data?.name }}
</h1>
<div
v-for="f in functionNames"
:key="f"
class="mr-3 inline-block w-fit rounded-md bg-function-200 px-3 py-1.5 text-xs font-semibold uppercase dark:bg-function-900 dark:text-neutral-100"
v-if="data?.repetitionType"
class="mr-3 inline-block w-fit rounded-md bg-salary-200 px-3 py-1.5 text-xs font-semibold uppercase dark:bg-salary-900 dark:text-neutral-100"
>
{{ f }}
{{ data?.repetitionType }}
</div>
</template>
<template #base>
<div class="col-span-2 my-2 border-t"></div>
<span>{{ t("Pages.searchviews.salary.type") }}:</span>
<span>
{{ data?.type }}
</span>
<div class="col-span-2 my-2 border-t"></div>
<span>{{ t("Pages.searchviews.salary.repetition_type") }}:</span>
<span>
{{ data?.repetitionType }}
</span>
<div class="col-span-2 my-2 border-t"></div>
<span>{{ t("Pages.searchviews.salary.start_date") }}:</span>
<span>
Expand Down

0 comments on commit e838639

Please sign in to comment.