Skip to content

Commit

Permalink
Re-enable location (undo ed09ca8)
Browse files Browse the repository at this point in the history
  • Loading branch information
MendyBerger committed Sep 15, 2024
1 parent 89332e3 commit b7f9fff
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ use utils::{
component::Component,
events,
languages::{Language, JIG_LANGUAGES},
unwrap::UnwrapJiExt,
};
use web_sys::{HtmlInputElement, ShadowRoot};

pub const STR_HEADING: &str = "Edit your details";
// pub const STR_LOCATION: &str = "Where I live";
pub const STR_LOCATION: &str = "Where I live";
pub const STR_ORGANIZATION: &str = "Where I work";
pub const STR_PERSONA: &str = "What I do";
pub const STR_LANGUAGE: &str = "Language";
Expand Down Expand Up @@ -52,37 +53,36 @@ impl Component<EditAbout> for Rc<EditAbout> {
.prop("slot", "body")
.class("field-grid")
.children(&mut [
// TODO: Temporary disabled location to prevent usage of Places API
// html!("fa-icon", {
// .prop("icon", "fa-solid fa-location-dot")
// }),
// html!("input-wrapper", {
// .prop("slot", "location")
// .prop("label", STR_LOCATION)
// .child(html!("input-location", {
// .prop_signal("locationAsString", state.location.signal_cloned().map(|location| {
// location.unwrap_or_default()
// .as_str()
// .unwrap_or_default()
// .to_owned()
// }))
// .event(clone!(state => move |evt: events::GoogleLocation| {
// let raw = serde_json::to_value(evt.raw_json()).unwrap_ji();
// state.location.set(Some(raw));
// }))
// }))
// .child(html!("img-ui", {
// .prop("slot", "icon")
// .prop("path", "core/inputs/pencil-blue-darker.svg")
// }))
// }),
// html!("community-private-public-switch", {
// .prop("type", "checkbox")
// .prop_signal("isPublic", state.location_public.signal())
// .event(clone!(state => move |evt: events::CustomToggle| {
// state.location_public.set_neq(evt.value());
// }))
// }),
html!("fa-icon", {
.prop("icon", "fa-solid fa-location-dot")
}),
html!("input-wrapper", {
.prop("slot", "location")
.prop("label", STR_LOCATION)
.child(html!("input-location", {
.prop_signal("locationAsString", state.location.signal_cloned().map(|location| {
location.unwrap_or_default()
.as_str()
.unwrap_or_default()
.to_owned()
}))
.event(clone!(state => move |evt: events::GoogleLocation| {
let raw = serde_json::to_value(evt.raw_json()).unwrap_ji();
state.location.set(Some(raw));
}))
}))
.child(html!("img-ui", {
.prop("slot", "icon")
.prop("path", "core/inputs/pencil-blue-darker.svg")
}))
}),
html!("community-private-public-switch", {
.prop("type", "checkbox")
.prop_signal("isPublic", state.location_public.signal())
.event(clone!(state => move |evt: events::CustomToggle| {
state.location_public.set_neq(evt.value());
}))
}),
html!("fa-icon", {
.prop("icon", "fa-solid fa-briefcase")
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ pub fn submit(state: Rc<State>) {
};
state.location_error.set_neq(location_error);

// TODO: Temporary disabled location_error check to prevent usage of Places API
if !terms_error && !language_error && !persona_error
/* && !location_error */
{
if !terms_error && !language_error && !persona_error && !location_error {
next_step(state);
}
}
Expand Down
22 changes: 11 additions & 11 deletions frontend/apps/crates/entry/user/src/register/pages/step_2/dom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ impl Step2Page {

html!("page-register-step2", {
.children(&mut [
// html!("input-wrapper", {
// .prop("slot", "location")
// .prop("label", STR_LOCATION_LABEL)
// .prop_signal("error", state.location_error.signal())
// .child(html!("input-location", {
// .prop("placeholder", STR_LOCATION_PLACEHOLDER)
// .event(clone!(state => move |evt:events::GoogleLocation| {
// *state.location_json.borrow_mut() = evt.raw_json();
// }))
// }))
// }),
html!("input-wrapper", {
.prop("slot", "location")
.prop("label", STR_LOCATION_LABEL)
.prop_signal("error", state.location_error.signal())
.child(html!("input-location", {
.prop("placeholder", STR_LOCATION_PLACEHOLDER)
.event(clone!(state => move |evt:events::GoogleLocation| {
*state.location_json.borrow_mut() = evt.raw_json();
}))
}))
}),
SimpleSelect::render_mixin(
SimpleSelect::new(
Some(STR_LANGUAGE_LABEL),
Expand Down
34 changes: 17 additions & 17 deletions frontend/apps/crates/entry/user/src/school_start/dom.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
use super::state::SchoolStart;
use const_format::formatcp;
use dominator::{clone, html, with_node, DomBuilder};
use futures_signals::signal::SignalExt;
use shared::domain::billing::SCHOOL_TRIAL_PERIOD;
use std::rc::Rc;
use utils::{component::Component, events};
use utils::{component::Component, events, unwrap::UnwrapJiExt};
use web_sys::{HtmlInputElement, ShadowRoot};

impl Component<SchoolStart> for Rc<SchoolStart> {
Expand Down Expand Up @@ -33,7 +34,6 @@ impl Component<SchoolStart> for Rc<SchoolStart> {
.child(html!("div", {
.class("inputs")
.child(html!("input-wrapper", {
.style("grid-column", "span 2") // TODO Remove when enabling Places API again
.prop("label", "School/Organization*")
.child(html!("input" => HtmlInputElement, {
.with_node!(elem => {
Expand All @@ -45,21 +45,21 @@ impl Component<SchoolStart> for Rc<SchoolStart> {
})
}))
}))
// .child(html!("input-wrapper", {
// .prop("label", "Location")
// .child(html!("input-location", {
// .prop_signal("locationAsString", state.location.signal_cloned().map(|location| {
// location.unwrap_or_default()
// .as_str()
// .unwrap_or_default()
// .to_owned()
// }))
// .event(clone!(state => move |evt: events::GoogleLocation| {
// let raw = serde_json::to_value(evt.raw_json()).unwrap_ji();
// state.location.set(Some(raw));
// }))
// }))
// }))
.child(html!("input-wrapper", {
.prop("label", "Location")
.child(html!("input-location", {
.prop_signal("locationAsString", state.location.signal_cloned().map(|location| {
location.unwrap_or_default()
.as_str()
.unwrap_or_default()
.to_owned()
}))
.event(clone!(state => move |evt: events::GoogleLocation| {
let raw = serde_json::to_value(evt.raw_json()).unwrap_ji();
state.location.set(Some(raw));
}))
}))
}))
}))
.child(html!("button-rect", {
.text("Continue")
Expand Down
4 changes: 2 additions & 2 deletions frontend/apps/crates/entry/user/src/strings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ pub mod register {
}

pub mod step_2 {
// pub const STR_LOCATION_LABEL: &str = "Location *";
// pub const STR_LOCATION_PLACEHOLDER: &str = "City, State";
pub const STR_LOCATION_LABEL: &str = "Location *";
pub const STR_LOCATION_PLACEHOLDER: &str = "City, State";
pub const STR_PERSONA_LABEL: &str = "I am signing up as a... *";
pub const STR_ORGANIZATION_LABEL: &str = "School/Organization";
pub const STR_TERMS_LABEL_ONE: &str = "I have read and accept the ";
Expand Down
4 changes: 2 additions & 2 deletions shared/rust/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ impl RemoteTarget {
match self {
// these are _apparently_ public?
Self::Local
| Self::Sandbox => "https://maps.googleapis.com/maps/api/js?key=AIzaSyCtU4taX_GG36bXfZr98HSwZTBNYo9HS1I&libraries=places",
Self::Release => "https://maps.googleapis.com/maps/api/js?key=AIzaSyCU1HygSZgK4L3qPdRmrV-dTnS1GBBiqyE&libraries=places"
| Self::Sandbox => "https://maps.googleapis.com/maps/api/js?key=AIzaSyA_2bOsRAkYy6M5W-FgC66sSMs6xasYsRs&libraries=places",
Self::Release => "https://maps.googleapis.com/maps/api/js?key=AIzaSyACFIbFhygrinifRdlsg8Ig_ztm5LphlkY&libraries=places"
}
}

Expand Down

0 comments on commit b7f9fff

Please sign in to comment.