From d13d6c1366b291a6eeb1c4405b0a16978007adbd Mon Sep 17 00:00:00 2001 From: Alexandre Tuleu Date: Sun, 13 Aug 2023 14:36:43 +0200 Subject: [PATCH] Start splitting in component the page. --- src/lib/components/ServiceCard.svelte | 14 +++++++++++ src/lib/components/ServiceGroup.svelte | 11 +++++++++ src/lib/config.ts | 30 ++++++++++++++++++++++++ src/lib/server/config.ts | 32 +------------------------- src/routes/+page.svelte | 20 ++++------------ 5 files changed, 60 insertions(+), 47 deletions(-) create mode 100644 src/lib/components/ServiceCard.svelte create mode 100644 src/lib/components/ServiceGroup.svelte create mode 100644 src/lib/config.ts diff --git a/src/lib/components/ServiceCard.svelte b/src/lib/components/ServiceCard.svelte new file mode 100644 index 0000000..1f78ec1 --- /dev/null +++ b/src/lib/components/ServiceCard.svelte @@ -0,0 +1,14 @@ + + +

{service.title}

+{#if component != undefined} + +{/if} diff --git a/src/lib/components/ServiceGroup.svelte b/src/lib/components/ServiceGroup.svelte new file mode 100644 index 0000000..ed26ae7 --- /dev/null +++ b/src/lib/components/ServiceGroup.svelte @@ -0,0 +1,11 @@ + + +{#each group.items as service, i} + +{/each} diff --git a/src/lib/config.ts b/src/lib/config.ts new file mode 100644 index 0000000..753016b --- /dev/null +++ b/src/lib/config.ts @@ -0,0 +1,30 @@ +export interface BrandConfig { + logo?: string; + icon?: string; + usemask?: boolean; +} + +export interface SectionConfig extends BrandConfig { + title: string; + subtitle?: string; +} + +export interface ServiceConfig extends SectionConfig { + url: string; + target?: string; + type?: string; + + [x: string]: unknown; +} + +export interface ServiceGroupConfig extends SectionConfig { + items: Array; + + [x: string]: unknown; +} + +export interface Config extends SectionConfig { + services: Array; + + [x: string]: unknown; +} diff --git a/src/lib/server/config.ts b/src/lib/server/config.ts index 20e1c8e..d32e80f 100644 --- a/src/lib/server/config.ts +++ b/src/lib/server/config.ts @@ -2,37 +2,7 @@ import { writable, type Readable, type Writable, derived } from 'svelte/store'; import configData from '../../config.yml'; import { readFile, watch } from 'fs/promises'; import * as yml from 'js-yaml'; - -export interface BrandConfig { - logo?: string; - icon?: string; - usemask?: boolean; -} - -export interface SectionConfig extends BrandConfig { - title: string; - subtitle?: string; -} - -export interface ServiceConfig extends SectionConfig { - url: string; - target?: string; - type?: string; - - [x: string]: unknown; -} - -export interface ServiceGroupConfig extends SectionConfig { - items: Array; - - [x: string]: unknown; -} - -export interface Config extends SectionConfig { - services: Array; - - [x: string]: unknown; -} +import type { Config, ServiceConfig, ServiceGroupConfig } from '$lib/config'; const requiredService: Required = { title: '', diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 23b8987..4390733 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -1,4 +1,5 @@