Skip to content

29-feature/swearjar/[id]/view-page#31

Merged
MikeyTheOng merged 23 commits into
mainfrom
29-feature/view-swearjar
Sep 8, 2024
Merged

29-feature/swearjar/[id]/view-page#31
MikeyTheOng merged 23 commits into
mainfrom
29-feature/view-swearjar

Conversation

@MikeyTheOng

Copy link
Copy Markdown
Owner

Description

This PR introduces the 'swearjar/[id]/view' page, along with key frontend and backend components necessary for the functionality of the SwearJar system. It includes updating the existing /api/swearjar nextjs endpoint, writing new golang endpoints, resolving mobile sticky hover issue, and addressing visual inconsistencies in charts.

SwearJar View Page

  • Create 'swearjar/[id]/view' page to display detailed SwearJar information { Includes components for SwearJarInfo, SwearJarTrend, and SwearJarRecent }
  • Update grid order of the 'swearjar/[id]/view' page for both mobile and desktop layouts
  • Add active state to SwearJarCards for better user interaction { Visually indicates the selected card when active }
  • Wrap SwearJarCards in swearjar/list within a to enable redirection to the detailed view on click

Next.js Backend

  • Rename /api/swearJar to /api/swearjar for consistency
  • Update GET /api/swearjar to fetch details of a specific SwearJar if an id query parameter is present
    • Previously, the endpoint did not check for an id query parameter.
    • Now, if an id is provided, the endpoint calls /swearjar?id={id} to retrieve a specific swear jar
    • If no id is provided, it calls /swearjar to retrieve swear jars by user ID

Golang Backend

  • Update GET /swearjar to fetch Swear Jar by it's ID, provided a query parameter is provided. Otherwise, it will retrieve a user's swearjar list
    • rest package: Update swearjar route and add GetSwearJarById method in handler
    • swearjar package: Update Service and Repository interfaces to include GetSwearJarById method
    • mongodb package: Implement GetSwearJarById method in MongoRepository
  • Create re-usable GetUserIdFromCookie method and implemented in GetSwearJarsByUserId method

Misc

  • Resolve the “sticky hover” problem on devices that don’t support hovering by adding 'hoverOnlyWhenSupported' in tailwind.config { Ensures hover behavior only occurs on devices that support it, improving UX on touchscreens }
  • Create a recharts patch-package to fix the disappearing gridline issue in charts { Fixes a visual bug when rendering Recharts on screens smaller than 375px }
  • Add a bottom margin to the layout in the swearjar/layout, which affects all pages within that folder

…T `/swearjar`, provided a query parameter is provided

- rest pkg: Update `swearjar` route and add `GetSwearJarById` method in handler
- swearjar pkg: Update Service and Repository interfaces to include `GetSwearJarById` method
- mongodb pkg: Implement `GetSwearJarById` method in MongoRepository
…mically based on the presence of a `swearJarId` query parameter

- Previously, the endpoint did not check for an `id` query parameter.
- Now, if an `id` is provided, the endpoint calls `/swearjar?id={id}` to retrieve a specific swear jar
- If no `id` is provided, it calls `/swearjar` to retrieve swear jars by user ID
- Corresponding backend logic differentiates handling based on the presence of `swearJarId`
…tch-fix to recharts resolve disappearing grid line issue
- Added error handling with `ErrorAlert` to display messages when data fetching fails
…render BreadcrumbHeader, SwearJarTrends, and SwearJarInfo components
@MikeyTheOng MikeyTheOng linked an issue Sep 8, 2024 that may be closed by this pull request
@MikeyTheOng MikeyTheOng merged commit 995f8df into main Sep 8, 2024
@MikeyTheOng

Copy link
Copy Markdown
Owner Author

sticky hover issue fix - tailwindlabs/tailwindcss#8394

@MikeyTheOng

Copy link
Copy Markdown
Owner Author

disappearing grid lines in recharts issue - recharts/recharts#1286

@MikeyTheOng MikeyTheOng deleted the 29-feature/view-swearjar branch November 2, 2024 11:45
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.

View swearJar

1 participant