UX: usersetting visual cleanup, add 'clear caches'-option, version bump

This commit is contained in:
Pieter Vander Vennet 2024-08-09 16:24:38 +02:00
parent 7293edf228
commit 97df1dc65b
13 changed files with 108 additions and 27 deletions

View file

@ -96,8 +96,8 @@ import { CombinedFetcher } from "../Logic/Web/NearbyImagesSearch"
import { And } from "../Logic/Tags/And"
import CloseNoteButton from "./Popup/Notes/CloseNoteButton.svelte"
import PendingChangesIndicator from "./BigComponents/PendingChangesIndicator.svelte"
import Loading from "./Base/Loading"
import QrCode from "./Popup/QrCode.svelte"
import ClearCaches from "./Popup/ClearCaches.svelte"
class NearbyImageVis implements SpecialVisualization {
// Class must be in SpecialVisualisations due to weird cyclical import that breaks the tests
@ -1304,6 +1304,10 @@ export default class SpecialVisualizations {
{
name: "arialabel",
doc: "If set, this text will be used as aria-label"
},
{
name: "icon",
doc: "If set, show this icon next to the link. You might want to combine this with `class: button`"
}
],
@ -1312,7 +1316,7 @@ export default class SpecialVisualizations {
tagSource: UIEventSource<Record<string, string>>,
args: string[]
): BaseUIElement {
let [text, href, classnames, download, ariaLabel] = args
let [text, href, classnames, download, ariaLabel, icon] = args
if (download === "") {
download = undefined
}
@ -1979,6 +1983,20 @@ export default class SpecialVisualizations {
constr(state: SpecialVisualizationState, tagSource: UIEventSource<Record<string, string>>, argument: string[], feature: Feature, layer: LayerConfig): BaseUIElement {
return new SvelteUIElement(PendingChangesIndicator, {state, compact: false})
}
},
{
funcName: "clear_caches",
docs: "A button which clears the locally downloaded data and the service worker. Login status etc will be kept",
args:[
{
name: "text",
required: true,
doc: "The text to show on the button"
}
],
constr(state: SpecialVisualizationState, tagSource: UIEventSource<Record<string, string>>, argument: string[], feature: Feature, layer: LayerConfig): SvelteUIElement {
return new SvelteUIElement<any, any, any>(ClearCaches, {msg: argument[0] ?? "Clear local caches"})
}
}
]