feat(companion): open the asset from an audit row - #2989
carlosvirreira wants to merge 1 commit into
Conversation
An asset row on the audit detail screen now opens the asset detail, matching the web audit row where the title links to the asset page. A field worker who finds a missing or unexpected asset can open it and update it from the audit. The row was inert because an earlier cross-tab router.push polluted the Assets tab's stack. pushIntoTab already solves that for bookings, home and the scanner by anchoring the Assets list beneath the detail, so the row uses it. DisplayAsset gains assetId (null for a deleted asset, whose row stays inert). The evidence chip becomes its own touchable with hitSlop so evidence stays reachable on every row, including a deleted-asset row. The card keeps a composed accessibility label ending in "tap to open asset"; the chip gets its own "tap to view" label, and rows with evidence expose a "View evidence" custom accessibility action because the accessible card folds the chip in. Adds a Maestro regression flow (audits/06-row-opens-asset.yaml). It has not been run on a device yet. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
🩺 React Doctor — companionFindings on the files changed by this PR:
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 8 included reviews per hour; 4 remain after this review. WalkthroughChangesAudit asset navigation
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This localized change adds asset navigation while preserving evidence access and deleted-asset handling. No actionable merge-blocking risk remains beyond normal checks and review. Sequence Diagram(s)sequenceDiagram
participant AuditDetail
participant Navigation
participant AssetDetail
participant AssetsList
AuditDetail->>Navigation: Tap live asset row
Navigation->>AssetDetail: Open asset detail in Assets tab
AssetDetail->>AssetsList: Press back
AssetsList-->>AuditDetail: Show Assets list
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Why
A field worker who finds a missing or unexpected asset during an audit needs to open that asset and update it right there. On the web audit detail page the asset row already links its title to the asset page (
audit-asset-list-item.tsx). On the phone the row was inert unless it had evidence, in which case the whole card opened the evidence viewer.The row was made inert because an earlier
router.push("/(tabs)/assets/...")from the Audits stack polluted the Assets tab's stack.pushIntoTab(lib/navigation.ts) has since solved that for bookings, home and the scanner: it navigates withwithAnchor, so the Assets list sits beneath the asset detail and "back" has a target. The audit row now uses the same helper.Change
apps/companion/app/(tabs)/audits/[id].tsxDisplayAssetgainsassetId: string | null. Expected rows carry the asset id; unexpected scans carryscan.assetId, ornullwhen the asset was deleted. The existingidfield (the FlatList key) is unchanged.assetIdis aTouchableOpacitythat callspushIntoTab("/(tabs)/assets", "/(tabs)/assets/<assetId>"). A deleted-asset row stays an inertView(accessibilityRole="summary").TouchableOpacity(withhitSlop8 on each side) that opens the evidence viewer exactly as the card did before. Evidence stays reachable on every row that has it, including a deleted-asset row, where the chip is the only tappable element.accessibleand a composed label; a card that opens the asset ends with "tap to open asset" and has rolebutton. The chip gets its own label (for example2 notes, 1 photo, tap to view) and rolebutton. Becauseaccessiblefolds the chip into the card for screen readers, rows with evidence also expose aView evidencecustom accessibility action (VoiceOver rotor / TalkBack actions menu) that opens the viewer.useCallbackdependencies are unchanged;pushIntoTabis a module import.apps/companion/.maestro/flows/audits/06-row-opens-asset.yaml(new)SHELF_TEST_AUDIT_NAMEfrom the Audits list, taps the first row whose label ends in "tap to open asset", asserts the asset detail ("Created" is always rendered there), presses back and asserts the Assets list is shown (the anchorpushIntoTabplaces beneath the detail), then reopens the audit from Home and asserts the audit detail is intact.Not changed:
components/audit/scanned-items-list.tsx(row tap opens the evidence modal on the scan screen) andcomponents/audit/remaining-assets-list.tsx(image tap opens an image preview). Neither opens the asset; that is out of scope here.Note on back navigation: the Audits group is hidden from the tab bar (
href: null), so after "back" lands on the Assets list the audit is reopened from Home. The audit's own stack stays mounted throughout.Testing
Run in
apps/companion:npx tsc --noEmit: 0 errors.pnpm lint(expo lint+scripts/check-version-sync.mjs): clean; version sync OK.pnpm test(node test runner,lib/**/*.test.ts): 80 passed, 0 failed. The companion has no vitest setup.npx prettier --checkon both changed files: clean.The Maestro flow
06-row-opens-asset.yamlhas NOT been run on a device or simulator yet. It follows the selectors and fixtures the other audit flows use (SHELF_TEST_AUDIT_NAME, "Created" on the asset detail,Filter: Allon the audit detail, "Search assets" on the Assets list).🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes
Tests