AppFlowy icon indicating copy to clipboard operation
AppFlowy copied to clipboard

feat: clear date value

Open dejvizelo opened this issue 2 years ago • 8 comments

Feature Preview

https://github.com/AppFlowy-IO/AppFlowy/assets/59970707/36571a12-4d59-4e30-8b14-1a18ec211f42

Close #1574

PR Checklist

  • [x] My code adheres to the AppFlowy Style Guide
  • [x] I've listed at least one issue that this PR fixes in the description above.
  • [x] I've added a test(s) to validate changes in this PR, or this PR only contains semantic changes.
  • [x] All existing tests are passing.

dejvizelo avatar Jun 04 '23 01:06 dejvizelo

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Jun 04 '23 01:06 CLAassistant

@dejvizelo looks good to me, but the analyzer warnings must be fixed to get CI to pass.

Are you planning on implementing the TODO comment in this PR or are you going to follow up on it?

a-wallen avatar Jun 05 '23 22:06 a-wallen

@a-wallen I'm planning to implement the TODO comment in this PR but I had some questions I asked in #1574. Maybe you can answer some of those questions? Will fix the analyzer warnings soon too.

dejvizelo avatar Jun 05 '23 22:06 dejvizelo

@a-wallen I'm planning to implement the TODO comment in this PR but I had some questions I asked in #1574. Maybe you can answer some of those questions? Will fix the analyzer warnings soon too.

I'm not the best person to answer. cc @richardshiue or @appflowy

a-wallen avatar Jun 05 '23 22:06 a-wallen

Hey there @dejvizelo, thanks for taking a jab at this. You can follow the following steps to do the backend:

  1. Create an event in rust-lib/flowy-database2/src/event_map.rs named ClearDateCell and specify the handler clear_date_cell_handler
  2. Implement the clear_date_cell_handler in rust-lib/flowy-database2/src/event_handlers.rs
  3. This should call a new clear_date_cell function in rust-lib/flowy-database2/src/services/database/database_editor.rs. You can refer to update_cell_with_changeset.
  4. This should then call a new function clear_date_cell that is a method of DateTypeOption, in it the Option<i64> timestamp will be turned into None. You can refer to the ApplyChangeset trait implementation for DateTypeOption

On the frontend, you're right, I don't think we need to use the selectDay or setTime functions anymore. In date_cal_bloc, you'd have to dispatch that this new ClearDateCell event and handle it (preferably in a helper function). Good luck and let me know if you need more help!

EDIT: moving the conversation here to discuss implementation details.

richardshiue avatar Jun 06 '23 14:06 richardshiue

Sorry for polluting the history. Had some trouble with Git after develop was merged into main.

@richardshiue Your instructions were very helpful and I've made good progress but I'm struggling with a few things. Can I reach you on Discord for some follow-up questions?

dejvizelo avatar Jun 13 '23 01:06 dejvizelo

@richardshiue Your instructions were very helpful and I've made good progress but I'm struggling with a few things. Can I reach you on Discord for some follow-up questions?

Of course! My Discord username is richardshiue. You can also find it on under the AppFlowy Contributors section in the Server Members list.

richardshiue avatar Jun 13 '23 08:06 richardshiue

Codecov Report

Merging #2700 (5b1c9cf) into main (d32c208) will increase coverage by 0.03%. The diff coverage is 96.55%.

@@            Coverage Diff             @@
##             main    #2700      +/-   ##
==========================================
+ Coverage   68.85%   68.88%   +0.03%     
==========================================
  Files         430      430              
  Lines       20471    20498      +27     
==========================================
+ Hits        14095    14121      +26     
- Misses       6376     6377       +1     
Flag Coverage Δ
appflowy_flutter_integrateion_test 65.86% <96.55%> (+0.04%) :arrow_up:
appflowy_flutter_unit_test 13.12% <3.44%> (-0.02%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...iew/widgets/row/cells/date_cell/date_cal_bloc.dart 82.40% <91.66%> (+2.75%) :arrow_up:
...e_view/application/cell/cell_data_persistence.dart 93.10% <100.00%> (+0.51%) :arrow_up:
...se_view/widgets/row/cells/date_cell/date_cell.dart 94.00% <100.00%> (ø)
...ew/widgets/row/cells/date_cell/date_cell_bloc.dart 100.00% <100.00%> (ø)
..._view/widgets/row/cells/date_cell/date_editor.dart 96.20% <100.00%> (+0.22%) :arrow_up:

... and 1 file with indirect coverage changes

codecov[bot] avatar Jul 08 '23 01:07 codecov[bot]

This PR should be either merged or closed by the end of July

annieappflowy avatar Jul 29 '23 06:07 annieappflowy

@annieappflowy Is there anything I can do about the failing Rust-CI check? Otherwise the PR is ready for review

dejvizelo avatar Jul 29 '23 15:07 dejvizelo

@dejvizelo thanks for contributing!

richardshiue avatar Jul 31 '23 02:07 richardshiue