jacob-ai-bot / jacob

Just Another Coding Bot
https://jacb.ai
Apache License 2.0
131 stars 20 forks source link

JACoB PR for Issue Add Toggle to Enable/Disable Live Updates on Assigned Tasks Page #185

Closed jacob-ai-bot[bot] closed 1 month ago

jacob-ai-bot[bot] commented 1 month ago

Summary:

Description

Currently, the Assigned Tasks page implements live updates to automatically refresh task statuses and icons in real-time. While this feature ensures users receive the most up-to-date information, some users may prefer to manually control updates to reduce distractions or save bandwidth.

Feature Request

Implement a toggle switch that allows users to enable or disable live updates on the Assigned Tasks page. When the toggle is turned off, live updates will be paused, and the selected task's icon will no longer update automatically when a new event occurs.

Benefits

Requirements

  1. Toggle Placement

    • Add a toggle switch labeled "Enable Live Updates" at the top of the Assigned Tasks page or within the user settings/preferences section.
  2. Default State

    • The default state of the toggle should be enabled to maintain current user experience.
  3. Functionality

    • When Enabled:
      • Live updates continue as currently implemented.
      • Task icons and statuses update automatically upon receiving new events.
    • When Disabled:
      • Live updates are paused.
      • The selected task's icon and status remain static regardless of incoming events.
      • Optionally, provide a manual "Refresh" button for users to update the view on-demand.
  4. Persistence

    • The toggle state should persist across user sessions using local storage or user settings.

Acceptance Criteria

Additional Notes


@jacob-ai-bot --skip-build

Plan:

Step 1: Edit /src/app/dashboard/[org]/[repo]/assigned-tasks/TasksPage.tsx

Task: Add Live Updates Toggle and Manual Refresh to Assigned Tasks Page

Instructions: Modify the Assigned Tasks page to add a toggle switch labeled 'Live Updates' at the top of the page. Steps:

  1. In /src/app/dashboard/[org]/[repo]/assigned-tasks/TasksPage.tsx, import React hooks useState, useEffect.
  2. Add a state variable liveUpdatesEnabled using useState, defaulting to true.
  3. Add a toggle switch UI element at the top of the page, labeled 'Live Updates', which controls liveUpdatesEnabled.
  4. Modify the api.events.onAdd.useSubscription hook to conditionally subscribe based on liveUpdatesEnabled. If live updates are disabled, the subscription should not update the state. You may need to use a conditional statement or adjust the enabled option in the hook.
  5. Add a 'Refresh' button next to the toggle that is visible when live updates are disabled. Implement an onClick handler that calls refetchTasks() and refetchEvents() to manually update the data.

Exit Criteria: The Assigned Tasks page includes a 'Live Updates' toggle switch and a 'Refresh' button (visible when live updates are disabled). The toggle state persists across page reloads and user sessions. When live updates are disabled, task statuses and icons do not update automatically, and the 'Refresh' button successfully updates the tasks and events when clicked.

jacob-ai-bot[bot] commented 1 month ago

Hello human! 👋

This PR was created by JACoB to address the issue Add Toggle to Enable/Disable Live Updates on Assigned Tasks Page

Next Steps

  1. Please review the PR carefully. Auto-generated code can and will contain subtle bugs and mistakes.

  2. If you identify code that needs to be changed, please reject the PR with a specific reason. Be as detailed as possible in your comments. JACoB will take these comments, make changes to the code and push up changes. Please note that this process will take a few minutes.

  3. Once the code looks good, approve the PR and merge the code.