From 5f5960e909cf2d66b04d1e879eb94621fac84beb Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Fri, 28 Feb 2025 13:14:14 +0100 Subject: [PATCH] Studio(UX): small fixes to studio --- .../QuestionableTagRenderingConfigJson.ts | 8 +-- .../Json/TagRenderingConfigJson.ts | 7 ++- src/UI/Studio/ChooseLayerToEdit.svelte | 7 ++- src/UI/StudioGUI.svelte | 58 +++++++++---------- src/assets/schemas/layerconfigmeta.json | 8 +++ src/assets/schemas/layoutconfigmeta.json | 24 ++++++++ 6 files changed, 72 insertions(+), 40 deletions(-) diff --git a/src/Models/ThemeConfig/Json/QuestionableTagRenderingConfigJson.ts b/src/Models/ThemeConfig/Json/QuestionableTagRenderingConfigJson.ts index 0bda688ba..1d7c6e4d9 100644 --- a/src/Models/ThemeConfig/Json/QuestionableTagRenderingConfigJson.ts +++ b/src/Models/ThemeConfig/Json/QuestionableTagRenderingConfigJson.ts @@ -218,10 +218,10 @@ export interface QuestionableTagRenderingConfigJson extends TagRenderingConfigJs */ freeform?: { /** - * question: What is the name of the attribute that should be written to? - * This is the OpenStreetMap-key that that value will be written to - * ifunset: do not offer a freeform textfield as answer option - * + * question: What is the name of the key (attribute) that should be filled if an answer is given? + * This data will be uploaded to OpenStreetMap + * If this key is present in the feature, then 'render' is used to display the value and should contain this. + * ifunset: Do not allow a text/value field that a contributor can type into. (Only if no question is defined): always show "render", no matter the values */ key?: string diff --git a/src/Models/ThemeConfig/Json/TagRenderingConfigJson.ts b/src/Models/ThemeConfig/Json/TagRenderingConfigJson.ts index 22cfc1f11..665999ea3 100644 --- a/src/Models/ThemeConfig/Json/TagRenderingConfigJson.ts +++ b/src/Models/ThemeConfig/Json/TagRenderingConfigJson.ts @@ -147,9 +147,10 @@ export interface TagRenderingConfigJson { */ freeform?: { /** - * What attribute should be filled out - * If this key is present in the feature, then 'render' is used to display the value. - * If this is undefined, the rendering is _always_ shown + * question: What is the name of the key (attribute) that should be filled if an answer is given? + * This data will be uploaded to OpenStreetMap + * If this key is present in the feature, then 'render' is used to display the value and should contain this. + * ifunset: Do not allow a text/value field that a contributor can type into. (Only if no question is defined): always show "render", no matter the values */ key?: string } diff --git a/src/UI/Studio/ChooseLayerToEdit.svelte b/src/UI/Studio/ChooseLayerToEdit.svelte index 5a116e321..64550211e 100644 --- a/src/UI/Studio/ChooseLayerToEdit.svelte +++ b/src/UI/Studio/ChooseLayerToEdit.svelte @@ -1,16 +1,17 @@ -{#if layerIds.length > 0} +{#if $layerIds.length > 0}
- {#each Array.from(layerIds) as layer} + {#each Array.from($layerIds) as layer (layer)} {/each}
diff --git a/src/UI/StudioGUI.svelte b/src/UI/StudioGUI.svelte index 10231c46a..86ca452ac 100644 --- a/src/UI/StudioGUI.svelte +++ b/src/UI/StudioGUI.svelte @@ -58,9 +58,7 @@ fakeUser: fakeUser.data, }) const expertMode = UIEventSource.asBoolean( - osmConnection.GetPreference("studio-expert-mode", "false", { - documentation: "Indicates if more options are shown in mapcomplete studio", - }) + osmConnection.GetPreference("studio-expert-mode", "false") ) expertMode.addCallbackAndRunD((expert) => console.log("Expert mode is", expert)) const createdBy = osmConnection.userDetails.data?.name @@ -71,63 +69,63 @@ const studio = new StudioServer(studioUrl, uid) let layersWithErr = studio.fetchOverview() - let layerFilterTerm: string = "" + let layerFilterTerm: UIEventSource = new UIEventSource("") let layers: Store<{ owner: number; id: string }[]> = layersWithErr.mapD((l) => l["success"]?.filter((l) => l.category === "layers") ) - $: selfLayers = layers.mapD( + let selfLayers = layers.mapD( (ls) => ls.filter( - (l) => l.owner === uid.data && l.id.toLowerCase().includes(layerFilterTerm.toLowerCase()) + (l) => l.owner === uid.data && l.id.toLowerCase().includes(layerFilterTerm.data.toLowerCase()) ), - [uid] + [uid, layerFilterTerm] ) - $: otherLayers = layers.mapD( + let otherLayers = layers.mapD( (ls) => ls.filter( (l) => l.owner !== undefined && l.owner !== uid.data && - l.id.toLowerCase().includes(layerFilterTerm.toLowerCase()) + l.id.toLowerCase().includes(layerFilterTerm.data.toLowerCase()) ), - [uid] + [uid, layerFilterTerm] ) - $: officialLayers = layers.mapD( + let officialLayers = layers.mapD( (ls) => ls.filter( - (l) => l.owner === undefined && l.id.toLowerCase().includes(layerFilterTerm.toLowerCase()) + (l) => l.owner === undefined && l.id.toLowerCase().includes(layerFilterTerm.data.toLowerCase()) ), - [uid] + [uid, layerFilterTerm] ) - let themeFilterTerm: string = "" + let themeFilterTerm: UIEventSource = new UIEventSource("") let themes: Store<{ owner: number; id: string }[]> = layersWithErr.mapD((l) => l["success"]?.filter((l) => l.category === "themes") ) - $: selfThemes = themes.mapD( + let selfThemes = themes.mapD( (ls) => ls.filter( - (l) => l.owner === uid.data && l.id.toLowerCase().includes(themeFilterTerm.toLowerCase()) + (l) => l.owner === uid.data && l.id.toLowerCase().includes(themeFilterTerm.data.toLowerCase()) ), - [uid] + [uid, themeFilterTerm] ) - $: otherThemes = themes.mapD( + let otherThemes = themes.mapD( (ls) => ls.filter( (l) => l.owner !== undefined && l.owner !== uid.data && - l.id.toLowerCase().includes(themeFilterTerm.toLowerCase()) + l.id.toLowerCase().includes(themeFilterTerm.data.toLowerCase()) ), - [uid] + [uid, themeFilterTerm] ) - $: officialThemes = themes.mapD( + let officialThemes = themes.mapD( (ls) => ls.filter( - (l) => l.owner === undefined && l.id.toLowerCase().includes(themeFilterTerm.toLowerCase()) + (l) => l.owner === undefined && l.id.toLowerCase().includes(themeFilterTerm.data.toLowerCase()) ), - [uid] + [uid, themeFilterTerm] ) let state: @@ -321,12 +319,12 @@ id="layer-search" type="search" placeholder="Filter layers by name" - bind:value={layerFilterTerm} + bind:value={$layerFilterTerm} /> - +

Your layers

Your id is {$uid}
@@ -335,7 +333,7 @@ Selecting a layer will create a copy in your account that you edit. You will not change the version of the other contributor - +

Official layers by MapComplete

@@ -344,7 +342,7 @@
@@ -370,15 +368,15 @@ - +

Your themes

Themes by other contributors

- +

Official themes by MapComplete

diff --git a/src/assets/schemas/layerconfigmeta.json b/src/assets/schemas/layerconfigmeta.json index 2bf546996..03977542e 100644 --- a/src/assets/schemas/layerconfigmeta.json +++ b/src/assets/schemas/layerconfigmeta.json @@ -10820,6 +10820,10 @@ "if": "value=brothel", "then": "brothel - An establishment specifically dedicated to prostitution." }, + { + "if": "value=building", + "then": "building - All buildings" + }, { "if": "value=cafe_pub", "then": "cafe_pub - A layer showing cafés and pubs where one can gather around a drink. The layer asks for some relevant questions" @@ -10900,6 +10904,10 @@ "if": "value=cycle_highways", "then": "cycle_highways - undefined" }, + { + "if": "value=cyclestreets", + "then": "cyclestreets - A cyclestreet is a street where motorized traffic is not allowed to overtake a cyclist" + }, { "if": "value=cycleways_and_roads", "then": "cycleways_and_roads - All infrastructure that someone can cycle over, accompanied with questions about this infrastructure" diff --git a/src/assets/schemas/layoutconfigmeta.json b/src/assets/schemas/layoutconfigmeta.json index 554b51649..74ebd006c 100644 --- a/src/assets/schemas/layoutconfigmeta.json +++ b/src/assets/schemas/layoutconfigmeta.json @@ -699,6 +699,10 @@ "if": "value=brothel", "then": "brothel (builtin) - An establishment specifically dedicated to prostitution." }, + { + "if": "value=building", + "then": "building (builtin) - All buildings" + }, { "if": "value=cafe_pub", "then": "cafe_pub (builtin) - A layer showing cafés and pubs where one can gather around a drink. The layer asks for some relevant questions" @@ -779,6 +783,10 @@ "if": "value=cycle_highways", "then": "cycle_highways (builtin) - undefined" }, + { + "if": "value=cyclestreets", + "then": "cyclestreets (builtin) - A cyclestreet is a street where motorized traffic is not allowed to overtake a cyclist" + }, { "if": "value=cycleways_and_roads", "then": "cycleways_and_roads (builtin) - All infrastructure that someone can cycle over, accompanied with questions about this infrastructure" @@ -13439,6 +13447,10 @@ "if": "value=brothel", "then": "brothel - An establishment specifically dedicated to prostitution." }, + { + "if": "value=building", + "then": "building - All buildings" + }, { "if": "value=cafe_pub", "then": "cafe_pub - A layer showing cafés and pubs where one can gather around a drink. The layer asks for some relevant questions" @@ -13519,6 +13531,10 @@ "if": "value=cycle_highways", "then": "cycle_highways - undefined" }, + { + "if": "value=cyclestreets", + "then": "cyclestreets - A cyclestreet is a street where motorized traffic is not allowed to overtake a cyclist" + }, { "if": "value=cycleways_and_roads", "then": "cycleways_and_roads - All infrastructure that someone can cycle over, accompanied with questions about this infrastructure" @@ -35215,6 +35231,10 @@ "if": "value=brothel", "then": "brothel - An establishment specifically dedicated to prostitution." }, + { + "if": "value=building", + "then": "building - All buildings" + }, { "if": "value=cafe_pub", "then": "cafe_pub - A layer showing cafés and pubs where one can gather around a drink. The layer asks for some relevant questions" @@ -35295,6 +35315,10 @@ "if": "value=cycle_highways", "then": "cycle_highways - undefined" }, + { + "if": "value=cyclestreets", + "then": "cyclestreets - A cyclestreet is a street where motorized traffic is not allowed to overtake a cyclist" + }, { "if": "value=cycleways_and_roads", "then": "cycleways_and_roads - All infrastructure that someone can cycle over, accompanied with questions about this infrastructure"