Chore: sort code, improve error messages

This commit is contained in:
Pieter Vander Vennet 2025-04-08 02:55:32 +02:00
parent cfeabe4d22
commit 6ed31b9f10
2 changed files with 29 additions and 30 deletions

View file

@ -33,36 +33,35 @@ export type ValidatorType = (typeof Validators.availableTypes)[number]
export default class Validators {
public static readonly availableTypes = [
"string",
"text",
"date",
"nat",
"int",
"distance",
"direction",
"wikidata",
"pnat",
"float",
"pfloat",
"email",
"url",
"phone",
"opening_hours",
"color",
"image",
"simple_tag",
"key",
"translation",
"icon",
"fediverse",
"tag",
"fediverse",
"id",
"slope",
"velopark",
"nsi",
"currency",
"date",
"direction",
"distance",
"email",
"fediverse",
"float",
"icon",
"id",
"image",
"int",
"key",
"nat",
"nsi",
"opening_hours",
"pfloat",
"phone",
"pnat",
"regex",
"simple_tag",
"slope",
"string",
"tag",
"text",
"translation",
"url",
"velopark",
"wikidata"
] as const
public static readonly AllValidators: ReadonlyArray<Validator> = [
@ -94,7 +93,7 @@ export default class Validators {
new VeloparkValidator(),
new NameSuggestionIndexValidator(),
new CurrencyValidator(),
new RegexValidator(),
new RegexValidator()
]
private static _byType = Validators._byTypeConstructor()

View file

@ -23,11 +23,11 @@
export let getCountry = () => "?"
onMount(() => {
console.log("Setting selected unit based on country", getCountry(), upstreamValue.data)
console.log("Setting selected unit based on country", getCountry(), "and upstream value:", upstreamValue.data)
if (upstreamValue.data === undefined || upstreamValue.data === "") {
// Init the selected unit
let denomination: Denomination = unit.getDefaultDenomination(getCountry)
console.log("Found denom", denomination.canonical)
console.log("Found denom", denomination.canonical, "available denominations are:", unit.denominations.map(denom => denom.canonical))
selectedUnit.setData(denomination.canonical)
}
})