aboutsummaryrefslogtreecommitdiff
path: root/ui/src/components/filter.rs
blob: cd2b63cadfa2e58f444f19a4a10ce4f0cc5b710b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/*
    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) 2026 metamuffin <metamuffin.org>
*/

use crate::RenderInfo;
use jellycommon::jellyobject::Tag;
use jellyui_locale::tr;

pub struct FilterInfo {
    kinds: Vec<(Tag, u64)>,
}

markup::define! {
    Filter<'a>(ri: &'a RenderInfo<'a>, info: &'a FilterInfo) { .filter {
        ul.kinds {
            @for (k, count) in &info.kinds {
                li { a[href=format!("?fk={k}")] { @tr(ri.lang, &format!("tag.kind.{k}")) ": " @count } }
            }
        }
    }}
}