Treat elements with "Ultimate Goal" label specially
Mainly restyle them to appear different from other techtree elements. Also ignore any element status for these, because it is meaningless (they can never be reached).
This commit is contained in:
parent
be7f305a6b
commit
8b0aef0599
2 changed files with 12 additions and 1 deletions
|
|
@ -128,9 +128,15 @@ fn element_from_issue(issue: &forgejo_api::structs::Issue) -> anyhow::Result<cra
|
|||
.iter()
|
||||
.any(|l| l.name.as_deref() == Some("Completed"));
|
||||
|
||||
let has_ultimate_label = labels
|
||||
.iter()
|
||||
.any(|l| l.name.as_deref() == Some("Ultimate Goal"));
|
||||
|
||||
let status = match issue.state.context("Missing issue state")? {
|
||||
forgejo_api::structs::StateType::Open => {
|
||||
if has_completed_label {
|
||||
if has_ultimate_label {
|
||||
crate::tree::ElementStatus::UltimateGoal
|
||||
} else if has_completed_label {
|
||||
crate::tree::ElementStatus::Completed
|
||||
} else if issue.assignee.is_some()
|
||||
|| issue.assignees.as_ref().is_some_and(|v| !v.is_empty())
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ impl Element {
|
|||
let (color, background) = match (subtree_role, status) {
|
||||
(Some(SubtreeElementRole::ElementOfInterest), _) => ("black", "white"),
|
||||
(Some(SubtreeElementRole::Dependant), _) => ("gray", "gray"),
|
||||
(_, ElementStatus::UltimateGoal) => ("black", "white"),
|
||||
(_, ElementStatus::Missing) => (
|
||||
"#800",
|
||||
// Highlight root elements
|
||||
|
|
@ -100,6 +101,7 @@ impl Element {
|
|||
let class = match (role, status) {
|
||||
(Some(SubtreeElementRole::ElementOfInterest), _) => "eoi",
|
||||
(Some(SubtreeElementRole::Dependant), _) => "dependant",
|
||||
(_, ElementStatus::UltimateGoal) => "ultimate",
|
||||
(_, ElementStatus::Missing) => "dep_missing",
|
||||
(_, ElementStatus::Assigned) => "dep_assigned",
|
||||
(_, ElementStatus::Completed) => "dep_completed",
|
||||
|
|
@ -116,6 +118,7 @@ fn mermaid_classes() -> String {
|
|||
r##"
|
||||
classDef eoi fill:#fff, stroke:#000, color:#000;
|
||||
classDef dependant fill:#fff, stroke:#888, color:#888;
|
||||
classDef ultimate fill:#fff, stroke:#000, color:#000;
|
||||
classDef dep_missing fill:#fcc, stroke:#800, color:#000;
|
||||
classDef dep_assigned fill:#ffa, stroke:#a50, color:#000;
|
||||
classDef dep_completed fill:#afa, stroke:#080, color:#000;
|
||||
|
|
@ -128,6 +131,7 @@ pub enum ElementStatus {
|
|||
Missing,
|
||||
Assigned,
|
||||
Completed,
|
||||
UltimateGoal,
|
||||
}
|
||||
|
||||
impl std::fmt::Display for ElementStatus {
|
||||
|
|
@ -136,6 +140,7 @@ impl std::fmt::Display for ElementStatus {
|
|||
ElementStatus::Missing => "MISSING",
|
||||
ElementStatus::Assigned => "ASSIGNED",
|
||||
ElementStatus::Completed => "COMPLETED",
|
||||
ElementStatus::UltimateGoal => "ULTIMATE GOAL",
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue