Use 'area' to create a new note; open note popup when created
This commit is contained in:
parent
1c1df43bf9
commit
b4ecd963fc
4 changed files with 10 additions and 19 deletions
|
@ -61,17 +61,6 @@ export class TextField extends InputElement<string> {
|
||||||
return this._isValid(t)
|
return this._isValid(t)
|
||||||
}
|
}
|
||||||
|
|
||||||
private static test() {
|
|
||||||
const placeholder = new UIEventSource<string>("placeholder")
|
|
||||||
const tf = new TextField({
|
|
||||||
placeholder,
|
|
||||||
})
|
|
||||||
const html = <HTMLInputElement>tf.InnerConstructElement().children[0]
|
|
||||||
html.placeholder // => 'placeholder'
|
|
||||||
placeholder.setData("another piece of text")
|
|
||||||
html.placeholder // => "another piece of text"
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* // should update placeholders dynamically
|
* // should update placeholders dynamically
|
||||||
|
|
|
@ -52,10 +52,6 @@ export class TextFieldDef {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protectedisValid(s: string, _: (() => string) | undefined): boolean {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
public getFeedback(s: string): Translation {
|
public getFeedback(s: string): Translation {
|
||||||
const tr = Translations.t.validation[this.name]
|
const tr = Translations.t.validation[this.name]
|
||||||
if (tr !== undefined) {
|
if (tr !== undefined) {
|
||||||
|
@ -82,6 +78,9 @@ export class TextFieldDef {
|
||||||
}
|
}
|
||||||
|
|
||||||
options["textArea"] = this.name === "text"
|
options["textArea"] = this.name === "text"
|
||||||
|
if (this.name === "text") {
|
||||||
|
options["htmlType"] = "area"
|
||||||
|
}
|
||||||
|
|
||||||
const self = this
|
const self = this
|
||||||
|
|
||||||
|
@ -589,7 +588,7 @@ class StringTextField extends TextFieldDef {
|
||||||
class TextTextField extends TextFieldDef {
|
class TextTextField extends TextFieldDef {
|
||||||
declare inputmode: "text"
|
declare inputmode: "text"
|
||||||
constructor() {
|
constructor() {
|
||||||
super("text", "A longer piece of text")
|
super("text", "A longer piece of text. Uses an textArea instead of a textField")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ import Toggle from "../Input/Toggle"
|
||||||
import LayoutConfig from "../../Models/ThemeConfig/LayoutConfig"
|
import LayoutConfig from "../../Models/ThemeConfig/LayoutConfig"
|
||||||
import FeaturePipeline from "../../Logic/FeatureSource/FeaturePipeline"
|
import FeaturePipeline from "../../Logic/FeatureSource/FeaturePipeline"
|
||||||
import FilteredLayer from "../../Models/FilteredLayer"
|
import FilteredLayer from "../../Models/FilteredLayer"
|
||||||
|
import Hash from "../../Logic/Web/Hash"
|
||||||
|
|
||||||
export default class NewNoteUi extends Toggle {
|
export default class NewNoteUi extends Toggle {
|
||||||
constructor(
|
constructor(
|
||||||
|
@ -33,7 +34,7 @@ export default class NewNoteUi extends Toggle {
|
||||||
text.SetClass("border rounded-sm border-grey-500")
|
text.SetClass("border rounded-sm border-grey-500")
|
||||||
|
|
||||||
const postNote = new SubtleButton(Svg.addSmall_svg().SetClass("max-h-7"), t.createNote)
|
const postNote = new SubtleButton(Svg.addSmall_svg().SetClass("max-h-7"), t.createNote)
|
||||||
postNote.onClick(async () => {
|
postNote.OnClickWithLoading(t.creating, async () => {
|
||||||
let txt = text.GetValue().data
|
let txt = text.GetValue().data
|
||||||
if (txt === undefined || txt === "") {
|
if (txt === undefined || txt === "") {
|
||||||
return
|
return
|
||||||
|
@ -63,6 +64,7 @@ export default class NewNoteUi extends Toggle {
|
||||||
}
|
}
|
||||||
state?.featurePipeline?.InjectNewPoint(feature)
|
state?.featurePipeline?.InjectNewPoint(feature)
|
||||||
state.selectedElement?.setData(feature)
|
state.selectedElement?.setData(feature)
|
||||||
|
Hash.hash.setData(feature.properties.id)
|
||||||
text.GetValue().setData("")
|
text.GetValue().setData("")
|
||||||
isCreated.setData(true)
|
isCreated.setData(true)
|
||||||
})
|
})
|
||||||
|
@ -73,12 +75,12 @@ export default class NewNoteUi extends Toggle {
|
||||||
new Combine([
|
new Combine([
|
||||||
new Toggle(
|
new Toggle(
|
||||||
undefined,
|
undefined,
|
||||||
t.warnAnonymous.SetClass("alert"),
|
t.warnAnonymous.SetClass("block alert"),
|
||||||
state?.osmConnection?.isLoggedIn
|
state?.osmConnection?.isLoggedIn
|
||||||
),
|
),
|
||||||
new Toggle(
|
new Toggle(
|
||||||
postNote,
|
postNote,
|
||||||
t.textNeeded.SetClass("alert"),
|
t.textNeeded.SetClass("block alert"),
|
||||||
text.GetValue().map((txt) => txt?.length > 3)
|
text.GetValue().map((txt) => txt?.length > 3)
|
||||||
),
|
),
|
||||||
]).SetClass("flex justify-end items-center"),
|
]).SetClass("flex justify-end items-center"),
|
||||||
|
|
|
@ -746,6 +746,7 @@
|
||||||
"createNote": "Create a new note",
|
"createNote": "Create a new note",
|
||||||
"createNoteIntro": "Is something wrong or missing on the map? Create a note here. These will be checked by volunteers.",
|
"createNoteIntro": "Is something wrong or missing on the map? Create a note here. These will be checked by volunteers.",
|
||||||
"createNoteTitle": "Create a new note here",
|
"createNoteTitle": "Create a new note here",
|
||||||
|
"creating": "Creating note...",
|
||||||
"disableAllNoteFilters": "Disable all filters",
|
"disableAllNoteFilters": "Disable all filters",
|
||||||
"isClosed": "This note is resolved",
|
"isClosed": "This note is resolved",
|
||||||
"isCreated": "Your note has been created!",
|
"isCreated": "Your note has been created!",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue