Small usability tweaks

This commit is contained in:
Pieter Vander Vennet 2023-12-25 19:59:58 +01:00
parent bfd818cb38
commit 32606856f9
7 changed files with 43 additions and 23 deletions

View file

@ -109,11 +109,6 @@
"override": { "override": {
"render": "./assets/layers/id_presets/maki-shop.svg", "render": "./assets/layers/id_presets/maki-shop.svg",
"+mappings": [ "+mappings": [
{
"#": "Layer icon rendering",
"if": "id=",
"then": "./assets/layers/id_presets/maki-shop.svg"
},
{ {
"if": { "if": {
"or": [ "or": [
@ -133,6 +128,11 @@
{ {
"if": "craft=key_cutter", "if": "craft=key_cutter",
"then": "./assets/layers/id_presets/fas-key.svg" "then": "./assets/layers/id_presets/fas-key.svg"
},
{
"#": "Layer icon rendering",
"if": "id=",
"then": "./assets/layers/id_presets/maki-shop.svg"
} }
] ]
} }
@ -204,15 +204,15 @@
}, },
"description": { "description": {
"en": "Add a new shop", "en": "Add a new shop",
"fr": "Ajouter un nouveau magasin", "ca": "Afegir una botiga nova",
"ru": "Добавить новый магазин", "cs": "Přidat nový obchod",
"ja": "新しい店を追加する",
"nl": "Voeg een nieuwe winkel toe",
"de": "Ein neues Geschäft hinzufügen", "de": "Ein neues Geschäft hinzufügen",
"eo": "Enmeti novan butikon", "eo": "Enmeti novan butikon",
"es": "Añadir una nueva tienda", "es": "Añadir una nueva tienda",
"ca": "Afegir una botiga nova", "fr": "Ajouter un nouveau magasin",
"cs": "Přidat nový obchod" "ja": "新しい店を追加する",
"nl": "Voeg een nieuwe winkel toe",
"ru": "Добавить новый магазин"
} }
} }
], ],

View file

@ -667,9 +667,10 @@
"question_opinion": "How was your experience?", "question_opinion": "How was your experience?",
"rate": "Rate {n} stars", "rate": "Rate {n} stars",
"rated": "Rated {n} stars", "rated": "Rated {n} stars",
"reviewPlaceholder": "Describe your experience…",
"reviewing_as": "Reviewing as {nickname}", "reviewing_as": "Reviewing as {nickname}",
"reviewing_as_anonymous": "Reviewing as anonymous", "reviewing_as_anonymous": "Reviewing as anonymous",
"save": "Save", "save": "Save review",
"saved": "Review saved. Thanks for sharing!", "saved": "Review saved. Thanks for sharing!",
"saving_review": "Saving…", "saving_review": "Saving…",
"title": "{count} reviews", "title": "{count} reviews",

View file

@ -36,7 +36,9 @@
</script> </script>
{#if $tags._deleted === "yes"} {#if $tags._deleted === "yes"}
<Tr t={Translations.t.delete.isDeleted} /> <div aria-live="assertive">
<Tr t={Translations.t.delete.isDeleted} />
</div>
<button class="w-full" on:click={() => state.selectedElement.setData(undefined)}> <button class="w-full" on:click={() => state.selectedElement.setData(undefined)}>
<Tr t={Translations.t.general.returnToTheMap} /> <Tr t={Translations.t.general.returnToTheMap} />
</button> </button>

View file

@ -28,6 +28,8 @@
import Not_found from "../../assets/svg/Not_found.svelte" import Not_found from "../../assets/svg/Not_found.svelte"
import { twMerge } from "tailwind-merge" import { twMerge } from "tailwind-merge"
import Direction_gradient from "../../assets/svg/Direction_gradient.svelte" import Direction_gradient from "../../assets/svg/Direction_gradient.svelte"
import Mastodon from "../../assets/svg/Mastodon.svelte"
import Party from "../../assets/svg/Party.svelte"
/** /**
* Renders a single icon. * Renders a single icon.
@ -105,6 +107,10 @@
<Direction_gradient class={clss} {color} /> <Direction_gradient class={clss} {color} />
{:else if icon === "not_found"} {:else if icon === "not_found"}
<Not_found class={twMerge(clss, "no-image-background")} {color} /> <Not_found class={twMerge(clss, "no-image-background")} {color} />
{:else if icon === "mastodon"}
<Mastodon {color} class={clss} />
{:else if icon === "party"}
<Party {color} class={clss} />
{:else} {:else}
<img class={clss ?? "h-full w-full"} src={icon} aria-hidden="true" alt="" /> <img class={clss ?? "h-full w-full"} src={icon} aria-hidden="true" alt="" />
{/if} {/if}

View file

@ -13,6 +13,7 @@
import Loading from "../Base/Loading.svelte" import Loading from "../Base/Loading.svelte"
import { Review } from "mangrove-reviews-typescript" import { Review } from "mangrove-reviews-typescript"
import { Utils } from "../../Utils" import { Utils } from "../../Utils"
import { placeholder } from "../../Utils/placeholder"
export let state: SpecialVisualizationState export let state: SpecialVisualizationState
export let tags: UIEventSource<Record<string, string>> export let tags: UIEventSource<Record<string, string>>
@ -83,7 +84,8 @@
{#if confirmedScore !== undefined} {#if confirmedScore !== undefined}
<Tr cls="font-bold mt-2" t={t.question_opinion} /> <Tr cls="font-bold mt-2" t={t.question_opinion} />
<textarea bind:value={$opinion} inputmode="text" rows="3" class="mb-1 w-full" /> <textarea autofocus bind:value={$opinion} inputmode="text" rows="3" class="mb-1 w-full"
use:placeholder={t.reviewPlaceholder}/>
<Checkbox selected={isAffiliated}> <Checkbox selected={isAffiliated}>
<div class="flex flex-col"> <div class="flex flex-col">
<Tr t={t.i_am_affiliated} /> <Tr t={t.i_am_affiliated} />

View file

@ -1569,14 +1569,23 @@ export default class SpecialVisualizations {
feature: Feature, feature: Feature,
layer: LayerConfig layer: LayerConfig
): BaseUIElement { ): BaseUIElement {
const url = return new VariableUiElement(
window.location.protocol + tagSource
"//" + .map((tags) => tags.id)
window.location.host + .map((id) => {
window.location.pathname + if (id.startsWith("node/-")) {
"#" + // Not yet uploaded
feature.properties.id return undefined
return new Img(new Qr(url).toImageElement(75)).SetStyle("width: 75px") }
const [lon, lat] = GeoOperations.centerpointCoordinates(feature)
const url =
`${window.location.protocol}//${window.location.host}${window.location.pathname}?lat=${lat}&lon=${lon}&z=15` +
`#${id}`
return new Img(new Qr(url).toImageElement(75)).SetStyle(
"width: 75px"
)
})
)
}, },
}, },
] ]

View file

@ -1,6 +1,6 @@
import { Translation } from "../UI/i18n/Translation" import { Translation } from "../UI/i18n/Translation"
export function placeholder(htmlElement: HTMLInputElement, t: Translation) { export function placeholder(htmlElement: HTMLInputElement | HTMLTextAreaElement, t: Translation) {
let destroy: () => void = undefined let destroy: () => void = undefined
t.current.map( t.current.map(