Skip to content
This repository was archived by the owner on Jul 24, 2026. It is now read-only.

Commit cf07e83

Browse files
committed
refactor(tui): avoid to show details in a new view
1 parent c82f31a commit cf07e83

5 files changed

Lines changed: 54 additions & 10 deletions

File tree

crates/tui/src/app/mod.rs

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -340,9 +340,15 @@ impl App {
340340
crate::ui::keymap::AppAction::Up => {
341341
if self.state.screen == Screen::Home
342342
&& self.state.section == Section::Transactions
343-
&& self.state.transactions.mode == TransactionsMode::List
343+
&& matches!(
344+
self.state.transactions.mode,
345+
TransactionsMode::List | TransactionsMode::Detail
346+
)
344347
{
345348
self.state.transactions.select_prev();
349+
if self.state.transactions.mode == TransactionsMode::Detail {
350+
self.open_transaction_detail().await?;
351+
}
346352
} else if self.state.screen == Screen::Home
347353
&& self.state.section == Section::Transactions
348354
&& matches!(
@@ -366,22 +372,34 @@ impl App {
366372
self.transaction_form_select_prev();
367373
} else if self.state.screen == Screen::Home
368374
&& self.state.section == Section::Wallets
369-
&& self.state.wallets.mode == WalletsMode::List
375+
&& matches!(self.state.wallets.mode, WalletsMode::List | WalletsMode::Detail)
370376
{
371377
self.wallets_select_prev();
378+
if self.state.wallets.mode == WalletsMode::Detail {
379+
self.open_wallet_detail().await?;
380+
}
372381
} else if self.state.screen == Screen::Home
373382
&& self.state.section == Section::Flows
374-
&& self.state.flows.mode == FlowsMode::List
383+
&& matches!(self.state.flows.mode, FlowsMode::List | FlowsMode::Detail)
375384
{
376385
self.flows_select_prev();
386+
if self.state.flows.mode == FlowsMode::Detail {
387+
self.open_flow_detail().await?;
388+
}
377389
}
378390
}
379391
crate::ui::keymap::AppAction::Down => {
380392
if self.state.screen == Screen::Home
381393
&& self.state.section == Section::Transactions
382-
&& self.state.transactions.mode == TransactionsMode::List
394+
&& matches!(
395+
self.state.transactions.mode,
396+
TransactionsMode::List | TransactionsMode::Detail
397+
)
383398
{
384399
self.state.transactions.select_next();
400+
if self.state.transactions.mode == TransactionsMode::Detail {
401+
self.open_transaction_detail().await?;
402+
}
385403
} else if self.state.screen == Screen::Home
386404
&& self.state.section == Section::Transactions
387405
&& matches!(
@@ -405,14 +423,20 @@ impl App {
405423
self.transaction_form_select_next();
406424
} else if self.state.screen == Screen::Home
407425
&& self.state.section == Section::Wallets
408-
&& self.state.wallets.mode == WalletsMode::List
426+
&& matches!(self.state.wallets.mode, WalletsMode::List | WalletsMode::Detail)
409427
{
410428
self.wallets_select_next();
429+
if self.state.wallets.mode == WalletsMode::Detail {
430+
self.open_wallet_detail().await?;
431+
}
411432
} else if self.state.screen == Screen::Home
412433
&& self.state.section == Section::Flows
413-
&& self.state.flows.mode == FlowsMode::List
434+
&& matches!(self.state.flows.mode, FlowsMode::List | FlowsMode::Detail)
414435
{
415436
self.flows_select_next();
437+
if self.state.flows.mode == FlowsMode::Detail {
438+
self.open_flow_detail().await?;
439+
}
416440
}
417441
}
418442
crate::ui::keymap::AppAction::Input(ch) => {

crates/tui/src/ui/screens/flows.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,14 @@ pub fn render(frame: &mut Frame<'_>, area: Rect, state: &AppState) {
2424
render_header(frame, layout[0], state, &theme);
2525

2626
match state.flows.mode {
27-
FlowsMode::Detail => render_detail(frame, layout[1], state, &theme),
27+
FlowsMode::Detail => {
28+
let columns = Layout::default()
29+
.direction(Direction::Horizontal)
30+
.constraints([Constraint::Percentage(55), Constraint::Percentage(45)])
31+
.split(layout[1]);
32+
render_list(frame, columns[0], state, &theme);
33+
render_detail(frame, columns[1], state, &theme);
34+
}
2835
FlowsMode::Create | FlowsMode::Rename | FlowsMode::List => {
2936
render_list(frame, layout[1], state, &theme)
3037
}

crates/tui/src/ui/screens/login.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ pub fn render(frame: &mut Frame<'_>, area: Rect, state: &AppState) {
4545
// Clear the area behind the form
4646
frame.render_widget(Clear, card_area);
4747

48-
// Main container with rounded borders
48+
// Main container with rounded borders and title
4949
let block = Block::default()
50+
.title(" login ")
5051
.borders(Borders::ALL)
5152
.border_type(BorderType::Rounded)
5253
.border_style(Style::default().fg(theme.border));

crates/tui/src/ui/screens/transactions.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,12 @@ pub fn render(frame: &mut Frame<'_>, area: Rect, state: &AppState) {
4949
}
5050
}
5151
TransactionsMode::Detail | TransactionsMode::Edit => {
52-
render_detail(frame, layout[1], state, &theme)
52+
let columns = Layout::default()
53+
.direction(Direction::Horizontal)
54+
.constraints([Constraint::Percentage(55), Constraint::Percentage(45)])
55+
.split(layout[1]);
56+
render_list(frame, columns[0], state, &theme);
57+
render_detail(frame, columns[1], state, &theme);
5358
}
5459
}
5560
}

crates/tui/src/ui/screens/wallets.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,14 @@ pub fn render(frame: &mut Frame<'_>, area: Rect, state: &AppState) {
2424
render_header(frame, layout[0], state, &theme);
2525

2626
match state.wallets.mode {
27-
WalletsMode::Detail => render_detail(frame, layout[1], state, &theme),
27+
WalletsMode::Detail => {
28+
let columns = Layout::default()
29+
.direction(Direction::Horizontal)
30+
.constraints([Constraint::Percentage(55), Constraint::Percentage(45)])
31+
.split(layout[1]);
32+
render_list(frame, columns[0], state, &theme);
33+
render_detail(frame, columns[1], state, &theme);
34+
}
2835
WalletsMode::Create | WalletsMode::Rename | WalletsMode::List => {
2936
render_list(frame, layout[1], state, &theme)
3037
}

0 commit comments

Comments
 (0)