Conversation
There was a problem hiding this comment.
Pull request overview
Updates project navigation interactions to open the config view from project cards/list items, addressing the reported “card click doesn’t open project” behavior.
Changes:
- Added double-click navigation from the main project card to
/config. - Added double-click navigation from project list items to
/config. - Updated/added Playwright coverage for title-click and double-click navigation.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| src/MobiFlightConnector/frontend/tests/Dashboard.spec.ts | Adds/adjusts E2E tests for navigating to the config page via title click and double click. |
| src/MobiFlightConnector/frontend/src/components/project/ProjectListItem.tsx | Adds onDoubleClick navigation for project list items. |
| src/MobiFlightConnector/frontend/src/components/project/ProjectCard.tsx | Adds onDoubleClick navigation for the project card container. |
| const navigate = useNavigate() | ||
| const navigateToProject = () => { | ||
| navigate(`/config`) | ||
| } |
There was a problem hiding this comment.
navigateToProject is now implemented both in ProjectCardTitle and again in ProjectCard with identical logic. This duplicates routing behavior in the same file, making future route changes easy to miss. Consider extracting a shared helper/hook or passing a single handler down so there’s one source of truth for navigation.
| ref={ref} | ||
| {...props} | ||
| onDoubleClick={navigateToProject} | ||
| > |
There was a problem hiding this comment.
This onDoubleClick navigates unconditionally to /config. In the recent-projects list, a single click can trigger the unsaved-changes confirmation flow via onSelect (see ProjectMainCard.confirmLoadProject). A double-click will still fire this handler after the clicks, potentially navigating away even when the confirmation dialog should block changing projects. Consider delegating the double-click behavior to the same selection/confirmation logic (or disabling navigation when a confirmation is pending).
| // Verify we navigate to config route | ||
| await currentProjectCard.getByRole("button").nth(0).click() | ||
| await expect(page).toHaveURL(/.*\/config((\/|\?).*)?/) |
There was a problem hiding this comment.
The locator currentProjectCard.getByRole("button").nth(0) is brittle because the card contains multiple buttons and the DOM order can change. Prefer a more specific, user-facing locator (e.g., targeting the project title by text or adding a dedicated data-testid/accessible name for the clickable title area) to reduce flakiness.
| test("Navigate to project view via double click on card", async ({ | ||
| dashboardPage, | ||
| page, | ||
| }) => { | ||
| await dashboardPage.gotoPage() | ||
| await dashboardPage.mobiFlightPage.initWithTestData() | ||
|
|
||
| const currentProjectCard = page.getByTestId("project-card") | ||
| await currentProjectCard.first().dblclick() | ||
|
|
||
| await expect(page).toHaveURL(/.*\/config((\/|\?).*)?/) | ||
| }) |
There was a problem hiding this comment.
These new tests validate double click navigation, but the linked bug report expects navigation on a normal single click anywhere on the project card. If the intended fix is single-click, update the implementation and tests accordingly; otherwise, the PR description/issue linkage should be adjusted because this won’t validate the reported behavior.
| <div | ||
| data-testid="project-card" | ||
| onDoubleClick={navigateToProject} | ||
| {...otherProps} |
There was a problem hiding this comment.
The linked issue (#2781) describes a single click on the project card not opening the project, but this change only adds an onDoubleClick handler. A double-click requirement won’t resolve the reported behavior for users who click once. Consider handling onClick on the card (and stopping propagation for inner buttons/menus as needed), or otherwise align the PR description/issue linkage with the intended UX.
|
Build for this pull request: |
|
Build for this pull request: |
On the dashboard, you can now double click on either the project card or one of the items from the project list to access the project detail view.
fixes #2781