86 lines
3.3 KiB
Rust
86 lines
3.3 KiB
Rust
use std::collections::HashMap;
|
|
|
|
use froxy_templates::index::{self, ClusterData, IndexData, LocationData, MapPos, PcIssue};
|
|
use smol_str::SmolStr;
|
|
|
|
fn main() {
|
|
let mut env = minijinja::Environment::new();
|
|
index::add_to_context(&mut env);
|
|
|
|
let data = index::render(
|
|
&env,
|
|
IndexData {
|
|
clusters: HashMap::from([(
|
|
SmolStr::new_static("F1"),
|
|
ClusterData {
|
|
users: 80,
|
|
max_pc: 100,
|
|
dead_pc: 1,
|
|
silent: false,
|
|
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(),
|
|
me: false,
|
|
friend: false,
|
|
close_friend: false,
|
|
pooled: false,
|
|
})]
|
|
.into_iter()
|
|
.collect(),
|
|
current_cluster: SmolStr::new_static("F1"),
|
|
},
|
|
)
|
|
.unwrap();
|
|
|
|
println!("{data}");
|
|
}
|