@@ -3,35 +3,6 @@ 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, Copy, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum AppearanceMode {
|
||||
@@ -82,8 +53,6 @@ pub struct Preferences {
|
||||
#[serde(default = "open_status")]
|
||||
pub pull_status: String,
|
||||
#[serde(default)]
|
||||
pub icon_style: IconStyle,
|
||||
#[serde(default)]
|
||||
pub appearance: AppearanceMode,
|
||||
}
|
||||
|
||||
@@ -95,7 +64,6 @@ impl Default for Preferences {
|
||||
last_server: None,
|
||||
issue_status: open_status(),
|
||||
pull_status: open_status(),
|
||||
icon_style: IconStyle::default(),
|
||||
appearance: AppearanceMode::default(),
|
||||
}
|
||||
}
|
||||
@@ -126,17 +94,7 @@ pub struct HistoryCommit {
|
||||
pub struct State {
|
||||
pub preferences: Preferences,
|
||||
pub active_server: Option<usize>,
|
||||
pub active_repository: Option<(String, String)>,
|
||||
pub active_issue: Option<i64>,
|
||||
pub active_pull: Option<(String, String, i64)>,
|
||||
pub active_commit: Option<String>,
|
||||
pub opened_from_home: bool,
|
||||
pub repositories: Vec<RepositoryData>,
|
||||
pub issues: Vec<models::Issue>,
|
||||
pub pulls: Vec<models::Issue>,
|
||||
pub branches: Vec<String>,
|
||||
pub active_branch: Option<String>,
|
||||
pub commits: Vec<HistoryCommit>,
|
||||
}
|
||||
|
||||
pub struct HomeData {
|
||||
@@ -149,6 +107,11 @@ pub struct IssueDetails {
|
||||
pub comments: Vec<models::Comment>,
|
||||
}
|
||||
|
||||
pub struct MilestoneDetails {
|
||||
pub milestone: models::Milestone,
|
||||
pub issues: Vec<models::Issue>,
|
||||
}
|
||||
|
||||
pub struct PullDetails {
|
||||
pub pull: models::PullRequest,
|
||||
pub comments: Vec<models::Comment>,
|
||||
|
||||
Reference in New Issue
Block a user