Skip to content

feat: #72 — Replace Data nav icon with map marker; extract Alerts into dedicated screen#108

Open
luandro wants to merge 1 commit into
mainfrom
agent/comapeo-cloud-app/issue-72
Open

feat: #72 — Replace Data nav icon with map marker; extract Alerts into dedicated screen#108
luandro wants to merge 1 commit into
mainfrom
agent/comapeo-cloud-app/issue-72

Conversation

@luandro

@luandro luandro commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Automated implementation of #72 by forge.

Changes:

  • Replaced Data nav icon with map marker icon
  • Extracted Alerts into dedicated screen (AlertsScreen.tsx)
  • Updated router and authenticated layout
  • Added i18n messages for Alerts screen
  • Added unit tests for new screen and router changes

Closes #72


*Implemented by the agent implementation worker.

Greptile Summary

This PR extracts the Alerts tab from DataScreen into a dedicated /alerts route and screen, replaces the Data nav icon with a map-marker SVG, adds a bell icon for the new Alerts nav item, and wires up i18n and tests for all changes.

  • AlertsScreen.tsx is a new top-level screen at /alerts that mirrors the former alerts tab in DataScreen, with full skeleton/error/empty states and an "Add Alert" CTA linking to /data/alerts/new.
  • DataScreen.tsx is simplified to observations-only by removing the Tabs wrapper, the alerts query, and associated messages.
  • es.json / pt.json received the new alerts.* translations but were not cleaned up of the five stale data.* alert keys removed from en.json.

Confidence Score: 3/5

Safe to merge for the structural refactor, but the back-navigation from alert detail will silently drop users on the Data screen when they arrived from Alerts.

The alerts-to-detail navigation path is now reachable from two entry points (/data and /alerts), but AlertDetailScreen back button permanently hardcodes to /data. Any user who enters the detail from the new /alerts screen will be routed to Data on pressing back, making the Alerts screen feel like a dead end. The stale translation keys in es.json/pt.json are a secondary concern that may surface in CI i18n parity check.

src/screens/AlertDetailScreen.tsx (not in this diff) needs its back-navigation updated to handle being reached from /alerts; src/i18n/messages/es.json and pt.json need the five orphaned data.* alert keys removed.

Important Files Changed

Filename Overview
src/screens/AlertsScreen.tsx New screen correctly shows alerts for the selected project with skeleton loading, error, and empty states; however its alert-card links navigate to /data/alerts/$alertId whose back button hardcodes /data, breaking round-trip navigation.
src/screens/DataScreen.tsx Alerts tab and related hooks/messages cleanly removed; observations-only layout is correct.
src/app/router.tsx alertsRoute correctly added under _authenticatedRoute at /alerts and exported; route tree ordering is fine.
src/components/layout/authenticated-layout.tsx DataIcon replaced with map-marker SVG; new AlertsIcon bell added; Alerts nav item correctly inserted between Data and Settings.
src/i18n/messages/en.json New alerts.* keys added and stale data.* alert keys removed; en.json is clean.
src/i18n/messages/es.json New alerts.* translations added but five stale data.* alert keys were not removed, leaving es.json and pt.json out of sync with en.json.
tests/unit/screens/AlertsScreen.test.tsx Good coverage of no-project, loading, error, empty, and populated states; test for alert-card link href uses the mock raw template path which is acceptable.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    NAV[Bottom Nav]
    NAV -->|/| HOME[HomeScreen]
    NAV -->|/data| DATA[DataScreen Observations only]
    NAV -->|/alerts| ALERTS[AlertsScreen new]
    NAV -->|/settings| SETTINGS[SettingsScreen]
    ALERTS -->|Add Alert CTA| CREATE[CreateAlertScreen /data/alerts/new]
    ALERTS -->|Click card| DETAIL[AlertDetailScreen /data/alerts/$alertId]
    DATA -->|Click observation| OBS_DETAIL[ObservationDetail]
    DETAIL -->|Back button hardcoded| DATA
    DETAIL -.->|Expected back to| ALERTS
Loading

Comments Outside Diff (1)

  1. src/i18n/messages/es.json, line 51-94 (link)

    P2 Orphaned translation keys in es.json and pt.json

    en.json had data.addAlert, data.alertsError, data.noAlerts, data.tabs.alerts, and data.tabs.observations removed (they moved to alerts.*), but es.json and pt.json still contain all five of those old data.* keys. They are now dead strings not referenced by any component. If CI runs a locale key-parity check these files will diverge from en.json; at minimum they'll silently inflate the translation bundle.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: src/i18n/messages/es.json
    Line: 51-94
    
    Comment:
    **Orphaned translation keys in `es.json` and `pt.json`**
    
    `en.json` had `data.addAlert`, `data.alertsError`, `data.noAlerts`, `data.tabs.alerts`, and `data.tabs.observations` removed (they moved to `alerts.*`), but `es.json` and `pt.json` still contain all five of those old `data.*` keys. They are now dead strings not referenced by any component. If CI runs a locale key-parity check these files will diverge from `en.json`; at minimum they'll silently inflate the translation bundle.
    
    How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 2
src/screens/AlertsScreen.tsx:148-157
**Back navigation broken when entering alert detail from Alerts screen**

`AlertDetailScreen` hardcodes its back button to `to="/data"` (line 213 of `AlertDetailScreen.tsx`). A user who navigates `/alerts` → clicks an alert card → `/data/alerts/$alertId` → presses back will land on the Data screen instead of returning to Alerts. The new `/alerts` entry point shares the same detail route that was originally only reachable from `/data`, so the hardcoded back link is now wrong for this flow. Consider using `router.history.go(-1)` (or a `from` search param) in `AlertDetailScreen`, or creating a separate `/alerts/$alertId` route.

### Issue 2 of 2
src/i18n/messages/es.json:51-94
**Orphaned translation keys in `es.json` and `pt.json`**

`en.json` had `data.addAlert`, `data.alertsError`, `data.noAlerts`, `data.tabs.alerts`, and `data.tabs.observations` removed (they moved to `alerts.*`), but `es.json` and `pt.json` still contain all five of those old `data.*` keys. They are now dead strings not referenced by any component. If CI runs a locale key-parity check these files will diverge from `en.json`; at minimum they'll silently inflate the translation bundle.

Reviews (1): Last reviewed commit: "feat: implement #72 — feat: Replace Data..." | Re-trigger Greptile

Greptile also left 1 inline comment on this PR.

@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedplaywright@​1.60.01001001009980
Addedtypescript@​6.0.3100100909590
Addedprettier@​3.8.3981009793100

View full report

@socket-security

Copy link
Copy Markdown

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn High
Obfuscated code: npm seroval is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: ?npm/@storybook/tanstack-react@10.4.2npm/@tanstack/react-router@1.170.11npm/seroval@1.5.4

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/seroval@1.5.4. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

Comment on lines +148 to +157
<Link
key={alert.localId}
to="/data/alerts/$alertId"
params={{ alertId: alert.localId }}
className="no-underline"
>
<Card className="p-4 hover:shadow-elevated transition-shadow cursor-pointer h-full">
<AlertCard alert={alert} />
</Card>
</Link>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Back navigation broken when entering alert detail from Alerts screen

AlertDetailScreen hardcodes its back button to to="/data" (line 213 of AlertDetailScreen.tsx). A user who navigates /alerts → clicks an alert card → /data/alerts/$alertId → presses back will land on the Data screen instead of returning to Alerts. The new /alerts entry point shares the same detail route that was originally only reachable from /data, so the hardcoded back link is now wrong for this flow. Consider using router.history.go(-1) (or a from search param) in AlertDetailScreen, or creating a separate /alerts/$alertId route.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/screens/AlertsScreen.tsx
Line: 148-157

Comment:
**Back navigation broken when entering alert detail from Alerts screen**

`AlertDetailScreen` hardcodes its back button to `to="/data"` (line 213 of `AlertDetailScreen.tsx`). A user who navigates `/alerts` → clicks an alert card → `/data/alerts/$alertId` → presses back will land on the Data screen instead of returning to Alerts. The new `/alerts` entry point shares the same detail route that was originally only reachable from `/data`, so the hardcoded back link is now wrong for this flow. Consider using `router.history.go(-1)` (or a `from` search param) in `AlertDetailScreen`, or creating a separate `/alerts/$alertId` route.

How can I resolve this? If you propose a fix, please make it concise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Replace Data nav icon with map marker; extract Alerts into dedicated screen

1 participant