Skip to content

Commit a6215cb

Browse files
committed
Updated to v0.10.1!! (Minor Hotfix)
1 parent 40d57b1 commit a6215cb

6 files changed

Lines changed: 36 additions & 7 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rust-kanban"
3-
version = "0.10.0"
3+
version = "0.10.1"
44
authors = ["Yash Sharma <yashs662@gmail.com>"]
55
edition = "2021"
66
license = "MIT"

Changelog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
Changes in Version 0.10.1
2+
=========================
3+
### Fixes
4+
- Fixed a bug where date picker would not open on new card form when using the keyboard
5+
- Fixed a bug where date picker in new card For was not anchored properly
6+
17
Changes in Version 0.10.0
28
=========================
39
### New Features

src/app/app_helper.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4185,9 +4185,9 @@ fn handle_date_time_picker_action(app: &mut App, key: Option<Key>, action: Optio
41854185
.format(app.config.date_time_format.to_parser_string())
41864186
.to_string()
41874187
}
4188-
app.widgets.date_time_picker.close_date_picker();
41894188
debug!("Changed due date to {}", card.due_date);
41904189
}
4190+
app.widgets.date_time_picker.close_date_picker();
41914191
}
41924192
Focus::DTPToggleTimePicker => {
41934193
if app.widgets.date_time_picker.time_picker_active {
@@ -4304,13 +4304,16 @@ fn handle_new_card_action(app: &mut App) {
43044304
} else {
43054305
warn!("New card name is empty or already exists");
43064306
app.send_warning_toast("New card name is empty or already exists", None);
4307+
return;
43074308
}
43084309

43094310
if let Some(previous_focus) = &app.state.prev_focus {
43104311
app.state.set_focus(*previous_focus);
43114312
}
43124313
refresh_visible_boards_and_cards(app);
43134314
reset_new_card_form(app);
4315+
} else if app.state.focus == Focus::CardDueDate {
4316+
app.set_popup_mode(PopupMode::DateTimePicker);
43144317
} else if app.state.app_status == AppStatus::Initialized {
43154318
app.state.app_status = AppStatus::UserInput;
43164319
}
@@ -5528,6 +5531,7 @@ fn reset_new_board_form(app: &mut App) {
55285531
fn reset_new_card_form(app: &mut App) {
55295532
app.state.text_buffers.card_name.reset();
55305533
app.state.text_buffers.card_description.reset();
5534+
app.widgets.date_time_picker.reset();
55315535
}
55325536

55335537
fn reset_login_form(app: &mut App) {

src/ui/ui_helper.rs

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2611,6 +2611,22 @@ pub fn render_new_card_form(rect: &mut Frame, app: &mut App, popup_mode: bool) {
26112611
)
26122612
.split(rect.size());
26132613

2614+
let card_due_date = app.widgets.date_time_picker.get_date_time_as_string(app.config.date_time_format);
2615+
2616+
if app.state.z_stack.last() == Some(&PopupMode::DateTimePicker) {
2617+
if app.widgets.date_time_picker.anchor.is_none() {
2618+
app.widgets.date_time_picker.anchor = Some((
2619+
chunks[3].x + card_due_date.len() as u16 + 2,
2620+
chunks[3].y + 3,
2621+
)); // offsets to make sure date is visible
2622+
debug!(
2623+
"Setting anchor for date time picker to: {:?}",
2624+
app.widgets.date_time_picker.anchor
2625+
);
2626+
}
2627+
app.widgets.date_time_picker.current_viewport = Some(rect.size());
2628+
}
2629+
26142630
let general_style = check_for_popup_and_get_style(
26152631
popup_mode,
26162632
app.current_theme.inactive_text_style,
@@ -7907,15 +7923,16 @@ pub fn render_date_time_widget(rect: &mut Frame, app: &mut App, popup_mode: bool
79077923

79087924
app.widgets.date_time_picker.current_render_area = Some(render_area);
79097925

7910-
let title_length = (current_month.len() + 3 + current_year.len()) as u16; // 3 is for the " - "
7926+
let title_length = (current_month.len() + 3 + current_year.len() + 4) as u16; // 3 is for the " - ",
7927+
// additional 4 is to compensate for the borders that show when focus is on month or year
79117928
let padding = (render_area
79127929
.width
79137930
.min(app.widgets.date_time_picker.date_target_width)
79147931
- 3
79157932
- 2)
79167933
.saturating_sub(title_length); // 3 is for the Time section expand button, 2 is for margin
7917-
let month_length = current_month.len() as u16 + (padding / 2);
7918-
let year_length = current_year.len() as u16 + (padding / 2);
7934+
let month_length = current_month.len() as u16 + (padding / 2) + 2;
7935+
let year_length = current_year.len() as u16 + (padding / 2) + 2;
79197936

79207937
let (date_picker_render_area, time_picker_render_area) =
79217938
if app.widgets.date_time_picker.widget_width

src/ui/widgets.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1516,7 +1516,9 @@ impl<'a> Widget for DateTimePickerWidget<'a> {
15161516
}
15171517
WidgetAnimState::Closed => {
15181518
app.state.z_stack.pop();
1519-
date_time_picker.reset();
1519+
if app.state.ui_mode != UiMode::NewCard {
1520+
date_time_picker.reset();
1521+
}
15201522
}
15211523
}
15221524

0 commit comments

Comments
 (0)