Closed jacob-ai-bot[bot] closed 1 month ago
Hello human! 👋
This PR was created by JACoB to address the issue Implement Step Navigation Feature in Assigned Tasks Page
Please review the PR carefully. Auto-generated code can and will contain subtle bugs and mistakes.
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.
Once the code looks good, approve the PR and merge the code.
Summary:
Description
Currently, the Assigned Tasks page utilizes a
useState
hook to manage anevents
array:However, these events are not actively utilized within the component. I propose implementing a step navigation feature that allows users to traverse through the sequence of events using forward and backward controls. This functionality will enable users to fast forward, rewind, and navigate through the task events interactively.
Feature Details
Navigation Controls
Add four navigation buttons to the interface:
Functionality
Expected Outcome
Users will be able to:
The interface will reflect these changes in real-time, offering a clear visualization of the event progression.
Implementation Steps
UI Components:
State Management:
events
array manipulation to handle navigation actions based on the current index.Event Handling:
Icon Feedback:
Additional Context
Providing a navigable history of events will enhance user experience by allowing detailed review and interaction with task progression.
@jacob-ai-bot --skip-build
Plan:
Step 1: Edit
/src/app/dashboard/[org]/[repo]/assigned-tasks/TasksPage.tsx
Task: Implement event index state and navigation functions in TasksPage.tsx
Instructions: In the file
/src/app/dashboard/[org]/[repo]/assigned-tasks/TasksPage.tsx
, add a new state variablecurrentEventIndex
usinguseState
to track the current position in theevents
array. Implement navigation functionshandleRestart
,handleStepBackward
,handleStepForward
, andhandleJumpToEnd
that updatecurrentEventIndex
appropriately. Modify theevents
passed to theWorkspace
component by slicing theevents
array up tocurrentEventIndex + 1
. Ensure that when a new task is selected,currentEventIndex
resets to the latest event index (i.e., the end of theevents
array).Exit Criteria: The
TasksPage
component manages event navigation state, and theWorkspace
component receives the correct subset of events based on the current navigation position.Step 2: Create
/src/app/dashboard/[org]/[repo]/assigned-tasks/components/StepNavigation.tsx
Task: Create StepNavigation component for event navigation controls
Instructions: Create a new file
StepNavigation.tsx
in/src/app/dashboard/[org]/[repo]/assigned-tasks/components/
. Implement a functional React component that renders four navigation buttons labeled 'Restart', 'Step Backward', 'Step Forward', and 'Jump to End'. The component should accept props:onRestart
,onStepBackward
,onStepForward
,onJumpToEnd
(callback functions),currentIndex
, andtotalSteps
. Each button should call its corresponding function when clicked. Disable the 'Restart' and 'Step Backward' buttons whencurrentIndex
is 0, and disable the 'Step Forward' and 'Jump to End' buttons whencurrentIndex
equalstotalSteps - 1
.Exit Criteria: The
StepNavigation
component is created, displaying navigation buttons that are interactive and appropriately disabled based on the current event index.Step 3: Edit
/src/app/dashboard/[org]/[repo]/assigned-tasks/TasksPage.tsx
Task: Integrate StepNavigation component into TasksPage.tsx
Instructions: In
/src/app/dashboard/[org]/[repo]/assigned-tasks/TasksPage.tsx
, import theStepNavigation
component. Include it in the JSX layout, placing it above or below theWorkspace
component for visibility. Pass the navigation functions (handleRestart
,handleStepBackward
,handleStepForward
,handleJumpToEnd
),currentEventIndex
ascurrentIndex
, and the total number of events (usingevents.length
) astotalSteps
to theStepNavigation
component.Exit Criteria: The
StepNavigation
component is rendered withinTasksPage
, and the navigation controls are operational, allowing users to navigate through events.Step 4: Edit
/src/app/dashboard/[org]/[repo]/assigned-tasks/components/workspace/index.tsx
Task: Update Workspace component to handle event slices
Instructions: In
/src/app/dashboard/[org]/[repo]/assigned-tasks/components/workspace/index.tsx
, modify the component to accept the slicedevents
array as a prop. Update any state and rendering logic withinWorkspace
and its child components to utilize the providedevents
array, reflecting the state up to thecurrentEventIndex
. Adjust theuseEffect
hook that setsselectedIcon
to base its logic on the last event in the slicedevents
array.Exit Criteria: The
Workspace
component and its children render content based on the current subset of events, updating the UI to reflect the selected point in the event sequence.Step 5: Edit
/src/app/dashboard/[org]/[repo]/assigned-tasks/components/StepNavigation.tsx
Task: Style navigation buttons in StepNavigation.tsx to match existing design
Instructions: In
/src/app/dashboard/[org]/[repo]/assigned-tasks/components/StepNavigation.tsx
, apply styling to the buttons to match the application's existing design patterns, such as those used inSidebar.tsx
and other navigation components. Use appropriate Tailwind CSS classes for layout, colors, typography, and responsive behavior. Ensure that buttons have visual feedback on hover and disabled states, and consider using icon components consistent with the application's style.Exit Criteria: The navigation buttons are styled consistently with the application's UI, providing a cohesive user experience.
Step 6: Edit
/src/app/dashboard/[org]/[repo]/assigned-tasks/TasksPage.tsx
Task: Reset navigation state when a new task is selected
Instructions: In
/src/app/dashboard/[org]/[repo]/assigned-tasks/TasksPage.tsx
, update theuseEffect
hook that handlesselectedTask
changes. When a new task is selected, resetcurrentEventIndex
to the last index of the new task's events (i.e.,events.length - 1
). Ensure that the navigation controls andWorkspace
component reflect the initial state of the newly selected task's event sequence.Exit Criteria: Selecting a new task resets the navigation to show the full sequence of events for that task, with the navigation controls updated accordingly.