summaryrefslogtreecommitdiff
path: root/crates/wipfel/src/widgets.rs
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2026-10-27 20:02:23 +0100
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2026-10-27 20:03:12 +0100
commit4cdfae6ad5d5f9808ebf3078fb4630298051f464 (patch)
tree9b982284a809831b812797ed8876d211c4c70ae3 /crates/wipfel/src/widgets.rs
parentb084d94e484aa057cc839892c6e49df3caf8a0e6 (diff)
web: GPS paste field in Viewpoint section
One text field accepting '47.676,13.32042' (optionally ',alt' as a third component; commas, semicolons or spaces as separators) — the format gallery apps show, so the coordinates can simply be copied and pasted. This replaces the PWA/share-target detour for getting a viewpoint onto mobile: EXIF GPS may be redacted by the OS, but the gallery displays the true coordinates for manual transfer.
Diffstat (limited to 'crates/wipfel/src/widgets.rs')
-rw-r--r--crates/wipfel/src/widgets.rs29
1 files changed, 29 insertions, 0 deletions
diff --git a/crates/wipfel/src/widgets.rs b/crates/wipfel/src/widgets.rs
index 1d22bac..93e2cdc 100644
--- a/crates/wipfel/src/widgets.rs
+++ b/crates/wipfel/src/widgets.rs
@@ -46,6 +46,35 @@ pub fn slider_item(p: &SliderProps) -> Html {
}
}
+/// single-line text row (e.g. paste a GPS string)
+#[derive(Properties, PartialEq)]
+pub struct TextProps {
+ pub label: AttrValue,
+ pub placeholder: AttrValue,
+ pub onchange: Callback<String>,
+}
+
+#[function_component(TextItem)]
+pub fn text_item(p: &TextProps) -> Html {
+ let onchange = {
+ let onchange = p.onchange.clone();
+ Callback::from(move |e: Event| {
+ let input: HtmlInputElement = e.target_unchecked_into();
+ onchange.emit(input.value());
+ })
+ };
+ html! {
+ <label class="numrow">
+ <span>{ p.label.as_ref().to_string() }</span>
+ <input
+ type="text"
+ placeholder={p.placeholder.as_ref().to_string()}
+ {onchange}
+ />
+ </label>
+ }
+}
+
#[derive(Properties, PartialEq)]
pub struct NumProps {
pub label: AttrValue,