From 4bd2b7b5d10123725986e70bf8544de365a231ec Mon Sep 17 00:00:00 2001 From: Franklin Date: Sun, 30 Apr 2023 12:47:19 -0400 Subject: [PATCH] Finished website. All that's left is adding translations & missing text --- Cargo.lock | 660 ++++++++++++++++++++++++++++++++- Cargo.toml | 7 + css/call_to_action.css | 43 ++- locales/en.yml | 3 +- src/api/backend.rs | 19 + src/api/base.rs | 62 ++++ src/api/mod.rs | 2 + src/components/footer.rs | 9 +- src/components/mod.rs | 2 +- src/components/nav_bar.rs | 1 - src/components/service_card.rs | 2 +- src/components/textfield.rs | 2 + src/main.rs | 7 +- src/pages/about.rs | 2 +- src/pages/call_to_action.rs | 93 +++-- src/pages/main_page.rs | 11 - 16 files changed, 868 insertions(+), 57 deletions(-) create mode 100644 src/api/backend.rs create mode 100644 src/api/base.rs create mode 100644 src/api/mod.rs diff --git a/Cargo.lock b/Cargo.lock index 9c3f9b7..293e3fe 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -73,6 +73,12 @@ version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270" +[[package]] +name = "base64" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" + [[package]] name = "bincode" version = "1.3.3" @@ -92,11 +98,16 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" name = "bl-frontend" version = "0.1.0" dependencies = [ + "bl-types", "chrono", + "err", "js-sys", "log", "once_cell", + "reqwest", "rust-i18n", + "serde", + "serde_json", "stdweb", "stylist", "thousands", @@ -109,6 +120,17 @@ dependencies = [ "yew-utils", ] +[[package]] +name = "bl-types" +version = "0.1.0" +dependencies = [ + "chrono", + "chrono-tz", + "serde", + "serde_json", + "uuid", +] + [[package]] name = "boolinator" version = "2.4.0" @@ -131,6 +153,12 @@ version = "3.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b1ce199063694f33ffb7dd4e0ee620741495c32833cde5aa08f02a0bf96f0c8" +[[package]] +name = "bytes" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" + [[package]] name = "cc" version = "1.0.79" @@ -153,11 +181,34 @@ dependencies = [ "js-sys", "num-integer", "num-traits", + "serde", "time", "wasm-bindgen", "winapi", ] +[[package]] +name = "chrono-tz" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf9cc2b23599e6d7479755f3594285efb3f74a1bdca7a7374948bc831e23a552" +dependencies = [ + "chrono", + "chrono-tz-build", + "phf", +] + +[[package]] +name = "chrono-tz-build" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9998fb9f7e9b2111641485bf8beb32f92945f97f92a3d061f744cfef335f751" +dependencies = [ + "parse-zoneinfo", + "phf", + "phf_codegen", +] + [[package]] name = "clap" version = "2.34.0" @@ -255,6 +306,23 @@ version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" +[[package]] +name = "encoding_rs" +version = "0.8.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "err" +version = "0.1.1" +source = "git+https://git.franklinblanco.dev/franklinblanco/err.git#d814091e7367d101197c35e2f7e56a744ce4296b" +dependencies = [ + "serde", +] + [[package]] name = "fastrand" version = "1.9.0" @@ -356,6 +424,19 @@ dependencies = [ "slab", ] +[[package]] +name = "getrandom" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", + "wasm-bindgen", +] + [[package]] name = "glob" version = "0.3.1" @@ -543,6 +624,25 @@ dependencies = [ "web-sys", ] +[[package]] +name = "h2" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17f8a914c2987b688368b5138aa05321db91f4090cf26118185672ad588bce21" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "hashbrown" version = "0.12.3" @@ -567,6 +667,77 @@ dependencies = [ "libc", ] +[[package]] +name = "http" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" + +[[package]] +name = "httpdate" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" + +[[package]] +name = "hyper" +version = "0.14.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab302d72a6f11a3b910431ff93aae7e773078c769f0a3ef15fb9ec692ed147d4" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1788965e61b367cd03a62950836d5cd41560c3577d90e40e0819373194d1661c" +dependencies = [ + "http", + "hyper", + "rustls", + "tokio", + "tokio-rustls", +] + [[package]] name = "iana-time-zone" version = "0.1.56" @@ -591,6 +762,16 @@ dependencies = [ "cxx-build", ] +[[package]] +name = "idna" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + [[package]] name = "ignore" version = "0.4.20" @@ -639,6 +820,12 @@ dependencies = [ "web-sys", ] +[[package]] +name = "ipnet" +version = "2.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12b6ee2129af8d4fb011108c73d99a1b83a85977f23b82460c0ae2e25bb4b57f" + [[package]] name = "itertools" version = "0.10.5" @@ -714,12 +901,40 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "mime_guess" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef" +dependencies = [ + "mime", + "unicase", +] + [[package]] name = "minimal-lexical" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" +[[package]] +name = "mio" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" +dependencies = [ + "libc", + "log", + "wasi 0.11.0+wasi-snapshot-preview1", + "windows-sys 0.45.0", +] + [[package]] name = "nom" version = "7.1.3" @@ -765,12 +980,59 @@ version = "1.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +[[package]] +name = "parse-zoneinfo" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c705f256449c60da65e11ff6626e0c16a0a0b96aaa348de61376b249bc340f41" +dependencies = [ + "regex", +] + [[package]] name = "percent-encoding" version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +[[package]] +name = "phf" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "928c6535de93548188ef63bb7c4036bd415cd8f36ad25af44b9789b2ee72a48c" +dependencies = [ + "phf_shared", +] + +[[package]] +name = "phf_codegen" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a56ac890c5e3ca598bbdeaa99964edb5b0258a583a9eb6ef4e89fc85d9224770" +dependencies = [ + "phf_generator", + "phf_shared", +] + +[[package]] +name = "phf_generator" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1181c94580fa345f50f19d738aaa39c0ed30a600d95cb2d3e23f94266f14fbf" +dependencies = [ + "phf_shared", + "rand", +] + +[[package]] +name = "phf_shared" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1fb5f6f826b772a8d4c0394209441e7d37cbbb967ae9c7e0e8134365c9ee676" +dependencies = [ + "siphasher", +] + [[package]] name = "pin-project" version = "1.0.12" @@ -814,6 +1076,12 @@ dependencies = [ "thiserror", ] +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + [[package]] name = "prettyplease" version = "0.1.25" @@ -883,6 +1151,36 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + [[package]] name = "regex" version = "1.8.1" @@ -900,6 +1198,61 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a5996294f19bd3aae0453a862ad728f60e6600695733dd5df01da90c54363a3c" +[[package]] +name = "reqwest" +version = "0.11.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13293b639a097af28fc8a90f22add145a9c954e49d77da06263d58cf44d5fb91" +dependencies = [ + "base64", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-rustls", + "ipnet", + "js-sys", + "log", + "mime", + "mime_guess", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls", + "rustls-pemfile", + "serde", + "serde_json", + "serde_urlencoded", + "tokio", + "tokio-rustls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots", + "winreg", +] + +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin", + "untrusted", + "web-sys", + "winapi", +] + [[package]] name = "route-recognizer" version = "0.3.1" @@ -984,6 +1337,27 @@ dependencies = [ "semver", ] +[[package]] +name = "rustls" +version = "0.20.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fff78fc74d175294f4e83b28343315ffcfb114b156f0185e9741cb5570f50e2f" +dependencies = [ + "log", + "ring", + "sct", + "webpki", +] + +[[package]] +name = "rustls-pemfile" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b" +dependencies = [ + "base64", +] + [[package]] name = "rustversion" version = "1.0.12" @@ -1011,6 +1385,16 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1" +[[package]] +name = "sct" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "semver" version = "0.9.0" @@ -1107,6 +1491,12 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae1a47186c03a32177042e55dbc5fd5aee900b8e0069a8d70fba96a9375cd012" +[[package]] +name = "siphasher" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" + [[package]] name = "slab" version = "0.4.8" @@ -1116,6 +1506,22 @@ dependencies = [ "autocfg", ] +[[package]] +name = "socket2" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + [[package]] name = "stdweb" version = "0.4.20" @@ -1302,10 +1708,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" dependencies = [ "libc", - "wasi", + "wasi 0.10.0+wasi-snapshot-preview1", "winapi", ] +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + [[package]] name = "tokio" version = "1.28.0" @@ -1313,8 +1734,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3c786bf8134e5a3a166db9b29ab8f48134739014a3eca7bc6bfa95d673b136f" dependencies = [ "autocfg", + "bytes", + "libc", + "mio", + "num_cpus", "pin-project-lite", - "windows-sys", + "socket2", + "windows-sys 0.48.0", +] + +[[package]] +name = "tokio-rustls" +version = "0.23.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" +dependencies = [ + "rustls", + "tokio", + "webpki", ] [[package]] @@ -1328,6 +1765,20 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-util" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", +] + [[package]] name = "toml" version = "0.5.11" @@ -1337,6 +1788,12 @@ dependencies = [ "serde", ] +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + [[package]] name = "tracing" version = "0.1.38" @@ -1368,18 +1825,89 @@ dependencies = [ "once_cell", ] +[[package]] +name = "try-lock" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" + +[[package]] +name = "unicase" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" +dependencies = [ + "version_check", +] + +[[package]] +name = "unicode-bidi" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" + [[package]] name = "unicode-ident" version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + [[package]] name = "unicode-width" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + +[[package]] +name = "url" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "uuid" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dad5567ad0cf5b760e5665964bec1b47dfd077ba8a2544b513f3556d3d239a2" +dependencies = [ + "getrandom", + "rand", + "serde", + "uuid-macro-internal", + "wasm-bindgen", +] + +[[package]] +name = "uuid-macro-internal" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18d884370cccfad1f913e67c7362f9c00357844bc9f3cfce86faa2241cabd166" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.15", +] + [[package]] name = "vec_map" version = "0.8.2" @@ -1402,12 +1930,28 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "want" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +dependencies = [ + "log", + "try-lock", +] + [[package]] name = "wasi" version = "0.10.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + [[package]] name = "wasm-bindgen" version = "0.2.84" @@ -1495,6 +2039,25 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "webpki" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "webpki-roots" +version = "0.22.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" +dependencies = [ + "webpki", +] + [[package]] name = "winapi" version = "0.3.9" @@ -1532,7 +2095,16 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" dependencies = [ - "windows-targets", + "windows-targets 0.48.0", +] + +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets 0.42.2", ] [[package]] @@ -1541,7 +2113,22 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets", + "windows-targets 0.48.0", +] + +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", ] [[package]] @@ -1550,57 +2137,108 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_aarch64_gnullvm 0.48.0", + "windows_aarch64_msvc 0.48.0", + "windows_i686_gnu 0.48.0", + "windows_i686_msvc 0.48.0", + "windows_x86_64_gnu 0.48.0", + "windows_x86_64_gnullvm 0.48.0", + "windows_x86_64_msvc 0.48.0", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + [[package]] name = "windows_aarch64_gnullvm" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + [[package]] name = "windows_aarch64_msvc" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + [[package]] name = "windows_i686_gnu" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + [[package]] name = "windows_i686_msvc" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + [[package]] name = "windows_x86_64_gnu" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + [[package]] name = "windows_x86_64_gnullvm" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + [[package]] name = "windows_x86_64_msvc" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +[[package]] +name = "winreg" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" +dependencies = [ + "winapi", +] + [[package]] name = "yaml-rust" version = "0.4.5" diff --git a/Cargo.toml b/Cargo.toml index aac364f..6e9983f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,3 +26,10 @@ chrono = "0.4.23" log = "0.4" once_cell = "1.10.0" rust-i18n = "1" +reqwest = { version = "0.11.11", features = ["rustls-tls", "json", "blocking", "multipart"], default-features = false } +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0.88" +err = { git = "https://git.franklinblanco.dev/franklinblanco/err.git" } + + +bl-types = { path = "../bl-types", features = ["wasm"] } \ No newline at end of file diff --git a/css/call_to_action.css b/css/call_to_action.css index 5241b42..4fef48c 100644 --- a/css/call_to_action.css +++ b/css/call_to_action.css @@ -77,10 +77,43 @@ cursor: pointer; user-select: none; } +.contact-container-sent { + transition-duration: 0.8s; + + scroll-margin-top: 100px; + margin-top: clamp(50px, 20vw, 150px); + + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + gap: 10px; + + width: 100vw; + height: 300px; + margin-left: calc(-1 * clamp(35px, 15%, 10vw)); + + background-color: #4C40F7; + + padding-top: 40px; + padding-bottom: 20px; + + color: rgb(3, 234, 3); + font-size: 40px; +} +.contact-sent-text { + color: white; + font-size: 12px; + font-family: Poppins; + font-weight: 600; + text-align: end; + letter-spacing: 1px; + text-align: start; +} @media only screen and (min-width: 1000px) { .contact-container { margin-left: calc(-1 * clamp(35px, 25%, 10vw)); - margin-right: calc(-1 * clamp(35px, 25%, 10vw)) + margin-right: calc(-1 * clamp(35px, 25%, 10vw)); } .contact-textfield-container { width: 700px; @@ -88,4 +121,12 @@ .contact-form-button-container { width: 700px; } + .contact-container-sent { + margin-left: calc(-1 * clamp(35px, 25%, 10vw)); + margin-right: calc(-1 * clamp(35px, 25%, 10vw)); + gap: 30px; + } + .contact-sent-text { + font-size: 14px; + } } \ No newline at end of file diff --git a/locales/en.yml b/locales/en.yml index ec6a34c..efd8baf 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -72,4 +72,5 @@ contact: form-name-label: Name form-email-label: Phone number or Email form-message-label: Start typing... - form-button-label: Send \ No newline at end of file + form-button-label: Send + sent-text: Thank you! We will get back to you very soon. \ No newline at end of file diff --git a/src/api/backend.rs b/src/api/backend.rs new file mode 100644 index 0000000..84aece9 --- /dev/null +++ b/src/api/backend.rs @@ -0,0 +1,19 @@ +use bl_types::{NewContactPayload}; +use reqwest::Method; + +use super::base::perform_request_without_client; + +pub const BASE_URL: &str = "http://0.0.0.0:8085/api"; + +pub async fn create_contact(contact: NewContactPayload) -> Result<(), err::Error> { + perform_request_without_client( + BASE_URL.to_string(), + Method::POST, + format!("/contact"), + Some(contact), + 200, + Vec::new(), + None, + ) + .await +} diff --git a/src/api/base.rs b/src/api/base.rs new file mode 100644 index 0000000..4615576 --- /dev/null +++ b/src/api/base.rs @@ -0,0 +1,62 @@ +use err::{Error, MessageResource}; +use reqwest::Client; +use serde::{de::DeserializeOwned, Serialize}; + +/// This function is mainly for when you don't have a client in your application and just want to get it over with. +/// This shouldn't be used as it takes more resource consumption than the above method. +pub async fn perform_request_without_client( + base_url: String, + method: reqwest::Method, + path: String, + body: Option, + expected_status_code: u16, + headers: Vec<(String, String)>, + params: Option>, +) -> Result { + let client = Client::new(); + let mut req_incomplete = + client.request(method, format!("{url}{path}", url = base_url, path = path)); + + for header in headers { + req_incomplete = req_incomplete.header(&header.0, &header.1); + } + + if let Some(parameters) = params { + req_incomplete = req_incomplete.query(¶meters) + } + + let req_complete = match body { + Some(b) => req_incomplete.json(&b), + None => req_incomplete.header("content-length", 0), + }; + println!("{:?}", req_complete); + match req_complete.send().await { + // Error handling here + Ok(res) => { + // Request sent correctly + match res.status().as_u16() == expected_status_code { + true => { + match res.json::().await { + Ok(resp_dto) => Ok(resp_dto), // Return correctly deserialized obj + Err(err) => Err(Error::Serde(MessageResource::from(err))), + } + } + false => { + //If status code is any other than expected + Err(Error::UnexpectedStatusCode( + expected_status_code, + res.status().as_u16(), + match res.json::>().await { + Ok(messages) => messages, + Err(e) => vec![MessageResource::from(e)], + }, + )) + } + } + } + Err(e) => { + // Request couldn't be sent + Err(Error::Network(MessageResource::from(e))) + } + } +} diff --git a/src/api/mod.rs b/src/api/mod.rs new file mode 100644 index 0000000..a57ca5e --- /dev/null +++ b/src/api/mod.rs @@ -0,0 +1,2 @@ +pub mod backend; +pub mod base; diff --git a/src/components/footer.rs b/src/components/footer.rs index b99ce3d..c818cd8 100644 --- a/src/components/footer.rs +++ b/src/components/footer.rs @@ -9,7 +9,7 @@ pub struct PageFooterProps { } #[function_component(PageFooter)] -pub fn page_footer(props: &PageFooterProps) -> Html { //TODO: Add t!() everywhere +pub fn page_footer(props: &PageFooterProps) -> Html { let language = props.language.clone(); html! {
@@ -37,15 +37,14 @@ pub fn page_footer(props: &PageFooterProps) -> Html { //TODO: Add t!() everywher {t!("footer.copyright-text", locale = language.locale())}
- //TODO: Add all logos with href links - + - +
} -} \ No newline at end of file +} diff --git a/src/components/mod.rs b/src/components/mod.rs index a850732..6f174fc 100644 --- a/src/components/mod.rs +++ b/src/components/mod.rs @@ -2,4 +2,4 @@ pub mod footer; pub mod language_picker; pub mod nav_bar; pub mod service_card; -pub mod textfield; \ No newline at end of file +pub mod textfield; diff --git a/src/components/nav_bar.rs b/src/components/nav_bar.rs index 148dc46..3efc4c2 100644 --- a/src/components/nav_bar.rs +++ b/src/components/nav_bar.rs @@ -38,7 +38,6 @@ pub fn navigation_bar(props: &NavigationBarProps) -> Html { } }); - html! {
diff --git a/src/components/service_card.rs b/src/components/service_card.rs index f930276..9592559 100644 --- a/src/components/service_card.rs +++ b/src/components/service_card.rs @@ -61,7 +61,7 @@ pub fn service_card(props: &ServiceCardProps) -> Html { } } } - +
} } diff --git a/src/components/textfield.rs b/src/components/textfield.rs index ad30d6d..38a71a2 100644 --- a/src/components/textfield.rs +++ b/src/components/textfield.rs @@ -78,9 +78,11 @@ pub fn get_value_from_textarea_event(e: InputEvent) -> String { let target: HtmlTextAreaElement = event_target.dyn_into().unwrap_throw(); target.value() } +/* pub fn get_files_from_input_event(e: InputEvent) -> Option { let event: Event = e.dyn_into().unwrap_throw(); let event_target = event.target().unwrap_throw(); let target: HtmlInputElement = event_target.dyn_into().unwrap_throw(); target.files() } +*/ diff --git a/src/main.rs b/src/main.rs index c230022..1d34a3b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,7 @@ -pub mod components; -pub mod pages; -pub mod routes; +mod api; +mod components; +mod pages; +mod routes; use rust_i18n::i18n; use yew::prelude::*; diff --git a/src/pages/about.rs b/src/pages/about.rs index 0367401..e3218da 100644 --- a/src/pages/about.rs +++ b/src/pages/about.rs @@ -5,7 +5,7 @@ use crate::components::language_picker::Language; #[derive(PartialEq, Properties)] pub struct AboutPageProps { - pub language: Language + pub language: Language, } #[function_component(AboutPage)] pub fn about_page(props: &AboutPageProps) -> Html { diff --git a/src/pages/call_to_action.rs b/src/pages/call_to_action.rs index 035d23f..389a943 100644 --- a/src/pages/call_to_action.rs +++ b/src/pages/call_to_action.rs @@ -1,38 +1,89 @@ +use bl_types::NewContactPayload; use rust_i18n::t; use yew::prelude::*; -use crate::components::{language_picker::Language, textfield::{TextField, TextFieldType}}; +use crate::{components::{ + language_picker::Language, + textfield::{TextField, TextFieldType}, +}, api}; #[derive(Properties, PartialEq)] pub struct CallToActionPageProps { - pub language: Language + pub language: Language, } #[function_component(CallToActionPage)] pub fn call_to_action_page(props: &CallToActionPageProps) -> Html { let language = props.language.clone(); + + let sent_handle = use_state(|| false); let name_handle = use_state(|| String::new()); let email_handle = use_state(|| String::new()); let message_handle = use_state(|| String::new()); + + let on_send = { + let sent_handle = sent_handle.clone(); + let name_handle = name_handle.clone(); + let email_handle = email_handle.clone(); + let message_handle = message_handle.clone(); + Callback::from(move |_: MouseEvent| { + let sent_handle = sent_handle.clone(); + let name_handle = name_handle.clone(); + let email_handle = email_handle.clone(); + let message_handle = message_handle.clone(); + wasm_bindgen_futures::spawn_local(async move { + let name = (*name_handle).clone(); + let credential = (*email_handle).clone(); + let message = (*message_handle).clone(); + if !name.is_empty() && !credential.is_empty() { + match api::backend::create_contact(NewContactPayload { + name, + credential, + message + }).await { + Ok(_) => {sent_handle.set(true)}, + Err(error) => log::error!("Error creating a contact request: {error}") + } + } else { + log::error!("Name Or Credential fields are empty.") + } + }); + }) + }; html! { -
-
- {t!("contact.title", locale = language.locale())} -
-
- {t!("contact.subtitle", locale = language.locale())} -
-
- - - -
-
-
- {t!("contact.form-button-label", locale = language.locale())} -
-
- -
+ { + if (*sent_handle).clone() { + html! { +
+ +
+ {t!("contact.sent-text", locale = language.locale())} +
+
+ } + } else { + html! { +
+
+ {t!("contact.title", locale = language.locale())} +
+
+ {t!("contact.subtitle", locale = language.locale())} +
+
+ + + +
+
+
+ {t!("contact.form-button-label", locale = language.locale())} +
+
+
+ } + } + } + } } diff --git a/src/pages/main_page.rs b/src/pages/main_page.rs index 4075eeb..73146b6 100644 --- a/src/pages/main_page.rs +++ b/src/pages/main_page.rs @@ -12,17 +12,6 @@ use crate::{ }, }; -#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] -pub enum Section { - Services, - AboutUs, - CallToAction, -} -#[derive(Properties, PartialEq)] -pub struct MainPageProps { - pub section: Option
, -} - /// The whole website will be in here, from top to bottom. The navigation /// Will happen with scrolling. #[function_component(MainPage)]