Skip to content

feat: add analytics charts, live occupancy widget, and data table components#1047

Open
walexjnr wants to merge 9 commits into
DistinctCodes:mainfrom
walexjnr:feat/fe-analytics-components
Open

feat: add analytics charts, live occupancy widget, and data table components#1047
walexjnr wants to merge 9 commits into
DistinctCodes:mainfrom
walexjnr:feat/fe-analytics-components

Conversation

@walexjnr
Copy link
Copy Markdown

Summary

Implements four frontend components inside rontend/cntr/ as specified in the linked issues.


[FE-03] Booking Trends Line Chart

Files: rontend/cntr/charts/BookingTrendsChart.tsx, BookingTrendsChart.test.tsx

echarts LineChart with two lines: New Bookings (blue #3b82f6) and Cancellations (red #ef4444)

  • ResponsiveContainer at 100% width
  • Skeleton placeholder when data.length === 0
  • Props: data: { date, bookings, cancellations }[], period: 'week' | 'month'

[FE-05] Workspace Occupancy Pie Chart

Files: rontend/cntr/charts/OccupancyPieChart.tsx, OccupancyPieChart.test.tsx

echarts PieChart, Pie, Cell, Tooltip, Legend

  • 6-colour palette constant array
  • Tooltip shows workspace name and percentage; Legend below chart
  • Props: data: { workspaceName, occupancyPercent }[]

[FE-06] Live Occupancy Counter Widget

Files: rontend/cntr/LiveOccupancy/useWebSocket.ts, LiveOccupancyWidget.tsx, LiveOccupancyWidget.test.tsx

  • useWebSocket(url) hook - exposes { data, status: 'connecting' | 'open' | 'closed' }, calls ws.close() on unmount
  • Widget displays "{current} / {capacity} occupied" with colour coding: green < 70%, yellow 70-89%, red ? 90%
  • Shows "Connecting." while status is connecting

[FE-12] Generic Sortable Paginated Data Table

Files: rontend/cntr/DataTable/DataTable.tsx, DataTable.test.tsx

  • Generic DataTable with columns, data, pageSize (default 10), onRowClick
  • Client-side sort: clicking a sortable column toggles asc/desc with ?/? indicator
  • Pagination: "Page X of Y" with Previous/Next buttons
  • Works with any object type via TypeScript generics

closes #982
closes #984
closes #985
closes #991

@vercel
Copy link
Copy Markdown

vercel Bot commented May 30, 2026

@walexjnr is attempting to deploy a commit to the naijabuz's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 30, 2026

@walexjnr Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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

Labels

None yet

Projects

None yet

1 participant