From aa294c4e29e9191bef6d79487b0b321fbc34f6fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wieland=20Sch=C3=B6bl?= Date: Thu, 23 Sep 2021 12:40:50 +0000 Subject: [PATCH] feat: add about config --- src/config/app.ts | 152 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 152 insertions(+) diff --git a/src/config/app.ts b/src/config/app.ts index 869781b7..4ff90223 100644 --- a/src/config/app.ts +++ b/src/config/app.ts @@ -15,6 +15,7 @@ // tslint:disable-next-line:no-implicit-dependencies import {Polygon} from 'geojson'; import {SCTranslations} from '../general/i18n'; +import {SCMap} from '../general/map'; import {SCLanguageSetting, SCSetting, SCUserGroupSetting} from '../things/setting'; /** @@ -80,6 +81,13 @@ export interface SCAppConfigurationMenuCategory { * An app configuration */ export interface SCAppConfiguration { + /** + * The about page + * + * Mapping route -> page config + */ + aboutPages: SCMap; + /** * Polygon that encapsulates the main campus */ @@ -174,3 +182,147 @@ export interface SCAppConfigurationMenuCategoryTranslationName { */ name: string; } + +export enum SCAboutPageContentType { + SECTION = 'section', + ROUTER_LINK = 'router link', + TABLE = 'table', + MARKDOWN = 'markdown', +} + +export interface SCAboutPageTranslationTitle { + /** + * Translation of the title + */ + title: string; +} + +export interface SCAboutPageTranslationValue { + /** + * Translation of the value + */ + value: string; +} + +/** + * A (mostly) self-contained section, akin to markdown `# Title` + */ +export interface SCAboutPageSection { + /** + * If the section should be contained in a card + */ + card?: true; + + /** + * The content of the section + */ + content: SCAboutPageContent; + + /** + * The title of the section + */ + title: string; + + /** + * Translations + */ + translations: SCTranslations; + + /** + * Type + */ + type: SCAboutPageContentType.SECTION; +} + +/** + * A router link that can lead to a new page + * + * For external links, prefer markdown `[destination](link)` + */ +export interface SCAboutPageRouterLink { + /** + * Icon of the destination + */ + icon?: string; + + /** + * Router link + */ + link: string; + + /** + * Title of the destination + */ + title: string; + + /** + * Translations + */ + translations: SCTranslations; + + /** + * Type + */ + type: SCAboutPageContentType.ROUTER_LINK; +} + +/** + * A simple table element + */ +export interface SCAboutPageTable { + /** + * Rows of the table + */ + rows: SCAboutPageContent[][]; + + /** + * Type + */ + type: SCAboutPageContentType.TABLE; +} + +/** + * A markdown element + */ +export interface SCAboutPageMarkdown { + /** + * Translations + */ + translations: SCTranslations; + + /** + * Type + */ + type: SCAboutPageContentType.MARKDOWN; + + /** + * Value (Markdown) + */ + value: string; +} + +export type SCAboutPageContent = + | SCAboutPageMarkdown + | SCAboutPageTable + | SCAboutPageSection + | SCAboutPageRouterLink; + +/** + * Root of the about page + */ +export interface SCAboutPage { + /** + * Content of the page + */ + content: SCAboutPageContent[]; + + /** + * Header (title) of the page + */ + title: string; + + /** + * Translations + */ + translations: SCTranslations; +}