generated from GarandPLG/rust-flake-template
Add side panel and refactor title helpers
Introduce a `side_panel` flag throughout the skirmish state, board creation, and cell area calculation to enable a detachable side panel. Refactor the title helper to own its strings and use a static separator, updating the single‑title helper accordingly. Add a new `SidePanelWidget` and expose the `skirmish_main_area_layout` helper. Extend keybindings with `Tab` and `ShiftTab` actions under a new `Opener` group. Update structures and units to implement a `get_name` method and adjust related traits and imports.
This commit is contained in:
1 parent
06a439ff88
commit
cf843057c3
23 files changed
+302
-123
No files matched your search
+13
-4
@@ -1,14 +1,14 @@
|
||||
use crate::app::states::skirmish_states::{
|
||||
ZoomLevel,
|
||||
structures::{Stone, Structures},
|
||||
units::{OptionalUnit, Units},
|
||||
structures::{Stone, Structure, Structures},
|
||||
units::{Unit, Units},
|
||||
};
|
||||
use ratatui::{
|
||||
buffer::Buffer,
|
||||
layout::{Alignment, Rect},
|
||||
style::{Color, Style, Stylize},
|
||||
text::{Line, Span, ToSpan},
|
||||
widgets::{Block, Borders, Paragraph, Widget},
|
||||
widgets::{Block, BorderType, Borders, Paragraph, Widget},
|
||||
};
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
@@ -52,6 +52,14 @@ impl CellWidget {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn get_structure(&self) -> Structures {
|
||||
self.structure
|
||||
}
|
||||
|
||||
pub fn get_unit_option(&self) -> Option<Units> {
|
||||
self.unit
|
||||
}
|
||||
|
||||
pub fn set_structure(&mut self, sctructure: Structures) -> &mut Self {
|
||||
self.structure = sctructure;
|
||||
self
|
||||
@@ -102,7 +110,7 @@ impl CellWidget {
|
||||
self.zoom_level.get_cell_text_area(
|
||||
self.structure.get_tag(),
|
||||
self.structure.get_level(),
|
||||
self.unit.try_get_tag(),
|
||||
self.unit.get_tag(),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -111,6 +119,7 @@ impl CellWidget {
|
||||
.borders(Borders::ALL)
|
||||
.style(Style::default().fg(self.fg_color()))
|
||||
.title(self.display_coords())
|
||||
.border_type(BorderType::Rounded)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user