summaryrefslogtreecommitdiff
path: root/src/view/name.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/view/name.rs')
-rw-r--r--src/view/name.rs19
1 files changed, 5 insertions, 14 deletions
diff --git a/src/view/name.rs b/src/view/name.rs
index d864e35..27dadf1 100644
--- a/src/view/name.rs
+++ b/src/view/name.rs
@@ -1,8 +1,5 @@
-use yew::services::ConsoleService;
use yew::prelude::*;
use yewtil::NeqAssign;
-use yewtil::ptr::Irc;
-use yewtil::ptr::Mrc;
use crate::viewmodel::Error;
use crate::view::WeakComponentLink;
use crate::viewmodel::name::*;
@@ -25,7 +22,7 @@ use super::VCardPropertyInputComponent;
/// ```
pub struct NameView {
props: Props,
- value: Mrc<Name>,
+ value: Name,
error: Option<Error>,
}
@@ -41,19 +38,13 @@ pub enum Msg {
#[derive(Clone, PartialEq, Properties)]
pub struct Props {
- pub generated: Callback<Irc<Name>>,
+ pub generated: Callback<Name>,
pub weak_link: WeakComponentLink<NameView>,
}
impl VCardPropertyInputComponent<Name> for NameView {
fn get_input_object(&self) -> Name {
- match self.value.clone().try_unwrap() {
- Ok(name) => name,
- Err(_) => {
- ConsoleService::error("Couldn't unwrap name");
- Name::new()
- },
- }
+ self.value.clone()
}
fn get_title(&self) -> String {
"Name".to_string()
@@ -70,7 +61,7 @@ impl Component for NameView {
props.weak_link.borrow_mut().replace(link);
Self {
props,
- value: Mrc::new(Name::new()),
+ value: Name::new(),
error: None,
}
}
@@ -82,7 +73,7 @@ impl Component for NameView {
Msg::UpdateLastName(l) => self.value.last_name = l,
Msg::UpdateSuffix(s) => self.value.suffix = s,
Msg::Generate => {
- self.props.generated.emit(self.value.irc());
+ self.props.generated.emit(self.value.clone());
},
};
true