feat: add selectable icon styles
This commit is contained in:
@@ -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(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user