chore: formatting
This commit is contained in:
parent
c596e3750c
commit
4849f881e6
9 changed files with 75 additions and 67 deletions
|
@ -1,62 +1,63 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onMount } from "svelte";
|
import { onMount } from "svelte"
|
||||||
import { Store } from "../../Logic/UIEventSource";
|
import { Store } from "../../Logic/UIEventSource"
|
||||||
import BaseUIElement from "../BaseUIElement";
|
import BaseUIElement from "../BaseUIElement"
|
||||||
import Img from "./Img";
|
import Img from "./Img"
|
||||||
import Translations from "../i18n/Translations";
|
import Translations from "../i18n/Translations"
|
||||||
import { ImmutableStore } from "../../Logic/UIEventSource.js";
|
import { ImmutableStore } from "../../Logic/UIEventSource.js"
|
||||||
|
|
||||||
export let imageUrl: string | BaseUIElement = undefined;
|
export let imageUrl: string | BaseUIElement = undefined
|
||||||
export let message: string | BaseUIElement = undefined;
|
export let message: string | BaseUIElement = undefined
|
||||||
export let options: {
|
export let options: {
|
||||||
url?: string | Store<string>
|
url?: string | Store<string>
|
||||||
newTab?: boolean
|
newTab?: boolean
|
||||||
imgSize?: string
|
imgSize?: string
|
||||||
extraClasses?: string
|
extraClasses?: string
|
||||||
} = {};
|
} = {}
|
||||||
|
|
||||||
// Website to open when clicked
|
// Website to open when clicked
|
||||||
let href : Store<string> = undefined
|
let href: Store<string> = undefined
|
||||||
if(options?.url){
|
if (options?.url) {
|
||||||
href = typeof options?.url == "string" ? new ImmutableStore(options.url) : options.url;
|
href = typeof options?.url == "string" ? new ImmutableStore(options.url) : options.url
|
||||||
}
|
}
|
||||||
|
|
||||||
let imgElem: HTMLElement;
|
let imgElem: HTMLElement
|
||||||
let msgElem: HTMLElement;
|
let msgElem: HTMLElement
|
||||||
let imgClasses = "block justify-center shrink-0 mr-4 " + (options?.imgSize ?? "h-11 w-11");
|
let imgClasses = "block justify-center shrink-0 mr-4 " + (options?.imgSize ?? "h-11 w-11")
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
// Image
|
// Image
|
||||||
if (imgElem && imageUrl) {
|
if (imgElem && imageUrl) {
|
||||||
let img: BaseUIElement;
|
let img: BaseUIElement
|
||||||
|
|
||||||
if ((imageUrl ?? "") === "") {
|
if ((imageUrl ?? "") === "") {
|
||||||
img = undefined;
|
img = undefined
|
||||||
} else if (typeof imageUrl !== "string") {
|
} else if (typeof imageUrl !== "string") {
|
||||||
img = imageUrl?.SetClass(imgClasses);
|
img = imageUrl?.SetClass(imgClasses)
|
||||||
}
|
}
|
||||||
if (img) imgElem.replaceWith(img.ConstructElement());
|
if (img) imgElem.replaceWith(img.ConstructElement())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Message
|
// Message
|
||||||
if (msgElem && message) {
|
if (msgElem && message) {
|
||||||
let msg = Translations.W(message)?.SetClass("block text-ellipsis no-images flex-shrink");
|
let msg = Translations.W(message)?.SetClass("block text-ellipsis no-images flex-shrink")
|
||||||
msgElem.replaceWith(msg.ConstructElement());
|
msgElem.replaceWith(msg.ConstructElement())
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:element
|
<svelte:element
|
||||||
class={(options.extraClasses??"") + 'flex hover:shadow-xl transition-[color,background-color,box-shadow] hover:bg-unsubtle'}
|
this={href === undefined ? "span" : "a"}
|
||||||
|
class={(options.extraClasses ?? "") +
|
||||||
|
"flex hover:shadow-xl transition-[color,background-color,box-shadow] hover:bg-unsubtle"}
|
||||||
href={$href}
|
href={$href}
|
||||||
target={options?.newTab ? "_blank" : ""}
|
target={options?.newTab ? "_blank" : ""}
|
||||||
this={href === undefined ? "span" : "a"}
|
|
||||||
>
|
>
|
||||||
<slot name="image">
|
<slot name="image">
|
||||||
{#if imageUrl !== undefined}
|
{#if imageUrl !== undefined}
|
||||||
{#if typeof imageUrl === "string"}
|
{#if typeof imageUrl === "string"}
|
||||||
<Img src={imageUrl} class={imgClasses+ " bg-red border border-black"}></Img>
|
<Img src={imageUrl} class={imgClasses + " bg-red border border-black"} />
|
||||||
{:else }
|
{:else}
|
||||||
<template bind:this={imgElem} />
|
<template bind:this={imgElem} />
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
|
@ -68,7 +69,6 @@
|
||||||
</svelte:element>
|
</svelte:element>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
|
||||||
span,
|
span,
|
||||||
a {
|
a {
|
||||||
@apply flex p-3 my-2 py-4 rounded-lg shrink-0;
|
@apply flex p-3 my-2 py-4 rounded-lg shrink-0;
|
||||||
|
|
|
@ -13,7 +13,7 @@ export class SubtleButton extends UIElement {
|
||||||
private readonly options: {
|
private readonly options: {
|
||||||
url?: string | Store<string>
|
url?: string | Store<string>
|
||||||
newTab?: boolean
|
newTab?: boolean
|
||||||
imgSize?: string,
|
imgSize?: string
|
||||||
extraClasses?: string
|
extraClasses?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ export class SubtleButton extends UIElement {
|
||||||
options: {
|
options: {
|
||||||
url?: string | Store<string>
|
url?: string | Store<string>
|
||||||
newTab?: boolean
|
newTab?: boolean
|
||||||
imgSize?: "h-11 w-11" | string,
|
imgSize?: "h-11 w-11" | string
|
||||||
extraClasses?: string
|
extraClasses?: string
|
||||||
} = {}
|
} = {}
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -29,8 +29,8 @@
|
||||||
url: "https://pietervdvn.github.io/mc/legacy/070/customGenerator.html",
|
url: "https://pietervdvn.github.io/mc/legacy/070/customGenerator.html",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<span slot="image" class="h-11 w-11 mx-4 bg-red" >
|
<span slot="image" class="h-11 w-11 mx-4 bg-red">
|
||||||
<ToSvelte construct={Svg.pencil_ui()}/>
|
<ToSvelte construct={Svg.pencil_ui()} />
|
||||||
</span>
|
</span>
|
||||||
<span slot="message">{t.createYourOwnTheme.toString()}</span>
|
<span slot="message">{t.createYourOwnTheme.toString()}</span>
|
||||||
</SubtleButton>
|
</SubtleButton>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
import UserDetails, { OsmConnection } from "../../Logic/Osm/OsmConnection"
|
import UserDetails, { OsmConnection } from "../../Logic/Osm/OsmConnection"
|
||||||
import Constants from "../../Models/Constants"
|
import Constants from "../../Models/Constants"
|
||||||
import type Loc from "../../Models/Loc"
|
import type Loc from "../../Models/Loc"
|
||||||
import type { LayoutInformation } from "../../Models/ThemeConfig/LayoutConfig";
|
import type { LayoutInformation } from "../../Models/ThemeConfig/LayoutConfig"
|
||||||
|
|
||||||
export let theme: LayoutInformation
|
export let theme: LayoutInformation
|
||||||
export let isCustom: boolean = false
|
export let isCustom: boolean = false
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import CustomGeneratorButton from "./CustomGeneratorButton.svelte"
|
import CustomGeneratorButton from "./CustomGeneratorButton.svelte"
|
||||||
import ProfessionalServicesButton from "./ProfessionalServicesButton.svelte"
|
import ProfessionalServicesButton from "./ProfessionalServicesButton.svelte"
|
||||||
import ThemeButton from "./ThemeButton.svelte"
|
import ThemeButton from "./ThemeButton.svelte"
|
||||||
import { LayoutInformation } from "../../Models/ThemeConfig/LayoutConfig";
|
import { LayoutInformation } from "../../Models/ThemeConfig/LayoutConfig"
|
||||||
|
|
||||||
export let search: UIEventSource<string>
|
export let search: UIEventSource<string>
|
||||||
export let themes: LayoutInformation[]
|
export let themes: LayoutInformation[]
|
||||||
|
@ -55,7 +55,7 @@
|
||||||
{/if}
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
{:else }
|
{:else}
|
||||||
<div>
|
<div>
|
||||||
{#if ($search === undefined || $search === "") && !isCustom}
|
{#if ($search === undefined || $search === "") && !isCustom}
|
||||||
<CustomGeneratorButton userDetails={state.osmConnection.userDetails} />
|
<CustomGeneratorButton userDetails={state.osmConnection.userDetails} />
|
||||||
|
@ -68,8 +68,7 @@
|
||||||
{/if}
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
|
||||||
{#if filteredThemes.length == 0}
|
{#if filteredThemes.length == 0}
|
||||||
<NoThemeResultButton {search} />
|
<NoThemeResultButton {search} />
|
||||||
|
|
|
@ -57,7 +57,9 @@ describe("ChangesetHanlder", () => {
|
||||||
const d = Utils.asDict(rewritten)
|
const d = Utils.asDict(rewritten)
|
||||||
expect(d.size).toEqual(10)
|
expect(d.size).toEqual(10)
|
||||||
expect(d.get("answer")).toEqual("5")
|
expect(d.get("answer")).toEqual("5")
|
||||||
expect(d.get("comment")).toEqual("Adding data with #MapComplete for theme #toerisme_vlaanderen")
|
expect(d.get("comment")).toEqual(
|
||||||
|
"Adding data with #MapComplete for theme #toerisme_vlaanderen"
|
||||||
|
)
|
||||||
expect(d.get("created_by")).toEqual("MapComplete 0.16.6")
|
expect(d.get("created_by")).toEqual("MapComplete 0.16.6")
|
||||||
expect(d.get("host")).toEqual("https://mapcomplete.osm.be/toerisme_vlaanderen.html")
|
expect(d.get("host")).toEqual("https://mapcomplete.osm.be/toerisme_vlaanderen.html")
|
||||||
expect(d.get("imagery")).toEqual("osm")
|
expect(d.get("imagery")).toEqual("osm")
|
||||||
|
@ -115,7 +117,9 @@ describe("ChangesetHanlder", () => {
|
||||||
|
|
||||||
expect(d.size).toEqual(9)
|
expect(d.size).toEqual(9)
|
||||||
expect(d.get("answer")).toEqual("42")
|
expect(d.get("answer")).toEqual("42")
|
||||||
expect(d.get("comment")).toEqual("Adding data with #MapComplete for theme #toerisme_vlaanderen")
|
expect(d.get("comment")).toEqual(
|
||||||
|
"Adding data with #MapComplete for theme #toerisme_vlaanderen"
|
||||||
|
)
|
||||||
expect(d.get("created_by")).toEqual("MapComplete 0.16.6")
|
expect(d.get("created_by")).toEqual("MapComplete 0.16.6")
|
||||||
expect(d.get("host")).toEqual("https://mapcomplete.osm.be/toerisme_vlaanderen.html")
|
expect(d.get("host")).toEqual("https://mapcomplete.osm.be/toerisme_vlaanderen.html")
|
||||||
expect(d.get("imagery")).toEqual("osm")
|
expect(d.get("imagery")).toEqual("osm")
|
||||||
|
@ -166,7 +170,9 @@ describe("ChangesetHanlder", () => {
|
||||||
|
|
||||||
expect(d.size).toEqual(9)
|
expect(d.size).toEqual(9)
|
||||||
expect(d.get("answer")).toEqual("5")
|
expect(d.get("answer")).toEqual("5")
|
||||||
expect(d.get("comment")).toEqual("Adding data with #MapComplete for theme #toerisme_vlaanderen")
|
expect(d.get("comment")).toEqual(
|
||||||
|
"Adding data with #MapComplete for theme #toerisme_vlaanderen"
|
||||||
|
)
|
||||||
expect(d.get("created_by")).toEqual("MapComplete 0.16.6")
|
expect(d.get("created_by")).toEqual("MapComplete 0.16.6")
|
||||||
expect(d.get("host")).toEqual("https://mapcomplete.osm.be/toerisme_vlaanderen.html")
|
expect(d.get("host")).toEqual("https://mapcomplete.osm.be/toerisme_vlaanderen.html")
|
||||||
expect(d.get("imagery")).toEqual("osm")
|
expect(d.get("imagery")).toEqual("osm")
|
||||||
|
|
|
@ -258,31 +258,33 @@ describe("Tag optimalization", () => {
|
||||||
)
|
)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
expect(opt).toEqual(TagUtils.Tag({
|
expect(opt).toEqual(
|
||||||
or: [
|
TagUtils.Tag({
|
||||||
"club=climbing",
|
or: [
|
||||||
{
|
"club=climbing",
|
||||||
and: ["sport=climbing", { or: ["club~*", "office~*"] }],
|
{
|
||||||
},
|
and: ["sport=climbing", { or: ["club~*", "office~*"] }],
|
||||||
{
|
},
|
||||||
and: [
|
{
|
||||||
"sport=climbing",
|
and: [
|
||||||
{
|
"sport=climbing",
|
||||||
or: [
|
{
|
||||||
"leisure=sports_centre",
|
or: [
|
||||||
{
|
"leisure=sports_centre",
|
||||||
and: [
|
{
|
||||||
"climbing!~route",
|
and: [
|
||||||
"climbing!=route_top",
|
"climbing!~route",
|
||||||
"climbing!=route_bottom",
|
"climbing!=route_top",
|
||||||
"leisure!~sports_centre",
|
"climbing!=route_bottom",
|
||||||
],
|
"leisure!~sports_centre",
|
||||||
},
|
],
|
||||||
],
|
},
|
||||||
},
|
],
|
||||||
],
|
},
|
||||||
},
|
],
|
||||||
],
|
},
|
||||||
}))
|
],
|
||||||
|
})
|
||||||
|
)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -2,7 +2,6 @@ import { TagUtils } from "../../../Logic/Tags/TagUtils"
|
||||||
import { equal } from "assert"
|
import { equal } from "assert"
|
||||||
import { describe, expect, it } from "vitest"
|
import { describe, expect, it } from "vitest"
|
||||||
|
|
||||||
|
|
||||||
describe("TagUtils", () => {
|
describe("TagUtils", () => {
|
||||||
describe("ParseTag", () => {
|
describe("ParseTag", () => {
|
||||||
it("should refuse a key!=* tag", () => {
|
it("should refuse a key!=* tag", () => {
|
||||||
|
|
|
@ -23,7 +23,9 @@ describe("CreateNoteImportLayer", () => {
|
||||||
layer,
|
layer,
|
||||||
"ImportLayerGeneratorTest: convert"
|
"ImportLayerGeneratorTest: convert"
|
||||||
)
|
)
|
||||||
expect(generatedLayer.isShown["and"][1].or[0].and[0]).toEqual("_tags~(^|.*;)amenity=public_bookcase($|;.*)")
|
expect(generatedLayer.isShown["and"][1].or[0].and[0]).toEqual(
|
||||||
|
"_tags~(^|.*;)amenity=public_bookcase($|;.*)"
|
||||||
|
)
|
||||||
// "Zoomlevel is to high"
|
// "Zoomlevel is to high"
|
||||||
expect(generatedLayer.minzoom <= layer.minzoom).toBe(true)
|
expect(generatedLayer.minzoom <= layer.minzoom).toBe(true)
|
||||||
let renderings = Utils.NoNull(
|
let renderings = Utils.NoNull(
|
||||||
|
|
Loading…
Reference in a new issue