Skip to main content

fedimint_server_ui/dashboard/
general.rs

1use std::collections::BTreeMap;
2
3use fedimint_core::PeerId;
4use maud::{Markup, html};
5
6/// Renders the Guardian info card with federation name, session count and
7/// guardian list
8pub fn render(
9    federation_name: Option<&str>,
10    session_count: u64,
11    guardian_names: &BTreeMap<PeerId, String>,
12) -> Markup {
13    html! {
14        div class="card h-100" {
15            div class="card-header dashboard-header" {
16                @if let Some(name) = federation_name {
17                    (name)
18                } @else {
19                    i { "Federation name not set" }
20                }
21            }
22            div class="card-body" {
23                div id="session-count" class="alert alert-info" {
24                    "Session Count: " strong { (session_count) }
25                }
26
27                table class="table table-sm mb-0" {
28                    thead {
29                        tr {
30                            th { "Guardian ID" }
31                            th { "Guardian Name" }
32                        }
33                    }
34                    tbody {
35                        @for (guardian_id, name) in guardian_names {
36                            tr {
37                                td { (guardian_id.to_string()) }
38                                td { (name) }
39                            }
40                        }
41                    }
42                }
43            }
44        }
45    }
46}