Skip to content

update faces of clean air page#3782

Merged
Baalmart merged 5 commits into
stagingfrom
chore/content-updates
Jul 9, 2026
Merged

update faces of clean air page#3782
Baalmart merged 5 commits into
stagingfrom
chore/content-updates

Conversation

@OchiengPaul442

@OchiengPaul442 OchiengPaul442 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary of Changes (What does this PR do?)

  • Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Status of maturity (all need to be checked before merging):

  • I've tested this locally
  • I consider this code done

Screenshots (optional)

Summary by CodeRabbit

  • New Features

    • Added support for looking up selfies by ID in the app’s API routes.
  • Bug Fixes

    • Improved selfie wall data handling so items without a usable ID are skipped instead of breaking the list.
    • Made the selfie wall more reliable when loading data by returning an empty state on errors.
  • Style

    • Refreshed the selfie wall’s look with a teal/green visual theme and updated card, empty-state, and progress indicator styling.
  • Documentation

    • Updated project status badges in the main README.

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4da0d82e-f8de-48ad-ad5c-6f1034f729b1

📥 Commits

Reviewing files that changed from the base of the PR and between 0b23e3c and 208423d.

📒 Files selected for processing (3)
  • src/website/src/app/api/v2/[...slug]/route.ts
  • src/website/src/features/faces-of-clean-air/FacesOfCleanAirPage.tsx
  • src/website/src/services/external/faces-of-clean-air.service.ts

📝 Walkthrough

Walkthrough

Restructures the API proxy route's request handling order and narrows body-forwarding to POST/PUT, adds a selfie-by-id route and normalized submission id typing to the Faces of Clean Air service, updates the page's data typing/keys accordingly, restyles the page from blue to teal, and removes unused glare effects. README badges also updated.

Changes

API proxy and README badge

Layer / File(s) Summary
Proxy route restructure and PATCH body handling
src/website/src/app/api/v2/[...slug]/route.ts, src/website/README.md
handleRequest moved earlier in the module, the API_TOKEN config guard relocated after path mapping, request body forwarding limited to POST/PUT (removing PATCH), and README badges swapped to a CI badge.

Estimated code review effort: 2 (Simple) | ~12 minutes

Faces of Clean Air id normalization and teal restyle

Layer / File(s) Summary
Selfie route and submission id normalization
src/website/src/services/api/api-routes.ts, src/website/src/services/external/faces-of-clean-air.service.ts
Adds API_ROUTES.USERS.SELFIE_BY_ID, makes CleanAirSubmission.id/_id optional/nullable, adds CleanAirSubmissionWithId, and updates getSubmissions to normalize/filter ids into a guaranteed-id result.
Page typing and rendering updates
src/website/src/features/faces-of-clean-air/FacesOfCleanAirPage.tsx
Imports CleanAirSubmissionWithId, updates submissions state and FaceCard's prop type, and changes the per-card key to submission.id.
Teal visual restyle and effect cleanup
src/website/src/features/faces-of-clean-air/FacesOfCleanAirPage.tsx
Replaces blue colors with teal across backgrounds, glows, skeleton cards, card media (square/contain), empty/error states, and pagination indicators; updates event label constants, removes CategoryStyle, and removes the useMotionTemplate glare effect.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

  • airqo-platform/AirQo-frontend#3756: Builds on the same selfie wall implementation, facesOfCleanAirService, and FacesOfCleanAirPage that this PR normalizes and restyles.

Suggested reviewers: Baalmart

Poem

A rabbit hops through teal-lit sand,
Where blue once glowed, now green expands.
IDs trimmed and PATCH set free,
Proxy routes reorder gracefully.
🐰✨ Faces shine anew today.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is clearly related to the main change: updates to the Faces of Clean Air page.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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 chore/content-updates

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • JIRA integration encountered authorization issues. Please disconnect and reconnect the integration in the CodeRabbit UI.

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.

@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.74%. Comparing base (fa4332c) to head (208423d).
⚠️ Report is 28 commits behind head on staging.

Additional details and impacted files
Flag Coverage Δ
website 79.92% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

@@             Coverage Diff              @@
##           staging    #3782       +/-   ##
============================================
+ Coverage    53.30%   64.74%   +11.43%     
============================================
  Files          112      158       +46     
  Lines         4523     7930     +3407     
  Branches      1476     1923      +447     
============================================
+ Hits          2411     5134     +2723     
- Misses        2112     2734      +622     
- Partials         0       62       +62     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

New azure website changes available for preview here

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/website/src/features/faces-of-clean-air/FacesOfCleanAirPage.tsx`:
- Around line 760-804: The delete/hide handlers in FacesOfCleanAirPage currently
only react to thrown errors, but deleteSubmission and hideSubmission can fail by
returning false, so the user gets no feedback and the modal closes as if
success. Update handleConfirmDelete and handleConfirmHide to check the success
result explicitly, and surface a visible failure state (toast, inline message,
or similar) when the service returns false or throws, instead of silently
resetting state in the finally block. Use the existing handleConfirmDelete,
handleConfirmHide, and facesOfCleanAirService.deleteSubmission/hideSubmission
symbols to place the fix.
- Around line 1304-1365: The moderation modal in FacesOfCleanAirPage is missing
accessible dialog behavior; update the deleteTarget overlay/panel motion.divs to
expose proper dialog semantics with role="dialog", aria-modal="true", and an
aria-labelledby tied to the title, add an Escape key handler to close it, and
ensure focus is moved into the modal when it opens and trapped there until
handleCancelDelete runs.

In `@src/website/src/services/api/api-client.ts`:
- Around line 141-144: The client-side auth token handling in api-client.ts is
using a token query parameter that the Next.js proxy strips before the backend
sees it. Update the request path in the api-client logic to pass authToken
through a header or otherwise use an explicitly allow-listed parameter, and make
sure the token injection point in the client request builder is aligned with the
proxy behavior.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 51204733-2394-4811-ab1c-5c505644457b

📥 Commits

Reviewing files that changed from the base of the PR and between 09c86b4 and 0b23e3c.

📒 Files selected for processing (7)
  • src/website/README.md
  • src/website/src/app/api/v2/[...slug]/route.ts
  • src/website/src/features/faces-of-clean-air/FacesOfCleanAirPage.tsx
  • src/website/src/services/api/api-client.ts
  • src/website/src/services/api/api-error.ts
  • src/website/src/services/api/api-routes.ts
  • src/website/src/services/external/faces-of-clean-air.service.ts

Comment thread src/website/src/features/faces-of-clean-air/FacesOfCleanAirPage.tsx Outdated
Comment thread src/website/src/features/faces-of-clean-air/FacesOfCleanAirPage.tsx Outdated
Comment on lines +141 to +144
// Add auth token for client-side authenticated requests
if (!isServerSide && authToken) {
searchParams.set('token', authToken);
}

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.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the API client and proxy route around the referenced lines.
git ls-files 'src/website/src/services/api/api-client.ts' 'src/website/src/app/api/v2/[...slug]/route.ts'

echo
echo '--- api-client.ts (relevant slice) ---'
sed -n '120,170p' src/website/src/services/api/api-client.ts

echo
echo '--- route.ts (relevant slice) ---'
sed -n '1,220p' src/website/src/app/api/v2/[...slug]/route.ts

Repository: airqo-platform/AirQo-frontend

Length of output: 7452


Client-side authToken is dropped by the proxy

The Next.js proxy strips any incoming token query param and replaces it with API_TOKEN, so the value set here never reaches the backend. If per-user auth is intended, forward it in a header or explicitly allow-list this param.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/website/src/services/api/api-client.ts` around lines 141 - 144, The
client-side auth token handling in api-client.ts is using a token query
parameter that the Next.js proxy strips before the backend sees it. Update the
request path in the api-client logic to pass authToken through a header or
otherwise use an explicitly allow-listed parameter, and make sure the token
injection point in the client request builder is aligned with the proxy
behavior.

@OchiengPaul442
OchiengPaul442 requested a review from Baalmart July 9, 2026 12:12

Copilot AI left a comment

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.

Pull request overview

Updates the “Faces of Clean Air” website page to support moderation actions (hide/delete submissions), improves robustness of submission identifiers, and refreshes the page’s visual theme.

Changes:

  • Normalizes selfie submission IDs to handle both id and _id, and adds service methods to hide/delete submissions.
  • Extends the Next.js /api/v2/* proxy to support PATCH requests.
  • Refreshes the Faces of Clean Air page UI styling/layout and updates website README badges.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/website/src/services/external/faces-of-clean-air.service.ts Normalizes submission identifiers and adds hide/delete service calls.
src/website/src/services/api/api-routes.ts Adds a SELFIE_BY_ID route helper for moderation actions.
src/website/src/features/faces-of-clean-air/FacesOfCleanAirPage.tsx Updates page styling and introduces moderation UI + client-side handlers.
src/website/src/app/api/v2/[...slug]/route.ts Adds PATCH method support to the API proxy route.
src/website/README.md Updates badges/links for CI, Codecov, Node.js, and TypeScript.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 4 to 7
export interface CleanAirSubmission {
id: string;
_id: string;
eventId: string;
Comment on lines 32 to 35
if (response.success && response.data) {
return response.data.selfies ?? [];
const selfies = response.data.selfies ?? [];
return selfies.map((s) => ({ ...s, id: s.id || s._id }));
}
Comment on lines 372 to 375
onPointerMove={handlePointerMove}
onPointerLeave={resetPointerPosition}
onDoubleClick={() => onDeleteRequest?.(submission)}
style={{
Comment on lines 1299 to 1303
isMobile ? page === 0 : page === 0 && index < 3
}
reduceMotion={shouldReduceMotion}
onDeleteRequest={handleDeleteRequest}
/>
Comment on lines +65 to +70
export async function PATCH(
request: NextRequest,
{ params }: { params: { slug: string[] } },
) {
return handleRequest(request, params.slug, 'PATCH');
}
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

New azure website changes available for preview here

@Baalmart
Baalmart merged commit ffa96a0 into staging Jul 9, 2026
27 checks passed
@Baalmart
Baalmart deleted the chore/content-updates branch July 9, 2026 18:28
@Baalmart Baalmart mentioned this pull request Jul 9, 2026
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants