Studio: add slideshow, add useability tweaks

This commit is contained in:
Pieter Vander Vennet 2023-10-24 22:01:10 +02:00
parent 2df9aa8564
commit 8bc555fbe0
26 changed files with 440 additions and 316 deletions

View file

@ -22,7 +22,7 @@ $: documentation = TagUtils.modeDocumentation[mode];
</script>
<BasicTagInput bind:mode={mode} {dropdownFocussed} {overpassSupportNeeded} {silent} tag={value} {uploadableOnly} />
<BasicTagInput bind:mode={mode} {dropdownFocussed} {overpassSupportNeeded} {silent} tag={value} {uploadableOnly} on:submit />
{#if $dropdownFocussed}
<div class="border border-dashed border-black p-2 m-2">
<b>{documentation.name}</b>

View file

@ -19,4 +19,4 @@ let tag: UIEventSource<string | TagConfigJson> = value
</script>
<FullTagInput {overpassSupportNeeded} {silent} {tag} {uploadableOnly} />
<FullTagInput {overpassSupportNeeded} {silent} {tag} {uploadableOnly} on:submit/>

View file

@ -5,20 +5,14 @@
import { createEventDispatcher, onDestroy } from "svelte";
import ValidatedInput from "../ValidatedInput.svelte";
export let value: UIEventSource<string> = new UIEventSource<string>("");
export let value: UIEventSource<Record<string, string>> = new UIEventSource<Record<string, string>>({});
export let args: string[] = []
let prefix = args[0]
let postfix = args[1]
let prefix = args[0] ?? ""
let postfix = args[1] ?? ""
let translations: UIEventSource<Record<string, string>> = value.sync((s) => {
try {
return JSON.parse(s);
} catch (e) {
return {};
}
}, [], v => JSON.stringify(v));
let translations: UIEventSource<Record<string, string>> = value
const allLanguages: string[] = LanguageUtils.usedLanguagesSorted;
let currentLang = new UIEventSource("en");
@ -28,6 +22,9 @@
function update() {
const v = currentVal.data;
const l = currentLang.data;
if(translations.data === "" || translations.data === undefined){
translations.data = {}
}
if (translations.data[l] === v) {
return;
}
@ -37,6 +34,9 @@
onDestroy(currentLang.addCallbackAndRunD(currentLang => {
console.log("Applying current lang:", currentLang);
if(!translations.data){
translations.data = {}
}
translations.data[currentLang] = translations.data[currentLang] ?? "";
currentVal.setData(translations.data[currentLang]);
}));

View file

@ -27,14 +27,13 @@
let properties = { feature, args: args ?? [] };
let dispatch = createEventDispatcher<{
selected,
submit
selected
}>();
</script>
{#if type === "translation" }
<TranslationInput {value} on:submit={() => dispatch("submit")} {args} />
<TranslationInput {value} on:submit {args} />
{:else if type === "direction"}
<DirectionInput {value} mapProperties={InputHelpers.constructMapProperties(properties)} />
{:else if type === "date"}
@ -44,9 +43,9 @@
{:else if type === "image"}
<ImageHelper { value } />
{:else if type === "tag"}
<TagInput { value } />
<TagInput { value } on:submit />
{:else if type === "simple_tag"}
<SimpleTagInput { value } {args} />
<SimpleTagInput { value } {args} on:submit />
{:else if type === "opening_hours"}
<OpeningHoursInput { value } />
{:else if type === "wikidata"}

View file

@ -109,7 +109,7 @@
* Dispatches the submit, but only if the value is valid
*/
function sendSubmit(){
if(feedback.data){
if(feedback?.data){
console.log("Not sending a submit as there is feedback")
}
dispatch("submit")