AppFlowy icon indicating copy to clipboard operation
AppFlowy copied to clipboard

[FR] Clear value for date fields in grid/kanban

Open richardshiue opened this issue 2 years ago • 21 comments

Description

Most fields in the database allow you to clear the value, such as clearing out the text in a text field, or by deselecting all of the options. In date fields, however, the user is only permitted to change the date after setting it, or delete the entire row and recreate it.

Impact

Users wishing to clear the date field in their grid/kanban will be able to do so.

Additional Context

No response

richardshiue avatar Dec 15 '22 04:12 richardshiue

TODO: Add a 'Clear' function for Date to allow users to clear the value entered into a Date cell

annieappflowy avatar Dec 16 '22 03:12 annieappflowy

I would like to work on this issue!

hdjdoxDev avatar Jan 11 '23 00:01 hdjdoxDev

Hey @hdjdoxDev, thanks for offering to help on this. I've assigned the issue to you, hope to see your PR soon! If you have questions about the implementation, feel free to reach out to nathan on Discord.

richardshiue avatar Jan 11 '23 08:01 richardshiue

Hello @richardshiue Given that this would be my first contribution I will need some guidance, are you sure I can ask Nathan?

hdjdoxDev avatar Jan 11 '23 20:01 hdjdoxDev

Of course you can seek them for help! Good luck and have fun

annieappflowy avatar Jan 12 '23 02:01 annieappflowy

I've started getting my hands dirty with the code. Unfortunately I couldn't completely solve the issue because I'm not so familiar with the architecture and bloc in particular.

  • [x] added method clearValue to DateCellBloc (?)
  • [x] added DateCellAccessory following PrimaryCellAccessory (need tooltips)
  • [x] overridden accessoryBuilder of GridDateCell to return DateCellAccessory
  • [x] some code style changes (not sure if they are welcome)
  • [ ] retrieve bloc instance in GridDateCell
  • [ ] solve a bug I found on show/hide behaviour of GridCellAccessory

hdjdoxDev avatar Jan 13 '23 04:01 hdjdoxDev

Hey there @hdjdoxDev, glad to see progress. Do you think the accessory or an item in the menu would be better? I personally think that accessory would be too easy mis-click.

image

richardshiue avatar Jan 13 '23 05:01 richardshiue

Hi @hdjdoxDev , you can seek help from @appflowy and @richardshiue on Discord. Happy coding and good luck!

annieappflowy avatar Jan 13 '23 07:01 annieappflowy

Hi @richardshiue, I changed as you suggested but I still have some trouble following the bloc logic. Now the button actually deselects the date in the Cal bloc but it does'n clear the value once the editor is deselected in the Cell bloc. My guess is that there is some null-safe logic that prevents changes but I still couldn't track it.

hdjdoxDev avatar Jan 17 '23 21:01 hdjdoxDev

Hello @hdjdoxDev, from what I can see in your code, you are following the right bloc, but the event that you're firing is what is used by the backend to send information to the Flutter side and since the date isn't cleared in the backend, the date gets restored to the UI. It'd be better if you added a new DateCalEvent similar to setTime and handle that instead. As for clearing the date value in the backend, you can simply set it to none and use the existing selectDay/setTime functions.

richardshiue avatar Jan 19 '23 01:01 richardshiue

Hey there @hdjdoxDev, have you been able to make some progress on this?

richardshiue avatar Mar 09 '23 09:03 richardshiue

Hi @richardshiue, I'm sorry I left you hanging, I was hoping to be assigned a mentor to help me catch up with some technical gaps.

I saw your edits to the last comment, it's is not so clear to me how to proceed after adding the const factory DateCalEvent.resetTime() = _ResetTime; line. Right now I'm looking into the freezed package and the app_flowy docs.

I don't know how much of a rush you have to get this issue solved, but with me it will take some time given my inexperience and small availability at the moment. Please consider reassigning this issue given the situation, either way I would be happy to keep exploring it till I get to the solution.

hdjdoxDev avatar Mar 14 '23 12:03 hdjdoxDev

Hey there @hdjdoxDev, I encourage you to keep trying. That's a good start, the next step is to handle it. Please feel free to reach me on Discord at Stormcheetah#4271

richardshiue avatar Mar 14 '23 14:03 richardshiue

Hello @richardshiue, I am sorry to say that I will be unable to keep following this issue at the moment. I hope to come back and really help in the future. Thank you for your time and the encouragement!

hdjdoxDev avatar May 09 '23 19:05 hdjdoxDev

Hey there @hdjdoxDev, thanks for the update, and for trying to tackle this feature! Of course, I look forward to you coming back some time, I'm sure there will be other issues that you can work on.

richardshiue avatar May 10 '23 05:05 richardshiue

I would like to work on this

dejvizelo avatar May 14 '23 01:05 dejvizelo

As for clearing the date value in the backend, you can simply set it to none and use the existing selectDay/setTime functions.

@richardshiue I'm new to the project and would appreciate a bit of help on this. Can you elaborate a bit more on what you said above? Right now I can't seem to figure out how to set the date value to none, and I don't understand why or how we need to use the existing selectDay/setTime functions.

dejvizelo avatar Jun 04 '23 01:06 dejvizelo

Hi @dejvizelo , would you like to continue to work on this issue?

annieappflowy avatar Jun 19 '23 06:06 annieappflowy

Hi @annieappflowy, I'm still working on this but work has stalled a bit at the moment because I am not very familiar with Rust. I'm still keeping contact with @richardshiue to try to find a good implementation for it. Sorry that it's taking so long

dejvizelo avatar Jun 21 '23 13:06 dejvizelo

Thanks @dejvizelo for the update. Keep going!

annieappflowy avatar Jun 21 '23 14:06 annieappflowy

@annieappflowy PR is now ready

dejvizelo avatar Jul 05 '23 17:07 dejvizelo