Skip to content

SANC-106: add rider log table view#77

Open
tanvimahal wants to merge 1 commit intomainfrom
SANC-106-rider-logs-in-admin-view
Open

SANC-106: add rider log table view#77
tanvimahal wants to merge 1 commit intomainfrom
SANC-106-rider-logs-in-admin-view

Conversation

@tanvimahal
Copy link
Copy Markdown
Member

@tanvimahal tanvimahal commented Apr 13, 2026

Added a rider logs table view based on the vehicle logs frontend and the Figma design.

  • The CSV functionality still needs to be added (i believe its SANC-96)

Summary by CodeRabbit

Release Notes

  • New Features
    • Added new Rider Logs page with interactive table view for managing rider log records.
    • Displays rider information including passenger details, departure time, passenger rating, location changes, and comments.
    • Added export to CSV functionality to download rider logs data.

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
salvationarmy Ready Ready Preview, Comment Apr 13, 2026 4:04am

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 13, 2026

📝 Walkthrough

Walkthrough

A new rider log table display feature is introduced, consisting of an AG Grid-based RiderLogTableView component with custom header rendering, styling, and configuration constants. The rider logs page is converted from an async server component to a client component that integrates the new table view.

Changes

Cohort / File(s) Summary
Table Styling
src/app/_components/riderlogcomponents/rider-log-table-view.module.scss
New SCSS module defining tableContainer, headerWithIcon, and headerName classes for AG Grid table layout, header styling with right borders and custom typography.
Table Component & Configuration
src/app/_components/riderlogcomponents/rider-log-table-view.tsx, src/constants/RiderLogTableConstants.ts
New RiderLogTableView component with RiderLogData interface, custom header rendering with edit/mail icons, rating display with SVG mapping, and AG Grid column definitions. Companion constants file exports column sizing, IDs, headers, and theme parameters.
Page Integration
src/app/admin/rider-logs/page.tsx
Converted from async server component to client component with Mantine layout containing title, export CSV button, and integrated RiderLogTableView.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Suggested reviewers

  • wesleylui
  • JustinTan-1
  • themaxboucher
  • Yemyam
  • Lujarios

Poem

🐰 A table hops into view today,
With icons and ratings to display,
AG Grid dancing in Quartz so bright,
Rider logs sparkle, styled just right!
Thump thump goes the review delight! 🎉

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding a rider log table view component to the admin view, which aligns with the primary objective and the substantial changes across multiple files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch SANC-106-rider-logs-in-admin-view

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/app/_components/riderlogcomponents/rider-log-table-view.tsx`:
- Around line 106-109: In the valueFormatter for the column (valueFormatter)
guard against malformed dates by constructing a Dayjs instance from params.value
and calling isValid() before formatting; if the date is invalid or params.value
falsy, return an empty string, otherwise return dayjs(params.value).format("MMM
D, YYYY") — update the valueFormatter logic in rider-log-table-view.tsx
accordingly.

In `@src/app/admin/rider-logs/page.tsx`:
- Around line 13-15: The "Export to CSV File" Button in
src/app/admin/rider-logs/page.tsx is interactive but has no handler; change the
Button (rendered inside Group) to a non-interactive/disabled state by adding the
disabled prop (and optionally aria-disabled and a tooltip/title like "Coming
soon") so the control is visibly inert until CSV functionality is implemented;
ensure you update the Button with the unique text/content "Export to CSV File"
so reviewers can find and verify the change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 39c078e6-18ee-4249-984b-83226cf05e6c

📥 Commits

Reviewing files that changed from the base of the PR and between 596e2cd and 8c915ea.

📒 Files selected for processing (4)
  • src/app/_components/riderlogcomponents/rider-log-table-view.module.scss
  • src/app/_components/riderlogcomponents/rider-log-table-view.tsx
  • src/app/admin/rider-logs/page.tsx
  • src/constants/RiderLogTableConstants.ts

Comment on lines +106 to +109
valueFormatter: (params) => {
if (!params.value) return "";
return dayjs(params.value).format("MMM D, YYYY");
},
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot Apr 13, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Inspect surveys.getAll output shaping =="
rg -n "getAll: protectedProcedure|timeOfDeparture|departure|map\\(|return" src/server/api/routers/surveys.ts -C4

Repository: Code-the-Change-YYC/salvationarmy

Length of output: 5699


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Inspect rider-log-table-view.tsx structure and data binding =="
# Find the component file
fd -t f "rider-log-table-view.tsx"

# Get file size first to avoid reading huge files
wc -l src/app/_components/riderlogcomponents/rider-log-table-view.tsx 2>/dev/null || echo "File not found, searching..."

Repository: Code-the-Change-YYC/salvationarmy

Length of output: 274


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# If file exists, read around the formatter lines to see context
if [ -f "src/app/_components/riderlogcomponents/rider-log-table-view.tsx" ]; then
  echo "== Context around lines 100-115 =="
  sed -n '95,120p' src/app/_components/riderlogcomponents/rider-log-table-view.tsx
  
  echo -e "\n== Check for API query usage and data flow =="
  rg -n "api\.surveys\.getAll|useSurveys|timeOfDeparture" src/app/_components/riderlogcomponents/rider-log-table-view.tsx -A2 -B2
else
  echo "File not found in expected location"
  fd -i "rider-log" --type f
fi

Repository: Code-the-Change-YYC/salvationarmy

Length of output: 1566


Guard against invalid date strings before formatting.

The formatter can output "Invalid Date" for malformed values. Even though the backend validates timeOfDeparture as ISO 8601 format, add an isValid() check to gracefully fall back to empty text:

         valueFormatter: (params) => {
           if (!params.value) return "";
-          return dayjs(params.value).format("MMM D, YYYY");
+          const parsed = dayjs(params.value);
+          return parsed.isValid() ? parsed.format("MMM D, YYYY") : "";
         },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
valueFormatter: (params) => {
if (!params.value) return "";
return dayjs(params.value).format("MMM D, YYYY");
},
valueFormatter: (params) => {
if (!params.value) return "";
const parsed = dayjs(params.value);
return parsed.isValid() ? parsed.format("MMM D, YYYY") : "";
},
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/app/_components/riderlogcomponents/rider-log-table-view.tsx` around lines
106 - 109, In the valueFormatter for the column (valueFormatter) guard against
malformed dates by constructing a Dayjs instance from params.value and calling
isValid() before formatting; if the date is invalid or params.value falsy,
return an empty string, otherwise return dayjs(params.value).format("MMM D,
YYYY") — update the valueFormatter logic in rider-log-table-view.tsx
accordingly.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

i think this is a valid concern @tanvimahal

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

Comment on lines +13 to +15
{/* TODO: SANC-96 adds csv functionality */}
<Button text="Export to CSV File" variant="secondary" icon={<Grid />} />
</Group>
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot Apr 13, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Disable the CSV button until the action exists.

On Line 14, the button is interactive but has no handler. That’s a misleading control in production UI.

Small UX-safe adjustment
-        <Button text="Export to CSV File" variant="secondary" icon={<Grid />} />
+        <Button
+          text="Export to CSV File"
+          variant="secondary"
+          icon={<Grid />}
+          disabled
+        />
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{/* TODO: SANC-96 adds csv functionality */}
<Button text="Export to CSV File" variant="secondary" icon={<Grid />} />
</Group>
{/* TODO: SANC-96 adds csv functionality */}
<Button
text="Export to CSV File"
variant="secondary"
icon={<Grid />}
disabled
/>
</Group>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/app/admin/rider-logs/page.tsx` around lines 13 - 15, The "Export to CSV
File" Button in src/app/admin/rider-logs/page.tsx is interactive but has no
handler; change the Button (rendered inside Group) to a non-interactive/disabled
state by adding the disabled prop (and optionally aria-disabled and a
tooltip/title like "Coming soon") so the control is visibly inert until CSV
functionality is implemented; ensure you update the Button with the unique
text/content "Export to CSV File" so reviewers can find and verify the change.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yeah lets disable the button for now @tanvimahal

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

import Rating4 from "@/assets/icons/rating4";
import Rating5 from "@/assets/icons/rating5";
import {
COLUMN_IDS,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

unused import

@@ -0,0 +1,37 @@
import type { ColDef } from "ag-grid-community";

export const DEFAULT_COLUMN_WIDTH = 150;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

DEFAULT_COLUMN_WIDTH isnt used

Comment on lines +26 to +32
export interface RiderLogData {
timeOfDeparture: string | null;
originalLocationChanged: boolean | null;
passengerFitRating: number | null;
passengerInfo: string | null;
comments: string | null;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we try using a Pick?

Suggested change
export interface RiderLogData {
timeOfDeparture: string | null;
originalLocationChanged: boolean | null;
passengerFitRating: number | null;
passengerInfo: string | null;
comments: string | null;
}
type RiderLogData = Pick<
SurveySelectType,
| "timeOfDeparture"
| "originalLocationChanged"
| "passengerFitRating"
| "passengerInfo"
| "comments"
>;

[COLUMN_IDS.PASSENGER_INFO]: "Passenger name",
[COLUMN_IDS.DEPARTURE_TIME]: "Transport Date",
[COLUMN_IDS.PASSENGER_RATING]: "Fitness rating",
[COLUMN_IDS.LOCATION_CHANGED]: "Did Passenger Request to be dropped off at a different location?",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this string is too long to fit in a column header. it gets cut off

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.

2 participants