chore(templates:example): added some better examples

This commit is contained in:
Maieul BOYER 2026-02-08 14:39:04 +01:00
parent 024590c4f0
commit 9d4224aef3
Signed by: maix
SSH key fingerprint: SHA256:iqCzqFFF5KjRixmDExqbAltCIj9ndlBWIGJf3t9Ln9g
2 changed files with 116 additions and 12 deletions

View file

@ -66,7 +66,122 @@ fn main() {
.to_vec(),
},
},
)]),
),
(
SmolStr::new_static("F3"),
ClusterData {
users: 80,
max_pc: 400,
dead_pc: 1,
silent: false,
piscine: false,
issues: [
(SmolStr::new_static("F1r1s1"), PcIssue::Dead),
(SmolStr::new_static("F1r2s1"), PcIssue::Attention),
]
.into_iter()
.collect(),
map: index::Map {
rows: [
index::MapRow {
range: SmolStr::new_static("R1"),
col: [
MapPos::Empty,
MapPos::Flex,
MapPos::Wall,
MapPos::Door,
MapPos::Empty,
]
.to_vec(),
},
index::MapRow {
range: SmolStr::new_static("R2"),
col: [
MapPos::Empty,
MapPos::Flex,
MapPos::Pc(SmolStr::new_static("F1r1s1")),
MapPos::Pc(SmolStr::new_static("F1r2s1")),
MapPos::Pc(SmolStr::new_static("F1r3s1")),
MapPos::Pc(SmolStr::new_static("F1r4s1")),
MapPos::Pc(SmolStr::new_static("F1r5s1")),
MapPos::Empty,
]
.to_vec(),
},
index::MapRow {
range: SmolStr::new_static("R3"),
col: [
MapPos::Empty,
MapPos::Flex,
MapPos::Wall,
MapPos::Door,
MapPos::Empty,
]
.to_vec(),
},
]
.to_vec(),
},
},
),
(
SmolStr::new_static("F2"),
ClusterData {
users: 180,
max_pc: 200,
dead_pc: 1,
silent: true,
piscine: true,
issues: [
(SmolStr::new_static("F1r1s1"), PcIssue::Dead),
(SmolStr::new_static("F1r2s1"), PcIssue::Attention),
]
.into_iter()
.collect(),
map: index::Map {
rows: [
index::MapRow {
range: SmolStr::new_static("R1"),
col: [
MapPos::Empty,
MapPos::Flex,
MapPos::Wall,
MapPos::Door,
MapPos::Empty,
]
.to_vec(),
},
index::MapRow {
range: SmolStr::new_static("R2"),
col: [
MapPos::Empty,
MapPos::Flex,
MapPos::Pc(SmolStr::new_static("F1r1s1")),
MapPos::Pc(SmolStr::new_static("F1r2s1")),
MapPos::Pc(SmolStr::new_static("F1r3s1")),
MapPos::Pc(SmolStr::new_static("F1r4s1")),
MapPos::Pc(SmolStr::new_static("F1r5s1")),
MapPos::Empty,
]
.to_vec(),
},
index::MapRow {
range: SmolStr::new_static("R3"),
col: [
MapPos::Empty,
MapPos::Flex,
MapPos::Wall,
MapPos::Door,
MapPos::Empty,
]
.to_vec(),
},
]
.to_vec(),
},
},
)
]),
locations: [(SmolStr::new_static("F1r5s1"), LocationData {
login: "maiboyer".into(),
image: "https://friends.42paris.fr/proxy/resize/512/03c61af252becbca11aac5ff49a2e61c/maiboyer.jpg".into(),

View file

@ -1,17 +1,6 @@
use froxy_templates::profile::{self};
use smol_str::SmolStr;
/*
{
friends: std::array::from_fn::<_, 10, _>(|i| Friend {
name: "maiboyer".into(),
image: "https://friends.42paris.fr/proxy/resize/512/03c61af252becbca11aac5ff49a2e61c/maiboyer.jpg".into(),
position: (i < 5).then_some("f1r1s1".into()),
last_active: (i > 6).then_some("Last thuesday".into()),
}).to_vec(),
}
*/
fn main() {
let mut env = minijinja::Environment::new();
profile::add_to_context(&mut env);