Compare commits
2 commits
livecoding
...
main
Author | SHA1 | Date | |
---|---|---|---|
929daea75e | |||
faad5956cb |
5 changed files with 78 additions and 8 deletions
BIN
presentation/img/rust_code.png
Normal file
BIN
presentation/img/rust_code.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 34 KiB |
BIN
presentation/img/wasm_code.png
Normal file
BIN
presentation/img/wasm_code.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 31 KiB |
BIN
presentation/img/web_app.png
Normal file
BIN
presentation/img/web_app.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
|
@ -18,11 +18,13 @@ Das Projekt
|
||||||
|
|
||||||
.. rjs-div:: grid grid-cols-2 gap-8
|
.. rjs-div:: grid grid-cols-2 gap-8
|
||||||
|
|
||||||
.. rjs-fragments:: fade-right
|
.. rjs-box:: bg-gray-700 rounded-3xl
|
||||||
|
|
||||||
- 👨🏻💻 Entwickler: Martin Kavik
|
.. rjs-fragments:: fade-right
|
||||||
- ⚖️ MIT-Lizenz
|
|
||||||
- 📅 Erstes Release: 2019
|
- 👨🏻💻 Entwickler: Martin Kavik
|
||||||
|
- ⚖️ MIT-Lizenz
|
||||||
|
- 📅 Erstes Release: 2019
|
||||||
|
|
||||||
.. image:: img/martin_kavik.png
|
.. image:: img/martin_kavik.png
|
||||||
|
|
||||||
|
@ -30,8 +32,10 @@ Das Projekt
|
||||||
Architektur
|
Architektur
|
||||||
===========
|
===========
|
||||||
|
|
||||||
.. image:: img/diagram.svg
|
.. rjs-box:: bg-gray-700 rounded-3xl text-center
|
||||||
:width: 60%
|
|
||||||
|
.. image:: img/diagram.svg
|
||||||
|
:width: 60%
|
||||||
|
|
||||||
|
|
||||||
Code
|
Code
|
||||||
|
@ -108,6 +112,28 @@ Setup
|
||||||
#. Anwendung mit ``trunk serve`` kompilieren und live im Browser anzeigen
|
#. Anwendung mit ``trunk serve`` kompilieren und live im Browser anzeigen
|
||||||
#. Anwendung mit ``trunk build --release`` im Releasemodus kompilieren
|
#. Anwendung mit ``trunk build --release`` im Releasemodus kompilieren
|
||||||
|
|
||||||
|
.. rjs-effect::
|
||||||
|
|
||||||
|
.. rjs-div:: grid grid-cols-3 gap-8 mt-16
|
||||||
|
|
||||||
|
.. rjs-box:: bg-gray-700 rounded-3xl text-center
|
||||||
|
|
||||||
|
Rust-Code
|
||||||
|
|
||||||
|
.. image:: img/rust_code.png
|
||||||
|
|
||||||
|
.. rjs-box:: bg-gray-700 rounded-3xl text-center
|
||||||
|
|
||||||
|
WASM
|
||||||
|
|
||||||
|
.. image:: img/wasm_code.png
|
||||||
|
|
||||||
|
.. rjs-box:: bg-gray-700 rounded-3xl text-center
|
||||||
|
|
||||||
|
Webbrowser
|
||||||
|
|
||||||
|
.. image:: img/web_app.png
|
||||||
|
|
||||||
|
|
||||||
Ende
|
Ende
|
||||||
====
|
====
|
||||||
|
@ -118,3 +144,19 @@ Ende
|
||||||
|
|
||||||
.. image:: img/seed_logo.svg
|
.. image:: img/seed_logo.svg
|
||||||
:width: 30%
|
:width: 30%
|
||||||
|
|
||||||
|
.. rjs-div:: grid grid-cols-2 gap-8
|
||||||
|
|
||||||
|
.. rjs-box:: bg-gray-700 rounded-3xl
|
||||||
|
|
||||||
|
Webseite von Seed
|
||||||
|
|
||||||
|
https://seed-rs.org
|
||||||
|
|
||||||
|
.. rjs-box:: bg-gray-700 rounded-3xl
|
||||||
|
|
||||||
|
Quellcode zu diese Präsentation
|
||||||
|
|
||||||
|
https://code.thetadev.de/HSA/seed-presentation
|
||||||
|
|
||||||
|
|
||||||
|
|
32
src/main.rs
32
src/main.rs
|
@ -5,7 +5,6 @@ use openmensa_rs::{request::MealRequest, Meal};
|
||||||
use seed::{prelude::*, *};
|
use seed::{prelude::*, *};
|
||||||
|
|
||||||
const DATE_ISO_FMT: &str = "%Y-%m-%d";
|
const DATE_ISO_FMT: &str = "%Y-%m-%d";
|
||||||
const DATE_DE_FMT: &str = "%d.%m.%Y";
|
|
||||||
|
|
||||||
// ------ ------
|
// ------ ------
|
||||||
// Init
|
// Init
|
||||||
|
@ -67,7 +66,36 @@ fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
|
||||||
|
|
||||||
// `view` describes what to display.
|
// `view` describes what to display.
|
||||||
fn view(model: &Model) -> Node<Msg> {
|
fn view(model: &Model) -> Node<Msg> {
|
||||||
div!["Hello World"]
|
div![
|
||||||
|
h1![format!("Speiseplan vom {}", model.date.format("%d.%m.%Y"))],
|
||||||
|
input![
|
||||||
|
attrs! {
|
||||||
|
At::Type => "date",
|
||||||
|
At::Value => model.date.format(DATE_ISO_FMT)
|
||||||
|
},
|
||||||
|
input_ev(Ev::Input, Msg::SetDate),
|
||||||
|
],
|
||||||
|
if &model.meals.len() > &0 {
|
||||||
|
view_meals(&model.meals)
|
||||||
|
} else {
|
||||||
|
p!["Kein Speiseplan verfügbar"]
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
fn view_meals(meals: &[Meal]) -> Node<Msg> {
|
||||||
|
ul![meals.iter().map(|meal| {
|
||||||
|
let price = meal.prices().students();
|
||||||
|
let price_str = match price {
|
||||||
|
Some(p) => format!("{:.2} €", p),
|
||||||
|
None => String::from("unbekannt"),
|
||||||
|
};
|
||||||
|
|
||||||
|
li![
|
||||||
|
el_key(&meal.id()),
|
||||||
|
format!("{} ({})", meal.name(), price_str),
|
||||||
|
]
|
||||||
|
})]
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------ ------
|
// ------ ------
|
||||||
|
|
Loading…
Reference in a new issue