Merge master

This commit is contained in:
Pieter Vander Vennet 2025-04-08 14:52:32 +02:00
commit 9ab53188ec
5 changed files with 46 additions and 13 deletions

View file

@ -14,6 +14,16 @@
export let state: { osmConnection: OsmConnection }
export let onlyIcons: boolean = false
export let hasSelection: boolean = true
let themesFiltered: MinimalThemeInformation[] = []
for (const theme of themes) {
if (!theme) {
continue
}
if (themesFiltered.some(th => th.id === theme.id)) {
continue
}
themesFiltered.push(theme)
}
</script>
<section class="w-full">
@ -23,7 +33,7 @@
? "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"}
>
{#each Utils.NoNull(themes) as theme (theme.id)}
{#each Utils.NoNull(themesFiltered) as theme (theme.id)}
<ThemeButton {theme} {state} iconOnly={onlyIcons}>
{#if $search && hasSelection && themes?.[0] === theme}
<span class="thanks hidden-on-mobile" aria-hidden="true">

View file

@ -11,12 +11,21 @@
import { TrashIcon } from "@babeard/svelte-heroicons/mini"
import { CogIcon } from "@rgossiaux/svelte-heroicons/solid"
import Tr from "../Base/Tr.svelte"
import { Utils } from "../../Utils.ts"
import { MinimalThemeInformation } from "../../Models/ThemeConfig/ThemeConfig"
export let state: SpecialVisualizationState
let searchTerm = state.searchState.searchTerm
let recentThemes = state.userRelatedState.recentlyVisitedThemes.value.map((themes) =>
Utils.Dedup(themes.filter((th) => th !== state.theme.id).slice(0, 6))
let recentThemes = state.userRelatedState.recentlyVisitedThemes.value.map((themes) => {
const recent = themes.filter((th) => th !== state.theme.id).slice(0, 6)
const deduped: MinimalThemeInformation[] = []
for (const theme of recent) {
if (deduped.some(th => th.id === theme.id)) {
continue
}
deduped.push(theme)
}
return deduped
}
)
let themeResults = state.searchState.themeSuggestions