Compare commits
1 commit
main
...
livecoding
Author | SHA1 | Date | |
---|---|---|---|
cd02c48a14 |
5 changed files with 8 additions and 78 deletions
Binary file not shown.
Before Width: | Height: | Size: 34 KiB |
Binary file not shown.
Before Width: | Height: | Size: 31 KiB |
Binary file not shown.
Before Width: | Height: | Size: 3.2 KiB |
|
@ -18,13 +18,11 @@ Das Projekt
|
||||||
|
|
||||||
.. rjs-div:: grid grid-cols-2 gap-8
|
.. rjs-div:: grid grid-cols-2 gap-8
|
||||||
|
|
||||||
.. rjs-box:: bg-gray-700 rounded-3xl
|
.. rjs-fragments:: fade-right
|
||||||
|
|
||||||
.. rjs-fragments:: fade-right
|
- 👨🏻💻 Entwickler: Martin Kavik
|
||||||
|
- ⚖️ MIT-Lizenz
|
||||||
- 👨🏻💻 Entwickler: Martin Kavik
|
- 📅 Erstes Release: 2019
|
||||||
- ⚖️ MIT-Lizenz
|
|
||||||
- 📅 Erstes Release: 2019
|
|
||||||
|
|
||||||
.. image:: img/martin_kavik.png
|
.. image:: img/martin_kavik.png
|
||||||
|
|
||||||
|
@ -32,10 +30,8 @@ Das Projekt
|
||||||
Architektur
|
Architektur
|
||||||
===========
|
===========
|
||||||
|
|
||||||
.. rjs-box:: bg-gray-700 rounded-3xl text-center
|
.. image:: img/diagram.svg
|
||||||
|
:width: 60%
|
||||||
.. image:: img/diagram.svg
|
|
||||||
:width: 60%
|
|
||||||
|
|
||||||
|
|
||||||
Code
|
Code
|
||||||
|
@ -112,28 +108,6 @@ 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
|
||||||
====
|
====
|
||||||
|
@ -144,19 +118,3 @@ 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,6 +5,7 @@ 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
|
||||||
|
@ -66,36 +67,7 @@ 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![
|
div!["Hello World"]
|
||||||
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