2023-02-03 22:28:11 +01:00
|
|
|
<script lang="ts">
|
|
|
|
import NoThemeResultButton from "./NoThemeResultButton.svelte"
|
|
|
|
|
2023-06-14 20:39:36 +02:00
|
|
|
import { OsmConnection } from "../../Logic/Osm/OsmConnection"
|
|
|
|
import { UIEventSource } from "../../Logic/UIEventSource"
|
2023-02-03 22:28:11 +01:00
|
|
|
import ThemeButton from "./ThemeButton.svelte"
|
2024-10-17 04:06:03 +02:00
|
|
|
import { MinimalThemeInformation } from "../../Models/ThemeConfig/ThemeConfig"
|
2024-09-05 02:25:03 +02:00
|
|
|
import Translations from "../i18n/Translations"
|
|
|
|
import Tr from "../Base/Tr.svelte"
|
2025-03-01 03:33:57 +01:00
|
|
|
import { Utils } from "../../Utils"
|
2023-02-03 22:28:11 +01:00
|
|
|
|
2025-02-16 00:04:48 +01:00
|
|
|
export let search: UIEventSource<string> = new UIEventSource<string>(undefined)
|
2024-10-17 04:06:03 +02:00
|
|
|
export let themes: MinimalThemeInformation[]
|
2023-06-06 00:03:14 +02:00
|
|
|
export let state: { osmConnection: OsmConnection }
|
2025-02-16 00:04:48 +01:00
|
|
|
export let onlyIcons: boolean = false
|
2024-10-19 14:44:55 +02:00
|
|
|
export let hasSelection: boolean = true
|
2023-02-03 22:28:11 +01:00
|
|
|
</script>
|
|
|
|
|
2023-05-22 01:37:02 +02:00
|
|
|
<section class="w-full">
|
2023-02-03 22:28:11 +01:00
|
|
|
<slot name="title" />
|
2025-02-16 00:04:48 +01:00
|
|
|
<div
|
2025-03-06 16:21:55 +01:00
|
|
|
class={onlyIcons
|
|
|
|
? "flex flex-wrap items-center justify-center gap-x-2"
|
|
|
|
: "theme-list my-2 gap-4 md:grid md:grid-flow-row md:grid-cols-2 lg:grid-cols-3"}
|
|
|
|
>
|
2025-04-09 17:11:46 +02:00
|
|
|
{#each Utils.DedupOnId(Utils.NoNull(themes)) as theme (theme.id)}
|
2025-02-16 00:04:48 +01:00
|
|
|
<ThemeButton {theme} {state} iconOnly={onlyIcons}>
|
2024-09-15 02:25:57 +02:00
|
|
|
{#if $search && hasSelection && themes?.[0] === theme}
|
2024-10-19 14:44:55 +02:00
|
|
|
<span class="thanks hidden-on-mobile" aria-hidden="true">
|
|
|
|
<Tr t={Translations.t.general.morescreen.enterToOpen} />
|
|
|
|
</span>
|
2023-02-09 00:10:59 +01:00
|
|
|
{/if}
|
2024-09-05 02:25:03 +02:00
|
|
|
</ThemeButton>
|
2023-12-13 02:16:53 +01:00
|
|
|
{/each}
|
|
|
|
</div>
|
|
|
|
|
2024-09-15 02:25:57 +02:00
|
|
|
{#if themes?.length === 0}
|
2023-02-03 22:28:11 +01:00
|
|
|
<NoThemeResultButton {search} />
|
|
|
|
{/if}
|
|
|
|
</section>
|