diff --git a/src/UI/Studio/EditLayer.svelte b/src/UI/Studio/EditLayer.svelte index 1ce808f52..5fe3fabaf 100644 --- a/src/UI/Studio/EditLayer.svelte +++ b/src/UI/Studio/EditLayer.svelte @@ -20,12 +20,16 @@ import NextButton from "../Base/NextButton.svelte" import BackButton from "../Base/BackButton.svelte" import DeleteButton from "./DeleteButton.svelte" + import StudioHashSetter from "./StudioHashSetter" const layerSchema: ConfigMeta[] = layerSchemaRaw export let state: EditLayerState export let backToStudio: () => void + + new StudioHashSetter("layer", state.selectedTab, state.getStoreFor(["id"])) + let messages = state.messages let hasErrors = messages.mapD( (m: ConversionMessage[]) => m.filter((m) => m.level === "error").length @@ -127,7 +131,7 @@ {/each} {:else}
- +
General properties diff --git a/src/UI/Studio/EditLayerState.ts b/src/UI/Studio/EditLayerState.ts index 1c5b1a763..2b5b2134f 100644 --- a/src/UI/Studio/EditLayerState.ts +++ b/src/UI/Studio/EditLayerState.ts @@ -42,6 +42,11 @@ export abstract class EditJsonState { public readonly configuration: UIEventSource> = new UIEventSource>({}) public readonly messages: Store + /** + * The tab in the UI that is selected, used for deeplinks + */ + public readonly selectedTab: UIEventSource = new UIEventSource(0) + /** * The EditLayerUI shows a 'schemaBasedInput' for this path to pop advanced questions out */ diff --git a/src/UI/Studio/EditTheme.svelte b/src/UI/Studio/EditTheme.svelte index 0f0c1198c..e82702057 100644 --- a/src/UI/Studio/EditTheme.svelte +++ b/src/UI/Studio/EditTheme.svelte @@ -9,12 +9,15 @@ import RawEditor from "./RawEditor.svelte" import { OsmConnection } from "../../Logic/Osm/OsmConnection" import DeleteButton from "./DeleteButton.svelte" + import { UIEventSource } from "../../Logic/UIEventSource" + import StudioHashSetter from "./StudioHashSetter" export let state: EditThemeState export let osmConnection: OsmConnection export let backToStudio: () => void let schema: ConfigMeta[] = state.schema.filter((schema) => schema.path.length > 0) + new StudioHashSetter("theme", state.selectedTab, state.getStoreFor(["id"])) export let selfLayers: { owner: number; id: string }[] export let otherLayers: { owner: number; id: string }[] @@ -94,7 +97,7 @@
- +
Basic properties
diff --git a/src/UI/Studio/StudioHashSetter.ts b/src/UI/Studio/StudioHashSetter.ts new file mode 100644 index 000000000..970c6c467 --- /dev/null +++ b/src/UI/Studio/StudioHashSetter.ts @@ -0,0 +1,11 @@ +import { Store, UIEventSource } from "../../Logic/UIEventSource" +import Hash from "../../Logic/Web/Hash" + +export default class StudioHashSetter { + constructor(mode: "layer" | "theme", tab: Store, name: Store) { + tab.mapD(tab => { + Hash.hash.setData(mode + "/" + name.data + "/" + tab) + } + , [name]) + } +} diff --git a/src/UI/StudioGUI.svelte b/src/UI/StudioGUI.svelte index 382ee9139..48d1b6d02 100644 --- a/src/UI/StudioGUI.svelte +++ b/src/UI/StudioGUI.svelte @@ -1,7 +1,7 @@ d?.["error"] !== undefined)}> @@ -191,8 +221,8 @@
  • Try again in a few minutes
  • Contact - the MapComplete community via the chat. - + the MapComplete community via the chat. + Someone might be able to help you
  • @@ -257,9 +287,7 @@ { - state = undefined - }} + on:click={() => backToStudio()} > MapComplete Studio @@ -306,9 +334,7 @@ { - state = undefined - }} + on:click={() => backToStudio()} > MapComplete Studio @@ -348,30 +374,23 @@ {:else if state === "editing_layer"} { - state = undefined - }} + {backToStudio} > { - state = undefined - }} + on:click={() => backToStudio()} > MapComplete Studio {:else if state === "editing_theme"} - { - state = undefined - }}> + { - state = undefined - }} + on:click={() => backToStudio()} > MapComplete Studio