AppFlowy
AppFlowy copied to clipboard
[FR] Clear value for date fields in grid/kanban
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
TODO: Add a 'Clear' function for Date to allow users to clear the value entered into a Date cell
I would like to work on this issue!
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.
Hello @richardshiue Given that this would be my first contribution I will need some guidance, are you sure I can ask Nathan?
Of course you can seek them for help! Good luck and have fun
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
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.
Hi @hdjdoxDev , you can seek help from @appflowy and @richardshiue on Discord. Happy coding and good luck!
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.
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.
Hey there @hdjdoxDev, have you been able to make some progress on this?
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.
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
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!
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.
I would like to work on this
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.
Hi @dejvizelo , would you like to continue to work on this issue?
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
Thanks @dejvizelo for the update. Keep going!
@annieappflowy PR is now ready