Housekeeping: formatting

This commit is contained in:
Pieter Vander Vennet 2024-02-20 13:33:38 +01:00
parent 9d53a45f9a
commit 1528dfaae1
168 changed files with 3332 additions and 4560 deletions

View file

@ -38,10 +38,5 @@
</script>
<div>
<TagRenderingEditable
{config}
selectedElement={undefined}
{state}
{tags}
/>
<TagRenderingEditable {config} selectedElement={undefined} {state} {tags} />
</div>

View file

@ -24,7 +24,7 @@
export let backToStudio: () => void
let messages = state.messages
let hasErrors = messages.mapD(
(m: ConversionMessage[]) => m.filter((m) => m.level === "error").length,
(m: ConversionMessage[]) => m.filter((m) => m.level === "error").length
)
const configuration = state.configuration
@ -102,10 +102,7 @@
rel="noopener"
>
<div class="flex flex-col">
<b>
Test in safe mode
</b>
<b>Test in safe mode</b>
<div>No changes are recoded to OSM</div>
</div>
<ChevronRightIcon class="h-6 w-6 shrink-0" />

View file

@ -20,7 +20,7 @@
const perRegion: Record<string, ConfigMeta[]> = {}
for (const schemaElement of schema) {
if(schemaElement.path.length > 1 && schemaElement.path[0] === "layers"){
if (schemaElement.path.length > 1 && schemaElement.path[0] === "layers") {
continue
}
const key = schemaElement.hints.group ?? "no-group"

View file

@ -30,7 +30,7 @@
let thenText: UIEventSource<Record<string, string>> = state.getStoreFor([...path, "then"])
let thenTextEn = thenText.mapD((translation) =>
typeof translation === "string" ? translation : translation["en"],
typeof translation === "string" ? translation : translation["en"]
)
let editMode = Object.keys($thenText ?? {})?.length === 0
@ -72,7 +72,7 @@
<FromHtml src={$parsedTag?.asHumanString(false, false, $exampleTags)} />
{#if $messages.length > 0}
<div class="alert m-2 flex">
<ExclamationTriangle class="w-6 h-6" />
<ExclamationTriangle class="h-6 w-6" />
{$messages.length} errors
</div>
{/if}

View file

@ -83,7 +83,6 @@
helperArgs,
},
}
if (schema.hints.default) {
configJson.mappings = [
@ -95,7 +94,7 @@
schema.hints.default +
"</b> will be used. " +
(schema.hints.ifunset ?? ""),
hideInAnswer: mightBeBoolean(schema.type)
hideInAnswer: mightBeBoolean(schema.type),
},
]
} else if (!schema.required) {
@ -107,7 +106,6 @@
]
}
if (mightBeBoolean(schema.type)) {
configJson.mappings = configJson.mappings ?? []
configJson.mappings.push(
@ -147,19 +145,19 @@
tags.map((tgs) => {
const v = tgs["value"]
if (typeof v === "object") {
return { ...<object>v }
return { ...(<object>v) }
}
if (schema.type === "boolean") {
if(v === null || v === undefined){
return v
}
if (v === null || v === undefined) {
return v
}
return v === "true" || v === "yes" || v === "1"
}
if (mightBeBoolean(schema.type)) {
if (v === "true" || v === "yes" || v === "1") {
return true
}
if (v === "false" || v === "no" || v === "0" || (<any> v) === false) {
if (v === "false" || v === "no" || v === "0" || <any>v === false) {
return false
}
}

View file

@ -212,12 +212,7 @@
with MapComplete Studio
{:else}
<div>
<TagRenderingEditable
{config}
selectedElement={undefined}
{state}
{tags}
/>
<TagRenderingEditable {config} selectedElement={undefined} {state} {tags} />
</div>
{#if chosenOption !== undefined}

View file

@ -6,7 +6,7 @@
export let state: EditLayerState
export let path: (string | number)[] = []
let value = new UIEventSource<Record<string,string>>({})
let value = new UIEventSource<Record<string, string>>({})
console.log("Registering translation to path", path)
state.register(
path,

View file

@ -29,7 +29,7 @@
const store = state.getStoreFor(path)
let value = store.data
let hasSeenIntro = UIEventSource.asBoolean(
LocalStorageSource.Get("studio-seen-tagrendering-tutorial", "false"),
LocalStorageSource.Get("studio-seen-tagrendering-tutorial", "false")
)
onMount(() => {
if (!hasSeenIntro.data) {
@ -42,7 +42,7 @@
* Should only be enabled for 'tagrenderings' in the theme, if the source is OSM
*/
let allowQuestions: Store<boolean> = state.configuration.mapD(
(config) => path.at(0) === "tagRenderings" && config.source?.["geoJson"] === undefined,
(config) => path.at(0) === "tagRenderings" && config.source?.["geoJson"] === undefined
)
let mappingsBuiltin: MappingConfigJson[] = []
@ -118,7 +118,7 @@
const freeformSchemaAll = <ConfigMeta[]>(
questionableTagRenderingSchemaRaw.filter(
(schema) => schema.path.length == 2 && schema.path[0] === "freeform" && $allowQuestions,
(schema) => schema.path.length == 2 && schema.path[0] === "freeform" && $allowQuestions
)
)
let freeformSchema = $expertMode
@ -127,7 +127,7 @@
const missing: string[] = questionableTagRenderingSchemaRaw
.filter(
(schema) =>
schema.path.length >= 1 && !items.has(schema.path[0]) && !ignored.has(schema.path[0]),
schema.path.length >= 1 && !items.has(schema.path[0]) && !ignored.has(schema.path[0])
)
.map((schema) => schema.path.join("."))
console.log({ state })
@ -135,12 +135,7 @@
{#if typeof $store === "string"}
<div class="low-interaction flex">
<TagRenderingEditable
config={configBuiltin}
selectedElement={undefined}
{state}
{tags}
/>
<TagRenderingEditable config={configBuiltin} selectedElement={undefined} {state} {tags} />
<slot name="upper-right" />
</div>
{:else}
@ -177,7 +172,6 @@
</button>
</MappingInput>
</div>
{/each}
<button