feat(server): working friend page

This commit is contained in:
Maieul BOYER 2026-02-08 23:34:44 +01:00
parent 83433186f3
commit 0b17c760cb
Signed by: maix
SSH key fingerprint: SHA256:iqCzqFFF5KjRixmDExqbAltCIj9ndlBWIGJf3t9Ln9g
2126 changed files with 35620 additions and 42 deletions

View file

@ -16,7 +16,7 @@ pub fn render(env: &minijinja::Environment, data: FriendsData) -> Result<String,
template.render(data)
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, PartialEq, Eq, Hash)]
pub struct Friend {
pub name: smol_str::SmolStr,
pub image: String,
@ -24,7 +24,7 @@ pub struct Friend {
pub last_active: Option<smol_str::SmolStr>,
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, PartialEq, Eq, Hash)]
pub struct FriendsData {
pub friends: Vec<Friend>,
}

View file

@ -1,5 +1,6 @@
use std::collections::HashMap;
use indexmap::IndexMap;
use smol_str::SmolStr;
pub use crate::templates::INDEX;
@ -20,7 +21,7 @@ pub fn render(env: &minijinja::Environment, data: IndexData) -> Result<String, m
template.render(data)
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, PartialEq, Eq, Hash)]
pub struct LocationData {
pub login: SmolStr,
pub image: String,
@ -38,10 +39,10 @@ pub struct ClusterData {
pub silent: bool,
pub piscine: bool,
pub map: Map,
pub issues: HashMap<SmolStr, PcIssue>,
pub issues: IndexMap<SmolStr, PcIssue>,
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Default)]
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Default, PartialEq, Eq, Hash)]
#[serde(try_from = "SmolStr", into = "SmolStr")]
pub enum PcIssue {
#[default]
@ -69,7 +70,7 @@ impl From<PcIssue> for SmolStr {
}
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, PartialEq, Eq, Hash)]
#[serde(from = "SmolStr", into = "SmolStr")]
pub enum MapPos {
Wall,
@ -102,20 +103,20 @@ impl From<MapPos> for SmolStr {
}
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, PartialEq, Eq, Hash)]
pub struct MapRow {
pub range: SmolStr,
pub col: Vec<MapPos>,
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, PartialEq, Eq, Hash)]
pub struct Map {
pub rows: Vec<MapRow>,
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct IndexData {
pub locations: HashMap<SmolStr, LocationData>,
pub clusters: HashMap<SmolStr, ClusterData>,
pub locations: IndexMap<SmolStr, LocationData>,
pub clusters: IndexMap<SmolStr, ClusterData>,
pub current_cluster: SmolStr,
}