Skip to content

Dev Refactor Fixes#164

Open
1jeanpaul1 wants to merge 11 commits into
dev-refactorfrom
dev-refactor_jp
Open

Dev Refactor Fixes#164
1jeanpaul1 wants to merge 11 commits into
dev-refactorfrom
dev-refactor_jp

Conversation

@1jeanpaul1

@1jeanpaul1 1jeanpaul1 commented Mar 8, 2026

Copy link
Copy Markdown
Collaborator

Changes:

  1. Added Test files back
  2. Added google analytics back
  3. Small Changes to fix build
  4. Styling changes to put us back to what we have in production

I placed comments throughout the MR to mark important updates

Deployed here for QA testing: https://dev-refactor-jp.d1zqbru9k8x5eq.amplifyapp.com/

const fridgeId = params.fridgeId as string;
const fridgeId = (params?.fridgeId ?? '') as string;

const postReportUrl = `${process.env.NEXT_PUBLIC_FF_API_URL}/v1/reports`;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

API was incorrect - fixed

Comment thread src/app/globals.css
/* Sizes & Colors */
.marker-cluster-small {
background-color: rgba(181, 226, 140, 0.6);
background-color: rgba(255, 212, 255, 0.5);

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Used colors that matches out color palette

Comment thread src/app/layout.tsx
{children}
</Providers>
</AppRouterCacheProvider>
{analytics.TRACKING_ID && (

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

added analytics back

},
dirty: {
text: 'Fridge is dirty',
text: 'Fridge needs cleaning',

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

snuck this one in here, not needed but we wanted to update the language so I just did it here

/>
</Stack>
</>
<Box

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

snuck this one in here too, image sizing was too big so updated to the sizing that we wanted based on this previous MR

https://github.com/FridgeFinder/CFM_Frontend/pull/162/changes#diff-e1a393a61f6242ecff29fe36756332e519c6538c3db28011ab2bdeeac2a80577R135

@@ -1,5 +1,3 @@
'use client';

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

FridgeInformation component needs to be SSR, removed 'use client' and moved client side Share button to a different component

@@ -0,0 +1,36 @@
'use client';

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Moved share button to a new component so that FridgeInformation component can be SSR

label="Fridge is not at location"
/>
<FormControlLabel
{/* We will be migrating all ghost fridges to "not at location"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

dev-refactor introduced the "good" condition to the form, so removed the "ghost" condition from the form.

The team has agreed to move away from "ghost" condition so this will be the start

<Typography variant="caption">{name}</Typography>
<br />
{location.street}
<Typography

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This was removed in dev-refactor, added back in

const fridges = apiFridges
.map(transformFridge)
.filter((f) => f.report?.condition !== 'ghost')
.sort((a, b) => a.name.localeCompare(b.name));

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

adding back sorting the fridges by name, and filtering out ghost fridges

Comment thread src/theme/index.ts Outdated
styleOverrides: {
root: {
borderRadius: 45,
textTransform: 'none',

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

We want button text to be Capitalized (default), removing this

Comment thread src/theme/typography.ts Outdated
'sans-serif',
].join(','),
h1: {
fontSize: '2.5rem', // ~30pt

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Updating all of these to be more accurate to what we have in production

Comment thread src/app/browse/page.tsx Outdated
selectedFridgeId={selectedFridgeId}
onMarkerClick={setSelectedFridgeId}
/>
{!isWindowDesktop && !showSearchMap && (

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

remove search, it's not ready yet

Comment thread src/app/browse/page.tsx Outdated

const List = (
<>
{isWindowDesktop && (

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

remove search

spiderfyOnMaxZoom={true}
showCoverageOnHover={false}
maxClusterRadius={20}
maxClusterRadius={15}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

decreased cluster radius slightly

Comment thread src/utils/analytics.ts
@@ -0,0 +1,36 @@
/**

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

adding google analytics back

Comment thread package.json
"build": "next build",
"start": "next start",
"lint": "next lint",
"lint": "eslint .",

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

next lint depecated in next 15+, using eslint instead

Copilot AI left a comment

Copy link
Copy Markdown

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 restores and expands the frontend test suite, introduces a Google Analytics utility + layout integration, and applies several UI/theme adjustments intended to align styling with production while fixing build issues.

Changes:

  • Added/updated Jest tests across utils, store, app routes, and atomic components.
  • Introduced Google Analytics support (utils/analytics) and injected GA scripts from the root layout.
  • Updated theme/typography and multiple UI components (map markers, footer, buttons, spacing) plus API/reporting and mock data tweaks.

Reviewed changes

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

Show a summary per file
File Description
yarn.lock Adds new type deps (@types/gtag.js, @types/jest) and related transitive entries.
package.json Switches lint script to eslint . and adds new devDependencies for typings.
next-env.d.ts Adds a Next navigation compat type reference.
src/utils/analytics.ts New GA helper module exporting tracking ID + view/event helpers.
src/utils/analytics.test.ts Tests env-driven tracking ID behavior via module reload.
src/utils/geo.test.ts Adds unit tests for deltaInMeters.
src/app/layout.tsx Injects Google Analytics scripts when tracking ID is configured.
src/app/globals.css Adds global box-sizing reset and changes cluster marker colors.
src/theme/typography.ts Adds MUI typography variant augmentation + adjusts typography scale and introduces footer variant.
src/theme/index.ts Updates typography typing usage and tweaks button styling overrides.
src/store/useFridgeStore.ts Filters out ghost fridges and sorts fridges by name after fetch.
src/store/useFridgeStore.test.ts Adds tests for store fetch lifecycle and selectors.
src/features/navigation/components/ResponsiveAppBar.tsx Adjusts mobile drawer width.
src/features/fridge-map/components/layers/MarkerLayer.tsx Enhances popup content with MUI typography + adds action buttons; adjusts clustering radius.
src/features/fridge-management/components/ReportForm.tsx Updates condition label copy and comments out “ghost” option.
src/features/fridge-list/components/FridgeList.tsx Improves aria-label copy and adjusts button font sizing.
src/features/fridge-details/components/ShareButton.tsx Adds a dedicated client-side share button component.
src/features/fridge-details/components/FridgeInformation.tsx Refactors share logic into ShareButton, adjusts copy, and changes image rendering layout.
src/components/atoms/TitleCard/TitleCard.tsx Adjusts card sizing and typography variant.
src/components/atoms/TitleCard/TitleCard.test.tsx Adds render/link/image test coverage for TitleCard.
src/components/atoms/SoftWrap/SoftWrap.test.tsx Adds tests for sentence wrapping and edge cases.
src/components/atoms/ParagraphCard/ParagraphCard.test.tsx Adds tests for ParagraphCard variants and CTA link.
src/components/atoms/PamphletParagraph/PamphletParagraph.test.tsx Adds tests for optional/required rendering behavior.
src/components/atoms/PageHero/PageHero.tsx Removes fontVariant: small-caps styling.
src/components/atoms/PageHero/PageHero.test.tsx Adds tests for PageHero rendering with/without button.
src/components/atoms/PageFooter/PageFooter.tsx Switches footer typography variant + updates year and styling.
src/components/atoms/PageFooter/PageFooter.test.tsx Adds tests for footer text and scroll button behavior.
src/components/atoms/FeedbackCard/FeedbackCard.test.tsx Adds tests covering multiple FeedbackCard variants and interactions.
src/components/atoms/ButtonLink/ButtonLink.test.tsx Adds tests for ButtonLink variants and URL handling.
src/app/user/fridge/report/[fridgeId]/page.tsx Updates report POST endpoint to be fridge-scoped and makes param access more defensive.
src/app/user/fridge/report/[fridgeId]/page.test.tsx Adds tests for form rendering, submit success, and error flows.
src/app/user/contact/page.tsx Makes useSearchParams() access more defensive and switches to nullish coalescing.
src/app/pamphlet/best-practices/page.tsx Adjusts page vertical padding.
mock/data.json Adds missing IDs to reports and seeds contact entries.
Comments suppressed due to low confidence (1)

src/app/browse/page.tsx:50

  • showSearchMap is initialized to false and is only ever set to false (via onClose), so the SearchMap UI can never be opened anymore. That also makes searchQuery effectively not user-editable, so filtering can’t be used. Reintroduce an explicit control that sets setShowSearchMap(true) (mobile/desktop as appropriate), or remove the dead state and related JSX if search is intentionally being removed.
  const [currentView, setCurrentView] = useState<MapView>('map');
  const [showSearchMap, setShowSearchMap] = useState(false);

  const { searchQuery, setSearchQuery, filteredFridges } =
    useFridgeSearch(fridges);

  const availableHeight = useWindowHeight();
  const isWindowDesktop = useMediaQuery((theme: Theme) =>
    theme.breakpoints.up('md')
  );

  useEffect(() => {
    fetchFridges();
  }, [fetchFridges]);

  const Map = (
    <Box sx={{ position: 'relative', height: '100%' }}>
      <DynamicMap
        fridges={filteredFridges}
        selectedFridgeId={selectedFridgeId}
        onMarkerClick={setSelectedFridgeId}
      />
      {showSearchMap && (
        <SearchMap
          searchQuery={searchQuery}
          onSearchChange={setSearchQuery}
          onClose={() => setShowSearchMap(false)}
        />

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

<br />
{location.city}, {location.state} {location.zip}
</Typography>
<Stack direction="row" width="100" spacing={3} sx={{ mt: 3 }}>

Copilot AI Mar 8, 2026

Copy link

Choose a reason for hiding this comment

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

width="100" becomes width: 100 (unitless) in CSS, which is invalid and will be ignored by the browser. If the intent is full width, use width="100%" (or sx={{ width: '100%' }}); if it’s pixels, pass a number (width={100}).

Suggested change
<Stack direction="row" width="100" spacing={3} sx={{ mt: 3 }}>
<Stack direction="row" width="100%" spacing={3} sx={{ mt: 3 }}>

Copilot uses AI. Check for mistakes.
Comment thread src/store/useFridgeStore.ts
Comment thread src/components/atoms/ButtonLink/ButtonLink.test.tsx Outdated
Comment thread src/utils/analytics.ts
Comment thread src/features/fridge-details/components/FridgeInformation.tsx Outdated
fetch(`${baseUrl}${id}/reports`, {
headers: { Accept: 'application/json' },
next: { revalidate: 60 },
cache: 'no-store', //when a user makes a status update, we want to fetch the latest report. So no cache

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

we want to serve the latest report, no cache

@YELrhilassi YELrhilassi force-pushed the dev-refactor branch 5 times, most recently from adea3ae to a9ba949 Compare March 17, 2026 06:43
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