diff --git a/src/UI/Popup/NoteCommentElement.ts b/src/UI/Popup/Notes/NoteCommentElement.ts
similarity index 64%
rename from src/UI/Popup/NoteCommentElement.ts
rename to src/UI/Popup/Notes/NoteCommentElement.ts
index 4d4e59c7e..5abaa52f9 100644
--- a/src/UI/Popup/NoteCommentElement.ts
+++ b/src/UI/Popup/Notes/NoteCommentElement.ts
@@ -1,26 +1,33 @@
-import Combine from "../Base/Combine"
-import BaseUIElement from "../BaseUIElement"
-import Svg from "../../Svg"
-import Link from "../Base/Link"
-import { FixedUiElement } from "../Base/FixedUiElement"
-import Translations from "../i18n/Translations"
-import { Utils } from "../../Utils"
-import Img from "../Base/Img"
-import { SlideShow } from "../Image/SlideShow"
-import { Stores, UIEventSource } from "../../Logic/UIEventSource"
-import { OsmConnection } from "../../Logic/Osm/OsmConnection"
-import { VariableUiElement } from "../Base/VariableUIElement"
+import Combine from "../../Base/Combine"
+import BaseUIElement from "../../BaseUIElement"
+import Svg from "../../../Svg"
+import Link from "../../Base/Link"
+import { FixedUiElement } from "../../Base/FixedUiElement"
+import Translations from "../../i18n/Translations"
+import { Utils } from "../../../Utils"
+import Img from "../../Base/Img"
+import { SlideShow } from "../../Image/SlideShow"
+import { Stores, UIEventSource } from "../../../Logic/UIEventSource"
+import { OsmConnection } from "../../../Logic/Osm/OsmConnection"
+import { VariableUiElement } from "../../Base/VariableUIElement"
+import { SpecialVisualizationState } from "../../SpecialVisualization"
export default class NoteCommentElement extends Combine {
- constructor(comment: {
- date: string
- uid: number
- user: string
- user_url: string
- action: "closed" | "opened" | "reopened" | "commented"
- text: string
- html: string
- }) {
+ constructor(
+ comment: {
+ date: string
+ uid: number
+ user: string
+ user_url: string
+ action: "closed" | "opened" | "reopened" | "commented"
+ text: string
+ html: string
+ highlighted: boolean
+ },
+ state?: SpecialVisualizationState,
+ index?: number,
+ totalNumberOfComments?: number
+ ) {
const t = Translations.t.notes
let actionIcon: BaseUIElement
@@ -68,7 +75,15 @@ export default class NoteCommentElement extends Combine {
let imagesEl: BaseUIElement = undefined
if (images.length > 0) {
const imageEls = images.map((i) =>
- new Img(i).SetClass("w-full block").SetStyle("min-width: 50px; background: grey;")
+ new Img(i)
+ .SetClass("w-full block cursor-pointer")
+ .onClick(() =>
+ state?.previewedImage?.setData(
{
+ url_hd: i,
+ url: i,
+ })
+ )
+ .SetStyle("min-width: 50px; background: grey;")
)
imagesEl = new SlideShow(new UIEventSource(imageEls)).SetClass("mb-1")
}
@@ -84,6 +99,16 @@ export default class NoteCommentElement extends Combine {
),
])
this.SetClass("flex flex-col pb-2 mb-2 border-gray-500 border-b")
+ if (comment.highlighted) {
+ this.SetClass("glowing-shadow")
+ console.log(">>>", index, totalNumberOfComments)
+ if (index + 2 === totalNumberOfComments) {
+ console.log("Scrolling into view")
+ requestAnimationFrame(() => {
+ this.ScrollIntoView()
+ })
+ }
+ }
}
public static addCommentTo(
@@ -107,6 +132,7 @@ export default class NoteCommentElement extends Combine {
action: "commented",
text: txt,
html: html,
+ highlighted: true,
})
tags.data["comments"] = JSON.stringify(comments)
tags.ping()
diff --git a/src/UI/Popup/TagRendering/TagRenderingQuestion.svelte b/src/UI/Popup/TagRendering/TagRenderingQuestion.svelte
index 34d1ea19b..7a910f08f 100644
--- a/src/UI/Popup/TagRendering/TagRenderingQuestion.svelte
+++ b/src/UI/Popup/TagRendering/TagRenderingQuestion.svelte
@@ -105,7 +105,9 @@
}
// TODO this has _to much_ values
freeformInput.setData(unseenFreeformValues.join(";"))
- checkedMappings.push(unseenFreeformValues.length > 0)
+ if(checkedMappings.length + 1 < mappings.length ){
+ checkedMappings.push(unseenFreeformValues.length > 0)
+ }
}
}
if (confg.freeform?.key) {
@@ -125,13 +127,31 @@
initialize($tags, config)
}
+ freeformInput.addCallbackAndRun(freeformValue => {
+ console.log("FreeformValue:", freeformValue)
+ if (!mappings || mappings?.length == 0 || config.freeform?.key === undefined) {
+ return
+ }
+ // If a freeform value is given, mark the 'mapping' as marked
+ if (config.multiAnswer) {
+ if (checkedMappings === undefined) {
+ // Initialization didn't yet run
+ return
+ }
+ checkedMappings[mappings.length] = freeformValue?.length > 0
+ return
+ }
+ if (freeformValue?.length > 0) {
+ selectedMapping = mappings.length
+ }
+ })
$: {
try {
selectedTags = config?.constructChangeSpecification(
$freeformInput,
selectedMapping,
checkedMappings,
- tags.data
+ tags.data,
)
} catch (e) {
console.error("Could not calculate changeSpecification:", e)
@@ -182,19 +202,6 @@
}
}
- $: {
- try {
- selectedTags = config?.constructChangeSpecification(
- $freeformInput,
- selectedMapping,
- checkedMappings,
- tags.data
- )
- } catch (e) {
- console.error("Could not calculate changeSpecification:", e)
- selectedTags = undefined
- }
- }
let featureSwitchIsTesting = state?.featureSwitchIsTesting ?? new ImmutableStore(false)
let featureSwitchIsDebugging =
@@ -207,148 +214,151 @@
onDestroy(
state.osmConnection?.userDetails?.addCallbackAndRun((ud) => {
numberOfCs = ud.csCount
- })
+ }),
)
}
{#if question !== undefined}
- onSave()}
>
-
- {#if config.questionhint}
-
-
+
+
+ {/if}
+
+ {#if config.mappings?.length >= 8}
+
+
+
+
+ {/if}
+
+ {#if config.freeform?.key && !(mappings?.length > 0)}
+
+
-
- {/if}
-
- {#if config.mappings?.length >= 8}
-
-
-
-
- {/if}
-
- {#if config.freeform?.key && !(mappings?.length > 0)}
-
-
- {:else if mappings !== undefined && !config.multiAnswer}
-
-
+ {/if}
+
@@ -391,5 +401,5 @@
{/if}
-
+
{/if}
diff --git a/src/UI/Reviews/ReviewForm.svelte b/src/UI/Reviews/ReviewForm.svelte
index aa43f7fc1..a020267a1 100644
--- a/src/UI/Reviews/ReviewForm.svelte
+++ b/src/UI/Reviews/ReviewForm.svelte
@@ -85,9 +85,12 @@
/>
{#if confirmedScore !== undefined}
+
diff --git a/src/UI/SpecialVisualization.ts b/src/UI/SpecialVisualization.ts
index b86ffe56a..2261d3789 100644
--- a/src/UI/SpecialVisualization.ts
+++ b/src/UI/SpecialVisualization.ts
@@ -57,6 +57,9 @@ export interface SpecialVisualizationState {
readonly selectedElement: UIEventSource
/**
* Works together with 'selectedElement' to indicate what properties should be displayed
+ * @deprecated
+ *
+ * No need to set this anymore
*/
readonly selectedLayer: UIEventSource
readonly selectedElementAndLayer: Store<{ feature: Feature; layer: LayerConfig }>
diff --git a/src/UI/SpecialVisualizations.ts b/src/UI/SpecialVisualizations.ts
index 916e3070e..6c2342a14 100644
--- a/src/UI/SpecialVisualizations.ts
+++ b/src/UI/SpecialVisualizations.ts
@@ -13,10 +13,10 @@ import { MinimapViz } from "./Popup/MinimapViz"
import { ShareLinkViz } from "./Popup/ShareLinkViz"
import { UploadToOsmViz } from "./Popup/UploadToOsmViz"
import { MultiApplyViz } from "./Popup/MultiApplyViz"
-import { AddNoteCommentViz } from "./Popup/AddNoteCommentViz"
+import { AddNoteCommentViz } from "./Popup/Notes/AddNoteCommentViz"
import { PlantNetDetectionViz } from "./Popup/PlantNetDetectionViz"
import TagApplyButton from "./Popup/TagApplyButton"
-import { CloseNoteButton } from "./Popup/CloseNoteButton"
+import { CloseNoteButton } from "./Popup/Notes/CloseNoteButton"
import { MapillaryLinkVis } from "./Popup/MapillaryLinkVis"
import { Store, Stores, UIEventSource } from "../Logic/UIEventSource"
import AllTagsPanel from "./Popup/AllTagsPanel.svelte"
@@ -30,7 +30,7 @@ import Translations from "./i18n/Translations"
import OpeningHoursVisualization from "./OpeningHours/OpeningHoursVisualization"
import { SubtleButton } from "./Base/SubtleButton"
import Svg from "../Svg"
-import NoteCommentElement from "./Popup/NoteCommentElement"
+import NoteCommentElement from "./Popup/Notes/NoteCommentElement"
import { SubstitutedTranslation } from "./SubstitutedTranslation"
import List from "./Base/List"
import StatisticsPanel from "./BigComponents/StatisticsPanel"
@@ -42,7 +42,7 @@ import SvelteUIElement from "./Base/SvelteUIElement"
import { BBoxFeatureSourceForLayer } from "../Logic/FeatureSource/Sources/TouchesBboxFeatureSource"
import { Feature } from "geojson"
import { GeoOperations } from "../Logic/GeoOperations"
-import CreateNewNote from "./Popup/CreateNewNote.svelte"
+import CreateNewNote from "./Popup/Notes/CreateNewNote.svelte"
import AddNewPoint from "./Popup/AddNewPoint/AddNewPoint.svelte"
import UserProfile from "./BigComponents/UserProfile.svelte"
import LayerConfig from "../Models/ThemeConfig/LayerConfig"
@@ -1004,7 +1004,10 @@ export default class SpecialVisualizations {
return new Combine(
comments
.filter((c) => c.text !== "")
- .map((c) => new NoteCommentElement(c))
+ .map(
+ (c, i) =>
+ new NoteCommentElement(c, state, i, comments.length)
+ )
).SetClass("flex flex-col")
})
),
diff --git a/src/UI/ThemeViewGUI.svelte b/src/UI/ThemeViewGUI.svelte
index 6f8436044..b13fc8428 100644
--- a/src/UI/ThemeViewGUI.svelte
+++ b/src/UI/ThemeViewGUI.svelte
@@ -67,6 +67,7 @@
import PrivacyPolicy from "./BigComponents/PrivacyPolicy.svelte"
import { BBox } from "../Logic/BBox"
import { MapLibreAdaptor } from "./Map/MapLibreAdaptor.js"
+ import { QueryParameters } from "../Logic/Web/QueryParameters"
export let state: ThemeViewState
let layout = state.layout
@@ -138,6 +139,15 @@
}),
)
let previewedImage = state.previewedImage
+
+ let debug = state.featureSwitches.featureSwitchIsDebugging
+ debug.addCallbackAndRun(dbg => {
+ if(dbg){
+ document.body.classList.add("debug")
+ }else{
+ document.body.classList.remove("debug")
+ }
+ })
function forwardEventToMap(e: KeyboardEvent) {
const mlmap = state.map.data
diff --git a/src/Utils.ts b/src/Utils.ts
index 406056be6..f10f2ab43 100644
--- a/src/Utils.ts
+++ b/src/Utils.ts
@@ -1638,13 +1638,22 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be
return newObj
}
+ public static focusOn(el: HTMLElement): void {
+ if (!el) {
+ return
+ }
+ requestAnimationFrame(() => {
+ el.focus()
+ })
+ }
+
/**
* Searches a child that can be focused on, by first selecting a 'focusable', then a button, then a link
*
* Returns the focussed element
* @param el
*/
- public static focusOnFocusableChild(el: HTMLElement): undefined {
+ public static focusOnFocusableChild(el: HTMLElement): void {
if (!el) {
return
}
diff --git a/src/index.css b/src/index.css
index 0b7bf4fb3..9260eedf0 100644
--- a/src/index.css
+++ b/src/index.css
@@ -121,6 +121,16 @@ input[type=text] {
width: 100%;
}
+.debug input, .debug textarea {
+ border: 6px solid red
+}
+
+
+.debug label input, .debug label textarea {
+ border: 1px solid grey;
+}
+
+
/************************* BIG CATEGORIES ********************************/
/**
@@ -302,6 +312,11 @@ button.link:hover {
fill: var(--foreground-color) !important;
}
+.neutral-label{
+ /** This label styles as normal text. It's power comes from the many :not(.neutral-label) entries.
+ * Placed here for autocompletion
+ */
+}
label:not(.neutral-label) {
/**