-
Notifications
You must be signed in to change notification settings - Fork 59
Add pin/unpin task feature #275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Add pin icon display on the right side of status badge for pinned tasks - Add Pin/Unpin toggle button in task dialog footer - Implement pinned task storage in localStorage (per user) - Update sorting logic to show pinned tasks at top of list - Pinned tasks appear at top within filtered views - Add utility functions for managing pinned tasks (getPinnedTasks, togglePinnedTask, savePinnedTasks)
|
Thank you for opening this PR! Before a maintainer takes a look, it would be really helpful if you could walk through your changes using GitHub's review tools. Please take a moment to:
This helps make the review process smoother and gives us a clearer understanding of your thought process. Once you've added your self-review, we'll continue from our side. Thank you! |
|
Hi @Rustix69! I noticed that one check is failing because TaskDialog.test.tsx is To fix this:
Let me know if you need any help! |
ShivaGupta-14
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Rustix69!
Thanks for working on this feature! Here are a few suggestions:
1. UX suggestion
Currently, to pin a task, the user has to open the task dialog and then pin it. For unpinning, clicking the pin icon opens the dialog again, then you unpin and close it. This adds a bit of friction to a frequent action.
It might be helpful to add a clickable pin icon directly in the task row (e.g., in a new column or next to Status), so users can pin/unpin in one click without opening the dialog. The dialog button can still remain as a secondary option.
2. Edge case
I noticed that when a task is completed or deleted, its UUID still remains in the pinned tasks localStorage. Since completed or deleted tasks probably don’t need to stay pinned, this could lead to stale data over time.
As an example, you could unpin the task when it’s completed or deleted, e.g. in handleMarkComplete and handleMarkDelete:
// Unpin task if it was pinned
if (pinnedTasks.has(taskuuid)) {
togglePinnedTask(props.email, taskuuid);
setPinnedTasks(getPinnedTasks(props.email));
}
@its-me-abhishek – What do you think about this UX improvement and the edge case? Are these the right changes, and should they be handled in this PR or in a follow-up?
I disagree with this though. Keeping completed/deleted tasks pinned can be intentional (e.g., motivation), so automatically unpinning them isn’t necessarily desirable. |
Thanks for the clarification, that makes sense. I hadn't considered aspects like motivation. Given that, I agree the current behavior is better left as is. Regarding the UX suggestion (Point 1), do you think that is worth adding in this PR, or should we skip that as well? |
|
@ShivaGupta-14 In regardign to the Point 1 i feel it will be great if we add a three dot where we will add teh mark as completed adn then the pinning thing ??? This will reduce the friction and improve teh UX What your thoughts ?? @its-me-abhishek |
@Rustix69 That’s a good idea! One thing to consider: there’s a bulk‑actions feature (for complete/delete) in another open PR (#225) that will handle marking tasks as complete or deleting them in an easier way. If we add complete/delete to the three‑dot menu too, users might be confused by multiple ways to do the same thing, which might not be ideal UX. Maybe the three‑dot menu (or just a clickable icon) could be used only for Pin? That way each feature has one clear entry point. What do you think, @Rustix69 and @its-me-abhishek? |
|
@Rustix69 most of these will go out of scope of the parent issue, will create new sub issues for these (if and when required). For now, please proceed with adding a pin icon directly on each task on the table. One more fix you could preferable add is - increase the height of individual tasks on that table - specifically on MOBILE views by a little bit. So that we have 2 rows, which will be enough to accommodate the ID Description Project in one line, Tags, status and that Pin button in the next. Or however it feels good, and not Convoluted. As sliding to pin task on mobile will be really unpleasant |
Description
This PR implements a Pin Task feature that allows users to pin important or frequently accessed tasks to keep them at the top of their task list.
Changes Made
Frontend Changes:
New Utility Functions (
tasks-utils.ts):getPinnedTasks()- Retrieves pinned task UUIDs from localStoragesavePinnedTasks()- Persists pinned tasks to localStoragetogglePinnedTask()- Toggles pin status for a taskisTaskPinned()- Checks if a task is pinnedUI Enhancements (
TaskDialog.tsx):PinandPinOfficons from lucide-reactState Management (
Tasks.tsx):pinnedTasksstate to track pinned taskshandleTogglePin()handler for pin/unpin actionssortWithPinnedAndOverdueOnTop()to prioritize pinned tasksType Definitions (
types.ts):EditTaskDialogPropsinterface withisPinnedandonTogglePinpropertiesChecklist
npx prettier --write .(for formatting)gofmt -w .(for Go backend)npm test(for JS/TS testing)Additional Notes