Housekeeping

This commit is contained in:
Pieter Vander Vennet 2024-07-09 13:42:08 +02:00
parent 4ad1e67f6e
commit da615acfb1
55 changed files with 1772 additions and 1455 deletions

View file

@ -1,5 +1,4 @@
<script lang="ts">
import Translations from "../i18n/Translations"
import { Utils } from "../../Utils"
import Hotkeys from "../Base/Hotkeys"
@ -24,7 +23,6 @@
let layout = state.layout
let featureSwitches = state.featureSwitches
</script>
<div class="link-underline links-w-full m-2 flex flex-col gap-y-1">
@ -51,16 +49,14 @@
<a
class="flex"
href={"https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Themes/" +
layout.id +
".md"}
href={"https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Themes/" + layout.id + ".md"}
target="_blank"
>
<DocumentChartBar class="h-6 w-6" />
<Tr
t={Translations.t.general.attribution.openThemeDocumentation.Subs({
name: layout.title,
})}
name: layout.title,
})}
/>
</a>
@ -74,10 +70,7 @@
<Tr t={Translations.t.general.attribution.donate} />
</a>
<button
class="as-link"
on:click={() => state.guistate.communityIndexPanelIsOpened.setData(true)}
>
<button class="as-link" on:click={() => state.guistate.communityIndexPanelIsOpened.setData(true)}>
<Community class="h-6 w-6" />
<Tr t={Translations.t.communityIndex.title} />
</button>
@ -88,10 +81,7 @@
<MapillaryLink large={false} mapProperties={state.mapProperties} />
</If>
<button
class="as-link"
on:click={() => state.guistate.privacyPanelIsOpened.setData(true)}
>
<button class="as-link" on:click={() => state.guistate.privacyPanelIsOpened.setData(true)}>
<EyeIcon class="h-6 w-6 pr-1" />
<Tr t={Translations.t.privacy.title} />
</button>

View file

@ -40,9 +40,9 @@ export default class CopyrightPanel extends Combine {
const t = Translations.t.general.attribution
const layoutToUse = state.layout
const iconAttributions: BaseUIElement[] =layoutToUse.getUsedImages().map(
CopyrightPanel.IconAttribution
)
const iconAttributions: BaseUIElement[] = layoutToUse
.getUsedImages()
.map(CopyrightPanel.IconAttribution)
let maintainer: BaseUIElement = undefined
if (layoutToUse.credits !== undefined && layoutToUse.credits !== "") {

View file

@ -31,8 +31,7 @@
*/
let needsThemeRedirect = url.port !== "" || url.hostname.match(/^[0-9]/) || !state.layout.official
let layoutId = state.layout.id
let baseLink =
`${url.protocol}//${url.host}/${needsThemeRedirect ? "theme.html" : layoutId}?`
let baseLink = `${url.protocol}//${url.host}/${needsThemeRedirect ? "theme.html" : layoutId}?`
let showWelcomeMessage = true
let enableLogin = true
@ -45,7 +44,8 @@
enableLogin: boolean,
enableFilters: boolean,
enableBackground: boolean,
enableGeolocation: boolean) {
enableGeolocation: boolean
) {
const layout = state.layout
let excluded = Utils.NoNull([
showWelcomeMessage ? undefined : "fs-welcome-message",
@ -53,7 +53,6 @@
enableFilters ? undefined : "fs-filter",
enableBackground ? undefined : "fs-background",
enableGeolocation ? undefined : "fs-geolocation",
])
const layerParamsWhitelist: string[] = ["fs-layers-enabled=false"]
const layerParamsBlacklist: string[] = []
@ -79,9 +78,10 @@
const layersBlack = layerParamsBlacklist.join("&")
const layersWhite = layerParamsWhitelist.join("&")
const layers = layersBlack.length < layersWhite.length ? layerParamsBlacklist : layerParamsWhitelist
const layers =
layersBlack.length < layersWhite.length ? layerParamsBlacklist : layerParamsWhitelist
const params = QueryParameters.GetParts(new Set(excluded))
.filter(part => !part.startsWith("layer-"))
.filter((part) => !part.startsWith("layer-"))
.concat(...layers)
.concat(excluded.map((k) => k + "=" + false))
linkToShare = baseLink + Utils.Dedup(params).join("&")
@ -91,30 +91,42 @@
}
}
$: calculateLinkToShare(showWelcomeMessage, enableLogin, enableFilters, enableBackground, enableGeolocation)
$: calculateLinkToShare(
showWelcomeMessage,
enableLogin,
enableFilters,
enableBackground,
enableGeolocation
)
let iframeCode: string
$: iframeCode = `<iframe src="${linkToShare}"
${enableGeolocation ? 'allow="geolocation"' : ""} width="100%" height="100%" style="min-width: 250px; min-height: 250px"
${
enableGeolocation ? 'allow="geolocation"' : ""
} width="100%" height="100%" style="min-width: 250px; min-height: 250px"
title="${state.layout.title?.txt ?? "MapComplete"} with MapComplete">
</iframe>`
Array.from(state.layerState.filteredLayers.values()).forEach(flayer => flayer.isDisplayed.addCallbackAndRunD(_ => {
calculateLinkToShare(showWelcomeMessage, enableLogin, enableFilters, enableBackground, enableGeolocation)
}))
Array.from(state.layerState.filteredLayers.values()).forEach((flayer) =>
flayer.isDisplayed.addCallbackAndRunD((_) => {
calculateLinkToShare(
showWelcomeMessage,
enableLogin,
enableFilters,
enableBackground,
enableGeolocation
)
})
)
</script>
<div class="flex flex-col">
<div class="flex flex-col">
<Tr t={tr.intro} />
<Copyable {state} text={linkToShare}/>
<Copyable {state} text={linkToShare} />
</div>
<div class="flex justify-center">
<ToSvelte
construct={() => new Img(new Qr(linkToShare).toImageElement(125)).SetStyle("width: 125px")}
/>
@ -122,11 +134,11 @@
<Tr t={tr.embedIntro} />
<Copyable text={iframeCode}/>
<Copyable text={iframeCode} />
<AccordionSingle>
<div slot="header">
<Tr t={tr.options}/>
<Tr t={tr.options} />
</div>
<div class="link-underline my-1 flex flex-col">
<label>
@ -139,13 +151,11 @@
<Tr t={tr.fsUserbadge} />
</label>
<label>
<input bind:checked={enableFilters} type="checkbox" id="share_enable_filter" />
<Tr t={tr.fsFilter} />
</label>
<label>
<input bind:checked={enableBackground} type="checkbox" id="share_enable_background" />
<Tr t={tr.fsBackground} />
@ -157,15 +167,16 @@
</label>
<span>
<Tr t={tr.stateIsIncluded}/>
<a class="inline-block w-fit cursor-pointer" on:click={() => state.guistate.filtersPanelIsOpened.set(true)}>
<Tr t={tr.openLayers}/>
</a>
<Tr t={tr.stateIsIncluded} />
<a
class="inline-block w-fit cursor-pointer"
on:click={() => state.guistate.filtersPanelIsOpened.set(true)}
>
<Tr t={tr.openLayers} />
</a>
</span>
<Tr cls="link-underline" t={tr.documentation} />
</div>
</AccordionSingle>
</div>

View file

@ -86,7 +86,7 @@
</script>
{#if theme.id !== personal.id || $unlockedPersonal}
<a class="my-1 flex w-full items-center text-ellipsis rounded low-interaction p-1" href={$href}>
<a class="low-interaction my-1 flex w-full items-center text-ellipsis rounded p-1" href={$href}>
<Marker icons={theme.icon} size="block h-8 w-8 sm:h-11 sm:w-11 m-1 sm:mx-2 md:mx-4 shrink-0" />
<span class="flex flex-col overflow-hidden text-ellipsis text-xl font-bold">

View file

@ -63,7 +63,7 @@
<!-- Buttons: open map, go to location, search -->
<NextButton clss="primary w-full" on:click={() => state.guistate.themeIsOpened.setData(false)}>
<div class="flex flex-col w-full items-center">
<div class="flex w-full flex-col items-center">
<div class="flex w-full justify-center text-2xl">
<Tr t={Translations.t.general.openTheMap} />
</div>