Skip to content

Commit ba36b29

Browse files
committed
feat: ✨ add real key binding glossary in the help view
1 parent cddfc04 commit ba36b29

File tree

4 files changed

+24
-26
lines changed

4 files changed

+24
-26
lines changed

coco/src/view/sections/builder/commit.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ impl CommitStep {
6969
header_bg: theme.get("summary:bg"),
7070
header_fg: theme.get("summary:fg"),
7171
header_sec: theme.get("summary:sec"),
72-
..Default::default()
7372
})
7473
.with_title("summary")
7574
.with_subtitle("* required")
@@ -88,10 +87,9 @@ impl CommitStep {
8887
header_bg: theme.get("body:bg"),
8988
header_fg: theme.get("body:fg"),
9089
header_sec: theme.get("body:sec"),
91-
..Default::default()
9290
})
9391
.with_title("body")
94-
.with_subtitle("optional")
92+
.with_subtitle("(optional) alt/shift/ctrl + enter for new line")
9593
.with_active(false);
9694

9795
let footer_input = LabeledTextArea::new(LabeledTextAreaTheme {
@@ -101,10 +99,9 @@ impl CommitStep {
10199
header_bg: theme.get("footer:bg"),
102100
header_fg: theme.get("footer:fg"),
103101
header_sec: theme.get("footer:sec"),
104-
..Default::default()
105102
})
106103
.with_title("footer")
107-
.with_subtitle("optional")
104+
.with_subtitle("(optional) alt/shift/ctrl + enter for new line")
108105
.with_active(false);
109106

110107
Self {

coco/src/view/sections/builder/scope.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ impl ScopeStep {
4747
header_bg: theme.get("scope:bg"),
4848
header_fg: theme.get("scope:fg"),
4949
header_sec: theme.get("scope:sec"),
50-
..Default::default()
5150
})
5251
.with_title("Scope")
5352
.with_subtitle("optional")

coco/src/view/sections/help.rs

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,32 @@ impl HelpSection {
1919
}
2020
}
2121

22+
// "; observation => "Press 'q' or 'Ctrl+c' to quit the application",
23+
// "Quit the application": ["q", "Ctrl+c"]; observation => "Press 'q' or 'Ctrl+c' to quit the application",
24+
// "Navigate up": ["k", "Up arrow"],
25+
// "Navigate down": ["j", "Down arrow"],
26+
// "Navigate left": ["h", "Left arrow"],
27+
2228
impl Component for HelpSection {
2329
fn draw(&mut self, f: &mut Frame<'_>, area: Rect) {
24-
// TODO: Real help
25-
// for now, the key glossary is just a placeholder with fictitious data; should be
26-
// replaced with actual key bindings once all of them are implemented
2730
let sections = help! {
31+
"Help" => {
32+
"Toggle this help on and off": ["F2"],
33+
}
2834
"General" => {
29-
"Quit the application": ["q", "Ctrl+c"]; observation => "Press 'q' or 'Ctrl+c' to quit the application",
30-
"Navigate up": ["k", "Up arrow"],
31-
"Navigate down": ["j", "Down arrow"],
32-
"Navigate left": ["h", "Left arrow"],
35+
"Exit": ["ctrl+c"],
36+
"Go to the next step": ["pg-dn"],
37+
"Go to the previous step": ["pg-up"],
38+
}
39+
"Text Areas" => {
40+
"Submit": ["enter"],
41+
"New Line / carriage return": ["shift+enter", "alt+enter", "ctrl+enter"]; observation => "depends on the terminal",
3342
}
34-
"Switches" => {
35-
"Toggle switch": ["space"],
36-
"Switch to ON": ["Y"],
37-
"Switch to OFF": ["N"],
43+
"Switch" => {
44+
"Toggle the switch": ["space"],
45+
"Set the switch to true": ["🠆"],
46+
"Set the switch to false": ["🠄"],
47+
"Accept": ["enter"],
3848
}
3949
};
4050

tui/src/widgets/coco_header.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,12 @@ use matetui::ratatui::{
66
widgets::Paragraph,
77
};
88

9+
#[derive(Default)]
910
pub struct CocoHeader {
1011
style_left: Style,
1112
style_right: Style,
1213
}
1314

14-
impl Default for CocoHeader {
15-
fn default() -> Self {
16-
Self {
17-
style_left: Style::default(),
18-
style_right: Style::default(),
19-
}
20-
}
21-
}
22-
2315
impl CocoHeader {
2416
pub fn new(style_left: Style, style_right: Style) -> Self {
2517
Self {

0 commit comments

Comments
 (0)