{#if review.opinion}
- {review.opinion}
+
{/if}
{#if review.metadata.is_affiliated}
|
diff --git a/src/UI/Reviews/StarElement.svelte b/src/UI/Reviews/StarElement.svelte
index 09b0e56ce..f91f21bfe 100644
--- a/src/UI/Reviews/StarElement.svelte
+++ b/src/UI/Reviews/StarElement.svelte
@@ -1,31 +1,32 @@
-
dispatch("click", { score: getScore(e) })}
- on:mousemove={(e) => dispatch("hover", { score: getScore(e) })}
->
+{#if readonly}
{#if score >= cutoff}
{:else if score + 10 >= cutoff}
@@ -33,4 +34,22 @@
{:else}
{/if}
-
+
+{:else}
+
+{/if}
diff --git a/src/UI/Reviews/StarsBar.svelte b/src/UI/Reviews/StarsBar.svelte
index d2f13a824..f52a2d2ef 100644
--- a/src/UI/Reviews/StarsBar.svelte
+++ b/src/UI/Reviews/StarsBar.svelte
@@ -1,5 +1,4 @@
{#if score !== undefined}
{#each cutoffs as cutoff, i}
-
+
{/each}
{/if}
diff --git a/src/UI/Reviews/StarsBarIcon.svelte b/src/UI/Reviews/StarsBarIcon.svelte
index 72f9d8f73..7cd402d22 100644
--- a/src/UI/Reviews/StarsBarIcon.svelte
+++ b/src/UI/Reviews/StarsBarIcon.svelte
@@ -1,10 +1,16 @@
{#if $score !== undefined && $score !== null}
-
+
+
+
{/if}
diff --git a/src/UI/SpecialVisualization.ts b/src/UI/SpecialVisualization.ts
index a898ac226..b86ffe56a 100644
--- a/src/UI/SpecialVisualization.ts
+++ b/src/UI/SpecialVisualization.ts
@@ -19,6 +19,7 @@ import { ImageUploadManager } from "../Logic/ImageProviders/ImageUploadManager"
import { OsmTags } from "../Models/OsmFeature"
import FavouritesFeatureSource from "../Logic/FeatureSource/Sources/FavouritesFeatureSource"
import { ProvidedImage } from "../Logic/ImageProviders/ImageProvider"
+import GeoLocationHandler from "../Logic/Actors/GeoLocationHandler"
/**
* The state needed to render a special Visualisation.
@@ -87,6 +88,7 @@ export interface SpecialVisualizationState {
readonly imageUploadManager: ImageUploadManager
readonly previewedImage: UIEventSource
+ readonly geolocation: GeoLocationHandler
}
export interface SpecialVisualization {
diff --git a/src/UI/SpecialVisualizations.ts b/src/UI/SpecialVisualizations.ts
index 33148e62d..53926d425 100644
--- a/src/UI/SpecialVisualizations.ts
+++ b/src/UI/SpecialVisualizations.ts
@@ -85,6 +85,9 @@ import { Unit } from "../Models/Unit"
import Link from "./Base/Link.svelte"
import OrientationDebugPanel from "./Debug/OrientationDebugPanel.svelte"
import MaprouletteSetStatus from "./MapRoulette/MaprouletteSetStatus.svelte"
+import DirectionIndicator from "./Base/DirectionIndicator.svelte"
+import Img from "./Base/Img"
+import Qr from "../Utils/Qr"
class NearbyImageVis implements SpecialVisualization {
// Class must be in SpecialVisualisations due to weird cyclical import that breaks the tests
@@ -1539,6 +1542,43 @@ export default class SpecialVisualizations {
})
},
},
+ {
+ funcName: "direction_indicator",
+ args: [],
+ needsUrls: [],
+ docs: "Gives a distance indicator and a compass pointing towards the location from your GPS-location. If clicked, centers the map on the object",
+ constr(
+ state: SpecialVisualizationState,
+ tagSource: UIEventSource>,
+ argument: string[],
+ feature: Feature,
+ layer: LayerConfig
+ ): BaseUIElement {
+ return new SvelteUIElement(DirectionIndicator, { state, feature })
+ },
+ },
+ {
+ funcName: "qr_code",
+ args: [],
+ needsUrls: [],
+ docs: "Generates a QR-code to share the selected object",
+ constr(
+ state: SpecialVisualizationState,
+ tagSource: UIEventSource>,
+ argument: string[],
+ feature: Feature,
+ layer: LayerConfig
+ ): BaseUIElement {
+ const url =
+ window.location.protocol +
+ "//" +
+ window.location.host +
+ window.location.pathname +
+ "#" +
+ feature.properties.id
+ return new Img(new Qr(url).toImageElement(75)).SetStyle("width: 75px")
+ },
+ },
]
specialVisualizations.push(new AutoApplyButton(specialVisualizations))
diff --git a/src/UI/i18n/Translations.ts b/src/UI/i18n/Translations.ts
index 8ed7f9dad..e6e296e68 100644
--- a/src/UI/i18n/Translations.ts
+++ b/src/UI/i18n/Translations.ts
@@ -4,6 +4,9 @@ import BaseUIElement from "../BaseUIElement"
import CompiledTranslations from "../../assets/generated/CompiledTranslations"
import LanguageUtils from "../../Utils/LanguageUtils"
import { ClickableToggle } from "../Input/Toggle"
+import { Store } from "../../Logic/UIEventSource"
+import Locale from "./Locale"
+import { Utils } from "../../Utils"
export default class Translations {
static readonly t: Readonly = CompiledTranslations.t
@@ -130,6 +133,29 @@ export default class Translations {
}
}
+ public static DynamicSubstitute>(
+ translation: TypedTranslation,
+ t: Store
+ ): Store {
+ return Locale.language.map(
+ (lang) => {
+ const tags: Record = {}
+ for (const k in t.data) {
+ let v = t.data[k]
+ if (!v) {
+ continue
+ }
+ if (v["textFor"] !== undefined) {
+ v = v["textFor"](lang)
+ }
+ tags[k] = v
+ }
+ return Utils.SubstituteKeys(translation.textFor(lang), t.data)
+ },
+ [t]
+ )
+ }
+
static isProbablyATranslation(transl: any) {
if (!transl || typeof transl !== "object") {
return false
diff --git a/src/Utils/Qr.ts b/src/Utils/Qr.ts
index 55be7626a..2a48e6d3c 100644
--- a/src/Utils/Qr.ts
+++ b/src/Utils/Qr.ts
@@ -4,23 +4,20 @@ import Qrcode from "qrcode-generator"
* Creates a QR-code as Blob
*/
export default class Qr {
- private _textToShow: string
+ private readonly _textToShow: string
constructor(textToShow: string) {
this._textToShow = textToShow
}
public toImageElement(totalSize: number): string {
- console.log("Creating a QR code for", this._textToShow)
const typeNumber = 0
const errorCorrectionLevel = "L"
const qr = Qrcode(typeNumber, errorCorrectionLevel)
qr.addData(this._textToShow)
qr.make()
const moduleCount = qr.getModuleCount()
- const img = document.createElement("img")
const cellSize = Math.round(totalSize / moduleCount)
- console.log("Cellsize", cellSize)
return qr.createDataURL(cellSize)
}
}