Skip to content

Conversation

@NicholusMuwonge
Copy link
Contributor

@NicholusMuwonge NicholusMuwonge commented Jan 30, 2026

Summary

Implements TRA-322: Reports Filters - Adding filtering, export, and UX improvements to the Reports page.

Features

Filtering

  • Location filter: Server-side filtering by location (uses location_id query param)
  • Time range filter: Client-side filtering with options: All time, Today, Last 7 days, Last 30 days
  • Search: Client-side search by asset name (debounced)
  • Clear filters: Action button shown when no results match

Export Options

  • PDF: Formatted report with header, timestamp, and table
  • Excel (.xlsx): Full data export with styled headers
  • CSV: Simple comma-separated export
  • Available on both Locations History and Asset History tabs

Timestamps

  • Shows actual timestamp: "Jan 30, 2026 10:30 AM"
  • Shows relative time in parentheses: "(5 min ago)"
  • Consistent format across table and mobile cards

UX Improvements

  • Results count: "Showing X results (filtered)" indicator
  • Mobile share button: Icon-only to save space
  • Flex-wrap layout: All inputs on same line, wraps naturally on mobile
  • Consistent heights: All inputs/buttons use h-[42px]
  • Empty states: Aligned pattern between tabs

Implementation Details

New Files

  • src/utils/export/reportsExport.ts - Export generators (CSV, Excel, PDF)
  • src/components/reports/LocationFilter.tsx - Searchable location dropdown
  • src/components/reports/TimeRangeFilter.tsx - Time range select
  • src/hooks/reports/useReportsFilters.ts - Combined filter state management

Modified Files

  • ReportsScreen.tsx - Main page with filters, export, flex-wrap layout
  • AssetHistoryTab.tsx - Export options, unified layout
  • CurrentLocationsTable.tsx - Timestamp display
  • CurrentLocationCard.tsx - Timestamp display for mobile
  • ShareButton.tsx - Consistent h-[42px] height
  • DateRangeInputs.tsx - Consistent h-[42px] height
  • AssetSelector.tsx - Consistent h-[42px] height

API Integration

  • Location filter uses existing /api/v1/reports/current-locations?location_id=X
  • Time range filtering is client-side (filters by last_seen timestamp)
  • Export uses filtered data from current view

Validation

  • ✅ Lint: Clean (warnings only)
  • ✅ Types: No errors
  • ✅ Tests: 1013 passed, 26 skipped
  • ✅ Build: Successful

Screenshots

Test on preview environment after deployment.


🤖 Generated with Claude Code

NicholusMuwonge and others added 4 commits January 30, 2026 21:14
Add spec for implementing functional filter dropdowns on the
Current Locations tab:
- Location filter (populated from locations API)
- Time range filter (Live, Today, Week, Stale)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Plan for adding functional filter dropdowns to Reports:
- Location filter (searchable dropdown, server-side filtering)
- Time range filter (simple select, client-side filtering)
- 7 tasks, complexity 2/10, confidence 9/10

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implement functional filter dropdowns for Current Locations tab:
- Location filter: searchable dropdown with server-side filtering
- Time range filter: client-side freshness filtering (Live, Today, Week, Stale)
- Filter-aware empty state with "Clear filters" action

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add PDF, CSV, Excel export for Current Locations tab
- Add PDF, CSV, Excel export for Asset History tab
- Show actual timestamps (Jan 30, 2026 10:30 AM) with relative time
- Remove stale assets tab
- Clean up unused ExportCsvButton and related code

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@github-actions
Copy link

🚀 Preview Deployment Update

✅ This PR has been successfully merged into the preview branch.

The preview environment will update shortly at: https://app.preview.trakrf.id

@railway-app railway-app bot temporarily deployed to trakrf / production January 30, 2026 22:35 Inactive
- Show results count (e.g., "Showing 25 results (filtered)")
- Share button is icon-only on mobile, full button on desktop
- Search and filter inputs fill width on mobile
- Date range inputs are full width on mobile
- Add hint for infinite scroll ("scroll to load more")

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@github-actions
Copy link

🚀 Preview Deployment Update

✅ This PR has been successfully merged into the preview branch.

The preview environment will update shortly at: https://app.preview.trakrf.id

@railway-app railway-app bot temporarily deployed to trakrf / production January 31, 2026 11:36 Inactive
Move empty states outside the card container to match the Asset
History tab pattern. Empty states now use flex-1 to fill available
space consistently.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@github-actions
Copy link

🚀 Preview Deployment Update

✅ This PR has been successfully merged into the preview branch.

The preview environment will update shortly at: https://app.preview.trakrf.id

@railway-app railway-app bot temporarily deployed to trakrf / production January 31, 2026 11:40 Inactive
- All inputs on same line with flex-wrap (wraps on mobile)
- Consistent h-[42px] height for all inputs, dropdowns, and buttons
- Search, filters, and share button align properly
- Works on both Current Locations and Asset History tabs

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@github-actions
Copy link

🚀 Preview Deployment Update

✅ This PR has been successfully merged into the preview branch.

The preview environment will update shortly at: https://app.preview.trakrf.id

@railway-app railway-app bot temporarily deployed to trakrf / production January 31, 2026 11:58 Inactive
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@github-actions
Copy link

🚀 Preview Deployment Update

✅ This PR has been successfully merged into the preview branch.

The preview environment will update shortly at: https://app.preview.trakrf.id

@railway-app railway-app bot temporarily deployed to trakrf / production January 31, 2026 12:09 Inactive
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@github-actions
Copy link

🚀 Preview Deployment Update

✅ This PR has been successfully merged into the preview branch.

The preview environment will update shortly at: https://app.preview.trakrf.id

@railway-app railway-app bot temporarily deployed to trakrf / production January 31, 2026 12:14 Inactive
@NicholusMuwonge NicholusMuwonge merged commit 2c884b1 into main Jan 31, 2026
6 checks passed
@NicholusMuwonge NicholusMuwonge deleted the feature/TRA-322-reports-filters branch January 31, 2026 12:28
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.

1 participant