Skip to content

Conversation

@shakilhossain1
Copy link
Collaborator

No description provided.

@jbeard4 jbeard4 temporarily deployed to yourpeer-shakil-dynamic-9ffwsp May 16, 2025 11:30 Inactive
@jbeard4 jbeard4 temporarily deployed to yourpeer-shakil-dynamic-9ffwsp May 16, 2025 11:32 Inactive
@jbeard4
Copy link
Member

jbeard4 commented May 16, 2025

@shakilhossain1 Needs corresponding back-end PR.

@jbeard4 jbeard4 requested a review from Copilot June 28, 2025 02:03
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fetches the live count of services from the API and displays it dynamically on the homepage.

  • Changed getServicesCount to return a typed {count: number} instead of unknown.
  • Updated HomePage to an async component that calls getServicesCount and injects the count into the hero text.

Reviewed Changes

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

File Description
src/components/streetlives-api-service.ts Update getServicesCount return type for strong typing
src/app/page.tsx Make HomePage async, fetch service count, and render dynamic text
Comments suppressed due to low confidence (1)

src/components/streetlives-api-service.ts:834

  • There’s no test covering this newly typed service call. Adding a unit test (mocking the HTTP response) would ensure the function returns the expected { count } shape.
export async function getServicesCount(): Promise<{ count: number }> {

Comment on lines +41 to +42
Search through {servicesCount.count}+ free support services across
NYC
Copy link

Copilot AI Jun 28, 2025

Choose a reason for hiding this comment

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

The dynamic text is no longer wrapped in TranslatableText, which breaks localization. Wrap the entire message—including the interpolated count—in your translation component or use an i18n interpolation pattern so it remains translatable.

Suggested change
Search through {servicesCount.count}+ free support services across
NYC
<TranslatableText
text="Search through {count}+ free support services across NYC"
values={{ count: servicesCount.count }}
/>

Copilot uses AI. Check for mistakes.

export default function HomePage() {
export default async function HomePage() {
const servicesCount = await getServicesCount();
Copy link

Copilot AI Jun 28, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider adding error handling or a fallback (e.g. default count) around this API call to prevent the page from crashing if the request fails.

Suggested change
const servicesCount = await getServicesCount();
let servicesCount = { count: 0 }; // Default fallback value
try {
servicesCount = await getServicesCount();
} catch (error) {
console.error("Failed to fetch services count:", error);
}

Copilot uses AI. Check for mistakes.
Copy link
Member

@jbeard4 jbeard4 left a comment

Choose a reason for hiding this comment

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

This looks fine. I'm going to wait to merge it until I have the server deployed.

@jbeard4
Copy link
Member

jbeard4 commented Jul 9, 2025

Still stuck on back-end deployment related to API gateway. Working on this.

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.

3 participants