diff --git a/data/units.json b/data/units.json index 8afa22c..3eb4160 100644 --- a/data/units.json +++ b/data/units.json @@ -20,7 +20,7 @@ "id": "barrel", "label": "Barrel", "labelPlural": "Barrels", - "symbol": "dlbbl", + "symbol": "bbl", "group": "dickloads", "toBase": 19 }, @@ -28,18 +28,10 @@ "id": "hogshead", "label": "Hogshead", "labelPlural": "Hogsheads", - "symbol": "dlhhd", + "symbol": "hhd", "group": "dickloads", "toBase": 38 }, - { - "id": "assload", - "label": "Assload", - "labelPlural": "Assloads", - "symbol": "assl", - "group": "dickloads", - "toBase": 2 - }, { "id": "short-ton", "label": "Short ton", @@ -48,14 +40,6 @@ "group": "dickloads", "toBase": 76 }, - { - "id": "long-ton", - "label": "Long ton", - "labelPlural": "Long tons", - "symbol": "long tn", - "group": "dickloads", - "toBase": 85.1199999999 - }, { "id": "fuckton", "label": "Fuck ton", @@ -64,6 +48,14 @@ "group": "dickloads", "toBase": 152 }, + { + "id": "long-ton", + "label": "Long ton", + "labelPlural": "Long tons", + "symbol": "long tn", + "group": "dickloads", + "toBase": 85.1199999999 + }, { "id": "metric-fuckton", "label": "Metric fuckton", @@ -72,6 +64,14 @@ "group": "dickloads", "toBase": 170.2399999998 }, + { + "id": "assload", + "label": "Assload", + "labelPlural": "Assloads", + "symbol": "assl", + "group": "dickloads", + "toBase": 2 + }, { "id": "shitload", "label": "Shitload", diff --git a/src/lib/brand.ts b/src/lib/brand.ts new file mode 100644 index 0000000..5a68770 --- /dev/null +++ b/src/lib/brand.ts @@ -0,0 +1,32 @@ +/** + * Brand configuration keyed by hostname (www-stripped). + * Add new domains here — no other changes needed. + */ +export interface Brand { + /** Site name shown in nav and page titles. */ + name: string; + /** Footer tagline. */ + footer: string; +} + +const BRANDS: Record = { + 'humorunits.com': { + name: 'Humor Units', + footer: 'Humor Units — invented conversions for ridiculous people.', + }, + 'dickloads.com': { + name: 'Dick Loads', + footer: 'Dick Loads — serious units for serious people.', + }, +}; + +const DEFAULT_BRAND = BRANDS['humorunits.com']; + +export function getBrand(requestUrl: string): Brand { + try { + const host = new URL(requestUrl).hostname.replace(/^www\./, ''); + return BRANDS[host] ?? DEFAULT_BRAND; + } catch { + return DEFAULT_BRAND; + } +} diff --git a/src/routes/+layout.server.ts b/src/routes/+layout.server.ts new file mode 100644 index 0000000..ec34fba --- /dev/null +++ b/src/routes/+layout.server.ts @@ -0,0 +1,6 @@ +import { getBrand } from '$lib/brand'; +import type { LayoutServerLoad } from './$types'; + +export const load: LayoutServerLoad = ({ request }) => { + return { brand: getBrand(request.url) }; +}; diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 4b50f94..43727d0 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -2,8 +2,10 @@ import '@picocss/pico/css/pico.min.css'; import '../app.css'; import { browser } from '$app/environment'; + import type { Brand } from '$lib/brand'; - let { children } = $props(); + let { children, data }: { children: any; data: { brand: Brand } } = $props(); + let brand = $derived(data.brand); type Theme = 'light' | 'dark' | 'dan'; const CYCLE: Theme[] = ['light', 'dark', 'dan']; @@ -33,7 +35,7 @@