From ae00627e7c99fd21ce4ad8ec0692445f00a349b2 Mon Sep 17 00:00:00 2001 From: "Adam T. Carpenter" Date: Sat, 7 Sep 2024 21:18:54 -0400 Subject: feat: basic markdown post to html page loading --- .gitignore | 5 + Cargo.lock | 1081 +++++++++++++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 12 + scripts/serve.sh | 2 - src/main.rs | 136 +++++++ templates/post.html | 8 + 6 files changed, 1242 insertions(+), 2 deletions(-) create mode 100644 Cargo.lock create mode 100644 Cargo.toml delete mode 100755 scripts/serve.sh create mode 100644 src/main.rs create mode 100644 templates/post.html diff --git a/.gitignore b/.gitignore index 5958712..bf4e644 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,8 @@ _site/ *.core PHPMailer-master + + +# Added by cargo + +/target diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..c3394de --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,1081 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "addr2line" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "askama" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b79091df18a97caea757e28cd2d5fda49c6cd4bd01ddffd7ff01ace0c0ad2c28" +dependencies = [ + "askama_derive", + "askama_escape", + "comrak", + "humansize", + "num-traits", + "percent-encoding", +] + +[[package]] +name = "askama_axum" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a41603f7cdbf5ac4af60760f17253eb6adf6ec5b6f14a7ed830cf687d375f163" +dependencies = [ + "askama", + "axum-core", + "http", +] + +[[package]] +name = "askama_derive" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19fe8d6cb13c4714962c072ea496f3392015f0989b1a2847bb4b2d9effd71d83" +dependencies = [ + "askama_parser", + "basic-toml", + "mime", + "mime_guess", + "proc-macro2", + "quote", + "serde", + "syn", +] + +[[package]] +name = "askama_escape" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "619743e34b5ba4e9703bba34deac3427c72507c7159f5fd030aea8cac0cfe341" + +[[package]] +name = "askama_parser" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acb1161c6b64d1c3d83108213c2a2533a342ac225aabd0bda218278c2ddb00c0" +dependencies = [ + "nom", +] + +[[package]] +name = "async-trait" +version = "0.1.82" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a27b8a3a6e1a44fa4c8baf1f653e4172e81486d4941f2237e20dc2d0cf4ddff1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "autocfg" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" + +[[package]] +name = "axum" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a6c9af12842a67734c9a2e355436e5d03b22383ed60cf13cd0c18fbfe3dcbcf" +dependencies = [ + "async-trait", + "axum-core", + "bytes", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-util", + "itoa", + "matchit", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "rustversion", + "serde", + "serde_json", + "serde_path_to_error", + "serde_urlencoded", + "sync_wrapper 1.0.1", + "tokio", + "tower", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "axum-core" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a15c63fd72d41492dc4f497196f5da1fb04fb7529e631d73630d1b491e47a2e3" +dependencies = [ + "async-trait", + "bytes", + "futures-util", + "http", + "http-body", + "http-body-util", + "mime", + "pin-project-lite", + "rustversion", + "sync_wrapper 0.1.2", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "backtrace" +version = "0.3.73" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "basic-toml" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "823388e228f614e9558c6804262db37960ec8821856535f5c3f59913140558f8" +dependencies = [ + "serde", +] + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bumpalo" +version = "3.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" + +[[package]] +name = "bytes" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" + +[[package]] +name = "carpentertutoring" +version = "0.1.0" +dependencies = [ + "askama", + "askama_axum", + "axum", + "tokio", +] + +[[package]] +name = "cc" +version = "1.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b62ac837cdb5cb22e10a256099b4fc502b1dfe560cb282963a974d7abd80e476" +dependencies = [ + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "comrak" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "482aa5695bca086022be453c700a40c02893f1ba7098a2c88351de55341ae894" +dependencies = [ + "entities", + "memchr", + "once_cell", + "regex", + "slug", + "typed-arena", + "unicode_categories", +] + +[[package]] +name = "deunicode" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "339544cc9e2c4dc3fc7149fd630c5f22263a4fdf18a98afd0075784968b5cf00" + +[[package]] +name = "entities" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5320ae4c3782150d900b79807611a59a99fc9a1d61d686faafc24b93fc8d7ca" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "form_urlencoded" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures-channel" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" + +[[package]] +name = "futures-task" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" + +[[package]] +name = "futures-util" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +dependencies = [ + "futures-core", + "futures-task", + "pin-project-lite", + "pin-utils", +] + +[[package]] +name = "gimli" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" + +[[package]] +name = "hermit-abi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" + +[[package]] +name = "http" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" +dependencies = [ + "bytes", + "futures-util", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "humansize" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6cb51c9a029ddc91b07a787f1d86b53ccfa49b0e86688c946ebe8d3555685dd7" +dependencies = [ + "libm", +] + +[[package]] +name = "hyper" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", +] + +[[package]] +name = "hyper-util" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cde7055719c54e36e95e8719f95883f22072a48ede39db7fc17a4e1d5281e9b9" +dependencies = [ + "bytes", + "futures-util", + "http", + "http-body", + "hyper", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "libc" +version = "0.2.158" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" + +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + +[[package]] +name = "lock_api" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" + +[[package]] +name = "matchit" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[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.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" +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 = "miniz_oxide" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" +dependencies = [ + "adler", +] + +[[package]] +name = "mio" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" +dependencies = [ + "hermit-abi", + "libc", + "wasi", + "windows-sys", +] + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "object" +version = "0.36.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "084f1a5821ac4c651660a94a7153d27ac9d8a53736203f58b31945ded098070a" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets 0.48.5", +] + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "pin-project" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "proc-macro2" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags", +] + +[[package]] +name = "regex" +version = "1.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" + +[[package]] +name = "rustc-demangle" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" + +[[package]] +name = "rustversion" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "serde" +version = "1.0.210" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.210" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.128" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + +[[package]] +name = "serde_path_to_error" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af99884400da37c88f5e9146b7f1fd0fbcae8f6eec4e9da38b67d05486f814a6" +dependencies = [ + "itoa", + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signal-hook-registry" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +dependencies = [ + "libc", +] + +[[package]] +name = "slug" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "882a80f72ee45de3cc9a5afeb2da0331d58df69e4e7d8eeb5d3c7784ae67e724" +dependencies = [ + "deunicode", + "wasm-bindgen", +] + +[[package]] +name = "smallvec" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" + +[[package]] +name = "socket2" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "syn" +version = "2.0.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + +[[package]] +name = "sync_wrapper" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" + +[[package]] +name = "tokio" +version = "1.40.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys", +] + +[[package]] +name = "tokio-macros" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tower" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +dependencies = [ + "futures-core", + "futures-util", + "pin-project", + "pin-project-lite", + "tokio", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "log", + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", +] + +[[package]] +name = "typed-arena" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a" + +[[package]] +name = "unicase" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" +dependencies = [ + "version_check", +] + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unicode_categories" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[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.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" +dependencies = [ + "cfg-if", + "once_cell", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "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.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[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.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[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.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[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.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[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.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[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.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[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.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..a496dbf --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "carpentertutoring" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +askama = { version = "0.12", features = ["markdown", "with-axum"], default-features = false } +askama_axum = "0.4.0" +axum = "0.7.5" +tokio = { version = "1.40.0", features = ["full"] } diff --git a/scripts/serve.sh b/scripts/serve.sh deleted file mode 100755 index 16a3410..0000000 --- a/scripts/serve.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -php83 -S localhost:8000 diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..43b6fa6 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,136 @@ +use axum::response::Html; +use axum::extract::State; +use std::sync::Arc; +use askama_axum::Template; +use axum::{routing::get, Router}; +use std::borrow::Cow; +use std::ffi::OsString; +use std::fmt; +use std::fs; +use std::io::*; +use std::path::Path; +use std::path::PathBuf; + +trait Post<'a>: fmt::Debug { + fn dump(&self); + fn display_name(&'a self) -> &'a str; + fn get_content(&self) -> Cow; +} + +#[derive(Debug)] +struct MockPost; + +impl<'a> Post<'a> for MockPost { + fn dump(&self) { + println!("Post content goes here."); + } + + fn display_name(&'a self) -> &'a str { + "" + } + + fn get_content(&self) -> Cow { + Cow::Borrowed("") + } +} + +struct MdFilePost { + path: PathBuf, + name: OsString, +} + +impl MdFilePost { + fn new(path: &Path) -> Self { + Self { + path: path.to_path_buf(), + name: path.file_stem().unwrap_or_default().to_owned(), + } + } +} + +impl<'a> Post<'a> for MdFilePost { + fn dump(&self) { + println!("{}: {}", &self.display_name(), &self.get_content()); + } + + fn display_name(&'a self) -> &'a str { + self.name.to_str().unwrap() + } + + fn get_content(&self) -> Cow { + let mut file = std::fs::File::open(&self.path).unwrap(); + let mut markdown = String::new(); + file.read_to_string(&mut markdown).unwrap(); + Cow::Owned(markdown) + } +} + +impl fmt::Debug for MdFilePost { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "MdFilePost '{}'", self.display_name()) + } +} + +trait Posts { + fn get_posts(&self) -> impl Iterator; +} + +struct FsDirPosts { + path: PathBuf, +} + +impl FsDirPosts { + fn new(path: &str) -> Self { + Self { + path: PathBuf::from(path), + } + } +} + +impl Posts for FsDirPosts { + fn get_posts(&self) -> impl Iterator { + let dirs = fs::read_dir(&self.path).unwrap(); + dirs.flatten().map(|d| MdFilePost::new(&d.path())) + } +} + +trait Page<'a>: Template { + fn from_post(post: &impl Post<'a>) -> Self; +} + +#[derive(Template)] +#[template(path = "post.html")] +struct MdPage { + article: String, +} + +impl<'a> Page<'a> for MdPage { + fn from_post(post: &impl Post<'a>) -> Self { + Self { + article: post.get_content().into_owned(), + } + } +} + +fn test_get_posts(posts: &impl Posts) { + for post in posts.get_posts() { + let page = MdPage::from_post(&post); + println!("{}", page.render().unwrap()); + } +} + +async fn handler(State(posts): State>) -> Html { + let post = posts.get_posts().next().unwrap(); + let page = MdPage::from_post(&post); + Html(page.render().unwrap()) +} + +#[tokio::main] +async fn main() { + let repo = Arc::new(FsDirPosts::new(&format!("/data/ct/{}", "blog"))); + + let app = Router::new().route("/posts", get(handler)).with_state(repo); + + let listener = tokio::net::TcpListener::bind("0.0.0.0:8000").await.unwrap(); + axum::serve(listener, app).await.unwrap(); +} diff --git a/templates/post.html b/templates/post.html new file mode 100644 index 0000000..57964e9 --- /dev/null +++ b/templates/post.html @@ -0,0 +1,8 @@ + + + +
+ {{ article|markdown }} +
+ + -- cgit v1.2.3 From f2bd378e1a8cdfa7d1520b3734a748dd1cd9de25 Mon Sep 17 00:00:00 2001 From: "Adam T. Carpenter" Date: Sat, 7 Sep 2024 22:39:41 -0400 Subject: feat: serve static and assets add policies and index from base --- Cargo.lock | 72 +++++- Cargo.toml | 2 + assets/amy-sunny.png | Bin 511942 -> 0 bytes assets/amy-sunny.webp | Bin 58450 -> 0 bytes assets/amy.png | Bin 346630 -> 0 bytes assets/amy.webp | Bin 44532 -> 0 bytes assets/bg.png | Bin 150111 -> 0 bytes assets/brochure/brochure-back-center.png | Bin 332534 -> 0 bytes assets/brochure/brochure-back-left.png | Bin 316496 -> 0 bytes assets/brochure/brochure-back-right.png | Bin 304208 -> 0 bytes assets/brochure/brochure-front-center.png | Bin 334345 -> 0 bytes assets/brochure/brochure-front-left.png | Bin 402732 -> 0 bytes assets/brochure/brochure-front-right.png | Bin 295297 -> 0 bytes assets/favicon.ico | Bin 327262 -> 0 bytes assets/icons/close-box.svg | 1 - assets/icons/dots-horizontal-circle.svg | 1 - assets/icons/email-variant.svg | 1 - assets/icons/phone-classic.svg | 1 - assets/icons/send-circle.svg | 1 - assets/icons/star-box.svg | 5 - assets/logo-simple.png | Bin 9332 -> 0 bytes assets/logo-small.png | Bin 46158 -> 0 bytes assets/logo.png | Bin 89452 -> 0 bytes assets/logo.webp | Bin 10338 -> 0 bytes assets/signature.png | Bin 17196 -> 0 bytes assets/signature.webp | Bin 11102 -> 0 bytes desktop.css | 81 ------ src/main.rs | 82 +++--- static/desktop.css | 81 ++++++ static/widescreen.css | 8 + templates/base.html | 67 +++++ templates/index.html | 407 ++++++++++++++++++++++++++++++ templates/policies.html | 65 +++++ templates/posts.html | 13 + templates/styles.css | 272 ++++++++++++++++++++ widescreen.css | 8 - 36 files changed, 1032 insertions(+), 136 deletions(-) delete mode 100644 assets/amy-sunny.png delete mode 100644 assets/amy-sunny.webp delete mode 100644 assets/amy.png delete mode 100644 assets/amy.webp delete mode 100644 assets/bg.png delete mode 100644 assets/brochure/brochure-back-center.png delete mode 100644 assets/brochure/brochure-back-left.png delete mode 100644 assets/brochure/brochure-back-right.png delete mode 100644 assets/brochure/brochure-front-center.png delete mode 100644 assets/brochure/brochure-front-left.png delete mode 100644 assets/brochure/brochure-front-right.png delete mode 100644 assets/favicon.ico delete mode 100644 assets/icons/close-box.svg delete mode 100644 assets/icons/dots-horizontal-circle.svg delete mode 100644 assets/icons/email-variant.svg delete mode 100644 assets/icons/phone-classic.svg delete mode 100644 assets/icons/send-circle.svg delete mode 100644 assets/icons/star-box.svg delete mode 100644 assets/logo-simple.png delete mode 100644 assets/logo-small.png delete mode 100644 assets/logo.png delete mode 100644 assets/logo.webp delete mode 100644 assets/signature.png delete mode 100644 assets/signature.webp delete mode 100644 desktop.css create mode 100644 static/desktop.css create mode 100644 static/widescreen.css create mode 100644 templates/base.html create mode 100644 templates/index.html create mode 100644 templates/policies.html create mode 100644 templates/posts.html create mode 100644 templates/styles.css delete mode 100644 widescreen.css diff --git a/Cargo.lock b/Cargo.lock index c3394de..11b2bd0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -127,7 +127,7 @@ dependencies = [ "serde_urlencoded", "sync_wrapper 1.0.1", "tokio", - "tower", + "tower 0.4.13", "tower-layer", "tower-service", "tracing", @@ -184,6 +184,12 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" + [[package]] name = "bumpalo" version = "3.16.0" @@ -204,6 +210,8 @@ dependencies = [ "askama_axum", "axum", "tokio", + "tower 0.5.0", + "tower-http", ] [[package]] @@ -278,6 +286,12 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +[[package]] +name = "futures-sink" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" + [[package]] name = "futures-task" version = "0.3.30" @@ -342,6 +356,12 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "http-range-header" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08a397c49fec283e3d6211adbe480be95aae5f304cfb923e9970e08956d5168a" + [[package]] name = "httparse" version = "1.9.4" @@ -605,7 +625,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -808,6 +828,19 @@ dependencies = [ "syn", ] +[[package]] +name = "tokio-util" +version = "0.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + [[package]] name = "tower" version = "0.4.13" @@ -824,6 +857,41 @@ dependencies = [ "tracing", ] +[[package]] +name = "tower" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36b837f86b25d7c0d7988f00a54e74739be6477f2aac6201b8f429a7569991b7" +dependencies = [ + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-http" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9cd434a998747dd2c4276bc96ee2e0c7a2eadf3cae88e52be55a05fa9053f5" +dependencies = [ + "bitflags 2.6.0", + "bytes", + "futures-util", + "http", + "http-body", + "http-body-util", + "http-range-header", + "httpdate", + "mime", + "mime_guess", + "percent-encoding", + "pin-project-lite", + "tokio", + "tokio-util", + "tower-layer", + "tower-service", + "tracing", +] + [[package]] name = "tower-layer" version = "0.3.3" diff --git a/Cargo.toml b/Cargo.toml index a496dbf..afb71dd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,3 +10,5 @@ askama = { version = "0.12", features = ["markdown", "with-axum"], default-featu askama_axum = "0.4.0" axum = "0.7.5" tokio = { version = "1.40.0", features = ["full"] } +tower = "0.5.0" +tower-http = { version = "0.5.2", features = ["fs"] } diff --git a/assets/amy-sunny.png b/assets/amy-sunny.png deleted file mode 100644 index 003c700..0000000 Binary files a/assets/amy-sunny.png and /dev/null differ diff --git a/assets/amy-sunny.webp b/assets/amy-sunny.webp deleted file mode 100644 index 680335f..0000000 Binary files a/assets/amy-sunny.webp and /dev/null differ diff --git a/assets/amy.png b/assets/amy.png deleted file mode 100644 index ea2f165..0000000 Binary files a/assets/amy.png and /dev/null differ diff --git a/assets/amy.webp b/assets/amy.webp deleted file mode 100644 index 6ca2282..0000000 Binary files a/assets/amy.webp and /dev/null differ diff --git a/assets/bg.png b/assets/bg.png deleted file mode 100644 index a0c9ab8..0000000 Binary files a/assets/bg.png and /dev/null differ diff --git a/assets/brochure/brochure-back-center.png b/assets/brochure/brochure-back-center.png deleted file mode 100644 index 48ee7e2..0000000 Binary files a/assets/brochure/brochure-back-center.png and /dev/null differ diff --git a/assets/brochure/brochure-back-left.png b/assets/brochure/brochure-back-left.png deleted file mode 100644 index 5a2cc4a..0000000 Binary files a/assets/brochure/brochure-back-left.png and /dev/null differ diff --git a/assets/brochure/brochure-back-right.png b/assets/brochure/brochure-back-right.png deleted file mode 100644 index 73a5b8d..0000000 Binary files a/assets/brochure/brochure-back-right.png and /dev/null differ diff --git a/assets/brochure/brochure-front-center.png b/assets/brochure/brochure-front-center.png deleted file mode 100644 index 59f9f82..0000000 Binary files a/assets/brochure/brochure-front-center.png and /dev/null differ diff --git a/assets/brochure/brochure-front-left.png b/assets/brochure/brochure-front-left.png deleted file mode 100644 index 2ed6c56..0000000 Binary files a/assets/brochure/brochure-front-left.png and /dev/null differ diff --git a/assets/brochure/brochure-front-right.png b/assets/brochure/brochure-front-right.png deleted file mode 100644 index 1fd53c7..0000000 Binary files a/assets/brochure/brochure-front-right.png and /dev/null differ diff --git a/assets/favicon.ico b/assets/favicon.ico deleted file mode 100644 index 8ba4c15..0000000 Binary files a/assets/favicon.ico and /dev/null differ diff --git a/assets/icons/close-box.svg b/assets/icons/close-box.svg deleted file mode 100644 index 717756e..0000000 --- a/assets/icons/close-box.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/assets/icons/dots-horizontal-circle.svg b/assets/icons/dots-horizontal-circle.svg deleted file mode 100644 index ca1de94..0000000 --- a/assets/icons/dots-horizontal-circle.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/assets/icons/email-variant.svg b/assets/icons/email-variant.svg deleted file mode 100644 index e8ef2dd..0000000 --- a/assets/icons/email-variant.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/assets/icons/phone-classic.svg b/assets/icons/phone-classic.svg deleted file mode 100644 index 814990b..0000000 --- a/assets/icons/phone-classic.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/assets/icons/send-circle.svg b/assets/icons/send-circle.svg deleted file mode 100644 index 1b7e5c3..0000000 --- a/assets/icons/send-circle.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/assets/icons/star-box.svg b/assets/icons/star-box.svg deleted file mode 100644 index 2973ca8..0000000 --- a/assets/icons/star-box.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/assets/logo-simple.png b/assets/logo-simple.png deleted file mode 100644 index b299e66..0000000 Binary files a/assets/logo-simple.png and /dev/null differ diff --git a/assets/logo-small.png b/assets/logo-small.png deleted file mode 100644 index a128e24..0000000 Binary files a/assets/logo-small.png and /dev/null differ diff --git a/assets/logo.png b/assets/logo.png deleted file mode 100644 index 81e0776..0000000 Binary files a/assets/logo.png and /dev/null differ diff --git a/assets/logo.webp b/assets/logo.webp deleted file mode 100644 index 16ab275..0000000 Binary files a/assets/logo.webp and /dev/null differ diff --git a/assets/signature.png b/assets/signature.png deleted file mode 100644 index 7d115de..0000000 Binary files a/assets/signature.png and /dev/null differ diff --git a/assets/signature.webp b/assets/signature.webp deleted file mode 100644 index 8ce6e28..0000000 Binary files a/assets/signature.webp and /dev/null differ diff --git a/desktop.css b/desktop.css deleted file mode 100644 index 1b0eb43..0000000 --- a/desktop.css +++ /dev/null @@ -1,81 +0,0 @@ -@media only screen and (min-width: 700px) { - section { - padding: 3em; - } - - nav { - flex-direction: row-reverse; - margin: 0; - padding: 0; - top: 0; - position: fixed; - width: 100%; - } - - div.buttons { - flex-direction: row-reverse; - } - - .banner { - padding-top: 7em; - text-align: right; - background: linear-gradient( - to right, - rgba(255, 255, 255, 0) 0%, - rgba(255, 255, 255, 1) 50% - ); - } - - form { - margin-right: 10%; - margin-left: 10%; - } - - table td, - table th { - padding: 0.5em; - } - - section.flexible { - flex-direction: row; - } - - section.flexible div, - section.flexible figure { - flex-basis: 0; - } - - section.flexible div { - flex-grow: 2; - } - - section.flexible figure { - flex-grow: 1; - } - - .signature img { - width: 30%; - } - - .logo img { - width: 15%; - display: block; - margin-left: auto; - margin-right: auto; - } - - .card { - padding: 2em; - } - - #reviews .card, - #offerings .card { - display: block; - flex: none; - width: 20%; - } - - .modal .card { - width: 25%; - } -} diff --git a/src/main.rs b/src/main.rs index 43b6fa6..ca0a3d9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,4 @@ +use tower_http::services::ServeDir; use axum::response::Html; use axum::extract::State; use std::sync::Arc; @@ -11,29 +12,12 @@ use std::io::*; use std::path::Path; use std::path::PathBuf; -trait Post<'a>: fmt::Debug { +trait Post: fmt::Debug { fn dump(&self); - fn display_name(&'a self) -> &'a str; + fn display_name(&self) -> Cow; fn get_content(&self) -> Cow; } -#[derive(Debug)] -struct MockPost; - -impl<'a> Post<'a> for MockPost { - fn dump(&self) { - println!("Post content goes here."); - } - - fn display_name(&'a self) -> &'a str { - "" - } - - fn get_content(&self) -> Cow { - Cow::Borrowed("") - } -} - struct MdFilePost { path: PathBuf, name: OsString, @@ -48,13 +32,13 @@ impl MdFilePost { } } -impl<'a> Post<'a> for MdFilePost { +impl Post for MdFilePost { fn dump(&self) { println!("{}: {}", &self.display_name(), &self.get_content()); } - fn display_name(&'a self) -> &'a str { - self.name.to_str().unwrap() + fn display_name(&self) -> Cow { + self.name.to_string_lossy() } fn get_content(&self) -> Cow { @@ -94,8 +78,8 @@ impl Posts for FsDirPosts { } } -trait Page<'a>: Template { - fn from_post(post: &impl Post<'a>) -> Self; +trait Page: Template { + fn from_post(post: &impl Post) -> Self; } #[derive(Template)] @@ -104,32 +88,60 @@ struct MdPage { article: String, } -impl<'a> Page<'a> for MdPage { - fn from_post(post: &impl Post<'a>) -> Self { +impl Page for MdPage { + fn from_post(post: &impl Post) -> Self { Self { article: post.get_content().into_owned(), } } } -fn test_get_posts(posts: &impl Posts) { - for post in posts.get_posts() { - let page = MdPage::from_post(&post); - println!("{}", page.render().unwrap()); +#[derive(Template)] +#[template(path = "posts.html")] +struct PostsView { + post_titles: Vec +} + +impl PostsView { + fn with_posts(posts: &impl Posts) -> Self { + Self { + post_titles: posts.get_posts().map(|p| p.display_name().into_owned()).map(String::from).collect() + } } } -async fn handler(State(posts): State>) -> Html { - let post = posts.get_posts().next().unwrap(); - let page = MdPage::from_post(&post); - Html(page.render().unwrap()) +async fn posts_handler(State(posts): State>) -> Html { + let view = PostsView::with_posts(&*posts); + Html(view.render().unwrap()) +} + +#[derive(Template)] +#[template(path = "index.html")] +struct IndexTemplate; + +async fn index_handler() -> Html { + Html(IndexTemplate {}.render().unwrap()) +} + +#[derive(Template)] +#[template(path = "policies.html")] +struct PoliciesTemplate; + +async fn policies_handler() -> Html { + Html(PoliciesTemplate{}.render().unwrap()) } #[tokio::main] async fn main() { let repo = Arc::new(FsDirPosts::new(&format!("/data/ct/{}", "blog"))); - let app = Router::new().route("/posts", get(handler)).with_state(repo); + let app = Router::new() + .nest_service("/static", ServeDir::new("static")) + .nest_service("/assets", ServeDir::new("/data/ct/assets")) + .route("/posts", get(posts_handler)) + .route("/policies", get(policies_handler)) + .route("/", get(index_handler)) + .with_state(repo); let listener = tokio::net::TcpListener::bind("0.0.0.0:8000").await.unwrap(); axum::serve(listener, app).await.unwrap(); diff --git a/static/desktop.css b/static/desktop.css new file mode 100644 index 0000000..1b0eb43 --- /dev/null +++ b/static/desktop.css @@ -0,0 +1,81 @@ +@media only screen and (min-width: 700px) { + section { + padding: 3em; + } + + nav { + flex-direction: row-reverse; + margin: 0; + padding: 0; + top: 0; + position: fixed; + width: 100%; + } + + div.buttons { + flex-direction: row-reverse; + } + + .banner { + padding-top: 7em; + text-align: right; + background: linear-gradient( + to right, + rgba(255, 255, 255, 0) 0%, + rgba(255, 255, 255, 1) 50% + ); + } + + form { + margin-right: 10%; + margin-left: 10%; + } + + table td, + table th { + padding: 0.5em; + } + + section.flexible { + flex-direction: row; + } + + section.flexible div, + section.flexible figure { + flex-basis: 0; + } + + section.flexible div { + flex-grow: 2; + } + + section.flexible figure { + flex-grow: 1; + } + + .signature img { + width: 30%; + } + + .logo img { + width: 15%; + display: block; + margin-left: auto; + margin-right: auto; + } + + .card { + padding: 2em; + } + + #reviews .card, + #offerings .card { + display: block; + flex: none; + width: 20%; + } + + .modal .card { + width: 25%; + } +} diff --git a/static/widescreen.css b/static/widescreen.css new file mode 100644 index 0000000..8231129 --- /dev/null +++ b/static/widescreen.css @@ -0,0 +1,8 @@ +@media only screen and (min-width: 2000px) { + section { + padding-top: 3em; + padding-bottom: 3em; + padding-left: 25%; + padding-right: 25%; + } +} diff --git a/templates/base.html b/templates/base.html new file mode 100644 index 0000000..1657ec1 --- /dev/null +++ b/templates/base.html @@ -0,0 +1,67 @@ + + + + + + Tutoring Excellence Online and in Suffolk, VA - Carpenter Tutoring, LLC + + + + + + + + + + + + + + + + + + + + + +
+ {% block main %}

Placeholder content

{% endblock %} +
+ + + + + diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..48e85e8 --- /dev/null +++ b/templates/index.html @@ -0,0 +1,407 @@ +{% extends "base.html" %} + +{% block main %} + + + + +
+
+

+ Welcome, and thank you for your interest in Carpenter Tutoring! +

+ +

Carpenter Tutoring is a private tutoring service based in Suffolk, + Virginia. We offer high-engagement remote appointments through Zoom. A limited + number of in-person appointments with me are also available for students in the Harbour + View region of Suffolk, VA. Most of our offerings are one-on-one, and siblings + and pre-existing groups of students may opt for group meetings. No matter your + budget, I am confident that we can find an arrangement that will provide your + student services without creating financial strain.

+ +

+ I invite you to explore and learn more about the services we offer, Carpenter Tutoring's background, + and some of our policies. Thank you for visiting, and + please do not hesitate to reach out with any questions. We will be thrilled to + assist you! +

+ +
+ + + + Amy's signature + +
+ +
+ +
+ + + + Amy Carpenter + +
Amy Carpenter, M.Ed.
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+

Subject Tutoring

+

Tutoring for specific courses or disciplines +

+ expand Learn more +
+ +
+

Time Management

+

+ Personalized plans for managing academics, extracurriculars, and + other commitments +

+ expand Learn more +
+ +
+

Study Skills

+

Learn how to make the most of your study time

+ expand Learn more +
+ +
+

Academic Coaching

+

+ Time management and study skills blended with continuing + accountability +

+ expand Learn more +
+ +
+

College Application Assistance

+

+ Assistance with generating a college list and crafting application + essays +

+ expand Learn more +
+ +
+

College-Level Writing

+

Get a head start on meeting professors' expectations

+ expand Learn more +
+ +
+

Dissertation Coaching

+

Ensure your research is communicated effectively and eloquently

+ expand Learn more +
+ +
+

Standardized Test Prep

+

+ Tailored assistance in preparing for a variety of standardized tests +

+ expand Learn more +
+ +
+

Music Lessons

+

Instrument and/or composition lessons for students of all ages

+ expand Learn more +
+ +
+

Proof of Progress Evaluations

+

+ Two levels of portfolio-based evaluations for homeschool families + looking to satisfy Proof of Progress or gain insight into their + child's learning +

+ expand Learn more +
+ +
+ +
+ Click here to view an interactive brochure of our offerings +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Pricing Guide - Remote*

+
+ Single Subject, Time Management, Study Skills Tutoring, Music Lessons + $60/hr
+ Multi-Subject, Academic Coaching, Dissertation Coaching, Test Prep, College + Application Assistance + $70/hr
Small Group Sessions, Group Lessons$40/hr/student
Simplified Homeschool Evaluations$45
Detailed Homeschool Evaluations$80+
+ +

+

*In-person pricing for students in the Harbour View region of Suffolk is $10/hr more in each category.

+ See a list of our policies and procedures regarding scheduling, + payment, and booking. +

+ +
+ + +
+ +
+

C.L. Cannon

+
+ I hired Amy to complete an end-of-the-year evaluation for both of my Elementary aged sons. This being our first year of independent home instruction, the task of testing and/or evaluation was daunting! Amy put my fears to rest! She was super easy to work with, had great communication skills, and answered all my questions in a timely and informative manner! I would highly recommend her services! +
+

+ View on Google + or + leave a review. +

+ star + star + star + star + star +
+ +
+

Lee Crabtree

+
+ Amy is a wonderful tutor who helped my child (who does not like help at all) though some difficult classes where the teacher was not providing the support my child needed. Highly recommended. +
+

+ View on Google + or + leave a review. +

+ star + star + star + star + star +
+ +
+

Connor Fenton

+
+ I was a Graduate student at the College of William and Mary who needed to pass a Latin Language test as part of my degree requirements. I was struggling with refreshing my Latin after a few years out of the classroom and Amy was both professional and helpful. With her tutoring I was able to pass my test and finish my degree. She is very considerate and easy to work with. +
+

+ View on Google + or + leave a review. +

+ star + star + star + star + star +
+ +
+{% endblock %} diff --git a/templates/policies.html b/templates/policies.html new file mode 100644 index 0000000..0d39b38 --- /dev/null +++ b/templates/policies.html @@ -0,0 +1,65 @@ +{% extends "base.html" %} + +{% block main %} + + +
+

+

Payment Methods

+ We accept payments through Zelle (amy@carpentertutoring.com), Venmo + (@AmyCTutoring), and PayPal (amy@carpentertutoring.com). We also accept + checks made out to Carpenter Tutoring, LLC. Please contact Amy for + a mailing address if you would like to pay by check. +

+ +

+

Travel

+ Due to high appointment volumes, Amy is only able to travel to students in the Harbour View area of Suffolk, VA. +

+ +

Please contact other tutors directly to discuss their locations and in-person policies.

+ +

+

Remote sessions

+ Remote sessions are typically conducted from tutors' homes. We use online video conferencing software such as + Zoom and Google Meet. + Your tutor will inform you of their preferred meeting method and provide initial meeting instructions and support. +

+ +

+

Late Cancellations

+ Sessions cancelled within 72 hours of their start time will incur a late + cancellation fee equal to 40% of the cancelled session price. +

+ +

+

No-Shows

+ Sessions which a student does not attend with no notice of + cancellation will be charged the full session price. +

+ +

+

Session Duration

+ Sessions are purchased in half-hour increments, and the shortest + appointment duration is 60 minutes. Families are responsible for the + amount of time they book and will be charged based on that amount. + Students who provide no advance notice of a need to end their meeting early will still be responsible for the full session price. If a student is + late to their appointment, we will work to the end of their scheduled + time, but no later. +

+ +

+

Proof of Progress Evaluations

+ Proof of Progress letters will be returned within 7 days of notification that materials are ready for review. Families are responsible for sending Proof of Progress letters and proof of evaluator credentials to their school system by August 1, the deadline for Proof of Progress submissions in Virginia. Notifications regarding sample readiness sent on or after July 24 of each year will incur a $10 late submission fee per evaluation. All payments are expected within two weeks of receipt of letter(s). Payment method information is available on this site as well as in the email sent along with Proof of Progress letters. +

+ +

+

Learning Acceleration Grants

+ Carpenter Tutoring is proud to serve Virginia students and families as a vendor for the K-12 Learning Acceleration Grant. Families must share student names as they appear on the grants, associated parent name, and associated address for invoicing purposes. Families are expected to upload emailed invoices at their earliest convenience as there are significant lag times between family submission and fund deposits from ClassWallet. While Carpenter Tutoring will provide an overview of funds used with our tutors with each invoice, families are expected to keep track of fund use and communicate with tutors when funds are nearing exhaustion to plan an end date for services or a transition to out-of-pocket payment. Grant vendors cannot see fund totals or funds used with other vendors, so we rely on families completely to communicate their remaining balances. Families who fail to notify us that their funds are nearly or have been depleted or rescinded but continue to use services will be required to pay for any excesses out-of-pocket. +

+
+
+ +{% endblock %} diff --git a/templates/posts.html b/templates/posts.html new file mode 100644 index 0000000..9f522a6 --- /dev/null +++ b/templates/posts.html @@ -0,0 +1,13 @@ +{% extends "base.html" %} + +{% block main %} +
+

+

    + {% for title in post_titles %} +
  • {{ title }}
  • + {% endfor %} +
+

+
+{% endblock %} diff --git a/templates/styles.css b/templates/styles.css new file mode 100644 index 0000000..68eae3b --- /dev/null +++ b/templates/styles.css @@ -0,0 +1,272 @@ +/* Colors */ +:root { + --darkteal: rgb(0, 100, 108); + --green: rgb(88, 169, 143); + --darkerteal: rgb(29, 133, 137); + --gray: rgb(157, 210, 211); + --teal: rgb(58, 165, 166); + --cyan: rgb(156, 210, 210); + --darkgray: rgb(127, 177, 181); + --darkgreen: rgb(59, 136, 114); + --yellow: rgb(186, 214, 187); +} + +/* Elements */ + +html, +body { + margin: 0; + padding: 0; + font-family: "PT Sans", sans-serif; + color: dimgray; +} + +body { + background-image: url("/assets/bg.png"); +} + +.banner { + font-size: 1em; + text-align: center; + padding: 3em; + background-color: white; +} + +nav { + display: flex; + background-color: white; + flex-direction: column-reverse; +} + +nav img { + height: 1.4em; +} + +nav a { + font-family: "PT Sans", sans-serif; + color: dimgray; + text-align: center; + text-decoration: none; + padding: 1em 1em; + transition: 0.15s; +} + +nav a:hover { + color: var(--darkteal); + background-color: lightgray; +} + +div.buttons { + display: flex; + flex-direction: column; +} + +h1 { + font-size: 3em; + color: var(--darkteal); + font-family: "Architects Daughter", cursive; +} + +h2 { + font-size: 2em; + color: var(--darkteal); + font-family: "Indie Flower", cursive; +} + +em { + + color: var(--darkteal); +} + +section { + font-size: 1.5em; + margin: 0; + padding: 1em; +} + +section.quiet { + background-color: white; +} + +section.squarshed { + padding-bottom: 1em; + padding-top: 1em; +} + +.button img { + margin-right: 1em; +} + +button.button, +a.button { + display: flex; + align-items: center; + background-color: var(--teal); + padding-left: 1em; + padding-right: 1em; + padding-top: 0.5em; + padding-bottom: 0.5em; + margin-right: 0.5em; + margin-bottom: 0.5em; + text-decoration: none; + color: white; + border-radius: 3em; + transition: 0.15s; +} + +button.button:hover, +a.button:hover { + box-shadow: 0 4px 8px 0 lightgray, 0 6px 20px 0 lightgray; +} + +button { + font-family: "PT Sans", sans-serif; + border: none; + font-size: 0.75em; +} + +a.primary { + background-color: var(--darkteal); +} + +footer { + background-color: white; + text-align: center; + padding: 3em; + font-size: 1.5em; +} + +footer a, +section a { + color: var(--darkteal); + text-decoration: underline; +} + +.card { + font-size: 0.9em; + background-color: white; + padding: 1em; + border-radius: 1em; + margin-left: 0; + margin-right: 0; +} + +form input, +form textarea { + font-family: "PT Sans", sans-serif; + margin-bottom: 1.5em; + box-sizing: border-box; + width: 100%; + border: 1px solid lightgray; + padding: 1em; +} + +form input { + border-radius: 3em; +} + +textarea { + border-radius: 1em; + resize: none; +} + +/* honeypot */ +textarea#beehive { + display: none; +} + +table { + width: 100%; + border-collapse: collapse; +} + +table caption { + text-align: left; +} + +table th { + text-align: right; + color: var(--darkteal); +} + +table td, +table th { + vertical-align: bottom; +} + +tr:nth-child(even) { + background-color: lightgray; +} + +picture img { + width: 100%; +} + +.shadowy img { + box-shadow: 0 4px 8px 0 dimgray, 0 6px 20px 0 dimgray; +} + +figcaption { + text-align: right; + color: var(--darkteal); + font-family: "Architects Daughter", cursive; +} + +section.flexible { + display: flex; + flex-direction: column; +} + +#reviews .card, +#offerings .card { + margin: 1em; + text-align: center; +} + +#reviews, +#offerings { + padding-left: 0; + padding-right: 0; + display: flex; + flex-wrap: wrap; + justify-content: center; +} + +.modal { + position: fixed; + z-index: 1; + left: 0; + top: 0; + width: 100%; + height: 100%; + background-color: white; + background-color: rgba(1, 1, 1, 0.4); + overflow: auto; + display: none; + font-size: 1.5em; +} + +.modal .card { + max-height: 90%; + max-width: 60%; +} + +.modal a, +.card a.button { + float: right; +} + +:target.modal { + display: flex; + justify-content: center; + align-items: center; +} + +:target.modal .card { + overflow: auto; +} + +.centered { + text-align: center; + justify-content: center; +} diff --git a/widescreen.css b/widescreen.css deleted file mode 100644 index 8231129..0000000 --- a/widescreen.css +++ /dev/null @@ -1,8 +0,0 @@ -@media only screen and (min-width: 2000px) { - section { - padding-top: 3em; - padding-bottom: 3em; - padding-left: 25%; - padding-right: 25%; - } -} -- cgit v1.2.3 From 0213fd2dcd09ca4b1252cdc45415a765a887d679 Mon Sep 17 00:00:00 2001 From: "Adam T. Carpenter" Date: Mon, 9 Sep 2024 22:28:33 -0400 Subject: feat: teams and blurbs but lots of todos --- Cargo.lock | 10 ++++ Cargo.toml | 1 + about/blurb.php | 4 -- about/team/adamc/adamc.png | Bin 385645 -> 0 bytes about/team/adamc/adamc.webp | Bin 44888 -> 0 bytes about/team/adamc/blurb.php | 1 - about/team/adamc/name.php | 1 - about/team/alexp/alexp.png | Bin 367859 -> 0 bytes about/team/alexp/alexp.webp | Bin 18202 -> 0 bytes about/team/alexp/blurb.php | 3 - about/team/alexp/name.php | 1 - about/team/genevievea/blurb.php | 14 ----- about/team/genevievea/genevievea.png | Bin 337781 -> 0 bytes about/team/genevievea/genevievea.webp | Bin 70202 -> 0 bytes about/team/genevievea/name.php | 1 - about/team/jaydea/blurb.php | 1 - about/team/jaydea/jaydea.png | Bin 465599 -> 0 bytes about/team/jaydea/jaydea.webp | Bin 23712 -> 0 bytes about/team/jaydea/name.php | 1 - about/team/joelm/blurb.php | 1 - about/team/joelm/joelm.png | Bin 491308 -> 0 bytes about/team/joelm/joelm.webp | Bin 33982 -> 0 bytes about/team/joelm/name.php | 1 - about/team/katherinev/blurb.php | 1 - about/team/katherinev/katherinev.png | Bin 382099 -> 0 bytes about/team/katherinev/katherinev.webp | Bin 21316 -> 0 bytes about/team/katherinev/name.php | 1 - about/team/zackh/blurb.php | 1 - about/team/zackh/name.php | 1 - about/team/zackh/zackh.png | Bin 532626 -> 0 bytes about/team/zackh/zackh.webp | Bin 48908 -> 0 bytes brochure/brochure.html | 38 ------------ brochure/brochure.js | 34 ----------- brochure/index.php | 24 -------- brochure/styles.css | 93 ---------------------------- policies/index.php | 61 ------------------- src/main.rs | 110 ++++++++++++++++++++++++++++++---- templates/about/blurb.html | 4 ++ templates/about/figure.html | 8 +++ templates/about/index.html | 71 ++++++++++++++++++++++ templates/about/team.html | 15 +++++ templates/base.html | 6 +- templates/brochure/brochure.css | 93 ++++++++++++++++++++++++++++ templates/brochure/brochure.html | 37 ++++++++++++ templates/brochure/brochure.js | 34 +++++++++++ templates/brochure/index.html | 32 ++++++++++ templates/index.html | 5 +- 47 files changed, 410 insertions(+), 299 deletions(-) delete mode 100644 about/blurb.php delete mode 100644 about/team/adamc/adamc.png delete mode 100644 about/team/adamc/adamc.webp delete mode 100644 about/team/adamc/blurb.php delete mode 100644 about/team/adamc/name.php delete mode 100644 about/team/alexp/alexp.png delete mode 100644 about/team/alexp/alexp.webp delete mode 100644 about/team/alexp/blurb.php delete mode 100644 about/team/alexp/name.php delete mode 100644 about/team/genevievea/blurb.php delete mode 100644 about/team/genevievea/genevievea.png delete mode 100644 about/team/genevievea/genevievea.webp delete mode 100644 about/team/genevievea/name.php delete mode 100644 about/team/jaydea/blurb.php delete mode 100644 about/team/jaydea/jaydea.png delete mode 100644 about/team/jaydea/jaydea.webp delete mode 100644 about/team/jaydea/name.php delete mode 100644 about/team/joelm/blurb.php delete mode 100644 about/team/joelm/joelm.png delete mode 100644 about/team/joelm/joelm.webp delete mode 100644 about/team/joelm/name.php delete mode 100644 about/team/katherinev/blurb.php delete mode 100644 about/team/katherinev/katherinev.png delete mode 100644 about/team/katherinev/katherinev.webp delete mode 100644 about/team/katherinev/name.php delete mode 100644 about/team/zackh/blurb.php delete mode 100644 about/team/zackh/name.php delete mode 100644 about/team/zackh/zackh.png delete mode 100644 about/team/zackh/zackh.webp delete mode 100644 brochure/brochure.html delete mode 100644 brochure/brochure.js delete mode 100644 brochure/index.php delete mode 100644 brochure/styles.css delete mode 100644 policies/index.php create mode 100644 templates/about/blurb.html create mode 100644 templates/about/figure.html create mode 100644 templates/about/index.html create mode 100644 templates/about/team.html create mode 100644 templates/brochure/brochure.css create mode 100644 templates/brochure/brochure.html create mode 100644 templates/brochure/brochure.js create mode 100644 templates/brochure/index.html diff --git a/Cargo.lock b/Cargo.lock index 11b2bd0..69052fe 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -209,6 +209,7 @@ dependencies = [ "askama", "askama_axum", "axum", + "chrono", "tokio", "tower 0.5.0", "tower-http", @@ -229,6 +230,15 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "chrono" +version = "0.4.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" +dependencies = [ + "num-traits", +] + [[package]] name = "comrak" version = "0.18.0" diff --git a/Cargo.toml b/Cargo.toml index afb71dd..2e017fc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,7 @@ edition = "2021" askama = { version = "0.12", features = ["markdown", "with-axum"], default-features = false } askama_axum = "0.4.0" axum = "0.7.5" +chrono = { version = "0.4.38", default-features = false, features = ["now"] } tokio = { version = "1.40.0", features = ["full"] } tower = "0.5.0" tower-http = { version = "0.5.2", features = ["fs"] } diff --git a/about/blurb.php b/about/blurb.php deleted file mode 100644 index 5b4e5db..0000000 --- a/about/blurb.php +++ /dev/null @@ -1,4 +0,0 @@ -
-

-

-
diff --git a/about/team/adamc/adamc.png b/about/team/adamc/adamc.png deleted file mode 100644 index e0af5e7..0000000 Binary files a/about/team/adamc/adamc.png and /dev/null differ diff --git a/about/team/adamc/adamc.webp b/about/team/adamc/adamc.webp deleted file mode 100644 index 1884f87..0000000 Binary files a/about/team/adamc/adamc.webp and /dev/null differ diff --git a/about/team/adamc/blurb.php b/about/team/adamc/blurb.php deleted file mode 100644 index 08eca54..0000000 --- a/about/team/adamc/blurb.php +++ /dev/null @@ -1 +0,0 @@ - Adam earned a Bachelor's in Computer Science from The College of William & Mary in 2018. Since graduating, he has accumulated over four years of experience as a software engineer specializing in server-side automation and front end self-service software. Adam's favorite part of software development is learning and teaching new technology. He loves simplifying complicated concepts in computing and giving others the hints and tricks they need to realize their ideas. In his spare time Adam is a hobbyist mechanic, constantly tinkering with his classic Hudson Hornet. He is eager to contribute to Carpenter Tutoring with all levels of high school and college computer science and programming, information technology fundamentals, and software development practices. diff --git a/about/team/adamc/name.php b/about/team/adamc/name.php deleted file mode 100644 index 6884f41..0000000 --- a/about/team/adamc/name.php +++ /dev/null @@ -1 +0,0 @@ -Adam Carpenter diff --git a/about/team/alexp/alexp.png b/about/team/alexp/alexp.png deleted file mode 100644 index e524184..0000000 Binary files a/about/team/alexp/alexp.png and /dev/null differ diff --git a/about/team/alexp/alexp.webp b/about/team/alexp/alexp.webp deleted file mode 100644 index 5c67439..0000000 Binary files a/about/team/alexp/alexp.webp and /dev/null differ diff --git a/about/team/alexp/blurb.php b/about/team/alexp/blurb.php deleted file mode 100644 index 94830ec..0000000 --- a/about/team/alexp/blurb.php +++ /dev/null @@ -1,3 +0,0 @@ -Alex graduated from Christopher Newport University with a Bachelor’s of Science in Mathematics with a minor in Leadership Studies in 2023. She is currently pursuing her Master of Arts in Secondary Education in hopes of becoming a high school math teacher. Alex has always loved helping others in her classes throughout her time in school, whether that is helping her friends in their math classes or through formal tutoring positions. One of her favorite parts of teaching is taking concepts that may be difficult for students, explaining it in a way that makes sense to them, and seeing the light bulb go off once they understand. She has worked with students of varying abilities and ages ranging from kindergarten to college. She has experience mainly in math and science but also loves to help with standardized test prep and writing papers at a college level. - -In her free time, Alex enjoys spending time with her friends and her cat, Finley, and reading books at the nearest coffee shop. diff --git a/about/team/alexp/name.php b/about/team/alexp/name.php deleted file mode 100644 index 6488d59..0000000 --- a/about/team/alexp/name.php +++ /dev/null @@ -1 +0,0 @@ -Alex Patterson diff --git a/about/team/genevievea/blurb.php b/about/team/genevievea/blurb.php deleted file mode 100644 index d555b46..0000000 --- a/about/team/genevievea/blurb.php +++ /dev/null @@ -1,14 +0,0 @@ - Genevieve is currently pursuing a master’s degree in Clinical Mental Health Counseling - at the College of William & Mary. Previously, Genevieve earned a master’s in Equality Studies - from University College Dublin and bachelors’ degrees in Political Science and Women and - Gender Studies from St. Olaf College. In high school, Genevieve began tutoring elementary and - middle school children in piano and violin. While in college, Genevieve worked as tutor in a local - elementary school, focusing on language arts, reading, and math. Genevieve continued to seek - tutoring opportunities while living in Dublin and gained experience working with middle school - aged children in reading and language arts. Through her work as a tutor and additional - employment experiences, Genevieve has worked with individuals of variety of ages, academic - levels, and children with additional support needs. Genevieve loves supporting students and - working with them to foster a love of learning and overcome any challenges. As a Carpenter - Tutor, Genevieve welcomes students seeking assistance with all levels of reading, writing, and - language arts; elementary and middle school math; piano and violin; and additional skills such - as time management and study skills. diff --git a/about/team/genevievea/genevievea.png b/about/team/genevievea/genevievea.png deleted file mode 100644 index 4b7f99a..0000000 Binary files a/about/team/genevievea/genevievea.png and /dev/null differ diff --git a/about/team/genevievea/genevievea.webp b/about/team/genevievea/genevievea.webp deleted file mode 100644 index 56197c5..0000000 Binary files a/about/team/genevievea/genevievea.webp and /dev/null differ diff --git a/about/team/genevievea/name.php b/about/team/genevievea/name.php deleted file mode 100644 index 56a0214..0000000 --- a/about/team/genevievea/name.php +++ /dev/null @@ -1 +0,0 @@ -Genevieve Akins diff --git a/about/team/jaydea/blurb.php b/about/team/jaydea/blurb.php deleted file mode 100644 index ab7cbda..0000000 --- a/about/team/jaydea/blurb.php +++ /dev/null @@ -1 +0,0 @@ -Jayde graduated from Christopher Newport University in 2019 with a Bachelor's of Arts in Spanish and a minor in Dance. She then went on to receive her Master's of Arts in TESOL (Teaching English as a Second Language) in 2020. For the past 3 years Jayde worked as a Middle School Newcomer teacher in Newport News, supporting students with very limited English in all subject areas. She tutored and taught students ranging from lower elementary to upper middle school and has a specific love for tutoring in Spanish and English. Outside of the classroom, she enjoys reading, spending time with her husband and son, and catching up on a good TV show. diff --git a/about/team/jaydea/jaydea.png b/about/team/jaydea/jaydea.png deleted file mode 100644 index 11ae1f7..0000000 Binary files a/about/team/jaydea/jaydea.png and /dev/null differ diff --git a/about/team/jaydea/jaydea.webp b/about/team/jaydea/jaydea.webp deleted file mode 100644 index d261530..0000000 Binary files a/about/team/jaydea/jaydea.webp and /dev/null differ diff --git a/about/team/jaydea/name.php b/about/team/jaydea/name.php deleted file mode 100644 index 39c83d7..0000000 --- a/about/team/jaydea/name.php +++ /dev/null @@ -1 +0,0 @@ -Jayde Adams diff --git a/about/team/joelm/blurb.php b/about/team/joelm/blurb.php deleted file mode 100644 index 843605f..0000000 --- a/about/team/joelm/blurb.php +++ /dev/null @@ -1 +0,0 @@ - Joel has been a math nerd since he first discovered the number 11. Since then, he has worked to develop his skills in both studying and teaching math. Joel earned his Bachelor's in Mathematics and his Master's in Computational Operations Research from the College of William & Mary. Throughout his education, he has consistently sought opportunities to tutor, whether it was helping friends in high school, peers in college, or other students during his Master's program. Joel has a passion for seeing students break through the barriers which can form when studying math and discover the amazing language hidden within. As a part of Carpenter Tutoring, Joel is happy to offer assistance to students in high school and college math and introductory physics. diff --git a/about/team/joelm/joelm.png b/about/team/joelm/joelm.png deleted file mode 100644 index fcf53ac..0000000 Binary files a/about/team/joelm/joelm.png and /dev/null differ diff --git a/about/team/joelm/joelm.webp b/about/team/joelm/joelm.webp deleted file mode 100644 index fdd9c0b..0000000 Binary files a/about/team/joelm/joelm.webp and /dev/null differ diff --git a/about/team/joelm/name.php b/about/team/joelm/name.php deleted file mode 100644 index 370f5ce..0000000 --- a/about/team/joelm/name.php +++ /dev/null @@ -1 +0,0 @@ -Joel Monroe diff --git a/about/team/katherinev/blurb.php b/about/team/katherinev/blurb.php deleted file mode 100644 index 4987d48..0000000 --- a/about/team/katherinev/blurb.php +++ /dev/null @@ -1 +0,0 @@ -Katherine is currently working as an English As A Second Language teacher in Newport News. Previously, she earned a Bachelor of Arts degree in Psychology and Leadership Studies with a minor in Linguistics from Christopher Newport University in 2022, and a Masters in Teaching in 2023. Katherine is passionate about all things education! She has been an independent tutor to students grades K-12 in math, science, English, French, and general study skills, while also working in middle schools for the past 3 years. Outside of the classroom, she enjoys being outdoors, reading, and learning new languages. Katherine loves getting to know students and breaking down difficult ideas in a way that each student will understand. She is excited to contribute to Carpenter Tutoring by working with students in French, English, and K-8 math, as well as academic coaching. diff --git a/about/team/katherinev/katherinev.png b/about/team/katherinev/katherinev.png deleted file mode 100644 index de82f40..0000000 Binary files a/about/team/katherinev/katherinev.png and /dev/null differ diff --git a/about/team/katherinev/katherinev.webp b/about/team/katherinev/katherinev.webp deleted file mode 100644 index 856dfca..0000000 Binary files a/about/team/katherinev/katherinev.webp and /dev/null differ diff --git a/about/team/katherinev/name.php b/about/team/katherinev/name.php deleted file mode 100644 index ea4ec1a..0000000 --- a/about/team/katherinev/name.php +++ /dev/null @@ -1 +0,0 @@ -Katherine Vander Vennet diff --git a/about/team/zackh/blurb.php b/about/team/zackh/blurb.php deleted file mode 100644 index eb49046..0000000 --- a/about/team/zackh/blurb.php +++ /dev/null @@ -1 +0,0 @@ - Zack graduated from William & Mary in 2021 with a Bachelors of Science in Computer Science and Applied Mathematics. There, he spent three years tutoring his peers in math and computer science to help them reach a deeper understanding and appreciation of both subjects. Here he gained a passion for teaching and is excited to offer his assistance again at any levels of math and computer science through Carpenter Tutoring. In addition to tutoring, he currently works as an application developer for ADP in Norfolk, VA. In his spare time he loves to bike and spend time with his cat, Hans. diff --git a/about/team/zackh/name.php b/about/team/zackh/name.php deleted file mode 100644 index 5d0283a..0000000 --- a/about/team/zackh/name.php +++ /dev/null @@ -1 +0,0 @@ -Zack H'Doubler diff --git a/about/team/zackh/zackh.png b/about/team/zackh/zackh.png deleted file mode 100644 index c666802..0000000 Binary files a/about/team/zackh/zackh.png and /dev/null differ diff --git a/about/team/zackh/zackh.webp b/about/team/zackh/zackh.webp deleted file mode 100644 index 9281421..0000000 Binary files a/about/team/zackh/zackh.webp and /dev/null differ diff --git a/brochure/brochure.html b/brochure/brochure.html deleted file mode 100644 index 6690f4d..0000000 --- a/brochure/brochure.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - -
-
-
- -
-
- -
-
-
-
- -
-
- -
-
-
-
- -
-
- -
-
-
diff --git a/brochure/brochure.js b/brochure/brochure.js deleted file mode 100644 index 4872373..0000000 --- a/brochure/brochure.js +++ /dev/null @@ -1,34 +0,0 @@ -/* -Copyright (c) 2024 by Daniel Pox (https://codepen.io/danielpox/pen/abOopYo) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - - -document.addEventListener("DOMContentLoaded", (event) => { - const paper = document.querySelector(".paper"); - - const flipButton = document.querySelector("button") - flipButton.addEventListener("click", () => { - paper.classList.toggle("flip") - }) - - const leftSide = paper.querySelector(".page.left"); - leftSide.addEventListener("click", () => { - leftSide.classList.toggle("open") - }); - - const rightSide = paper.querySelector(".page.right"); - rightSide.addEventListener("click", () => { - rightSide.classList.toggle("open") - }); - - const centerSide = paper.querySelector(".page.center"); - centerSide.addEventListener("click", () => { - centerSide.classList.toggle("open") - }); -}); diff --git a/brochure/index.php b/brochure/index.php deleted file mode 100644 index 6dd3621..0000000 --- a/brochure/index.php +++ /dev/null @@ -1,24 +0,0 @@ - - - -
- - -

- Click on pages to fold and unfold and use Flip to toggle front and back. This works best on a tablet or desktop screen. -

- - - -
- -
- - - diff --git a/brochure/styles.css b/brochure/styles.css deleted file mode 100644 index 2abb118..0000000 --- a/brochure/styles.css +++ /dev/null @@ -1,93 +0,0 @@ -/* -Copyright (c) 2024 by Daniel Pox (https://codepen.io/danielpox/pen/abOopYo) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - - -.paper { - display: grid; - - width: 8.25rem; - - grid-template-columns: 8.25rem; - grid-template-rows: 19.41rem; /* .425 aspect */ - - margin: 2rem auto; - - transform-style: preserve-3d; - transition: transform linear 1s; -} -.paper.flip { - transform: rotateY(180deg); -} - -.paper .page { - display: inline-block; - - grid-column: 1 / 2; - grid-row: 1 / 2; - - position: relative; - - transform-style: preserve-3d; - - box-shadow: 0 4px 8px #0001; -} - -.paper .page .side { - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - - background: white; - backface-visibility: hidden; -} - -.paper .page .side.back { - transform: rotateY(180deg); -} - -.page { - transition: transform linear 1s; -} -.left.open { - transform: rotateY(-180deg); -} -.right.open { - transform: rotateY(180deg); -} - -.paper .page .side { - box-shadow: inset 1px 0 #f2f2f2, inset -1px 0 #f2f2f2; -} - -.side img { - max-width: 100%; - max-height: 100%; -} - -.left { - transform: translateZ(2px); - transform-origin: center left; -} - -.right { - transform: translateZ(1px); - transform-origin: center right; -} - -@media only screen and (min-width: 1500px) { - .paper { - width: 21.25em; - - grid-template-columns: 21.25em; - grid-template-rows: 50em; /* .425 aspect */ - } -} diff --git a/policies/index.php b/policies/index.php deleted file mode 100644 index 38dc2d2..0000000 --- a/policies/index.php +++ /dev/null @@ -1,61 +0,0 @@ - - -
-

-

Payment Methods

- We accept payments through Zelle (amy@carpentertutoring.com), Venmo - (@AmyCTutoring), and PayPal (amy@carpentertutoring.com). We also accept - checks made out to Carpenter Tutoring, LLC. Please contact Amy for - a mailing address if you would like to pay by check. -

- -

-

Travel

- Due to high appointment volumes, Amy is only able to travel to students in the Harbour View area of Suffolk, VA. -

- -

Please contact other tutors directly to discuss their locations and in-person policies.

- -

-

Remote sessions

- Remote sessions are typically conducted from tutors' homes. We use online video conferencing software such as - Zoom and Google Meet. - Your tutor will inform you of their preferred meeting method and provide initial meeting instructions and support. -

- -

-

Late Cancellations

- Sessions cancelled within 72 hours of their start time will incur a late - cancellation fee equal to 40% of the cancelled session price. -

- -

-

No-Shows

- Sessions which a student does not attend with no notice of - cancellation will be charged the full session price. -

- -

-

Session Duration

- Sessions are purchased in half-hour increments, and the shortest - appointment duration is 60 minutes. Families are responsible for the - amount of time they book and will be charged based on that amount. - Students who provide no advance notice of a need to end their meeting early will still be responsible for the full session price. If a student is - late to their appointment, we will work to the end of their scheduled - time, but no later. -

- -

-

Proof of Progress Evaluations

- Proof of Progress letters will be returned within 7 days of notification that materials are ready for review. Families are responsible for sending Proof of Progress letters and proof of evaluator credentials to their school system by August 1, the deadline for Proof of Progress submissions in Virginia. Notifications regarding sample readiness sent on or after July 24 of each year will incur a $10 late submission fee per evaluation. All payments are expected within two weeks of receipt of letter(s). Payment method information is available on this site as well as in the email sent along with Proof of Progress letters. -

- -

-

Learning Acceleration Grants

- Carpenter Tutoring is proud to serve Virginia students and families as a vendor for the K-12 Learning Acceleration Grant. Families must share student names as they appear on the grants, associated parent name, and associated address for invoicing purposes. Families are expected to upload emailed invoices at their earliest convenience as there are significant lag times between family submission and fund deposits from ClassWallet. While Carpenter Tutoring will provide an overview of funds used with our tutors with each invoice, families are expected to keep track of fund use and communicate with tutors when funds are nearing exhaustion to plan an end date for services or a transition to out-of-pocket payment. Grant vendors cannot see fund totals or funds used with other vendors, so we rely on families completely to communicate their remaining balances. Families who fail to notify us that their funds are nearly or have been depleted or rescinded but continue to use services will be required to pay for any excesses out-of-pocket. -

-
-
- diff --git a/src/main.rs b/src/main.rs index ca0a3d9..d07d201 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,6 +11,11 @@ use std::fs; use std::io::*; use std::path::Path; use std::path::PathBuf; +use chrono::Datelike; + +fn current_year() -> i32 { + chrono::Utc::now().year() +} trait Post: fmt::Debug { fn dump(&self); @@ -18,6 +23,12 @@ trait Post: fmt::Debug { fn get_content(&self) -> Cow; } +trait Tutor: fmt::Debug { + fn id(&self) -> &str; + fn display_name(&self) -> &str; + fn blurb(&self) -> &str; +} + struct MdFilePost { path: PathBuf, name: OsString, @@ -56,7 +67,11 @@ impl fmt::Debug for MdFilePost { } trait Posts { - fn get_posts(&self) -> impl Iterator; + fn get_posts(&self) -> impl IntoIterator; +} + +trait Tutors { + fn get_tutors(&self) -> impl IntoIterator; } struct FsDirPosts { @@ -71,10 +86,29 @@ impl FsDirPosts { } } +struct FsDirTutors { + path: PathBuf, +} + +impl Tutors for FsDirTutors { + fn get_tutors(&self) -> impl IntoIterator { + let test: Vec = Vec::new(); + test + } +} + +impl FsDirTutors { + fn new(path: &str) -> Self { + Self { + path: PathBuf::from(path), + } + } +} + impl Posts for FsDirPosts { - fn get_posts(&self) -> impl Iterator { - let dirs = fs::read_dir(&self.path).unwrap(); - dirs.flatten().map(|d| MdFilePost::new(&d.path())) + fn get_posts(&self) -> impl IntoIterator { + let files = fs::read_dir(&self.path).unwrap(); + files.flatten().filter(|d| !d.path().file_stem().unwrap().to_str().unwrap_or_default().starts_with('.')).map(|d| MdFilePost::new(&d.path())) } } @@ -105,16 +139,59 @@ struct PostsView { impl PostsView { fn with_posts(posts: &impl Posts) -> Self { Self { - post_titles: posts.get_posts().map(|p| p.display_name().into_owned()).map(String::from).collect() + post_titles: posts.get_posts().into_iter().map(|p| p.display_name().into_owned()).map(String::from).collect() } } } +// TODO: one single Markdown struct with id, name, and content can take over for both MdTutor and +// MdPost if it implements the Tutor and Post traits +// With this, I could have a repo which does all the same loading but returns things of a generic T +// as long as that T is provided it'll map values into those fields? + async fn posts_handler(State(posts): State>) -> Html { let view = PostsView::with_posts(&*posts); Html(view.render().unwrap()) } +#[derive(Debug)] +struct MdTutor { + id: String, + name: String, + blurb: String, +} + +impl Tutor for MdTutor { + fn id(&self) -> &str { + self.id.as_str() + } + + fn display_name(&self) -> &str { + self.name.as_str() + } + + fn blurb(&self) -> &str { + self.blurb.as_str() + } +} + +#[derive(Template)] +#[template(path = "about/index.html")] +struct AboutView { + tutors: Vec, +} + +impl AboutView { + fn with_tutors(tutors: &impl Tutors) -> Self { + todo!() + } +} + +async fn about_handler(State(tutors): State>) -> Html { + let view: AboutView = AboutView::with_tutors(&*tutors); + Html(view.render().unwrap()) +} + #[derive(Template)] #[template(path = "index.html")] struct IndexTemplate; @@ -131,17 +208,30 @@ async fn policies_handler() -> Html { Html(PoliciesTemplate{}.render().unwrap()) } +#[derive(Template)] +#[template(path = "brochure/index.html")] +struct BrochureTemplate; + +async fn brochure_handler() -> Html { + Html(BrochureTemplate{}.render().unwrap()) +} + #[tokio::main] async fn main() { - let repo = Arc::new(FsDirPosts::new(&format!("/data/ct/{}", "blog"))); + let posts = Arc::new(FsDirPosts::new(&format!("/data/ct/{}", "blog"))); + let tutors = Arc::new(FsDirTutors::new(&format!("/data/ct/{}", "team"))); let app = Router::new() - .nest_service("/static", ServeDir::new("static")) - .nest_service("/assets", ServeDir::new("/data/ct/assets")) + .route("/", get(index_handler)) .route("/posts", get(posts_handler)) + .with_state(posts) .route("/policies", get(policies_handler)) - .route("/", get(index_handler)) - .with_state(repo); + .route("/brochure", get(brochure_handler)) + .route("/about", get(about_handler)) + .with_state(tutors) + .nest_service("/assets", ServeDir::new("/data/ct/assets")) + .nest_service("/team", ServeDir::new("/data/ct/team")) + .fallback_service(ServeDir::new("static")); let listener = tokio::net::TcpListener::bind("0.0.0.0:8000").await.unwrap(); axum::serve(listener, app).await.unwrap(); diff --git a/templates/about/blurb.html b/templates/about/blurb.html new file mode 100644 index 0000000..630cf65 --- /dev/null +++ b/templates/about/blurb.html @@ -0,0 +1,4 @@ +
+

{{ tutor.display_name() }}

+

{{ tutor.blurb()|markdown }}

+
diff --git a/templates/about/figure.html b/templates/about/figure.html new file mode 100644 index 0000000..2b8e308 --- /dev/null +++ b/templates/about/figure.html @@ -0,0 +1,8 @@ +
+ + + + {{ tutor.display_name() }} + +
{{ tutor.display_name() }}
+
diff --git a/templates/about/index.html b/templates/about/index.html new file mode 100644 index 0000000..0c1d519 --- /dev/null +++ b/templates/about/index.html @@ -0,0 +1,71 @@ +{% extends "base.html" %} + +{% block main %} + + +
+

+

+ School is tricky, and there is no universal pathway to success. I started + Carpenter Tutoring for those seeking a little help finding their way. +

+

+
+ +
+
+ + + + Amy Carpenter + +
Amy Carpenter, M.Ed.
+
+ +
+

+ I received my B.A. from The College of William and Mary in 2018 and received + my M.Ed. from W&M in 2020. As an undergraduate, I worked and was trained + as a tutor at W&M's peer tutoring center, the TutorZone. During + this period, I conducted over 150 one-on-one appointments with W&M + students in 26 different content areas. I earned lifetime Advanced Tutor + Certification, the highest level W&M can grant, through the College + Reading and Learning Association, and I was trained as a time management + consultant. I took on leadership roles within the TutorZone until I was + working alongside its director. As a graduate student, I became one of the + Graduate Assistants helping oversee the TutorZone as well as an academic + coach to students with high need for academic support. +

+ +

+ I loved getting to work with the TutorZone tutors, but I realized that + I missed being the tutor. There's just nothing like watching the light bulb + of understanding go off or seeing students who had struggled with material + master it! With that realization, I decided to dedicate my life to my + passion -- helping students of all ages learn, succeed, and believe in + themselves. +

+ +

+ My instructional approach focuses on meeting students where they are and + supporting them through any hesitations or discomforts from which academic + difficulties may arise. Whether your student only has to brush up on a few + concepts or is resistant to completing coursework, I will come to each + session with patience, understanding, and just the right amount of + discipline. I truly believe that excellent educational relationships begin + with mutual respect, and I work to build meaningful relationships with all + of my clients. +

+ +

Thank you for considering Carpenter Tutoring.

+
+ +
+ +
+ +{% include "team.html" %} + +{% endblock %} diff --git a/templates/about/team.html b/templates/about/team.html new file mode 100644 index 0000000..b1f0588 --- /dev/null +++ b/templates/about/team.html @@ -0,0 +1,15 @@ +{% let flip = true %} + +{% for tutor in tutors %} +
+ {% if flip == true %} + {% include "blurb.html" %} + {% include "figure.html" %} + {% else %} + {% include "figure.html" %} + {% include "blurb.html" %} + {% endif %} +
+ +
+{% endfor %} diff --git a/templates/base.html b/templates/base.html index 1657ec1..f146a44 100644 --- a/templates/base.html +++ b/templates/base.html @@ -12,8 +12,8 @@ - - + + @@ -50,7 +50,7 @@

- © 2019- Carpenter Tutoring, LLC. All rights reserved. + © 2019-{{ self::current_year() }} Carpenter Tutoring, LLC. All rights reserved.

Visit me on Google diff --git a/templates/brochure/brochure.css b/templates/brochure/brochure.css new file mode 100644 index 0000000..2abb118 --- /dev/null +++ b/templates/brochure/brochure.css @@ -0,0 +1,93 @@ +/* +Copyright (c) 2024 by Daniel Pox (https://codepen.io/danielpox/pen/abOopYo) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + + +.paper { + display: grid; + + width: 8.25rem; + + grid-template-columns: 8.25rem; + grid-template-rows: 19.41rem; /* .425 aspect */ + + margin: 2rem auto; + + transform-style: preserve-3d; + transition: transform linear 1s; +} +.paper.flip { + transform: rotateY(180deg); +} + +.paper .page { + display: inline-block; + + grid-column: 1 / 2; + grid-row: 1 / 2; + + position: relative; + + transform-style: preserve-3d; + + box-shadow: 0 4px 8px #0001; +} + +.paper .page .side { + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + + background: white; + backface-visibility: hidden; +} + +.paper .page .side.back { + transform: rotateY(180deg); +} + +.page { + transition: transform linear 1s; +} +.left.open { + transform: rotateY(-180deg); +} +.right.open { + transform: rotateY(180deg); +} + +.paper .page .side { + box-shadow: inset 1px 0 #f2f2f2, inset -1px 0 #f2f2f2; +} + +.side img { + max-width: 100%; + max-height: 100%; +} + +.left { + transform: translateZ(2px); + transform-origin: center left; +} + +.right { + transform: translateZ(1px); + transform-origin: center right; +} + +@media only screen and (min-width: 1500px) { + .paper { + width: 21.25em; + + grid-template-columns: 21.25em; + grid-template-rows: 50em; /* .425 aspect */ + } +} diff --git a/templates/brochure/brochure.html b/templates/brochure/brochure.html new file mode 100644 index 0000000..b5a3cd3 --- /dev/null +++ b/templates/brochure/brochure.html @@ -0,0 +1,37 @@ + + + +

+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
diff --git a/templates/brochure/brochure.js b/templates/brochure/brochure.js new file mode 100644 index 0000000..4872373 --- /dev/null +++ b/templates/brochure/brochure.js @@ -0,0 +1,34 @@ +/* +Copyright (c) 2024 by Daniel Pox (https://codepen.io/danielpox/pen/abOopYo) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + + +document.addEventListener("DOMContentLoaded", (event) => { + const paper = document.querySelector(".paper"); + + const flipButton = document.querySelector("button") + flipButton.addEventListener("click", () => { + paper.classList.toggle("flip") + }) + + const leftSide = paper.querySelector(".page.left"); + leftSide.addEventListener("click", () => { + leftSide.classList.toggle("open") + }); + + const rightSide = paper.querySelector(".page.right"); + rightSide.addEventListener("click", () => { + rightSide.classList.toggle("open") + }); + + const centerSide = paper.querySelector(".page.center"); + centerSide.addEventListener("click", () => { + centerSide.classList.toggle("open") + }); +}); diff --git a/templates/brochure/index.html b/templates/brochure/index.html new file mode 100644 index 0000000..41a62f4 --- /dev/null +++ b/templates/brochure/index.html @@ -0,0 +1,32 @@ +{% extends "base.html" %} + +{% block style %} + {% include "../styles.css" %} + {% include "brochure.css" %} +{% endblock %} + +{% block main %} + + +
+ + +

+ Click on pages to fold and unfold and use Flip to toggle front and back. This works best on a tablet or desktop screen. +

+ + {% include "brochure.html" %} + +
+ +
+ + + +{% endblock %} diff --git a/templates/index.html b/templates/index.html index 48e85e8..c9b0e60 100644 --- a/templates/index.html +++ b/templates/index.html @@ -123,8 +123,7 @@