diff --git a/src/lib/services/models/course-utils.ts b/src/lib/services/models/course-utils.ts index f32a58c9..823805f3 100644 --- a/src/lib/services/models/course-utils.ts +++ b/src/lib/services/models/course-utils.ts @@ -1,4 +1,4 @@ -import { addIcon } from "$lib/ui/themes/theme-controller.svelte"; +import { themeService } from "$lib/ui/themes/theme-controller.svelte"; import type { Composite, Course, IconNav, Lo, LoType, Topic } from "./lo-types"; import { filterByType, setShowHide } from "./lo-utils"; @@ -51,7 +51,7 @@ export function createCompanions(course: Course) { if (course.properties.companions) { for (const [key, value] of Object.entries(course.properties.companions)) { const companion: any = value; - addIcon(key, companion.icon); + themeService.addIcon(key, companion.icon); course.companions.bar.push({ link: companion.link, type: key, diff --git a/src/lib/services/models/lo-types.ts b/src/lib/services/models/lo-types.ts index e3cce801..8ec8b9b1 100644 --- a/src/lib/services/models/lo-types.ts +++ b/src/lib/services/models/lo-types.ts @@ -54,6 +54,13 @@ export type IconNavBar = { bar: IconNav[]; }; +export type IconLib = Record; + +export type Theme = { + name: string; + icons: IconLib; +}; + export interface LearningRecord { date: Date; pageLoads: number; diff --git a/src/lib/ui/components/Card.svelte b/src/lib/ui/components/Card.svelte index aa069656..28054a6d 100644 --- a/src/lib/ui/components/Card.svelte +++ b/src/lib/ui/components/Card.svelte @@ -12,9 +12,9 @@ textSize } from "$lib/runes"; - import { getTypeColour } from "../themes/theme-controller.svelte"; import type { CardDetails } from "$lib/services/types.svelte"; import Icon from "$lib/ui/components/Icon.svelte"; + import { themeService } from "../themes/theme-controller.svelte"; let { cardDetails } = $props<{ cardDetails: CardDetails }>(); let target = $state(""); @@ -104,8 +104,8 @@
- + {text} {:else} - + {/if} {:else if link} diff --git a/src/lib/ui/learning-objects/content/Video.svelte b/src/lib/ui/learning-objects/content/Video.svelte index 2b8c8e5e..c52fa1b3 100644 --- a/src/lib/ui/learning-objects/content/Video.svelte +++ b/src/lib/ui/learning-objects/content/Video.svelte @@ -2,7 +2,7 @@ import { onMount } from "svelte"; import type { Lo } from "$lib/services/models/lo-types"; import { currentCourse } from "$lib/runes"; - import { getIcon } from "../../themes/theme-controller.svelte"; + import { themeService } from "$lib/ui/themes/theme-controller.svelte"; let firefox = $state(false); @@ -33,7 +33,7 @@ }); if (lo && lo.type === "panelvideo") { - lo.icon = { type: getIcon("video").type, color: getIcon("video").color }; + lo.icon = { type: themeService.getIcon("video").type, color: themeService.getIcon("video").color }; } if (lo.videoids) { diff --git a/src/lib/ui/themes/LayoutMenu.svelte b/src/lib/ui/themes/LayoutMenu.svelte index a041d6d0..b7720799 100644 --- a/src/lib/ui/themes/LayoutMenu.svelte +++ b/src/lib/ui/themes/LayoutMenu.svelte @@ -1,20 +1,20 @@