From 268ac8eed3e3a585f87fb7b8ed9c9070a746de79 Mon Sep 17 00:00:00 2001 From: finga Date: Thu, 2 May 2024 23:24:07 +0200 Subject: [PATCH] Add css and different colors for dates in the future --- .gitmodules | 3 +++ Cargo.lock | 13 ++++++++++ Cargo.toml | 4 +-- README.md | 3 +++ Trunk.toml | 2 ++ index.html | 11 ++++---- src/main.rs | 71 +++++++++++++++++++++++++++++++--------------------- srug.scss | 12 +++++++++ vendor/bulma | 1 + 9 files changed, 84 insertions(+), 36 deletions(-) create mode 100644 .gitmodules create mode 100644 README.md create mode 100644 Trunk.toml create mode 100644 srug.scss create mode 160000 vendor/bulma diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..5ba7570 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "vendor/bulma"] + path = vendor/bulma + url = https://github.com/jgthms/bulma.git diff --git a/Cargo.lock b/Cargo.lock index eeb31f5..2fb9224 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -677,6 +677,15 @@ dependencies = [ "libc", ] +[[package]] +name = "num_threads" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9" +dependencies = [ + "libc", +] + [[package]] name = "object" version = "0.32.2" @@ -974,7 +983,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", + "itoa", + "js-sys", + "libc", "num-conv", + "num_threads", "powerfmt", "serde", "time-core", diff --git a/Cargo.toml b/Cargo.toml index 8fdbcdd..fa07e63 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,8 +3,6 @@ name = "srug_website" version = "0.1.0" edition = "2021" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - [dependencies] -time = { version = "0.3.36", features = ["macros"] } +time = { version = "0.3.36", features = ["macros", "formatting", "local-offset", "wasm-bindgen"] } yew = { version = "0.21.0", features = ["csr"] } diff --git a/README.md b/README.md new file mode 100644 index 0000000..4e95232 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# SRUG Website + +This is the source repository of the SRUG Website. diff --git a/Trunk.toml b/Trunk.toml new file mode 100644 index 0000000..6b44082 --- /dev/null +++ b/Trunk.toml @@ -0,0 +1,2 @@ +[tools] +sass = "1.43.5" diff --git a/index.html b/index.html index 55dcd9e..d29e4c0 100644 --- a/index.html +++ b/index.html @@ -1,8 +1,9 @@ - - - ¯\_(ツ)_/¯ SRUG: Salzburg Rust User Group - - + + + ¯\_(ツ)_/¯ SRUG: Salzburg Rust User Group + + + diff --git a/src/main.rs b/src/main.rs index e2d3eee..4241d6b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,8 @@ -use time::{macros::datetime, OffsetDateTime}; -use yew::{function_component, html, Html, Properties}; +use time::{ + macros::{datetime, format_description}, + OffsetDateTime, +}; +use yew::{classes, function_component, html, Html, Properties}; #[derive(Properties, PartialEq)] struct Meeting { @@ -9,13 +12,22 @@ struct Meeting { } #[function_component] -fn MeetingRow(props: &Meeting) -> Html { +fn MeetingBox(props: &Meeting) -> Html { + let format = format_description!("[year]-[month]-[day] [hour]:[minute]"); + let upcoming = props.date > OffsetDateTime::now_local().unwrap(); + html! { - - { format!("{}", props.date) } - { &props.location } - { &props.description } - +
+
+

{ props.date.format(&format).unwrap_or("something went utterly wrong".into()) }

+
+
+

{ &props.description }

+
+ +
} } @@ -27,33 +39,28 @@ struct Meetings { #[function_component] fn MeetingsTable(props: &Meetings) -> Html { html! { - - - - - - +
{ props.meetings.iter().map(|row| { - html!{} + html!{} }).collect::() } -
{ "Date" }{ "Location" }{ "Description" }
+ } } -// Date::from_calendar_date(2019, Month::January, 1) -// PrimitiveDateTime::new(date!(2019-01-01), time!(0:00)), -// datetime!(2000-01-01 0:00 UTC) -// .to_offset(offset!(-1)) - #[function_component] fn App() -> Html { let meetings = vec![ Meeting { - date: datetime!(2023-11-28 18:30 +1:00), + date: datetime!(2024-05-23 18:00 +2:00), location: "CCCSBG Space".into(), - description: "Hello World!".into(), + description: "Something.await?".into(), + }, + Meeting { + date: datetime!(2024-04-30 18:00 +2:00), + location: "CCCSBG Space".into(), + description: "All your web are belong to us!".into(), }, Meeting { date: datetime!(2024-01-23 18:00 +1:00), @@ -61,18 +68,26 @@ fn App() -> Html { description: "Hello World, again!".into(), }, Meeting { - date: datetime!(2024-04-30 18:00 +2:00), + date: datetime!(2023-11-28 18:30 +1:00), location: "CCCSBG Space".into(), - description: "All your web are belong to us!".into(), + description: "Hello World!".into(), }, ]; html! { <> -

{ "¯\\_(ツ)_/¯ SRUG: Salzburg Rust User Group" }

-

{ "Eine Anhäufung von planlosen Wesen die was gerne etwas mit Rust machen würden." }

+
+
+
+

{ "¯\\_(ツ)_/¯ SRUG: Salzburg Rust User Group" }

+
+
+
+

{ "lazy_static!(std::collection::VecDeque), die gerne |etwas| unsafe { mit Rust machen } würde.await?;" }

-
+
+
+ diff --git a/srug.scss b/srug.scss new file mode 100644 index 0000000..2b0054a --- /dev/null +++ b/srug.scss @@ -0,0 +1,12 @@ +@charset "utf-8"; +@import "vendor/bulma/bulma.scss"; + +body { + display: flex; + min-height: 100vh; + flex-direction: column; +} + +#wrapper { + flex: 1; +} diff --git a/vendor/bulma b/vendor/bulma new file mode 160000 index 0000000..53f62f4 --- /dev/null +++ b/vendor/bulma @@ -0,0 +1 @@ +Subproject commit 53f62f465b01c7196085a29cd56cf0c9093579e0