fedimint_gateway_ui/
federation.rs

1use fedimint_core::Amount;
2use fedimint_gateway_common::FederationInfo;
3use maud::{Markup, html};
4
5pub fn render(fed: &FederationInfo) -> Markup {
6    html!(
7        @let bal = fed.balance_msat;
8        @let balance_class = if bal == Amount::ZERO {
9            "alert alert-danger"
10        } else {
11            "alert alert-success"
12        };
13
14        div class="row gy-4 mt-2" {
15            div class="col-12" {
16                div class="card h-100" {
17                    div class="card-header dashboard-header" {
18                        (fed.federation_name.clone().unwrap_or("Unnamed Federation".to_string()))
19                    }
20                    div class="card-body" {
21                        div id="balance" class=(balance_class) {
22                            "Balance: " strong { (fed.balance_msat) }
23                        }
24                        table class="table table-sm mb-0" {
25                            tbody {
26                                tr {
27                                    th { "Federation ID" }
28                                    td { (fed.federation_id) }
29                                }
30                                tr {
31                                    th { "Lightning Fee" }
32                                    td {
33                                        table class="table table-sm mb-0" {
34                                            tbody {
35                                                tr {
36                                                    th { "Base Fee" }
37                                                    td { (fed.config.lightning_fee.base) }
38                                                }
39                                                tr {
40                                                    th { "Parts Per Million" }
41                                                    td { (fed.config.lightning_fee.parts_per_million) }
42                                                }
43                                            }
44                                        }
45                                    }
46                                }
47                                tr {
48                                    th { "Transaction Fee" }
49                                    td {
50                                        table class="table table-sm mb-0" {
51                                            tbody {
52                                                tr {
53                                                    th { "Base Fee" }
54                                                    td { (fed.config.transaction_fee.base) }
55                                                }
56                                                tr {
57                                                    th { "Parts Per Million" }
58                                                    td { (fed.config.transaction_fee.parts_per_million) }
59                                                }
60                                            }
61                                        }
62                                    }
63                                }
64                            }
65                        }
66                    }
67                }
68            }
69        }
70    )
71}