Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Schlauer-Hax committed Apr 16, 2023
2 parents fa3e063 + d879413 commit 4a3d811
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 13 deletions.
18 changes: 9 additions & 9 deletions data/language.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[
"EN",
"PT",
"FR",
"DE",
"IT",
"RU",
"ES"
]
{
"EN": "English",
"PT": "Portuguese",
"FR": "French",
"DE": "German",
"IT": "Italian",
"RU": "Russian",
"ES": "Spanish"
}
3 changes: 2 additions & 1 deletion pages/manager/music/changeDrop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ export function ChangeDrop(drop: Drop, update: (data: Partial<EditViewState>) =>
],
TextInput("date", "Release Date").sync(data, "release"),
// TODO: Show user spelled out language
DropDownInput("Language", language)
DropDownInput("Language", Object.keys(language))
.setRender((key) => language[ <keyof typeof language>key ])
.sync(data, "language"),
[
{ width: 2 },
Expand Down
2 changes: 1 addition & 1 deletion pages/manager/music/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export function ManageSongs(state: StateHandler<{ songs: Drop[ "songs" ]; }>) {
.addClass("low-level")
],
[ "Country", "max-content", (row, index) =>
DropDownInput("Country", language)
DropDownInput("Country", Object.keys(language))
.setValue(row.country)
.onChange((data) => update(state, index, "country", data))
.setStyle(ButtonStyle.Inline)
Expand Down
3 changes: 2 additions & 1 deletion pages/manager/newDrop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ const wizard = (restore?: Drop) => Wizard({
Grid(
TextInput("date", "Release Date", "live").sync(state, "release"),
// TODO: Show user spelled out language
DropDownInput("Language", language)
DropDownInput("Language", Object.keys(language))
.setRender((key) => language[ <keyof typeof language>key ])
.sync(state, "language")
)
.setEvenColumns(small ? 1 : 2)
Expand Down
5 changes: 4 additions & 1 deletion spec/music.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ export const song = zod.object({
});

export const pageOne = zod.object({
upc: zod.string().min(1).transform(x => x.trim() || undefined).optional()
upc: zod.string().nullish()
.transform(x => x?.trim())
.transform(x => x?.length == 0 ? null : x)
.refine(x => x == null || x.length > 0, { message: "Not a valid UPC" })
});

export const pageTwo = zod.object({
Expand Down

0 comments on commit 4a3d811

Please sign in to comment.