aboutsummaryrefslogtreecommitdiff
path: root/ui/src/home.rs
blob: 7b58179dbd3077ed56c603c34e47fd62cd5d1cb7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*
    This file is part of jellything (https://codeberg.org/metamuffin/jellything)
    which is licensed under the GNU Affero General Public License (version 3); see /COPYING.
    Copyright (C) 2025 metamuffin <metamuffin.org>
*/

use crate::{
    locale::{Language, tr, trs},
    node_card::NodeCard,
    scaffold::LayoutPage,
};

markup::define! {
    HomePage<'a>(lang: &'a Language) {
        h2 { @tr(lang, "home.bin.root").replace("{title}", &CONF.brand) }
        ul.children.hlist {@for (node, udata) in &toplevel {
            li { @NodeCard { node, udata, lang: &lang } }
        }}
        @for (name, nodes) in &categories {
            @if !nodes.is_empty() {
                h2 { @trs(&lang, &name) }
                ul.children.hlist {@for (node, udata) in nodes {
                    li { @NodeCard { node, udata, lang: &lang } }
                }}
            }
        }
    }
}

pub fn home_page() {
    LayoutPage {
        title: tr(lang, "home").to_string(),
        content: HomePage { lang: &lang },
        ..Default::default()
    }
}