chore: automated housekeeping...

This commit is contained in:
Pieter Vander Vennet 2024-08-14 13:53:56 +02:00
parent f77570589d
commit 9b8a9337fd
111 changed files with 2911 additions and 1280 deletions

View file

@ -1,14 +1,12 @@
<script lang="ts">
import { IdbLocalStorage } from "../../Logic/Web/IdbLocalStorage"
import { Utils } from "../../Utils"
function clearCaches(){
function clearCaches() {
IdbLocalStorage.clearAll()
Utils.download("./service-worker-clear")
}
export let msg : string
export let msg: string
</script>
<button on:click={() => clearCaches()} class="flex gap-x-2">

View file

@ -15,13 +15,12 @@
export let header: string
export let layer: LayerConfig
let headerTr = layer.tagRenderings.find(tr => tr.id === header)
let headerTr = layer.tagRenderings.find((tr) => tr.id === header)
</script>
<AccordionSingle>
<div slot="header">
<TagRenderingAnswer {tags} {layer} config={headerTr} {state} {selectedElement} />
</div>
<SelectedElementView mustMatchLabels={new Set(labels)} {state} {layer} {tags} {selectedElement}/>
<SelectedElementView mustMatchLabels={new Set(labels)} {state} {layer} {tags} {selectedElement} />
</AccordionSingle>

View file

@ -45,7 +45,7 @@
location: new UIEventSource({ lon, lat }),
minzoom: new UIEventSource($reason.minZoom),
rasterLayer: state.mapProperties.rasterLayer,
zoom: new UIEventSource($reason?.startZoom ?? 16)
zoom: new UIEventSource($reason?.startZoom ?? 16),
}
}
@ -71,7 +71,7 @@
<AccordionSingle>
<span slot="header" class="flex">
{#if moveWizardState.reasons.length === 1}
<Icon icon={moveWizardState.reasons[0].icon} clss="w-6 h-6"/>
<Icon icon={moveWizardState.reasons[0].icon} clss="w-6 h-6" />
<Tr t={Translations.T(moveWizardState.reasons[0].invitingText)} />
{:else}
<Move class="h-6 w-6" />
@ -87,7 +87,7 @@
currentStep = "pick_location"
}}
>
<Icon icon={reasonSpec.icon} clss="w-12 h-12"/>
<Icon icon={reasonSpec.icon} clss="w-12 h-12" />
<Tr t={Translations.T(reasonSpec.text)} />
</button>
{/each}

View file

@ -18,7 +18,6 @@
export let minzoom: number
export let zoomMoreMessage: string
let curZoom = state.mapProperties.zoom
const isClosed = tags.map((tags) => (tags["closed_at"] ?? "") !== "")
@ -29,7 +28,6 @@
tags.data["closed_at"] = new Date().toISOString()
tags.ping()
}
</script>
<LoginToggle {state}>
@ -37,7 +35,6 @@
<Tr t={t.loginToClose} />
</div>
{#if $isClosed}
<Tr cls="thanks" t={t.isClosed} />
{:else if minzoom <= $curZoom}
@ -50,5 +47,4 @@
{:else if zoomMoreMessage}
{zoomMoreMessage}
{/if}
</LoginToggle>

View file

@ -16,18 +16,14 @@
let [lon, lat] = GeoOperations.centerpointCoordinates(feature)
const includeLayout = window.location.pathname
.split("/")
.at(-1)
.startsWith("theme")
const layout = includeLayout
? "layout=" + state.layout.id + "&"
: ""
let id: Store<string> = tags.mapD(tags => tags.id)
let url = id.mapD(id => `${window.location.protocol}//${window.location.host}${window.location.pathname}?${layout}lat=${lat}&lon=${lon}&z=15` +
`#${id}`)
const includeLayout = window.location.pathname.split("/").at(-1).startsWith("theme")
const layout = includeLayout ? "layout=" + state.layout.id + "&" : ""
let id: Store<string> = tags.mapD((tags) => tags.id)
let url = id.mapD(
(id) =>
`${window.location.protocol}//${window.location.host}${window.location.pathname}?${layout}lat=${lat}&lon=${lon}&z=15` +
`#${id}`
)
function toggleSize() {
if (size.data !== bigSize) {
@ -42,5 +38,9 @@
<!-- Not yet uploaded, doesn't have a fixed ID -->
<Loading />
{:else}
<img on:click={() => toggleSize()} src={new Qr($url).toImageElement($size)} style={`width: ${$size}px; height: ${$size}px`} />
<img
on:click={() => toggleSize()}
src={new Qr($url).toImageElement($size)}
style={`width: ${$size}px; height: ${$size}px`}
/>
{/if}

View file

@ -31,7 +31,8 @@
*/
export let notForLabels: string[] | undefined = undefined
const _notForLabels = new Set(notForLabels)
let showAllQuestionsAtOnce : Store<boolean>= state.userRelatedState?.showAllQuestionsAtOnce ?? new ImmutableStore(false)
let showAllQuestionsAtOnce: Store<boolean> =
state.userRelatedState?.showAllQuestionsAtOnce ?? new ImmutableStore(false)
function allowed(labels: string[]) {
if (onlyForLabels?.length > 0 && !labels.some((l) => _onlyForLabels.has(l))) {

View file

@ -32,19 +32,18 @@
onDestroy(
tags.addCallbackD((tags) => {
const knownNow = config.IsKnown(tags)
if(!knownNow){
if (!knownNow) {
editMode = true
return
}
if(knownNow && !knownAtTheStart) {
if (knownNow && !knownAtTheStart) {
// Some other question might have set this to 'known', so we close the 'editMode'
editMode = false
// well, not really 'known at the start', but it is known at this point in time, so it should not set 'editMode' to false automatically anymore
knownAtTheStart = true
}
}),
})
)
}

View file

@ -306,7 +306,8 @@
let hideMappingsUnlessSearchedFor =
config.mappings.length > 8 && config.mappings.some((m) => m.priorityIf !== undefined)
$: question = config.question
$: hideMappingsUnlessSearchedFor = config.mappings.length > 8 && config.mappings.some((m) => m.priorityIf !== undefined)
$: hideMappingsUnlessSearchedFor =
config.mappings.length > 8 && config.mappings.some((m) => m.priorityIf !== undefined)
if (state?.osmConnection) {
onDestroy(
@ -362,7 +363,7 @@
/>
</div>
{#if hideMappingsUnlessSearchedFor}
<div class="m-1 rounded border border-dashed border-black p-1 px-2 flex items-center">
<div class="m-1 flex items-center rounded border border-dashed border-black p-1 px-2">
<Tr t={Translations.t.general.mappingsAreHidden} />
</div>
{/if}