diff --git a/langs/en.json b/langs/en.json index 83b1916f7..1372e1ae2 100644 --- a/langs/en.json +++ b/langs/en.json @@ -616,6 +616,7 @@ "intro": "Maps about various topics which you can contribute to", "learnMore": "Learn more", "logIn": "Log in to see other themes you previously visited", + "recentThemes": "Recently visited themes", "title": "MapComplete" }, "inspector": { diff --git a/public/css/index-tailwind-output.css b/public/css/index-tailwind-output.css index 0df60cd4c..908fd6ac4 100644 --- a/public/css/index-tailwind-output.css +++ b/public/css/index-tailwind-output.css @@ -1140,10 +1140,6 @@ input[type="range"].range-lg::-moz-range-thumb { position: absolute; } -.\!relative { - position: relative !important; -} - .relative { position: relative; } @@ -2565,6 +2561,10 @@ input[type="range"].range-lg::-moz-range-thumb { grid-template-columns: repeat(7, minmax(0, 1fr)); } +.grid-rows-2 { + grid-template-rows: repeat(2, minmax(0, 1fr)); +} + .flex-row { flex-direction: row; } @@ -8729,6 +8729,10 @@ svg.apply-fill path { grid-template-columns: repeat(3, minmax(0, 1fr)); } + .md\:grid-rows-1 { + grid-template-rows: repeat(1, minmax(0, 1fr)); + } + .md\:flex-row { flex-direction: row; } diff --git a/src/UI/AllThemesGui.svelte b/src/UI/AllThemesGui.svelte index c9bed2eaa..aad6262cc 100644 --- a/src/UI/AllThemesGui.svelte +++ b/src/UI/AllThemesGui.svelte @@ -27,6 +27,7 @@ import { AndroidPolyfill } from "../Logic/Web/AndroidPolyfill" import Forgejo from "../assets/svg/Forgejo.svelte" import Locale from "./i18n/Locale" + AndroidPolyfill.init().then(() => console.log("Android polyfill setup completed")) const featureSwitches = new OsmConnectionFeatureSwitches() const osmConnection = new OsmConnection({ @@ -35,13 +36,15 @@ "oauth_token", undefined, "Used to complete the login" - ), + ) }) const state = new UserRelatedState(osmConnection) const t = Translations.t.index const tu = Translations.t.general const tr = Translations.t.general.morescreen + const recentThemes = state.recentlyVisitedThemes.value.mapD(themes => themes.map(thId => ThemeSearch.officialThemesById.get(thId))) + let userLanguages = osmConnection.userDetails.map((ud) => ud?.languages ?? []) let search: UIEventSource = new UIEventSource("") let searchStable = search.stabilized(100) @@ -64,6 +67,7 @@ const customThemes: Store = Stores.ListStabilized( state.installedUserThemes ).mapD((stableIds) => Utils.NoNullInplace(stableIds.map((id) => state.getUnofficialTheme(id)))) + function filtered(themes: Store): Store { const searchIndex = Locale.language.map(language => { return new ThemeSearchIndex(language, themes.data) @@ -97,7 +101,7 @@ let customSearched: Store = filtered(customThemes) let searchIsFocussed = new UIEventSource(false) - document.addEventListener("keydown", function (event) { + document.addEventListener("keydown", function(event) { if (event.ctrlKey && event.code === "KeyF") { searchIsFocussed.set(true) event.preventDefault() @@ -162,6 +166,17 @@ + + {#if $recentThemes.length > 2} +
+

+ +

+ +
+ {/if} +
+ - import { ImmutableStore, Store } from "../../Logic/UIEventSource" import { OsmConnection } from "../../Logic/Osm/OsmConnection" import type { MinimalThemeInformation } from "../../Models/ThemeConfig/ThemeConfig" import Tr from "../Base/Tr.svelte" @@ -10,7 +9,7 @@ export let theme: MinimalThemeInformation & { isOfficial?: boolean } let isCustom: boolean = theme.id.startsWith("https://") || theme.id.startsWith("http://") export let state: { layoutToUse?: { id: string }; osmConnection: OsmConnection } - + export let iconOnly: boolean = false $: title = Translations.T( theme.title, !isCustom && !theme.mustHaveLanguage ? "themes:" + theme.id + ".title" : undefined @@ -71,12 +70,17 @@ ) - - - - - - - - - +{#if iconOnly} + + + +{:else} + + + + + + + + +{/if} diff --git a/src/UI/BigComponents/ThemesList.svelte b/src/UI/BigComponents/ThemesList.svelte index 3cf0247cc..755fa7030 100644 --- a/src/UI/BigComponents/ThemesList.svelte +++ b/src/UI/BigComponents/ThemesList.svelte @@ -7,19 +7,21 @@ import { MinimalThemeInformation } from "../../Models/ThemeConfig/ThemeConfig" import Translations from "../i18n/Translations" import Tr from "../Base/Tr.svelte" + import { twMerge } from "tailwind-merge" - export let search: UIEventSource + export let search: UIEventSource = new UIEventSource(undefined) export let themes: MinimalThemeInformation[] export let state: { osmConnection: OsmConnection } - + export let onlyIcons: boolean = false export let hasSelection: boolean = true
-
+
{#each themes as theme (theme.id)} - + {#if $search && hasSelection && themes?.[0] === theme}