Skip to content

Commit

Permalink
Sort by category
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettmflynn committed Jun 4, 2024
1 parent 3180bc3 commit 10aa18b
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/schemas/timezone.schema.ts
Original file line number Diff line number Diff line change
@@ -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 = {}

Expand Down Expand Up @@ -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;
})
Expand Down

0 comments on commit 10aa18b

Please sign in to comment.