tui fixed v1

This commit is contained in:
maxstrb 2025-09-24 22:38:01 +02:00
parent 3681aa2a22
commit bbee1ca79d
5 changed files with 19 additions and 4 deletions

View file

@ -165,6 +165,10 @@ impl App<'_> {
AppEvent::Reload => {
self.days.reload_day_counts(db);
}
AppEvent::TagEdit => {
self.switch_focus(FocusedComponent::DayPopup);
self.day_popup.tag_edit();
}
AppEvent::MonthSet(month) => {
self.days.reload(month, self.year.year, 1);
}

View file

@ -215,6 +215,7 @@ impl Days {
Some(vec![AppEvent::AddEvent(start, end)])
}
KeyCode::Char('t') => Some(vec![AppEvent::TagEdit]),
KeyCode::Down => self.handle_focused_arrows(CursorMovement::Down),
KeyCode::Up => self.handle_focused_arrows(CursorMovement::Up),
KeyCode::Char(' ') => {

View file

@ -12,6 +12,7 @@ pub enum AppEvent {
MonthScrolled(Direction),
Reload,
TagEdit,
AddEvent(NaiveDate, NaiveDate),

View file

@ -71,7 +71,7 @@ impl Focused for DayDetails {
None
}
KeyCode::Enter => {
KeyCode::Delete => {
self.state = State::DeletionConfirm(false);
None
}
@ -119,7 +119,9 @@ impl DayDetails {
if self.events.is_empty() {
let outline = Block::bordered()
.border_set(border::ROUNDED)
.border_style(Style::new().fg(Color::Blue));
.border_style(Style::new().fg(Color::Blue))
.title_alignment(Alignment::Center)
.title(" Day details - edit ");
let no_events_text = Paragraph::new("No events for this day")
.style(Style::default().fg(Color::Red))
@ -133,7 +135,10 @@ impl DayDetails {
State::EventSelect => {
let outline = Block::bordered()
.border_set(border::ROUNDED)
.border_style(Style::new().fg(Color::Blue));
.border_style(Style::new().fg(Color::Blue))
.title(" Day details - edit ")
.title_alignment(Alignment::Center);
let layout = Layout::vertical([Constraint::Length(3), Constraint::Fill(1)])
.split(outline.inner(area));
outline.render(area, buf);
@ -167,7 +172,7 @@ impl DayDetails {
State::DeletionConfirm(confirm) => {
let block = Block::bordered()
.title(" Manage Tags ")
.title(" Day details - edit ")
.title_alignment(Alignment::Center)
.border_set(border::ROUNDED)
.border_style(Style::default().fg(Color::Blue))

View file

@ -46,6 +46,10 @@ impl Popup<'_> {
pub fn show_day(&mut self, day: NaiveDate, events: Vec<Event>, tag_names: Vec<String>) {
self.self_state = PopupType::DayDetails(DayDetails::show_day(day, events, tag_names));
}
pub fn tag_edit(&mut self) {
self.self_state = PopupType::TagManagement(TagManagement::default());
}
}
impl Focused for Popup<'_> {