Studio: some fixes, show user id when running localhost
This commit is contained in:
parent
26214ed2a3
commit
09ea799ad4
2 changed files with 45 additions and 22 deletions
|
@ -1,29 +1,30 @@
|
|||
<script lang="ts">
|
||||
import { UIEventSource } from "../../Logic/UIEventSource"
|
||||
import { OsmConnection } from "../../Logic/Osm/OsmConnection"
|
||||
import Marker from "../Map/Marker.svelte"
|
||||
import NextButton from "../Base/NextButton.svelte"
|
||||
import { AllKnownLayouts } from "../../Customizations/AllKnownLayouts"
|
||||
import { AllSharedLayers } from "../../Customizations/AllSharedLayers"
|
||||
import { createEventDispatcher } from "svelte"
|
||||
import { UIEventSource } from "../../Logic/UIEventSource"
|
||||
import { OsmConnection } from "../../Logic/Osm/OsmConnection"
|
||||
import Marker from "../Map/Marker.svelte"
|
||||
import NextButton from "../Base/NextButton.svelte"
|
||||
import { AllKnownLayouts } from "../../Customizations/AllKnownLayouts"
|
||||
import { AllSharedLayers } from "../../Customizations/AllSharedLayers"
|
||||
import { createEventDispatcher } from "svelte"
|
||||
|
||||
export let info: { id: string; owner: number }
|
||||
export let category: "layers" | "themes"
|
||||
export let osmConnection: OsmConnection
|
||||
export let info: { id: string; owner: number }
|
||||
export let category: "layers" | "themes"
|
||||
export let osmConnection: OsmConnection
|
||||
|
||||
let displayName = UIEventSource.FromPromise(
|
||||
osmConnection.getInformationAboutUser(info.owner)
|
||||
).mapD((response) => response.display_name)
|
||||
let displayName = UIEventSource.FromPromise(
|
||||
osmConnection.getInformationAboutUser(info.owner),
|
||||
).mapD((response) => response.display_name)
|
||||
|
||||
let selfId = osmConnection.userDetails.mapD((ud) => ud.uid)
|
||||
function fetchIconDescription(layerId): any {
|
||||
if (category === "themes") {
|
||||
return AllKnownLayouts.allKnownLayouts.get(layerId).icon
|
||||
let selfId = osmConnection.userDetails.mapD((ud) => ud.uid)
|
||||
|
||||
function fetchIconDescription(layerId): any {
|
||||
if (category === "themes") {
|
||||
return AllKnownLayouts.allKnownLayouts.get(layerId).icon
|
||||
}
|
||||
return AllSharedLayers.getSharedLayersConfigs().get(layerId)?._layerIcon
|
||||
}
|
||||
return AllSharedLayers.getSharedLayersConfigs().get(layerId)?._layerIcon
|
||||
}
|
||||
|
||||
const dispatch = createEventDispatcher<{ layerSelected: string }>()
|
||||
const dispatch = createEventDispatcher<{ layerSelected: string }>()
|
||||
</script>
|
||||
|
||||
<NextButton clss="small" on:click={() => dispatch("layerSelected", info)}>
|
||||
|
@ -32,6 +33,14 @@
|
|||
</div>
|
||||
<b class="px-1">{info.id}</b>
|
||||
{#if info.owner && info.owner !== $selfId}
|
||||
(made by {$displayName ?? info.owner})
|
||||
{#if $displayName}
|
||||
(made by {$displayName}
|
||||
{#if window.location.host.startsWith("127.0.0.1")}
|
||||
- {info.owner}
|
||||
{/if}
|
||||
)
|
||||
{:else }
|
||||
({info.owner})
|
||||
{/if}
|
||||
{/if}
|
||||
</NextButton>
|
||||
|
|
|
@ -299,6 +299,9 @@ export default class EditLayerState extends EditJsonState<LayerConfigJson> {
|
|||
|
||||
|
||||
function cleanArray(data: object, key: string): boolean{
|
||||
if(!data){
|
||||
return false
|
||||
}
|
||||
if (data[key]) {
|
||||
// A bit of cleanup
|
||||
const lBefore = data[key].length
|
||||
|
@ -312,7 +315,18 @@ export default class EditLayerState extends EditJsonState<LayerConfigJson> {
|
|||
}
|
||||
|
||||
this.configuration.addCallbackAndRunD((layer) => {
|
||||
const changed = cleanArray(layer, "tagRenderings") || cleanArray(layer, "pointRenderings")
|
||||
let changed = cleanArray(layer, "tagRenderings") || cleanArray(layer, "pointRenderings")
|
||||
for (const tr of layer.tagRenderings ?? []) {
|
||||
if(typeof tr === "string"){
|
||||
continue
|
||||
}
|
||||
|
||||
const qtr = (<QuestionableTagRenderingConfigJson> tr)
|
||||
if(qtr.freeform && Object.keys(qtr.freeform ).length === 0){
|
||||
delete qtr.freeform
|
||||
changed = true
|
||||
}
|
||||
}
|
||||
if(changed){
|
||||
this.configuration.ping()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue