summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjelemux <jeremias.weber@protonmail.com>2020-11-25 10:31:04 +0100
committerjelemux <jeremias.weber@protonmail.com>2020-11-25 10:31:04 +0100
commitb1ba906491a1ed396d47b0751f080fef991ea344 (patch)
treec8e306c217dbdc352e66000822d8fc7e4cdc55fb
parent5a03734b6767fed04c0913384584d8f59dc597ea (diff)
downloadwasm-card-b1ba906491a1ed396d47b0751f080fef991ea344.tar.gz
wasm-card-b1ba906491a1ed396d47b0751f080fef991ea344.tar.bz2
Struktur umbauen
-rw-r--r--src/lib.rs3
-rw-r--r--src/view/address.rs4
-rw-r--r--src/view/birthday.rs11
-rw-r--r--src/view/main.rs16
-rw-r--r--src/view/mod.rs5
-rw-r--r--src/view/name.rs4
-rw-r--r--src/view/photo.rs10
-rw-r--r--src/view/telephone.rs4
-rw-r--r--src/viewmodel/address.rs (renamed from src/view/input_objects/address.rs)2
-rw-r--r--src/viewmodel/mod.rs (renamed from src/view/input_objects/mod.rs)4
-rw-r--r--src/viewmodel/name.rs (renamed from src/view/input_objects/name.rs)2
-rw-r--r--src/viewmodel/telephone.rs (renamed from src/view/input_objects/telephone.rs)2
-rw-r--r--src/viewmodel/utility.rs (renamed from src/view/input_objects/utility.rs)0
13 files changed, 23 insertions, 44 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 2184f44..401e996 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -10,7 +10,8 @@ use view::main::MainView;
#[global_allocator]
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
-mod view;
+pub mod view;
+pub mod viewmodel;
fn init() {
panic::set_hook(Box::new(console_error_panic_hook::hook));
diff --git a/src/view/address.rs b/src/view/address.rs
index 4d3eae7..e26de04 100644
--- a/src/view/address.rs
+++ b/src/view/address.rs
@@ -1,7 +1,7 @@
use yew::prelude::*;
use vcard::properties;
-use super::input_objects::address::*;
-use super::input_objects::VCardPropertyInputObject;
+use crate::viewmodel::address::*;
+use crate::viewmodel::VCardPropertyInputObject;
use super::VCardPropertyInputComponent;
pub struct AddressView {
diff --git a/src/view/birthday.rs b/src/view/birthday.rs
deleted file mode 100644
index d4b9356..0000000
--- a/src/view/birthday.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-use yew::prelude::*;
-use vcard::properties;
-use vcard::parameters;
-use vcard::values::{self, text};
-
-#[derive(Clone)]
-pub struct Birthday {
- pub year: u16,
- pub month: u8,
- pub day: u8,
-} \ No newline at end of file
diff --git a/src/view/main.rs b/src/view/main.rs
index e1753b4..684db84 100644
--- a/src/view/main.rs
+++ b/src/view/main.rs
@@ -8,11 +8,11 @@ use qrcodegen::QrCode;
use qrcodegen::QrCodeEcc;
use yew::prelude::*;
use vcard::{VCard, VCardError};
-use super::input_objects::utility::*;
-use super::input_objects::name::Name;
-use super::input_objects::address::Address;
-use super::input_objects::telephone::Telephone;
-use super::input_objects::VCardPropertyInputObject;
+use crate::viewmodel::utility::*;
+use crate::viewmodel::name::Name;
+use crate::viewmodel::address::Address;
+use crate::viewmodel::telephone::Telephone;
+use crate::viewmodel::VCardPropertyInputObject;
pub struct MainView {
@@ -312,7 +312,11 @@ impl MainView {
doc.set_title("BCard test");
doc.set_minimal_conformance();
- doc.set_margins(10);
+
+ let mut decorator = genpdf::SimplePageDecorator::new();
+ decorator.set_margins(10);
+ doc.set_page_decorator(decorator);
+
doc.set_line_spacing(1.25);
doc.push(
diff --git a/src/view/mod.rs b/src/view/mod.rs
index b46accf..b47612a 100644
--- a/src/view/mod.rs
+++ b/src/view/mod.rs
@@ -1,11 +1,8 @@
use yew::prelude::*;
-use input_objects::*;
-pub mod input_objects;
+use crate::viewmodel::*;
pub mod main;
pub mod name;
-pub mod photo;
-pub mod birthday;
pub mod address;
pub mod telephone;
diff --git a/src/view/name.rs b/src/view/name.rs
index 4ac78a4..f76fd2e 100644
--- a/src/view/name.rs
+++ b/src/view/name.rs
@@ -1,7 +1,7 @@
use yew::prelude::*;
use vcard::properties;
-use super::input_objects::name::*;
-use super::input_objects::VCardPropertyInputObject;
+use crate::viewmodel::name::*;
+use crate::viewmodel::VCardPropertyInputObject;
use super::VCardPropertyInputComponent;
pub struct NameView {
diff --git a/src/view/photo.rs b/src/view/photo.rs
deleted file mode 100644
index 1c2d088..0000000
--- a/src/view/photo.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-use yew::prelude::*;
-use vcard::properties;
-use vcard::parameters;
-use vcard::values::{self, text};
-
-#[derive(Clone)]
-pub struct Photo {
- pub base64_image: String,
-}
-
diff --git a/src/view/telephone.rs b/src/view/telephone.rs
index 516552e..808ebfa 100644
--- a/src/view/telephone.rs
+++ b/src/view/telephone.rs
@@ -1,7 +1,7 @@
use yew::prelude::*;
use vcard::properties;
-use super::input_objects::telephone::*;
-use super::input_objects::VCardPropertyInputObject;
+use crate::viewmodel::telephone::*;
+use crate::viewmodel::VCardPropertyInputObject;
use super::VCardPropertyInputComponent;
pub struct TelephoneView {
diff --git a/src/view/input_objects/address.rs b/src/viewmodel/address.rs
index 3975200..757236c 100644
--- a/src/view/input_objects/address.rs
+++ b/src/viewmodel/address.rs
@@ -3,7 +3,7 @@ use vcard::parameters;
use vcard::values::{self, text};
use std::collections::HashSet;
use super::*;
-use super::super::address::*;
+use crate::view::address::*;
#[derive(Clone)]
pub struct Address {
diff --git a/src/view/input_objects/mod.rs b/src/viewmodel/mod.rs
index 7c0fdff..42ad77b 100644
--- a/src/view/input_objects/mod.rs
+++ b/src/viewmodel/mod.rs
@@ -1,11 +1,9 @@
use vcard::properties;
use yew::prelude::*;
-use super::VCardPropertyInputComponent;
+use crate::view::VCardPropertyInputComponent;
pub mod address;
-pub mod birthday;
pub mod name;
-pub mod photo;
pub mod telephone;
pub mod utility;
diff --git a/src/view/input_objects/name.rs b/src/viewmodel/name.rs
index 0fe9e64..55c1b4c 100644
--- a/src/view/input_objects/name.rs
+++ b/src/viewmodel/name.rs
@@ -1,7 +1,7 @@
use vcard::properties;
use vcard::values::{self, text};
use super::*;
-use super::super::name::*;
+use crate::view::name::*;
#[derive(Clone)]
pub struct Name {
diff --git a/src/view/input_objects/telephone.rs b/src/viewmodel/telephone.rs
index d7f7194..b67b0fb 100644
--- a/src/view/input_objects/telephone.rs
+++ b/src/viewmodel/telephone.rs
@@ -3,7 +3,7 @@ use vcard::parameters;
use vcard::values;
use std::collections::HashSet;
use super::*;
-use super::super::telephone::*;
+use crate::view::telephone::*;
#[derive(Clone)]
pub struct Telephone {
diff --git a/src/view/input_objects/utility.rs b/src/viewmodel/utility.rs
index a296c1e..a296c1e 100644
--- a/src/view/input_objects/utility.rs
+++ b/src/viewmodel/utility.rs