This commit is contained in:
Maieul BOYER 2026-02-06 23:24:21 +01:00
parent 8afdd208c6
commit 8e82ec9523
Signed by: maix
SSH key fingerprint: SHA256:iqCzqFFF5KjRixmDExqbAltCIj9ndlBWIGJf3t9Ln9g
23 changed files with 3345 additions and 0 deletions

View file

@ -0,0 +1,43 @@
use smol_str::SmolStr;
pub use crate::templates::PROFILE as TEMPLATE;
pub fn add_to_context(env: &mut minijinja::Environment) {
if env.get_template("template.html").is_err() {
crate::meta_template::add_to_context(env);
}
if env.get_template("open_modal.html").is_err() {
crate::open_modal::add_to_context(env);
}
env.add_template("profile.html", TEMPLATE).unwrap();
}
pub fn render(env: &minijinja::Environment, data: ProfileData) -> Result<String, minijinja::Error> {
let template = env.get_template("profile.html")?;
template.render(data)
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct ProfileUser {
pub position: Option<SmolStr>,
pub last_active: SmolStr,
pub image: String,
pub name: SmolStr,
pub pool: Option<SmolStr>,
pub id: u64,
pub is_friend: bool,
pub is_self: bool,
pub github: Option<String>,
pub website: Option<String>,
pub discord: Option<String>,
/// profile description
pub recit: Option<String>,
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct ProfileData {
pub user: ProfileUser,
}