forked from MapComplete/MapComplete
chore: automated housekeeping...
This commit is contained in:
parent
94c61744c0
commit
04c8ccb0d2
89 changed files with 2353 additions and 1390 deletions
|
@ -3,7 +3,7 @@
|
|||
</script>
|
||||
|
||||
<div class="relative h-80 w-60">
|
||||
<div class="h-full w-full animate-pulse interactive" />
|
||||
<div class="interactive h-full w-full animate-pulse" />
|
||||
<div class="absolute top-0 flex h-full w-full items-center justify-center">
|
||||
<Loading />
|
||||
</div>
|
||||
|
|
|
@ -16,9 +16,8 @@
|
|||
function showFor(timeoutSeconds: number = 5) {
|
||||
open = true
|
||||
window.setTimeout(() => {
|
||||
open = false
|
||||
},
|
||||
timeoutSeconds * 1000)
|
||||
open = false
|
||||
}, timeoutSeconds * 1000)
|
||||
}
|
||||
|
||||
mapIsDragged.addCallback(() => {
|
||||
|
@ -28,27 +27,30 @@
|
|||
}
|
||||
})
|
||||
gpsState.requestMoment.stabilized(50).addCallback(() => {
|
||||
if(gpsState.gpsAvailable.data && gpsState.allowMoving.data){
|
||||
if (gpsState.gpsAvailable.data && gpsState.allowMoving.data) {
|
||||
return
|
||||
}
|
||||
showFor(5)
|
||||
})
|
||||
let explanation = gpsState.gpsStateExplanation
|
||||
onDestroy(
|
||||
explanation.stabilized(50).addCallbackD(
|
||||
expl => {
|
||||
if (expl) {
|
||||
showFor(5)
|
||||
} else {
|
||||
open = false
|
||||
}
|
||||
},
|
||||
),
|
||||
explanation.stabilized(50).addCallbackD((expl) => {
|
||||
if (expl) {
|
||||
showFor(5)
|
||||
} else {
|
||||
open = false
|
||||
}
|
||||
})
|
||||
)
|
||||
|
||||
</script>
|
||||
|
||||
<Popover reference={undefined} trigger=null placement="left" transition={e => fade(e, {duration: 150})} bind:open>
|
||||
<Popover
|
||||
reference={undefined}
|
||||
trigger="null"
|
||||
placement="left"
|
||||
transition={(e) => fade(e, { duration: 150 })}
|
||||
bind:open
|
||||
>
|
||||
<div class="break-words" style="max-width: calc( 100vw - 8rem)">
|
||||
<Tr t={$explanation} />
|
||||
</div>
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<script lang="ts">
|
||||
|
||||
import { Popover } from "flowbite-svelte"
|
||||
import { fade } from "svelte/transition"
|
||||
import { OsmConnection } from "../../Logic/Osm/OsmConnection"
|
||||
|
@ -8,23 +7,28 @@
|
|||
export let state: { osmConnection: OsmConnection }
|
||||
let userdetails = state.osmConnection.userDetails
|
||||
|
||||
userdetails.addCallbackAndRunD(ud => {
|
||||
userdetails.addCallbackAndRunD((ud) => {
|
||||
if (ud) {
|
||||
open = true
|
||||
window.setTimeout(() => {
|
||||
open = false
|
||||
open = false
|
||||
}, 5000)
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
<Popover class="mt-4 z-50" defaultClass="py-2 px-3 w-fit " trigger=null placement="bottom"
|
||||
transition={e => fade(e, {duration: 150})} bind:open>
|
||||
<Popover
|
||||
class="z-50 mt-4"
|
||||
defaultClass="py-2 px-3 w-fit "
|
||||
trigger="null"
|
||||
placement="bottom"
|
||||
transition={(e) => fade(e, { duration: 150 })}
|
||||
bind:open
|
||||
>
|
||||
{#if $userdetails !== undefined}
|
||||
<div style="width: max-content" class="flex items-center">
|
||||
{#if $userdetails.img}
|
||||
<img src={$userdetails.img } alt="profile picture" class="w-8 h-8 rounded-full mr-4" />
|
||||
<img src={$userdetails.img} alt="profile picture" class="mr-4 h-8 w-8 rounded-full" />
|
||||
{/if}
|
||||
<div>
|
||||
<div>Welcome back</div>
|
||||
|
@ -35,4 +39,3 @@
|
|||
</div>
|
||||
{/if}
|
||||
</Popover>
|
||||
|
||||
|
|
|
@ -50,26 +50,21 @@
|
|||
|
||||
async function detectErrorReason() {
|
||||
try {
|
||||
|
||||
const response = await fetch(
|
||||
image.url,
|
||||
{
|
||||
headers: {
|
||||
"Accept": "image/avif,image/webp,*/*",
|
||||
},
|
||||
const response = await fetch(image.url, {
|
||||
headers: {
|
||||
Accept: "image/avif,image/webp,*/*",
|
||||
},
|
||||
)
|
||||
})
|
||||
if (response.status === 404) {
|
||||
notFound = true
|
||||
}
|
||||
} catch
|
||||
(e) {
|
||||
} catch (e) {
|
||||
console.log("Could not load image while trying to remediate", e)
|
||||
}
|
||||
}
|
||||
|
||||
async function onError() {
|
||||
Mapillary.isInStrictMode().addCallbackAndRunD(isStrict => {
|
||||
Mapillary.isInStrictMode().addCallbackAndRunD((isStrict) => {
|
||||
isInStrictMode.set(isStrict)
|
||||
return true // unregister
|
||||
})
|
||||
|
@ -82,16 +77,16 @@
|
|||
onDestroy(
|
||||
showBigPreview.addCallbackAndRun((shown) => {
|
||||
state?.guistate?.setPreviewedImage(shown ? image : undefined)
|
||||
}),
|
||||
})
|
||||
)
|
||||
if (previewedImage) {
|
||||
onDestroy(
|
||||
previewedImage.addCallbackAndRun((previewedImage) => {
|
||||
showBigPreview.set(
|
||||
previewedImage !== undefined &&
|
||||
(previewedImage?.id ?? previewedImage?.url) === (image.id ?? image.url),
|
||||
(previewedImage?.id ?? previewedImage?.url) === (image.id ?? image.url)
|
||||
)
|
||||
}),
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -135,17 +130,17 @@
|
|||
</div>
|
||||
</Popup>
|
||||
{#if error}
|
||||
<div class="h-80 w-60 interactive flex flex-col justify-center items-center p-4 text-center">
|
||||
<div class="interactive flex h-80 w-60 flex-col items-center justify-center p-4 text-center">
|
||||
{#if notFound}
|
||||
<div class="alert flex items-center">
|
||||
<TriangleOutline class="shrink-0 h-8 w-8" />
|
||||
<TriangleOutline class="h-8 w-8 shrink-0" />
|
||||
Not found
|
||||
</div>
|
||||
This image is probably incorrect or deleted.
|
||||
<slot name="not-found-extra" />
|
||||
{:else}
|
||||
<div class="alert flex items-center">
|
||||
<TriangleOutline class="shrink-0 h-8 w-8" />
|
||||
<TriangleOutline class="h-8 w-8 shrink-0" />
|
||||
<Tr t={Translations.t.image.loadingFailed} />
|
||||
</div>
|
||||
{#if image.provider.name.toLowerCase() === "mapillary" && $isInStrictMode}
|
||||
|
@ -153,7 +148,7 @@
|
|||
{:else if $isInStrictMode}
|
||||
<Tr t={Translations.t.image.strictProtectionDetected} />
|
||||
{image.provider.name}
|
||||
<div class="subtle text-sm mt-8">{image.url}</div>
|
||||
<div class="subtle mt-8 text-sm">{image.url}</div>
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
|
@ -225,10 +220,10 @@
|
|||
</div>
|
||||
</div>
|
||||
{:else if image.status === "hidden"}
|
||||
<div class="h-80 w-60 flex flex-col justify-center items-center break-words p-4 text-center">
|
||||
<TriangleOutline class="w-8 h-8 subtle" />
|
||||
<div class="flex h-80 w-60 flex-col items-center justify-center break-words p-4 text-center">
|
||||
<TriangleOutline class="subtle h-8 w-8" />
|
||||
<Tr t={Translations.t.image.reported} />
|
||||
<button class="text-sm" on:click={() => ignoreHidden = true}>
|
||||
<button class="text-sm" on:click={() => (ignoreHidden = true)}>
|
||||
<Tr t={Translations.t.image.showAnyway} />
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
}
|
||||
|
||||
async function unlink() {
|
||||
const {key} = image.originalAttribute
|
||||
const { key } = image.originalAttribute
|
||||
await state?.changes?.applyAction(
|
||||
new ChangeTagAction(tags.data.id, new Tag(key, ""), tags.data, {
|
||||
changeType: "delete-image",
|
||||
|
@ -95,7 +95,7 @@
|
|||
<div class="my-4">
|
||||
<AccordionSingle noBorder>
|
||||
<div slot="header" class="flex text-sm">
|
||||
<Tr t={t.requestDeletion}/>
|
||||
<Tr t={t.requestDeletion} />
|
||||
</div>
|
||||
<div class="interactive flex flex-col p-2">
|
||||
<h3>
|
||||
|
|
|
@ -157,7 +157,9 @@
|
|||
type: "Feature",
|
||||
geometry: { type: "Point", coordinates: GeoOperations.centerpointCoordinates(feature) },
|
||||
properties: <HotspotProperties>{
|
||||
name: layer.title?.GetRenderValue(feature.properties)?.Subs(feature.properties)?.txt ?? "Feature",
|
||||
name:
|
||||
layer.title?.GetRenderValue(feature.properties)?.Subs(feature.properties)?.txt ??
|
||||
"Feature",
|
||||
focus: true,
|
||||
},
|
||||
},
|
||||
|
|
|
@ -31,16 +31,15 @@
|
|||
|
||||
const state = new OpeningHoursState(value, prefix, postfix)
|
||||
let expanded = new UIEventSource(false)
|
||||
|
||||
</script>
|
||||
|
||||
<Popup bodyPadding="p-0" shown={expanded}>
|
||||
<OHTable value={state.normalOhs} />
|
||||
<div class="absolute w-full flex justify-center" style="bottom: -3rem">
|
||||
<button class=" primary " on:click={() => expanded.set(false)}>
|
||||
<Check class="m-0 h-6 w-6 shrink-0 p-0" color="white" />
|
||||
<Tr t={Translations.t.general.confirm}/>
|
||||
</button>
|
||||
<div class="absolute flex w-full justify-center" style="bottom: -3rem">
|
||||
<button class=" primary" on:click={() => expanded.set(false)}>
|
||||
<Check class="m-0 h-6 w-6 shrink-0 p-0" color="white" />
|
||||
<Tr t={Translations.t.general.confirm} />
|
||||
</button>
|
||||
</div>
|
||||
</Popup>
|
||||
|
||||
|
|
|
@ -757,10 +757,11 @@ export class MapLibreAdaptor implements MapProperties, ExportableMap {
|
|||
if (!showScale) {
|
||||
if (this.scaleControl) {
|
||||
try {
|
||||
|
||||
map.removeControl(this.scaleControl)
|
||||
} catch (e) {
|
||||
console.warn("Could not remove scale control, underlying map might have had a reset")
|
||||
console.warn(
|
||||
"Could not remove scale control, underlying map might have had a reset"
|
||||
)
|
||||
}
|
||||
this.scaleControl = undefined
|
||||
}
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
|
||||
<div class="flex h-full w-full flex-col items-center justify-center p-8">
|
||||
<div class="flex flex-col items-center">
|
||||
|
||||
<World class="w-full h-auto"/>
|
||||
<World class="h-auto w-full" />
|
||||
<h1>
|
||||
<Tr t={Translations.t.general["404"]} />
|
||||
</h1>
|
||||
|
|
|
@ -466,9 +466,8 @@ changes // => [[36000,61200], ["10:00", "17:00"]]
|
|||
*/
|
||||
public static allChangeMoments(
|
||||
ranges: OpeningRange[][],
|
||||
includeOpenEnds = false,
|
||||
includeOpenEnds = false
|
||||
): [number[], string[]] {
|
||||
|
||||
const changeHours: number[] = []
|
||||
const changeHourText: string[] = []
|
||||
|
||||
|
@ -477,7 +476,6 @@ changes // => [[36000,61200], ["10:00", "17:00"]]
|
|||
|
||||
for (const weekday of ranges) {
|
||||
for (const range of weekday) {
|
||||
|
||||
if (!(range.openEnd || range.isOpen || range.isSpecial)) {
|
||||
continue
|
||||
}
|
||||
|
@ -494,7 +492,7 @@ changes // => [[36000,61200], ["10:00", "17:00"]]
|
|||
)
|
||||
}
|
||||
|
||||
if(range.openEnd && !includeOpenEnds){
|
||||
if (range.openEnd && !includeOpenEnds) {
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -572,7 +570,7 @@ changes // => [[36000,61200], ["10:00", "17:00"]]
|
|||
public static createOhObject(
|
||||
tags: Record<string, string | number> & { _lat: number; _lon: number; _country?: string },
|
||||
textToParse: string,
|
||||
country: string,
|
||||
country: string
|
||||
) {
|
||||
return new opening_hours(
|
||||
textToParse,
|
||||
|
|
|
@ -14,11 +14,12 @@
|
|||
let startOfDay: Date = new Date(range.startDate)
|
||||
startOfDay.setHours(0, 0, 0, 0)
|
||||
let startpoint = (range.startDate.getTime() - startOfDay.getTime()) / 1000 - earliestOpen
|
||||
let width = (100 * (range.endDate.getTime() - range.startDate.getTime()) / 1000) / availableArea
|
||||
let width = (100 * (range.endDate.getTime() - range.startDate.getTime())) / 1000 / availableArea
|
||||
let startPercentage = (100 * startpoint) / availableArea
|
||||
</script>
|
||||
|
||||
{#if range.openEnd}
|
||||
<div class="ohviz-range open-end" style={`left:${startPercentage}%; width:${width}%`}/>
|
||||
<div class="ohviz-range open-end" style={`left:${startPercentage}%; width:${width}%`} />
|
||||
{:else if !range.isOpen && !range.isSpecial}
|
||||
<div class="ohviz-day-off">{textToShow}</div>
|
||||
{:else}
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
}
|
||||
|
||||
let baseQuestions = (layer?.tagRenderings ?? [])?.filter(
|
||||
(tr) => tr.question !== undefined && allowed(tr.labels),
|
||||
(tr) => tr.question !== undefined && allowed(tr.labels)
|
||||
)
|
||||
|
||||
/**
|
||||
|
@ -128,16 +128,19 @@
|
|||
<div slot="header" class="small subtle text-sm">
|
||||
Questionbox debug info: labels (whitelist) : {onlyForLabels?.join(",")}
|
||||
</div>
|
||||
<div class="flex flex-col" >
|
||||
|
||||
<div class="flex flex-col">
|
||||
<div>
|
||||
notForLabes (blacklist): {notForLabels?.join(",")} ;
|
||||
</div>
|
||||
<div>
|
||||
baseQuestions: {baseQuestions.length === 0 ? "NONE" : baseQuestions.map(q => q.id)?.join(",")} ;
|
||||
baseQuestions: {baseQuestions.length === 0
|
||||
? "NONE"
|
||||
: baseQuestions.map((q) => q.id)?.join(",")} ;
|
||||
</div>
|
||||
<div>
|
||||
questionsMeetingConditions: {$questionsToAsk.length === 0 ? "NONE" : baseQuestions.map(q => q.id)?.join(",")}
|
||||
questionsMeetingConditions: {$questionsToAsk.length === 0
|
||||
? "NONE"
|
||||
: baseQuestions.map((q) => q.id)?.join(",")}
|
||||
;
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -62,7 +62,9 @@
|
|||
"due to",
|
||||
e
|
||||
)
|
||||
return new FixedUiElement("Could not construct visualization "+specpart.func.funcName+" due to "+e)
|
||||
return new FixedUiElement(
|
||||
"Could not construct visualization " + specpart.func.funcName + " due to " + e
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -313,7 +313,7 @@
|
|||
let featureSwitchIsTesting = state?.featureSwitchIsTesting ?? new ImmutableStore(false)
|
||||
let featureSwitchIsDebugging =
|
||||
state?.featureSwitches?.featureSwitchIsDebugging ?? new ImmutableStore(false)
|
||||
let showTags : Store<boolean> = state?.userRelatedState?.showTagsB ?? new ImmutableStore(false)
|
||||
let showTags: Store<boolean> = state?.userRelatedState?.showTagsB ?? new ImmutableStore(false)
|
||||
let question = config.question
|
||||
let hideMappingsUnlessSearchedFor =
|
||||
config.mappings.length > 8 && config.mappings.some((m) => m.priorityIf !== undefined)
|
||||
|
@ -565,9 +565,7 @@
|
|||
<Tr t={Translations.t.unknown.title} />
|
||||
</h2>
|
||||
<Tr t={Translations.t.unknown.explanation} />
|
||||
<If
|
||||
condition={state.userRelatedState?.showTagsB}
|
||||
>
|
||||
<If condition={state.userRelatedState?.showTagsB}>
|
||||
<div class="subtle">
|
||||
<Tr t={Translations.t.unknown.removedKeys} />
|
||||
<TagHint tags={$onMarkUnknown} />
|
||||
|
|
|
@ -180,16 +180,18 @@
|
|||
let apiState = state?.osmConnection?.apiIsOnline ?? new ImmutableStore("online")
|
||||
|
||||
let mapIsDragged: UIEventSource<void> = new UIEventSource(undefined)
|
||||
function onMapDragged(){
|
||||
function onMapDragged() {
|
||||
mapIsDragged.ping()
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<main>
|
||||
<div class="absolute left-0 top-0 h-screen w-screen" style="background-color: #f0efdd" />
|
||||
<!-- Main map -->
|
||||
<div class="absolute left-0 top-0 h-screen w-screen overflow-hidden" use:dragDetection={() => onMapDragged()}>
|
||||
<div
|
||||
class="absolute left-0 top-0 h-screen w-screen overflow-hidden"
|
||||
use:dragDetection={() => onMapDragged()}
|
||||
>
|
||||
<MaplibreMap map={maplibremap} mapProperties={mapproperties} autorecovery={true} />
|
||||
</div>
|
||||
|
||||
|
@ -321,7 +323,7 @@
|
|||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<GpsElementHelper reference = "#gps-control-button" {state} {mapIsDragged}/>
|
||||
<GpsElementHelper reference="#gps-control-button" {state} {mapIsDragged} />
|
||||
</If>
|
||||
<If condition={state.mapProperties.showScale}>
|
||||
<div class="h-6">
|
||||
|
@ -354,7 +356,7 @@
|
|||
on:keydown={forwardEventToMap}
|
||||
>
|
||||
<MenuIcon class="h-6 w-6 cursor-pointer" />
|
||||
<WelcomeBack {state}/>
|
||||
<WelcomeBack {state} />
|
||||
</MapControlButton>
|
||||
|
||||
<MapControlButton
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue