Merge branch 'master' into develop

This commit is contained in:
Pieter Vander Vennet 2023-03-13 20:12:07 +01:00
commit f12b79754e
53 changed files with 315 additions and 259 deletions

View file

@ -14,7 +14,6 @@ import { LoginToggle } from "./Popup/LoginButton"
export default class AllThemesGui {
setup() {
try {
new FixedUiElement("").AttachTo("centermessage")
const state = new UserRelatedState(undefined)
const intro = new Combine([
new LanguagePicker1(Translations.t.index.title.SupportedLanguages(), "").SetClass(
@ -42,7 +41,7 @@ export default class AllThemesGui {
"Seems like no layers are compiled - check the output of `npm run generate:layeroverview`. Is this visible online? Contact pietervdvn immediately!"
)
.SetClass("alert")
.AttachTo("centermessage")
.AttachTo("top-left")
}
}
}

View file

@ -1,62 +1,63 @@
<script lang="ts">
import { onMount } from "svelte";
import { Store } from "../../Logic/UIEventSource";
import BaseUIElement from "../BaseUIElement";
import Img from "./Img";
import Translations from "../i18n/Translations";
import { ImmutableStore } from "../../Logic/UIEventSource.js";
import { onMount } from "svelte"
import { Store } from "../../Logic/UIEventSource"
import BaseUIElement from "../BaseUIElement"
import Img from "./Img"
import Translations from "../i18n/Translations"
import { ImmutableStore } from "../../Logic/UIEventSource.js"
export let imageUrl: string | BaseUIElement = undefined;
export let message: string | BaseUIElement = undefined;
export let imageUrl: string | BaseUIElement = undefined
export let message: string | BaseUIElement = undefined
export let options: {
url?: string | Store<string>
newTab?: boolean
imgSize?: string
extraClasses?: string
} = {};
} = {}
// Website to open when clicked
let href : Store<string> = undefined
if(options?.url){
href = typeof options?.url == "string" ? new ImmutableStore(options.url) : options.url;
let href: Store<string> = undefined
if (options?.url) {
href = typeof options?.url == "string" ? new ImmutableStore(options.url) : options.url
}
let imgElem: HTMLElement;
let msgElem: HTMLElement;
let imgClasses = "block justify-center shrink-0 mr-4 " + (options?.imgSize ?? "h-11 w-11");
let imgElem: HTMLElement
let msgElem: HTMLElement
let imgClasses = "block justify-center shrink-0 mr-4 " + (options?.imgSize ?? "h-11 w-11")
onMount(() => {
// Image
if (imgElem && imageUrl) {
let img: BaseUIElement;
let img: BaseUIElement
if ((imageUrl ?? "") === "") {
img = undefined;
img = undefined
} 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
if (msgElem && message) {
let msg = Translations.W(message)?.SetClass("block text-ellipsis no-images flex-shrink");
msgElem.replaceWith(msg.ConstructElement());
let msg = Translations.W(message)?.SetClass("block text-ellipsis no-images flex-shrink")
msgElem.replaceWith(msg.ConstructElement())
}
});
})
</script>
<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}
target={options?.newTab ? "_blank" : ""}
this={href === undefined ? "span" : "a"}
>
<slot name="image">
{#if imageUrl !== undefined}
{#if typeof imageUrl === "string"}
<Img src={imageUrl} class={imgClasses+ " bg-red border border-black"}></Img>
{:else }
<Img src={imageUrl} class={imgClasses + " bg-red border border-black"} />
{:else}
<template bind:this={imgElem} />
{/if}
{/if}
@ -68,7 +69,6 @@
</svelte:element>
<style lang="scss">
span,
a {
@apply flex p-3 my-2 py-4 rounded-lg shrink-0;

View file

@ -13,7 +13,7 @@ export class SubtleButton extends UIElement {
private readonly options: {
url?: string | Store<string>
newTab?: boolean
imgSize?: string,
imgSize?: string
extraClasses?: string
}
@ -23,7 +23,7 @@ export class SubtleButton extends UIElement {
options: {
url?: string | Store<string>
newTab?: boolean
imgSize?: "h-11 w-11" | string,
imgSize?: "h-11 w-11" | string
extraClasses?: string
} = {}
) {

View file

@ -29,8 +29,8 @@
url: "https://pietervdvn.github.io/mc/legacy/070/customGenerator.html",
}}
>
<span slot="image" class="h-11 w-11 mx-4 bg-red" >
<ToSvelte construct={Svg.pencil_ui()}/>
<span slot="image" class="h-11 w-11 mx-4 bg-red">
<ToSvelte construct={Svg.pencil_ui()} />
</span>
<span slot="message">{t.createYourOwnTheme.toString()}</span>
</SubtleButton>

View file

@ -6,7 +6,7 @@
import UserDetails, { OsmConnection } from "../../Logic/Osm/OsmConnection"
import Constants from "../../Models/Constants"
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 isCustom: boolean = false