start
This commit is contained in:
parent
8afdd208c6
commit
8e82ec9523
23 changed files with 3345 additions and 0 deletions
43
froxy-templates/src/profile.rs
Normal file
43
froxy-templates/src/profile.rs
Normal 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,
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue