🌐 AI搜索 & 代理 主页
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions pgml-dashboard/src/templates/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use pgml_components::Component;
use std::collections::HashMap;

pub use crate::components::{self, NavLink, StaticNav, StaticNavLink};
Expand Down Expand Up @@ -104,6 +105,7 @@ pub struct WebAppBase<'a> {
pub account_management_nav: StaticNav,
pub upper_left_nav: StaticNav,
pub lower_left_nav: StaticNav,
pub body_components: Vec<Component>,
}

impl<'a> WebAppBase<'a> {
Expand Down Expand Up @@ -153,6 +155,11 @@ impl<'a> WebAppBase<'a> {
self
}

pub fn body_components(&mut self, components: Vec<Component>) -> &mut Self {
self.body_components = components;
self
}

pub fn render<T>(&mut self, template: T) -> String
where
T: sailfish::TemplateOnce,
Expand Down
3 changes: 3 additions & 0 deletions pgml-dashboard/templates/layout/web_app_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
<html lang="en-US" data-bs-theme="dark">
<%- head %>
<body>
<% for component in body_components { %>
<%+ component %>
<% } %>
<main>
<div class="container-fluid p-0 min-vh-lg-100">
<div class="row gx-0 min-vh-lg-100 gy-0">
Expand Down