Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Mocca101 committed Mar 26, 2024
2 parents 83b21f8 + 6d74706 commit cb17dcc
Show file tree
Hide file tree
Showing 21 changed files with 1,390 additions and 1,309 deletions.
25 changes: 25 additions & 0 deletions .vscode/app.code-snippets
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"Nuxt static page component": {
"scope": "vue",
"prefix": "nuxt-page-static",
"body": [
"<script lang=\"ts\" setup>",
"defineRouteRules({",
"\tprerender: true,",
"});",
"",
"const t = useTranslations();",
"",
"usePageMetadata({",
"\ttitle: \"${1:Name}Page.meta.title\",",
"});",
"</script>",
"",
"<template>",
"\t<MainContent class=\"container grid content-start gap-y-8 py-8\">",
"\t\t<PageTitle>{{ t(\"${1:Name}Page.title\") }}</PageTitle>",
"\t</MainContent>",
"</template>",
],
},
}
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"typescript.preferences.preferTypeOnlyAutoImports": true,
"typescript.tsdk": "node_modules/typescript/lib",
"workbench.editor.labelFormat": "medium",
"workbench.tree.enableStickyScroll": true,
"[markdown][mdc]": {
"editor.wordWrap": "on"
}
Expand Down
4 changes: 2 additions & 2 deletions components/data-view.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const entities = computed(() => {
class="relative isolate grid size-full overflow-y-auto"
:class="{ 'opacity-50 grayscale': isLoading }"
>
<div v-if="useGetSearchResults.length > 0" class="grid gap-8">
<div v-if="entities.length > 0" class="grid gap-8">
<SearchResultsTable
:entities="entities"
:sorting="sortingState"
Expand Down Expand Up @@ -146,7 +146,7 @@ const entities = computed(() => {
</Pagination>
</div>

<div v-else>
<div v-else-if="!isLoading">
<Centered>{{ t("DataView.nothing-found") }}</Centered>
</div>

Expand Down
19 changes: 19 additions & 0 deletions composables/use-page-metadata.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
interface UsePageMetadataParams {
title: MaybeRef<string>;
description?: MaybeRef<string>;
}

export function usePageMetadata(params: UsePageMetadataParams): void {
useHead({
title: params.title,
meta: [
{ property: "og:title", content: params.title },
...(params.description != null
? [
{ name: "description", content: params.description },
{ property: "og:description", content: params.description },
]
: []),
],
});
}
11 changes: 1 addition & 10 deletions error.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
<script lang="ts" setup>
/**
* `error.vue` sits outside the routing structure, so we cannot define page metadata.
*
* @see https://github.com/nuxt/nuxt/issues/19344#issuecomment-1449685103
*/
// definePageMeta({
// title: "ErrorPage.meta.title",
// });
const props = defineProps<{
error:
| Error
Expand Down Expand Up @@ -50,7 +41,7 @@ function onReset() {
</script>

<template>
<MainContent class="grid min-h-full place-content-center place-items-center">
<MainContent class="grid min-h-full place-content-center place-items-center gap-y-3">
<template v-if="isNotFoundPage">
<h1>{{ t("NotFoundPage.title") }}</h1>
</template>
Expand Down
9 changes: 5 additions & 4 deletions layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const env = useRuntimeConfig();
const locale = useLocale();
const t = useTranslations();
const route = useRoute();
const i18nHead = useLocaleHead({
addDirAttribute: true,
Expand All @@ -28,7 +27,7 @@ useHead({
return ["%s", t("Metadata.name")].join(" | ");
}),
title: computed(() => {
return t(route.meta.title);
return t("Metadata.name");
}),
link: computed(() => {
return [
Expand All @@ -43,7 +42,7 @@ useHead({
return [
{ name: "description", content: t("Metadata.description") },
{ property: "og:type", content: "website" },
{ property: "og:title", content: t(route.meta.title) },
{ property: "og:title", content: t("Metadata.name") },
{ property: "og:site_name", content: t("Metadata.name") },
{ property: "og:description", content: t("Metadata.description") },
{
Expand Down Expand Up @@ -81,10 +80,12 @@ useHead({
isNonEmptyString(env.public.NUXT_PUBLIC_MATOMO_BASE_URL) &&
isNonEmptyString(env.public.NUXT_PUBLIC_MATOMO_ID)
) {
const baseUrl = env.public.NUXT_PUBLIC_MATOMO_BASE_URL;
scripts.push({
type: "",
innerHTML: createAnalyticsScript(
env.public.NUXT_PUBLIC_MATOMO_BASE_URL,
baseUrl.endsWith("/") ? baseUrl : baseUrl + "/",
env.public.NUXT_PUBLIC_MATOMO_ID,
),
});
Expand Down
4 changes: 3 additions & 1 deletion messages/de/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,13 @@
"end-date": "End-Datum",
"start-date": "Start-Datum"
},
"DataView": {
"nothing-found": "Keine Einträge zu dieser Suche."
},
"DataPage": {
"meta": {
"title": "Daten"
},
"nothing-found": "Nichts gefunden",
"search": "Suche",
"title": "Daten",
"work-in-progress": "Die Datenbank ist derzeit im Aufbau."
Expand Down
4 changes: 3 additions & 1 deletion messages/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,13 @@
"end-date": "End date",
"start-date": "Start date"
},
"DataView": {
"nothing-found": "No entries found for this search."
},
"DataPage": {
"meta": {
"title": "Data"
},
"nothing-found": "Nothing found",
"search": "Search",
"title": "Data",
"work-in-progress": "The database is currently work in progress."
Expand Down
52 changes: 26 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,74 +42,74 @@
"@acdh-oeaw/lib": "^0.1.7",
"@acdh-oeaw/tsconfig": "^1.0.2",
"@fontsource-variable/inter": "^5.0.17",
"@nuxt/content": "^2.12.0",
"@nuxt/image": "^1.3.0",
"@nuxt/content": "^2.12.1",
"@nuxt/image": "^1.4.0",
"@nuxtjs/color-mode": "^3.3.2",
"@nuxtjs/i18n": "^8.2.0",
"@nuxtjs/mdc": "^0.5.0",
"@nuxtjs/mdc": "^0.6.1",
"@stefanprobst/netlify-cms-oauth-client": "^0.4.0",
"@stefanprobst/openapi-client": "^0.0.3",
"@tanstack/vue-query": "^5.24.8",
"@tanstack/vue-query": "^5.28.4",
"@tanstack/vue-table": "^8.13.2",
"@turf/turf": "^6.5.0",
"@vee-validate/zod": "^4.12.5",
"@vee-validate/zod": "^4.12.6",
"@vueuse/core": "^10.9.0",
"@vueuse/nuxt": "^10.9.0",
"colorjs.io": "^0.5.0",
"cva": "^1.0.0-beta.1",
"dotenv": "^16.4.5",
"dotenv-cli": "^7.3.0",
"dotenv-cli": "^7.4.1",
"dotenv-expand": "^11.0.6",
"embla-carousel": "^8.0.0",
"embla-carousel-vue": "^8.0.0",
"fast-glob": "^3.3.2",
"is-ci": "^3.0.1",
"lucide-vue-next": "^0.344.0",
"maplibre-gl": "^4.1.0",
"lucide-vue-next": "^0.358.0",
"maplibre-gl": "^4.1.1",
"npm-run-all2": "^6.1.2",
"nuxt": "^3.10.3",
"openapi-typescript": "^7.0.0-next.7",
"nuxt": "^3.11.0",
"openapi-typescript": "^7.0.0-next.8",
"pino-http": "^9.0.0",
"radix-vue": "^1.4.9",
"tailwind-merge": "^2.2.1",
"radix-vue": "^1.5.2",
"tailwind-merge": "^2.2.2",
"tsx": "^4.7.1",
"vee-validate": "^4.12.5",
"vee-validate": "^4.12.6",
"vue": "^3.4.21",
"vue-i18n": "^9.10.1",
"vue-i18n": "^9.10.2",
"vue-i18n-routing": "^1.2.0",
"vue-router": "^4.3.0",
"vue-sonner": "^1.1.1",
"vue-sonner": "^1.1.2",
"zod": "^3.22.4"
},
"devDependencies": {
"@acdh-oeaw/eslint-config": "^1.0.6",
"@acdh-oeaw/eslint-config-nuxt": "^1.0.12",
"@acdh-oeaw/eslint-config-vue": "^1.0.11",
"@acdh-oeaw/eslint-config": "^1.0.7",
"@acdh-oeaw/eslint-config-nuxt": "^1.0.13",
"@acdh-oeaw/eslint-config-vue": "^1.0.12",
"@acdh-oeaw/prettier-config": "^2.0.0",
"@acdh-oeaw/stylelint-config": "^2.0.1",
"@acdh-oeaw/tailwindcss-preset": "^0.0.22",
"@nuxt/devtools": "^1.0.8",
"@playwright/test": "^1.42.1",
"@tanstack/eslint-plugin-query": "^5.20.1",
"@tanstack/eslint-plugin-query": "^5.27.7",
"@types/geojson": "^7946.0.14",
"@types/node": "^20.11.24",
"@types/node": "^20.11.28",
"axe-core": "^4.8.4",
"axe-playwright": "^2.0.1",
"ci-info": "^4.0.0",
"decap-server": "^3.0.2",
"eslint": "^8.57.0",
"eslint-plugin-tailwindcss": "^3.14.3",
"eslint-plugin-tailwindcss": "^3.15.1",
"is-ci": "^3.0.1",
"lint-staged": "^15.2.2",
"postcss": "^8.4.35",
"postcss": "^8.4.36",
"prettier": "^3.2.5",
"schema-dts": "^1.1.2",
"simple-git-hooks": "^2.10.0",
"simple-git-hooks": "^2.11.0",
"stylelint": "^16.2.1",
"tailwindcss": "^3.4.1",
"typescript": "^5.3.3",
"vite": "^5.1.4",
"vue-tsc": "^2.0.4"
"typescript": "^5.4.2",
"vite": "^5.1.6",
"vue-tsc": "^2.0.6"
},
"pnpm": {
"patchedDependencies": {
Expand Down
8 changes: 4 additions & 4 deletions pages/content/[...id].vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ defineRouteRules({
prerender: true,
});
definePageMeta({
title: "ContentPage.meta.title",
});
const locale = useLocale();
const t = useTranslations();
usePageMetadata({
title: t("ContentPage.meta.title"),
});
const route = useRoute();
const id = computed(() => {
return route.params.id as Array<string>;
Expand Down
5 changes: 4 additions & 1 deletion pages/data/index.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<script lang="ts" setup>
definePageMeta({
title: "DataPage.meta.title",
validate() {
const env = useRuntimeConfig();
return env.public.NUXT_PUBLIC_DATABASE !== "disabled";
Expand All @@ -9,6 +8,10 @@ definePageMeta({
const t = useTranslations();
usePageMetadata({
title: t("DataPage.meta.title"),
});
const env = useRuntimeConfig();
</script>

Expand Down
7 changes: 5 additions & 2 deletions pages/entities/[id].vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { hasCoordinates } from "@/utils/has-geojson-coordinates";
// });
definePageMeta({
title: "EntityPage.meta.title",
validate(route) {
const env = useRuntimeConfig();
if (env.public.NUXT_PUBLIC_DATABASE === "disabled") return false;
Expand All @@ -22,8 +21,12 @@ definePageMeta({
},
});
const locale = useLocale();
const t = useTranslations();
usePageMetadata({
title: t("EntityPage.meta.title"),
});
const { getUnprefixedId } = useIdPrefix();
const route = useRoute();
Expand Down
5 changes: 4 additions & 1 deletion pages/imprint.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@ defineRouteRules({
});
definePageMeta({
title: "ImprintPage.meta.title",
validate() {
return project.imprint !== "none";
},
});
const t = useTranslations();
usePageMetadata({
title: t("ImprintPage.meta.title"),
});
if (project.imprint === "none") {
throw createError({ fatal: true, statusCode: 404, statusMessage: "Imprint page is disabled" });
}
Expand Down
8 changes: 4 additions & 4 deletions pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ defineRouteRules({
prerender: true,
});
definePageMeta({
title: "IndexPage.meta.title",
});
const locale = useLocale();
const t = useTranslations();
usePageMetadata({
title: t("IndexPage.meta.title"),
});
const {
data: content,
error,
Expand Down
5 changes: 4 additions & 1 deletion pages/map/index.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<script lang="ts" setup>
definePageMeta({
title: "MapPage.meta.title",
validate() {
const env = useRuntimeConfig();
return env.public.NUXT_PUBLIC_DATABASE !== "disabled";
Expand All @@ -9,6 +8,10 @@ definePageMeta({
const t = useTranslations();
usePageMetadata({
title: t("MapPage.meta.title"),
});
const env = useRuntimeConfig();
</script>

Expand Down
8 changes: 4 additions & 4 deletions pages/team.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ defineRouteRules({
prerender: true,
});
definePageMeta({
title: "TeamPage.meta.title",
});
const locale = useLocale();
const t = useTranslations();
usePageMetadata({
title: t("TeamPage.meta.title"),
});
const {
data: content,
error,
Expand Down
Loading

0 comments on commit cb17dcc

Please sign in to comment.