From 8fae4b7d6fb9cc09ad035072dbdb7aa8cd962bf2 Mon Sep 17 00:00:00 2001 From: Karl Ludwig Weise Date: Wed, 23 Sep 2026 09:10:35 +0200 Subject: [PATCH] BookAppointment: Channels are now sorted alphabetically --- src/routes/(pages)/(clients)/+layout.server.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/routes/(pages)/(clients)/+layout.server.ts b/src/routes/(pages)/(clients)/+layout.server.ts index 1c4a85b..3c2385b 100644 --- a/src/routes/(pages)/(clients)/+layout.server.ts +++ b/src/routes/(pages)/(clients)/+layout.server.ts @@ -1,5 +1,6 @@ import logger from "$lib/logger"; import type { TPublicChannel, TPublicTenant } from "$lib/types/public"; +import { getCurrentTranslation } from "$lib/utils/localizations"; import type { LayoutServerLoad } from "./$types"; const log = logger.setContext(import.meta.filename); @@ -33,7 +34,11 @@ export const load: LayoutServerLoad = async (event) => { .then(async (res) => { try { const body = await res.json(); - return body.channels || ([] as TPublicChannel[]); + return ( + body.channels.sort((a: TPublicChannel, b: TPublicChannel) => + getCurrentTranslation(a.names).localeCompare(getCurrentTranslation(b.names)), + ) || ([] as TPublicChannel[]) + ); } catch (error) { log.error("Failed to parse settings base response", { error }); }