From 1a9a5b45c1fd82c49d70d2e1bef03fde0d3a089b Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Sun, 3 Dec 2023 04:49:28 +0100 Subject: [PATCH] Fixes to favourites --- .../ImageProviders/ImageUploadManager.ts | 8 ++- src/UI/Popup/LinkableImage.svelte | 5 +- .../TagRendering/TagRenderingQuestion.svelte | 7 -- src/UI/ThemeViewGUI.svelte | 67 +------------------ 4 files changed, 8 insertions(+), 79 deletions(-) diff --git a/src/Logic/ImageProviders/ImageUploadManager.ts b/src/Logic/ImageProviders/ImageUploadManager.ts index 07a9ff3ae..17b3b8f56 100644 --- a/src/Logic/ImageProviders/ImageUploadManager.ts +++ b/src/Logic/ImageProviders/ImageUploadManager.ts @@ -107,7 +107,8 @@ export class ImageUploadManager { title, description, file, - targetKey + targetKey, + tags.data["_orig_theme"] ) if (!isNaN(Number(featureId))) { // This is a map note @@ -126,7 +127,8 @@ export class ImageUploadManager { title: string, description: string, blob: File, - targetKey: string | undefined + targetKey: string | undefined, + theme?: string ): Promise { this.increaseCountFor(this._uploadStarted, featureId) const properties = this._featureProperties.getStore(featureId) @@ -148,7 +150,7 @@ export class ImageUploadManager { console.log("Uploading done, creating action for", featureId) key = targetKey ?? key const action = new LinkImageAction(featureId, key, value, properties, { - theme: this._layout.id, + theme: theme ?? this._layout.id, changeType: "add-image", }) this.increaseCountFor(this._uploadFinished, featureId) diff --git a/src/UI/Popup/LinkableImage.svelte b/src/UI/Popup/LinkableImage.svelte index d9290fbdd..a4776dc81 100644 --- a/src/UI/Popup/LinkableImage.svelte +++ b/src/UI/Popup/LinkableImage.svelte @@ -28,7 +28,6 @@ const t = Translations.t.image.nearby const c = [lon, lat] - console.log(">>>", image) let attributedImage = new AttributedImage({ url: image.thumbUrl ?? image.pictureUrl, provider: AllImageProviders.byName(image.provider), @@ -45,7 +44,7 @@ const url = image.osmTags[key] if (isLinked) { const action = new LinkImageAction(currentTags.id, key, url, tags, { - theme: state.layout.id, + theme: tags.data._orig_theme ?? state.layout.id, changeType: "link-image", }) state.changes.applyAction(action) @@ -54,7 +53,7 @@ const v = currentTags[k] if (v === url) { const action = new ChangeTagAction(currentTags.id, new Tag(k, ""), currentTags, { - theme: state.layout.id, + theme: tags.data._orig_theme ?? state.layout.id, changeType: "remove-image", }) state.changes.applyAction(action) diff --git a/src/UI/Popup/TagRendering/TagRenderingQuestion.svelte b/src/UI/Popup/TagRendering/TagRenderingQuestion.svelte index 423046fec..3705ec236 100644 --- a/src/UI/Popup/TagRendering/TagRenderingQuestion.svelte +++ b/src/UI/Popup/TagRendering/TagRenderingQuestion.svelte @@ -190,13 +190,6 @@ } } - let dispatch = createEventDispatcher<{ - saved: { - config: TagRenderingConfig - applied: TagsFilter - } - }>(); - let featureSwitchIsTesting = state?.featureSwitchIsTesting ?? new ImmutableStore(false); let featureSwitchIsDebugging = diff --git a/src/UI/ThemeViewGUI.svelte b/src/UI/ThemeViewGUI.svelte index e45b9d3a1..79e258195 100644 --- a/src/UI/ThemeViewGUI.svelte +++ b/src/UI/ThemeViewGUI.svelte @@ -65,73 +65,8 @@ import Download from "../assets/svg/Download.svelte"; import Share from "../assets/svg/Share.svelte"; import Favourites from "./Favourites/Favourites.svelte"; - import { Store, UIEventSource } from "../Logic/UIEventSource" - import { Map as MlMap } from "maplibre-gl" - import MaplibreMap from "./Map/MaplibreMap.svelte" - import FeatureSwitchState from "../Logic/State/FeatureSwitchState" - import MapControlButton from "./Base/MapControlButton.svelte" - import ToSvelte from "./Base/ToSvelte.svelte" - import If from "./Base/If.svelte" - import { GeolocationControl } from "./BigComponents/GeolocationControl" - import type { Feature } from "geojson" - import SelectedElementView from "./BigComponents/SelectedElementView.svelte" - import LayerConfig from "../Models/ThemeConfig/LayerConfig" - import Filterview from "./BigComponents/Filterview.svelte" - import ThemeViewState from "../Models/ThemeViewState" - import type { MapProperties } from "../Models/MapProperties" - import Geosearch from "./BigComponents/Geosearch.svelte" - import Translations from "./i18n/Translations" - import { CogIcon, EyeIcon, MenuIcon, XCircleIcon } from "@rgossiaux/svelte-heroicons/solid" - import Tr from "./Base/Tr.svelte" - import CommunityIndexView from "./BigComponents/CommunityIndexView.svelte" - import FloatOver from "./Base/FloatOver.svelte" - import PrivacyPolicy from "./BigComponents/PrivacyPolicy" - import Constants from "../Models/Constants" - import TabbedGroup from "./Base/TabbedGroup.svelte" - import UserRelatedState from "../Logic/State/UserRelatedState" - import LoginToggle from "./Base/LoginToggle.svelte" - import LoginButton from "./Base/LoginButton.svelte" - import CopyrightPanel from "./BigComponents/CopyrightPanel" - import DownloadPanel from "./DownloadFlow/DownloadPanel.svelte" - import ModalRight from "./Base/ModalRight.svelte" - import { Utils } from "../Utils" - import Hotkeys from "./Base/Hotkeys" - import { VariableUiElement } from "./Base/VariableUIElement" - import SvelteUIElement from "./Base/SvelteUIElement" - import OverlayToggle from "./BigComponents/OverlayToggle.svelte" - import LevelSelector from "./BigComponents/LevelSelector.svelte" - import ExtraLinkButton from "./BigComponents/ExtraLinkButton" - import SelectedElementTitle from "./BigComponents/SelectedElementTitle.svelte" - import ThemeIntroPanel from "./BigComponents/ThemeIntroPanel.svelte" - import type { RasterLayerPolygon } from "../Models/RasterLayers" - import { AvailableRasterLayers } from "../Models/RasterLayers" - import RasterLayerOverview from "./Map/RasterLayerOverview.svelte" - import IfHidden from "./Base/IfHidden.svelte" - import { onDestroy } from "svelte" - import MapillaryLink from "./BigComponents/MapillaryLink.svelte" - import OpenIdEditor from "./BigComponents/OpenIdEditor.svelte" - import OpenBackgroundSelectorButton from "./BigComponents/OpenBackgroundSelectorButton.svelte" - import StateIndicator from "./BigComponents/StateIndicator.svelte" - import ShareScreen from "./BigComponents/ShareScreen.svelte" - import UploadingImageCounter from "./Image/UploadingImageCounter.svelte" - import PendingChangesIndicator from "./BigComponents/PendingChangesIndicator.svelte" - import Cross from "../assets/svg/Cross.svelte" - import Summary from "./BigComponents/Summary.svelte" - import Mastodon from "../assets/svg/Mastodon.svelte" - import Bug from "../assets/svg/Bug.svelte" - import Liberapay from "../assets/svg/Liberapay.svelte" - import Min from "../assets/svg/Min.svelte" - import Plus from "../assets/svg/Plus.svelte" - import Filter from "../assets/svg/Filter.svelte" - import Add from "../assets/svg/Add.svelte" - import Statistics from "../assets/svg/Statistics.svelte" - import Community from "../assets/svg/Community.svelte" - import Download from "../assets/svg/Download.svelte" - import Share from "../assets/svg/Share.svelte" - import LanguagePicker from "./InputElement/LanguagePicker.svelte" - import OpenJosm from "./Base/OpenJosm.svelte" - export let state: ThemeViewState + export let state: ThemeViewState let layout = state.layout let maplibremap: UIEventSource = state.map