Skip to content

Commit

Permalink
small optimizations, added titles (#85)
Browse files Browse the repository at this point in the history
resolves #84

---------

Co-authored-by: Robin Kaggl <[email protected]>
  • Loading branch information
kaggl and Robin Kaggl authored Mar 18, 2024
1 parent 231913f commit a2793f6
Show file tree
Hide file tree
Showing 18 changed files with 131 additions and 23 deletions.
3 changes: 3 additions & 0 deletions components/autocomplete.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import type { ModelRef } from "vue";
import type { HierarchyNode } from "@/lib/types";
const t = useTranslations();
const query = ref(
useQuery({
queryKey: ["autocomplete"],
Expand Down Expand Up @@ -63,6 +65,7 @@ defineEmits(["change", "input"]);
/>
<ComboboxButton class="inset-y-0 right-0 flex items-center px-3 text-gray-500">
<Search class="h-5 w-5" />
<span class="sr-only">{{ t("ui.search-placeholder") }}</span>
</ComboboxButton>
</div>
<MenuTransition>
Expand Down
6 changes: 0 additions & 6 deletions components/search-table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,6 @@ const getDetailLink = (id: string, entity?: string) => {
</button>
</div>
<slot />
<!-- <DownloadResultsWrapper
v-if="data && data.page"
:all="data.found"
:collection="collectionName"
:query="comQuery"
/> -->
<div class="flex w-full justify-end">
<DownloadMenu
v-if="data && data.page"
Expand Down
12 changes: 11 additions & 1 deletion pages/detail/courts/[id].vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ const relCols = ["relation_type", "target.name", "start_date", "end_date"];
definePageMeta({
title: "pages.searchviews.courts.title",
});
const title = computed(() => {
if (data.value.entity.data?.name)
return `${data.value.entity.data.name} - ${t("pages.searchviews.courts.sing")}`;
return t("pages.searchviews.courts.sing");
});
useHead({
title,
});
</script>

<template>
Expand All @@ -65,7 +75,7 @@ definePageMeta({
<div class="flex items-center gap-2">
<Indicator class="w-24" :status="data.details.data?.ampel" />
<HierarchyLinkButton
:id="data.entity.data?.object_id"
:id="String(data.entity.data?.object_id)"
model="Institution"
:label="data.entity.data?.name"
/>
Expand Down
12 changes: 12 additions & 0 deletions pages/detail/events/[id].vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { useRoute } from "vue-router";
import type { Event } from "@/types/schema";
import { definePageMeta, ref } from "#imports";
const t = useTranslations();
const route = useRoute();
const id = String(route.params.id);
Expand All @@ -18,6 +20,16 @@ const data = ref({
definePageMeta({
title: "pages.searchviews.events.title",
});
const title = computed(() => {
if (data.value.entity.data?.name)
return `${data.value.entity.data.name} - ${t("pages.searchviews.events.sing")}`;
return t("pages.searchviews.events.sing");
});
useHead({
title,
});
</script>

<template>
Expand Down
11 changes: 10 additions & 1 deletion pages/detail/institutions/[id].vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@ const loading = computed(() => ({
definePageMeta({
title: "pages.searchviews.institutions.title",
});
const title = computed(() => {
if (data.value.entity.data?.name) return `${data.value.entity.data.name} - Institution`;
return "Institution";
});
useHead({
title,
});
</script>

<template>
Expand All @@ -62,7 +71,7 @@ definePageMeta({
<div class="flex items-center gap-2">
<Indicator class="w-24" :status="data.entity.data?.ampel" />
<HierarchyLinkButton
:id="data.entity.data?.object_id"
:id="String(data.entity.data?.object_id)"
model="Institution"
:label="data.entity.data?.name"
/>
Expand Down
11 changes: 10 additions & 1 deletion pages/detail/persons/[id].vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@ const relCols = ["relation_type", "target.name", "start_date", "end_date"];
definePageMeta({
title: "pages.searchviews.people.title",
});
const title = computed(() => {
if (data.value.entity.data?.name) return `${data.value.entity.data.fullname} - Person`;
return "Person";
});
useHead({
title,
});
</script>

<template>
Expand Down Expand Up @@ -92,7 +101,7 @@ definePageMeta({
<div class="flex items-center gap-2">
<Indicator class="w-24" :status="data.entity.data?.ampel" />
<HierarchyLinkButton
:id="data.entity.data?.object_id"
:id="String(data.entity.data?.object_id)"
model="Person"
:label="data.entity.data?.fullname"
/>
Expand Down
10 changes: 10 additions & 0 deletions pages/detail/places/[id].vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,16 @@ const relCols = ["relation_type", "target.name", "start_date", "end_date"];
definePageMeta({
title: "pages.searchviews.places.title",
});
const title = computed(() => {
if (data.value.entity.data?.name)
return `${data.value.entity.data.name} - ${t("pages.searchviews.places.sing")}`;
return t("pages.searchviews.places.sing");
});
useHead({
title,
});
</script>

<template>
Expand Down
32 changes: 19 additions & 13 deletions pages/documentation/[...slug].vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ const currentDoc = computed(() => {
return route.params.slug[0];
}
});
useHead({
title: t("pages.documentation.title"),
});
console.log(route.params.slug, locale.value);
</script>

Expand All @@ -23,22 +27,24 @@ console.log(route.params.slug, locale.value);
<nav class="lg:justify-self-end" data-testid="docNav">
<ContentNavigation v-slot="{ navigation }" :query="{ where: [{ _locale: locale }] }">
<!-- :where="{ _locale: locale }" -->
<ul class="m-4 rounded bg-gray-200 p-4 text-lg shadow">
<div class="m-4 rounded bg-gray-200 p-4 text-lg shadow">
<h2 class="mb-2 text-xl font-black">
{{ t("pages.documentation.contents") }}
</h2>
<li v-for="link of navigation" :key="link._path">
<NuxtLink
:to="`/${locale}/documentation${link._path}`"
class="flex w-full items-center gap-1 rounded px-2 transition hover:bg-gray-300 active:bg-gray-400"
>
<ChevronRight class="h-4 w-4" />
<span>
{{ link.title }}
</span>
</NuxtLink>
</li>
</ul>
<ul>
<li v-for="link of navigation" :key="link._path">
<NuxtLink
:to="`/${locale}/documentation${link._path}`"
class="flex w-full items-center gap-1 rounded px-2 transition hover:bg-gray-300 active:bg-gray-400"
>
<ChevronRight class="h-4 w-4" />
<span>
{{ link.title }}
</span>
</NuxtLink>
</li>
</ul>
</div>
</ContentNavigation>
</nav>
<MainContent class="w-full px-6 py-4">
Expand Down
3 changes: 3 additions & 0 deletions pages/hierarchy.vue
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ const query = ref(
definePageMeta({
title: "pages.hierarchy.title",
});
useHead({
title: t("pages.hierarchy.label"),
});
</script>

<template>
Expand Down
4 changes: 3 additions & 1 deletion pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ definePageMeta({
<div class="flex flex-col gap-16 md:gap-32">
<div>
<div class="h-2 w-full bg-primary-900" />
<img
<NuxtImg
:placeholder="[452, 128, 75]"
src="/assets/images/background-court-ship.jpeg"
alt=""
format="webp"
class="min-h-[20rem] w-full object-cover"
/>
<div class="h-2 w-full bg-primary-800" />
Expand Down
4 changes: 4 additions & 0 deletions pages/search.vue
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ watch(
definePageMeta({
title: "pages.search.title",
});
useHead({
title: t("pages.search.title"),
});
</script>

<template>
Expand Down
6 changes: 6 additions & 0 deletions pages/search/courts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import SearchTable from "@/components/search-table.vue";
import { getSchema } from "@/composables/use-ts-data";
import { definePageMeta } from "#imports";
const t = useTranslations();
const collectionName = "viecpro_courts";
const queryBy = ["name", "main_owner.name", "kategorie"];
Expand All @@ -30,6 +32,10 @@ const sortable = computed(
definePageMeta({
title: "pages.searchviews.courts.title",
});
useHead({
title: `${t("pages.searchviews.courts.title")} ${t("pages.search.title")}`,
});
</script>

<template>
Expand Down
6 changes: 6 additions & 0 deletions pages/search/events.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import SearchTable from "@/components/search-table.vue";
import { getSchema } from "@/composables/use-ts-data";
import { definePageMeta } from "#imports";
const t = useTranslations();
const collectionName = "viecpro_events";
const queryBy = ["name", "alternativenames"];
Expand All @@ -30,6 +32,10 @@ const sortable = computed(
definePageMeta({
title: "pages.searchviews.events.title",
});
useHead({
title: `${t("pages.searchviews.events.title")} ${t("pages.search.title")}`,
});
</script>

<template>
Expand Down
10 changes: 10 additions & 0 deletions pages/search/institutions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import SearchTable from "@/components/search-table.vue";
import { getSchema } from "@/composables/use-ts-data";
import { definePageMeta } from "#imports";
const t = useTranslations();
const collectionName = "viecpro_institutions";
const queryBy = ["name", "alternativenames"];
const koi = ["name", "start", "end", "label:Auflösung", "label:Kategorie", "ampel"];
Expand All @@ -28,6 +30,14 @@ const sortable = computed(
definePageMeta({
title: "pages.searchviews.institutions.title",
});
useHead({
title: `${t("pages.searchviews.institutions.title")} ${t("pages.search.title")}`,
});
useHead({
title: `${t("pages.searchviews.institutions.title")} ${t("pages.search.title")}`,
});
</script>

<template>
Expand Down
6 changes: 6 additions & 0 deletions pages/search/persons.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import SearchTable from "@/components/search-table.vue";
import { getSchema } from "@/composables/use-ts-data";
import { definePageMeta } from "#imports";
const t = useTranslations();
const collectionName = "viecpro_persons";
const queryBy = ["name", "first_name", "alternativenames", "functions", "institutions"];
Expand All @@ -29,6 +31,10 @@ const sortable = computed(
definePageMeta({
title: "pages.searchviews.people.title",
});
useHead({
title: `${t("pages.searchviews.people.title")} ${t("pages.search.title")}`,
});
</script>

<template>
Expand Down
6 changes: 6 additions & 0 deletions pages/search/places.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import SearchTable from "@/components/search-table.vue";
import { getSchema } from "@/composables/use-ts-data";
import { definePageMeta } from "#imports";
const t = useTranslations();
const collectionName = "viecpro_places";
const queryBy = ["name", "alternativenames"];
const koi = ["name", "kind", "ampel"];
Expand All @@ -28,6 +30,10 @@ const sortable = computed(
definePageMeta({
title: "pages.searchviews.places.title",
});
useHead({
title: `${t("pages.searchviews.places.title")} ${t("pages.search.title")}`,
});
</script>

<template>
Expand Down
6 changes: 6 additions & 0 deletions pages/search/references.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import SearchTable from "@/components/search-table.vue";
import { getSchema } from "@/composables/use-ts-data";
import { definePageMeta } from "#imports";
const t = useTranslations();
const collectionName = "viecpro_references";
const queryBy = "folio";
const koi = ["id", "folio", "shortTitle", "related_doc.name"];
Expand All @@ -28,6 +30,10 @@ const sortable = computed(
definePageMeta({
title: "pages.searchviews.courts.title",
});
useHead({
title: `${t("pages.searchviews.references.title")} ${t("pages.search.title")}`,
});
</script>

<template>
Expand Down
6 changes: 6 additions & 0 deletions pages/search/relations.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import SearchTable from "@/components/search-table.vue";
import { getSchema } from "@/composables/use-ts-data";
import { definePageMeta } from "#imports";
const t = useTranslations();
const collectionName = "viecpro_relations";
const queryBy = ["target.name", "source.name", "relation_type"];
const koi = ["source_kind", "source.name", "relation_type", "target.name", "target_kind"];
Expand All @@ -28,6 +30,10 @@ const sortable = computed(
definePageMeta({
title: "pages.searchviews.relations.title",
});
useHead({
title: `${t("pages.searchviews.relations.title")} ${t("pages.search.title")}`,
});
</script>

<template>
Expand Down

0 comments on commit a2793f6

Please sign in to comment.