From 976d872eedf5c564ad207b9def7d01f7c093d117 Mon Sep 17 00:00:00 2001 From: Gabriel Kaszewski Date: Wed, 3 Jun 2026 10:07:41 +0200 Subject: [PATCH] feat: add EmbedProfileTemplate struct --- crates/adapters/template-askama/src/lib.rs | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/crates/adapters/template-askama/src/lib.rs b/crates/adapters/template-askama/src/lib.rs index bfc2274..8ddc215 100644 --- a/crates/adapters/template-askama/src/lib.rs +++ b/crates/adapters/template-askama/src/lib.rs @@ -230,6 +230,40 @@ impl<'a> ProfileTemplate<'a> { } } +#[derive(Template)] +#[template(path = "embed_profile.html")] +pub struct EmbedProfileTemplate<'a> { + pub profile_display_name: String, + pub profile_user_id: uuid::Uuid, + pub profile_url: String, + pub stats: &'a UserStats, + pub avg_rating_display: String, + pub favorite_director_display: String, + pub most_active_month_display: String, + pub view: &'a str, + pub entries: Option<&'a Paginated>, + pub current_offset: u32, + pub has_more: bool, + pub limit: u32, + pub history: Option<&'a Vec>, + pub trends: Option<&'a UserTrends>, + pub monthly_rating_rows: Vec>, + pub heatmap: Vec, + pub page_items: Vec, + pub sort_by: String, +} + +impl<'a> EmbedProfileTemplate<'a> { + pub fn filter_qs(&self) -> String { + let parts = vec![ + format!("view={}", self.view), + format!("sort_by={}", self.sort_by), + "embed=1".to_string(), + ]; + format!("&{}", parts.join("&")) + } +} + pub struct RemoteActorData { pub handle: String, pub display_name: Option,