feat: add selectable icon styles

This commit is contained in:
Georg Bauer
2026-07-30 18:13:42 +02:00
parent 8c383e3672
commit d8a63c00f5
5 changed files with 326 additions and 66 deletions

View File

@@ -3,6 +3,35 @@ use std::collections::BTreeSet;
use gotcha_gitea::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Copy, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "lowercase")]
pub enum IconStyle {
Duotone,
Bold,
#[default]
#[serde(other)]
Outline,
}
impl IconStyle {
pub fn index(self) -> i32 {
match self {
Self::Outline => 0,
Self::Duotone => 1,
Self::Bold => 2,
}
}
pub fn from_index(index: i32) -> Option<Self> {
match index {
0 => Some(Self::Outline),
1 => Some(Self::Duotone),
2 => Some(Self::Bold),
_ => None,
}
}
}
#[derive(Clone, Deserialize, Serialize)]
pub struct Server {
pub name: String,
@@ -23,6 +52,8 @@ pub struct Preferences {
pub issue_status: String,
#[serde(default = "open_status")]
pub pull_status: String,
#[serde(default)]
pub icon_style: IconStyle,
}
impl Default for Preferences {
@@ -33,6 +64,7 @@ impl Default for Preferences {
last_server: None,
issue_status: open_status(),
pull_status: open_status(),
icon_style: IconStyle::default(),
}
}
}