forked from craws/OpenAtlas-Discovery
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feature/i18n
- Loading branch information
Showing
27 changed files
with
1,024 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/usr/bin/env sh | ||
#!/usr/bin/.env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npx lint-staged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
{ | ||
"defaultLocale": "en", | ||
"APIbase": "https://demo-dev.openatlas.eu", | ||
"imageDomains": ["openatlas.eu"] | ||
"colors": { | ||
"primaryColor": "#b8cf5b" | ||
}, | ||
"defaultLocale": "en", | ||
"logo": "/logo.svg" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,75 @@ | ||
/** | ||
* Configuration options for the Discovery website. | ||
*/ | ||
export interface DiscoveryConfig { | ||
/** | ||
* The default locale for the website. The locales have to be provided and present to be applied. | ||
*/ | ||
defaultLocale: string; | ||
import { z } from "zod"; | ||
import userConfig from "./discoveryConfig.json"; | ||
const locales = ["en", "de"] as const; | ||
|
||
const schema = z.object({ | ||
/** | ||
* The custom format for displaying dates and times on the Discovery website. | ||
* The title of the website. | ||
* Specifies the title that will be used for the Discovery website. | ||
* @default OpenAtlas Discovery | ||
*/ | ||
dateTimeFormat?: string; | ||
title: z.string().default("OpenAtlas Discovery"), | ||
|
||
/** | ||
* A list of filters represented as numbers. | ||
* Acts as a whitelist to allow only entities belonging to a certain type given by ID. | ||
* These filters are applied in the Overview and Search sections of the website but not in the detailed view. | ||
* The description of the website. | ||
* Specifies the description that will be used for the Discovery website. | ||
*/ | ||
defaultFilters?: number[]; | ||
description: z.string().optional(), | ||
|
||
/** | ||
* The base URL for the Discovery website's API. | ||
* If provided, it specifies the root URL that will be used for making API requests. | ||
* The default locale for the website. The locales have to be provided and present to be applied. | ||
*/ | ||
APIbase?: string; | ||
defaultLocale: z.enum(locales).default("en"), | ||
|
||
/** | ||
* The list of allowed image domains. | ||
* Specifies the domains from which images can be optimized via nuxt-img for the Discovery website. | ||
* A list of filters represented as numbers. | ||
* Acts as a whitelist to allow only entities belonging to a certain type given by ID. | ||
* These filters are applied in the Overview and Search sections of the website but not in the detailed view. | ||
*/ | ||
imageDomains?: string[]; | ||
defaultFilters: z.array(z.number()).optional(), // should be required | ||
|
||
/** | ||
* Hex color code for the primary color of the website. | ||
*/ | ||
primaryColor?: string; | ||
colors: z.object({ | ||
/** | ||
* Hex color code for the primary color of the website. | ||
*/ | ||
primaryColor: z.string().default("#b8cf5b"), | ||
|
||
/** | ||
* Hex color for the secondary color of the website | ||
*/ | ||
secondaryColor: z.string().optional(), | ||
}), | ||
|
||
/** | ||
* Logo | ||
* Specifies the logo that will be used for the Discovery website. | ||
* @default logo.svg | ||
*/ | ||
logo: string; | ||
logo: z.string().default("logo.svg"), | ||
|
||
/** | ||
* Header Logo | ||
* Specifies the logo that will be used for the header of the Discovery website. Will default to logo if not provided. | ||
* @default logo | ||
* @see logo | ||
*/ | ||
headerLogo?: string; | ||
|
||
// Favicon | ||
headerLogo: z.string().optional(), // should be required | ||
|
||
/** | ||
* The favicon of the website. | ||
* Specifies the favicon that will be used for the Discovery website. | ||
* @supportedTypes image/svg+xml, image/x-icon | ||
*/ | ||
favicon?: string; | ||
favicon: z.string().optional(), // should be required | ||
}); | ||
|
||
/** | ||
* The title of the website. | ||
* Specifies the title that will be used for the Discovery website. | ||
* @default OpenAtlas Discovery | ||
*/ | ||
title: string; | ||
const result = schema.safeParse(userConfig); | ||
if (!result.success) { | ||
console.error("invalid config!", result.error.flatten().fieldErrors); | ||
throw new Error("invalid config!"); | ||
} | ||
|
||
export const defaultDiscoveryConfig: DiscoveryConfig = { | ||
defaultLocale: "en", | ||
logo: "/logo.svg", | ||
title: "OpenAtlas Discovery", | ||
}; | ||
export const discoveryConfig = result.data; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
--- | ||
title: About | ||
navigation: | ||
title: "About" | ||
title: About | ||
--- | ||
|
||
# About | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
--- | ||
title: Home | ||
navigation: | ||
title: OpenAtlas Disovery | ||
--- | ||
![logo](/logo.svg) | ||
|
||
# OpenAtlas Discovery | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
export default defineNuxtRouteMiddleware(() => { | ||
const { $discoveryConfig } = useNuxtApp(); | ||
if ($discoveryConfig.APIbase === undefined) { | ||
if (useRuntimeConfig().public.APIBase === undefined) { | ||
return navigateTo("/", { redirectCode: 308 }); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.