From 10aa18be118eefcce87bed39895ca50a7abc6281 Mon Sep 17 00:00:00 2001 From: Garrett Michael Flynn Date: Tue, 4 Jun 2024 16:34:56 -0700 Subject: [PATCH] Sort by category --- src/schemas/timezone.schema.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/schemas/timezone.schema.ts b/src/schemas/timezone.schema.ts index b752c633c..6d643f0be 100644 --- a/src/schemas/timezone.schema.ts +++ b/src/schemas/timezone.schema.ts @@ -1,5 +1,6 @@ import { baseUrl, onServerOpen } from "../electron/frontend/core/server/globals"; import { isStorybook } from '../electron/frontend/core/globals' +import { header } from "../electron/frontend/core/components/forms/utils"; const setReady: any = {} @@ -105,16 +106,23 @@ ready.timezones.then((timezones) => { }); timezoneSchema.enumLabels = filteredTimezones.reduce((acc, tz) => { - const [ region, city ] = tz.split('/') - acc[tz] = `${city}, ${region}` + const [ _, ...other ] = tz.split('/') + acc[tz] = other.map(part => header(part)).join(' — ') return acc - }) + }, {}) + + timezoneSchema.enumKeywords = filteredTimezones.reduce((acc, tz) => { + const [ region ] = tz.split('/') + acc[tz] = [ header(region) ] + return acc + }, {}) timezoneSchema.enumCategories = filteredTimezones.reduce((acc, tz) => { const [ region ] = tz.split('/') acc[tz] = region return acc - }) + }, {}) + console.log(timezone); timezoneSchema.default = timezone; })