generated from GarandPLG/rust-flake-template
Display structure owner and adjust UI layouts
Add owner line to structure text, using gray label and owner span. Switch side panel layout to Fill/Length and remove left border from side panel widget. Import Stylize for colored text rendering.
This commit is contained in:
@@ -2,7 +2,10 @@ use crate::app::states::skirmish_states::{
|
||||
Players,
|
||||
structures::{BaseBuilding, Ore, Stone, Structure, Tunnel},
|
||||
};
|
||||
use ratatui::{style::Color, text::Line};
|
||||
use ratatui::{
|
||||
style::{Color, Stylize},
|
||||
text::Line,
|
||||
};
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum Structures {
|
||||
@@ -58,6 +61,14 @@ impl Structure for Structures {
|
||||
}
|
||||
|
||||
fn text(&self) -> Vec<Line<'_>> {
|
||||
self.structure().text()
|
||||
let owner: Players = self.structure().get_owner();
|
||||
let mut lines: Vec<Line<'_>> = self.structure().text();
|
||||
|
||||
match owner {
|
||||
Players::Unclaimed => {}
|
||||
_ => lines.push(Line::from_iter(["Owner: ".gray(), owner.get_span()])),
|
||||
}
|
||||
|
||||
lines
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user