From 8b7e528bc9225a922783de7b424b8edd90c91d48 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Thu, 11 Jan 2024 23:59:56 +0100 Subject: [PATCH] Update leptos_icons + Add chrono datetime for matter + Add reading time estimation --- Cargo.lock | 358 +++++++++++++++++++++++++--- Cargo.toml | 16 +- data_src/posts/test.md | 2 +- src/app/components/link.rs | 4 +- src/app/components/nav.rs | 4 +- src/app/components/social_link.rs | 5 +- src/app/components/timeline.rs | 3 +- src/app/components/top_component.rs | 8 +- src/app/models/post.rs | 8 +- src/app/pages/posts.rs | 9 +- src/app/utils/mod.rs | 3 +- src/app/utils/reading_time.rs | 10 + 12 files changed, 362 insertions(+), 68 deletions(-) create mode 100644 src/app/utils/reading_time.rs diff --git a/Cargo.lock b/Cargo.lock index 43d09c1..26b6200 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -21,9 +21,9 @@ dependencies = [ [[package]] name = "actix-files" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc517050e349356239da19a5e100cd61c21658b3ae183b02c1c6799c581bddf3" +checksum = "bf0bdd6ff79de7c9a021f5d9ea79ce23e108d8bfc9b49b5b4a2cf6fad5a35212" dependencies = [ "actix-http", "actix-service", @@ -273,6 +273,21 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + [[package]] name = "anyhow" version = "1.0.79" @@ -352,9 +367,9 @@ dependencies = [ [[package]] name = "base64" -version = "0.21.5" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "bitflags" @@ -508,6 +523,21 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "chrono" +version = "0.4.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "js-sys", + "num-traits", + "serde", + "wasm-bindgen", + "windows-targets 0.48.5", +] + [[package]] name = "ciborium" version = "0.2.1" @@ -780,6 +810,12 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +[[package]] +name = "estimated_read_time" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "649cfd341410b1f8906e8ca1b39e5534be9312fda9182edd770cec34dfbce8d7" + [[package]] name = "flate2" version = "1.0.28" @@ -921,9 +957,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" +checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" dependencies = [ "cfg-if", "js-sys", @@ -1019,9 +1055,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.22" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" +checksum = "b553656127a00601c8ae5590fcfdc118e4083a7924b6cf4ffc1ea4b99dc429d7" dependencies = [ "bytes", "fnv", @@ -1141,46 +1177,219 @@ dependencies = [ ] [[package]] -name = "icondata" -version = "0.0.8" +name = "iana-time-zone" +version = "0.1.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f41f2deec9249d16ef6b1a8442fbe16013f67053797052aa0b7d2f5ebd0f0098" +checksum = "b6a67363e2aa4443928ce15e57ebae94fd8949958fd1223c4cfc0cd473ad7539" dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "icondata" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e38f18389f3cd0e664bd42f1dfe0aba4acda0a44036fb720eb07e8ba3a09640c" +dependencies = [ + "icondata_ai", + "icondata_bi", + "icondata_bs", + "icondata_cg", + "icondata_ch", "icondata_core", "icondata_fa", "icondata_fi", + "icondata_hi", + "icondata_im", "icondata_io", + "icondata_lu", + "icondata_oc", + "icondata_ri", + "icondata_si", + "icondata_tb", + "icondata_ti", + "icondata_vs", + "icondata_wi", +] + +[[package]] +name = "icondata_ai" +version = "0.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bf3a9c196a6a169f790639ecc8fdd4396660b1d53b905230bf0b364776a56fc" +dependencies = [ + "icondata_core", +] + +[[package]] +name = "icondata_bi" +version = "0.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6ce125f0d203e66444b02982af9b15631f2385573ad7992af79d4d4babc638d" +dependencies = [ + "icondata_core", +] + +[[package]] +name = "icondata_bs" +version = "0.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67940e592b0b8df8d7adc055c8542d135ce1d7d6ad01d8fb8de9405ebfc21c2e" +dependencies = [ + "icondata_core", +] + +[[package]] +name = "icondata_cg" +version = "0.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0eba691ca17a43ffc8ebbcf200cd3ea54ad75837f210a6a6ace87a491be8314" +dependencies = [ + "icondata_core", +] + +[[package]] +name = "icondata_ch" +version = "0.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2870b3c4ebf013b7e27af71d4c55f10b97ea448831e9a156cb53fec0f262dc20" +dependencies = [ + "icondata_core", ] [[package]] name = "icondata_core" -version = "0.0.2" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1640a4c1d5ddd08ab1d9854ffa7a2fa3dc52339492676b6d3031e77ca579f434" +checksum = "6c97be924215abd5e630d84e95a47c710138a6559b4c55039f4f33aa897fa859" [[package]] name = "icondata_fa" -version = "0.0.8" +version = "0.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a515ecda53468cf4a383409da1708da2e4c00253561873c46304cd7f412e9414" +checksum = "0c7fee576096efe5567a7216a6fb8154db8eae9ae108e5a4706805204208c2af" dependencies = [ "icondata_core", ] [[package]] name = "icondata_fi" -version = "0.0.8" +version = "0.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a68806fd5abc6bcf395fc54f6193b0f9085aa2a6c740d72825e7e43be4d6a366" +checksum = "e1a4e81557c205a12ac051046595bb616f388537468987f7ee8960f897cdc538" +dependencies = [ + "icondata_core", +] + +[[package]] +name = "icondata_hi" +version = "0.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3435d50de04c61799613995e753e613dc4f2771aa08eb94a7318289a5ea9d784" +dependencies = [ + "icondata_core", +] + +[[package]] +name = "icondata_im" +version = "0.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce4bd1d64bb67bb080f605e3e600271894b67c4aaa18965179586ef5990a2297" dependencies = [ "icondata_core", ] [[package]] name = "icondata_io" -version = "0.0.8" +version = "0.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134d9fb91cdd0e7ac971199e2c8c8eb917a975faeeee54b227a0068c4f70c886" +checksum = "35b9d681c936a6e087940beb4766159cddc080d7f1fd5ef0ef3ab9f50a11f3f6" +dependencies = [ + "icondata_core", +] + +[[package]] +name = "icondata_lu" +version = "0.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d552c45cc3ab1d1bf88cc0201004eb92418141e5454e9e0e46c4b4a4faf66248" +dependencies = [ + "icondata_core", +] + +[[package]] +name = "icondata_oc" +version = "0.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8be19499912a05d5db89ccb88dbe3c459ca4100bda3dbcbddff69f2dcf71d305" +dependencies = [ + "icondata_core", +] + +[[package]] +name = "icondata_ri" +version = "0.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "114a85cc95d1bfaee8dc5bf8a07dd043fc9e75499dc2ff4ac5e066193c594930" +dependencies = [ + "icondata_core", +] + +[[package]] +name = "icondata_si" +version = "0.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc30cb2dbc2ac53f23dddbcb0ad73720970b24c0ed13935df8082b74fb627860" +dependencies = [ + "icondata_core", +] + +[[package]] +name = "icondata_tb" +version = "0.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f2b8d8e2047546285805795e6d3cb6e820a52bb008e15942e11353c7ba659f2" +dependencies = [ + "icondata_core", +] + +[[package]] +name = "icondata_ti" +version = "0.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f85074d4bf10960d0f2b01ce3d9cfa2b2434a170d0738336411bb61e83227e4" +dependencies = [ + "icondata_core", +] + +[[package]] +name = "icondata_vs" +version = "0.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a82bb4a8b1523200fc7c3b588bb80858db16708067093110ee8614db63b8913" +dependencies = [ + "icondata_core", +] + +[[package]] +name = "icondata_wi" +version = "0.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d2c65b534aa9d7ccb107d892200e8fef2d1849acad160af067e9e20ced3619b" dependencies = [ "icondata_core", ] @@ -1395,13 +1604,16 @@ dependencies = [ [[package]] name = "leptos_icons" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b3fad7820b18b983d49ff4262df88de94dc8fd993278937979cc0dd188868e5" +checksum = "accafa97c1790701c0a7a3db804e462be3ce1f8fb08be57911b958c34316ef84" dependencies = [ - "icondata", + "encoding_rs", + "icondata_core", + "lazy_static", "leptos", - "tracing", + "log", + "paste", ] [[package]] @@ -1532,9 +1744,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.151" +version = "0.2.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" +checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" [[package]] name = "linear-map" @@ -1676,6 +1888,15 @@ dependencies = [ "minimal-lexical", ] +[[package]] +name = "num-traits" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +dependencies = [ + "autocfg", +] + [[package]] name = "num_threads" version = "0.1.6" @@ -1726,7 +1947,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-targets", + "windows-targets 0.48.5", ] [[package]] @@ -1793,11 +2014,14 @@ dependencies = [ "actix-web", "anyhow", "cfg-if", + "chrono", "console_error_panic_hook", "console_log", + "estimated_read_time", "futures", "gloo-net 0.5.0", "gray_matter", + "icondata", "leptos", "leptos_actix", "leptos_icons", @@ -2852,13 +3076,22 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-core" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +dependencies = [ + "windows-targets 0.52.0", +] + [[package]] name = "windows-sys" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets", + "windows-targets 0.48.5", ] [[package]] @@ -2867,13 +3100,28 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" 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.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +dependencies = [ + "windows_aarch64_gnullvm 0.52.0", + "windows_aarch64_msvc 0.52.0", + "windows_i686_gnu 0.52.0", + "windows_i686_msvc 0.52.0", + "windows_x86_64_gnu 0.52.0", + "windows_x86_64_gnullvm 0.52.0", + "windows_x86_64_msvc 0.52.0", ] [[package]] @@ -2882,42 +3130,84 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" + [[package]] name = "windows_aarch64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" + [[package]] name = "windows_i686_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" +[[package]] +name = "windows_i686_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" + [[package]] name = "windows_i686_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" +[[package]] +name = "windows_i686_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" + [[package]] name = "windows_x86_64_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" + [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" + [[package]] name = "windows_x86_64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" + [[package]] name = "winreg" version = "0.50.0" diff --git a/Cargo.toml b/Cargo.toml index 270d96d..4d9e66b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,17 +16,11 @@ gloo-net = { version = "0.5", features = ["http"] } log = "0.4" cfg-if = "1.0" serde = "1.0" +chrono = { version = "0.4", features = ["serde"] } # https://carlosted.github.io/icondata/ -leptos_icons = { version = "0.1.0", features = [ - "FiMenu", - "FiExternalLink", - "FaGithubBrands", - "FaLinkedinBrands", - "FaEnvelopeSolid", - "FaCaretDownSolid", - "IoConstruct" -]} +leptos_icons = "0.2.0" +icondata = "0.3.0" # dependecies for client (enable when csr or hydrate set) wasm-bindgen = { version = "0.2", optional = true } @@ -44,6 +38,7 @@ gray_matter = { version = "0.2", optional = true } # frontmatter parser serde_yaml = { version = "0.9", optional = true } anyhow = { version = "1.0", optional = true } thiserror = { version = "1.0", optional = true } +estimated_read_time = { version = "1.0", optional = true } [features] default = ["csr"] @@ -76,7 +71,8 @@ ssr = [ "dep:gray_matter", "dep:serde_yaml", "dep:anyhow", - "dep:thiserror" + "dep:thiserror", + "dep:estimated_read_time" ] [package.metadata.cargo-all-features] diff --git a/data_src/posts/test.md b/data_src/posts/test.md index f4a940a..f2ee268 100644 --- a/data_src/posts/test.md +++ b/data_src/posts/test.md @@ -2,7 +2,7 @@ image_path: "https://upload.wikimedia.org/wikipedia/commons/thumb/1/11/Test-Logo.svg/783px-Test-Logo.svg.png?20150906031702" slug: test_layout title: Testing layout -date: 2023-11-26 +date: 2023-11-26T00:00:00Z description: Testing the layout of the site. project_link: none draft: true diff --git a/src/app/components/link.rs b/src/app/components/link.rs index 2ccbe41..065d1bb 100644 --- a/src/app/components/link.rs +++ b/src/app/components/link.rs @@ -1,6 +1,4 @@ use leptos::*; -use leptos_icons::FiIcon::FiExternalLink; -use leptos_icons::*; #[component] pub fn Link( @@ -11,7 +9,7 @@ pub fn Link( view! { { children() } - + } } \ No newline at end of file diff --git a/src/app/components/nav.rs b/src/app/components/nav.rs index fb27d95..49f5348 100644 --- a/src/app/components/nav.rs +++ b/src/app/components/nav.rs @@ -1,7 +1,5 @@ use leptos::*; use leptos_router::*; -use leptos_icons::FiIcon::FiMenu; -use leptos_icons::*; #[component] pub fn Nav() -> impl IntoView { @@ -11,7 +9,7 @@ pub fn Nav() -> impl IntoView {