Android: More work to attempt to get login working

This commit is contained in:
Pieter Vander Vennet 2024-12-19 13:49:14 +01:00
parent fcf8416b5a
commit 969ad74bd9
9 changed files with 99 additions and 61 deletions

View file

@ -39,7 +39,7 @@
let maplibremap: MapLibreAdaptor = new MapLibreAdaptor(map, {
zoom,
location: new UIEventSource<{ lon: number; lat: number }>({ lat: lat.data, lon: lon.data })
location: new UIEventSource<{ lon: number; lat: number }>({ lat: lat.data, lon: lon.data }),
})
maplibremap.location.stabilized(500).addCallbackAndRunD(l => {
lat.set(l.lat)
@ -47,18 +47,18 @@
})
let allLayers = HistoryUtils.personalTheme.layers
let layersNoFixme = allLayers.filter(l => l.id !== "fixme")
let fixme = allLayers.find(l => l.id === "fixme")
let layersNoFixme = allLayers.filter(l => l.id !== "fixme")
let fixme = allLayers.find(l => l.id === "fixme")
let featuresStore = new UIEventSource<Feature[]>([])
let features = new StaticFeatureSource(featuresStore)
ShowDataLayer.showMultipleLayers(map, features, [...layersNoFixme, fixme] , {
ShowDataLayer.showMultipleLayers(map, features, [...layersNoFixme, fixme], {
zoomToFeatures: true,
onClick: (f: Feature) => {
selectedElement.set(undefined)
Utils.waitFor(200).then(() => {
selectedElement.set(f)
})
}
},
})
let osmConnection = new OsmConnection()
@ -71,7 +71,7 @@ let fixme = allLayers.find(l => l.id === "fixme")
async function load() {
const user = username.data
if(user.indexOf(";")<0){
if (user.indexOf(";") < 0) {
const inspectedData = inspectedContributors.data
const previousEntry = inspectedData.find(e => e.name === user)
@ -81,7 +81,7 @@ let fixme = allLayers.find(l => l.id === "fixme")
inspectedData.push({
label: undefined,
visitedTime: new Date().toISOString(),
name: user
name: user,
})
}
inspectedContributors.ping()
@ -114,44 +114,44 @@ let fixme = allLayers.find(l => l.id === "fixme")
let mode: "map" | "table" | "aggregate" | "images" = "map"
let showPreviouslyVisited = new UIEventSource(true)
const t = Translations.t.inspector
const t = Translations.t.inspector
</script>
<div class="flex flex-col w-full h-full">
<div class="flex gap-x-2 items-center low-interaction p-2">
<MagnifyingGlassCircle class="w-12 h-12"/>
<MagnifyingGlassCircle class="w-12 h-12" />
<h1 class="flex-shrink-0 m-0 mx-2">
<Tr t={t.title}/>
<Tr t={t.title} />
</h1>
<ValidatedInput type="string" value={username} on:submit={() => load()} />
{#if loadingData}
<Loading />
{:else}
<button class="primary" on:click={() => load()}>
<Tr t={t.load}/>
<Tr t={t.load} />
</button>
{/if}
<button on:click={() => showPreviouslyVisited.setData(true)}>
<Tr t={t.earlierInspected}/>
<Tr t={t.earlierInspected} />
</button>
<a href="./index.html" class="button">
<Tr t={t.backToIndex}/>
<Tr t={t.backToIndex} />
</a>
</div>
<div class="flex">
<button class:primary={mode === "map"} on:click={() => mode = "map"}>
<Tr t={t.mapView}/>
<Tr t={t.mapView} />
</button>
<button class:primary={mode === "table"} on:click={() => mode = "table"}>
<Tr t={t.tableView}/>
<Tr t={t.tableView} />
</button>
<button class:primary={mode === "aggregate"} on:click={() => mode = "aggregate"}>
<Tr t={t.aggregateView}/>
<Tr t={t.aggregateView} />
</button>
<button class:primary={mode === "images"} on:click={() => mode = "images"}>
<Tr t={t.images}/>
<Tr t={t.images} />
</button>
</div>
@ -215,5 +215,5 @@ const t = Translations.t.inspector
<div slot="header">Earlier inspected constributors</div>
<PreviouslySpiedUsers {osmConnection} {inspectedContributors} on:selectUser={(e) => {
username.set(e.detail); load();showPreviouslyVisited.set(false)
}} />
}} />
</Page>