globe for status

This commit is contained in:
Simon
2026-03-21 20:21:43 +00:00
parent 9bba981796
commit 05ea90405b
2 changed files with 16 additions and 0 deletions

View File

@@ -410,6 +410,13 @@ fn channel_group_title(group_id: &str) -> &'static str {
}
}
fn channel_group_system_image(group_id: &str) -> Option<&'static str> {
match group_id {
"jav" | "chinese" => Some("globe"),
_ => None,
}
}
fn channel_group_order(group_id: &str) -> usize {
match group_id {
"meta-search" => 0,
@@ -483,6 +490,7 @@ pub fn build_channel_groups(channels: &[ChannelView]) -> Vec<ChannelGroup> {
groups.push(ChannelGroup {
id: group_id.clone(),
title: channel_group_title(&group_id).to_string(),
systemImage: channel_group_system_image(&group_id).map(str::to_string),
channelIds: channel_ids,
});
}
@@ -675,5 +683,11 @@ mod tests {
.expect("meta group present");
assert_eq!(meta_group["channelIds"], serde_json::json!(["all"]));
assert!(meta_group.get("channels").is_none());
let chinese_group = groups
.iter()
.find(|group| group["id"] == "chinese")
.expect("chinese group present");
assert_eq!(chinese_group["systemImage"], "globe");
}
}

View File

@@ -26,6 +26,8 @@ pub struct Channel {
pub struct ChannelGroup {
pub id: String,
pub title: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub systemImage: Option<String>,
pub channelIds: Vec<String>,
}