feat: add hide completed tasks button #54

Closed
curiouslad wants to merge 3 commits from main into main
curiouslad commented 2025-05-17 08:18:11 +00:00 (Migrated from github.com)

Hello,
This PR adds toggle button to hide completed tasks. I added button next to the export button.

TODO:
[ ] Change icon
[ ] Use config state as fallback

Hello, This PR adds toggle button to hide completed tasks. I added button next to the export button. TODO: [ ] Change icon [ ] Use config state as fallback
edfloreshz (Migrated from github.com) requested changes 2025-05-17 19:34:27 +00:00
@ -0,0 +27,4 @@
pub enum Message {
AddTask,
Complete(DefaultKey, bool),
Delete(DefaultKey),
edfloreshz (Migrated from github.com) commented 2025-05-17 19:34:19 +00:00

Only one thing, could you change this to ToggleHideCompleted?

Only one thing, could you change this to `ToggleHideCompleted`?
edfloreshz (Migrated from github.com) requested changes 2025-05-17 19:37:39 +00:00
@ -0,0 +85,4 @@
.push(widget::text::title3(&list.name).width(Length::Fill))
.push(hide_complete_button)
.push(export_button)
.into()
edfloreshz (Migrated from github.com) commented 2025-05-17 19:37:34 +00:00

You're using the same icon that's being used for the share button.

You're using the same icon that's being used for the share button.
curiouslad (Migrated from github.com) reviewed 2025-05-17 19:45:36 +00:00
@ -0,0 +85,4 @@
.push(widget::text::title3(&list.name).width(Length::Fill))
.push(hide_complete_button)
.push(export_button)
.into()
curiouslad (Migrated from github.com) commented 2025-05-17 19:45:36 +00:00

sorry, i forgot to mention it, I am not sure what icon should be used. I looked at cosmic-icons repository and couldn't find any that would suit. Maybe this shouldn't be a icon button at all, maybe i could move it view menu?

sorry, i forgot to mention it, I am not sure what icon should be used. I looked at cosmic-icons repository and couldn't find any that would suit. Maybe this shouldn't be a icon button at all, maybe i could move it view menu?
curiouslad (Migrated from github.com) reviewed 2025-05-17 19:49:41 +00:00
@ -0,0 +27,4 @@
pub enum Message {
AddTask,
Complete(DefaultKey, bool),
Delete(DefaultKey),
curiouslad (Migrated from github.com) commented 2025-05-17 19:49:41 +00:00

done

done
edfloreshz (Migrated from github.com) reviewed 2025-05-17 20:01:10 +00:00
@ -0,0 +85,4 @@
.push(widget::text::title3(&list.name).width(Length::Fill))
.push(hide_complete_button)
.push(export_button)
.into()
edfloreshz (Migrated from github.com) commented 2025-05-17 20:01:10 +00:00

I think having it in both places would be great, a global toggle that lives in the menu + the list toggle that overrides the global toggle.

I think having it in both places would be great, a global toggle that lives in the menu + the list toggle that overrides the global toggle.
curiouslad (Migrated from github.com) reviewed 2025-05-17 20:13:15 +00:00
@ -0,0 +85,4 @@
.push(widget::text::title3(&list.name).width(Length::Fill))
.push(hide_complete_button)
.push(export_button)
.into()
curiouslad (Migrated from github.com) commented 2025-05-17 20:13:15 +00:00

sorry, i am new to rust and iced. If i understand correctly there should be flag in application state that would be updated from view and also possible persisted in some config/state, and flag on content state that would work on the list it has?

sorry, i am new to rust and iced. If i understand correctly there should be flag in application state that would be updated from view and also possible persisted in some config/state, and flag on content state that would work on the list it has?
edfloreshz (Migrated from github.com) reviewed 2025-05-18 03:58:04 +00:00
@ -0,0 +85,4 @@
.push(widget::text::title3(&list.name).width(Length::Fill))
.push(hide_complete_button)
.push(export_button)
.into()
edfloreshz (Migrated from github.com) commented 2025-05-18 03:58:04 +00:00

To clarify my previous request, I'm proposing a system with two levels of control for managing the visibility of completed tasks:

  • Application: I envision a menu item, specifically a checkbox, that governs a global configuration property. When this checkbox is enabled, the application would, by default, hide completed tasks in all task lists. This global preference would be persisted within the application's configuration files.

  • List-Specific: In addition to the global setting, each individual task list should feature its own toggle (similar to the one you previously implemented). This toggle would manage a list-specific setting for the visibility of completed tasks. This per-list setting would be saved within the configuration of that particular list.

To clarify my previous request, I'm proposing a system with two levels of control for managing the visibility of completed tasks: - **Application**: I envision a menu item, specifically a checkbox, that governs a global configuration property. When this checkbox is enabled, the application would, by default, hide completed tasks in all task lists. This global preference would be persisted within the application's configuration files. - **List-Specific**: In addition to the global setting, each individual task list should feature its own toggle (similar to the one you previously implemented). This toggle would manage a list-specific setting for the visibility of completed tasks. This per-list setting would be saved within the configuration of that particular list.
edfloreshz (Migrated from github.com) reviewed 2025-05-18 03:59:20 +00:00
@ -0,0 +85,4 @@
.push(widget::text::title3(&list.name).width(Length::Fill))
.push(hide_complete_button)
.push(export_button)
.into()
edfloreshz (Migrated from github.com) commented 2025-05-18 03:59:19 +00:00

Regardless of that, I think we can proceed with this PR and add the global config later on.

Please find an icon with an eye to symbolize what the button is doing and we can proceed with the merge.

Regardless of that, I think we can proceed with this PR and add the global config later on. Please find an icon with an eye to symbolize what the button is doing and we can proceed with the merge.
curiouslad commented 2025-05-20 08:07:31 +00:00 (Migrated from github.com)

I updated this so that it stores hide_completed flag in config, that part seems to be working, but i still don't know how to use config flag in content. Tomorrow I will try to solve that and to change icon to something meaningful. Also i just realized that maybe sending bool in Message is not best way because I could just do it in ApplicationAction::ToggleHideCompleted

I updated this so that it stores hide_completed flag in config, that part seems to be working, but i still don't know how to use config flag in content. Tomorrow I will try to solve that and to change icon to something meaningful. Also i just realized that maybe sending bool in Message is not best way because I could just do it in ApplicationAction::ToggleHideCompleted
edfloreshz commented 2025-05-20 16:18:26 +00:00 (Migrated from github.com)

Thanks! I just merged this in a separate PR 🎉

Thanks! I just merged this in a separate PR 🎉

Pull request closed

Sign in to join this conversation.
No description provided.