Skip to content

Staging#1145

Merged
JayeshVP24 merged 8 commits into
mainfrom
staging
Jul 24, 2025
Merged

Staging#1145
JayeshVP24 merged 8 commits into
mainfrom
staging

Conversation

@JayeshVP24
Copy link
Copy Markdown
Contributor

@JayeshVP24 JayeshVP24 commented Jul 24, 2025

What does this PR do?

Where should the reviewer start?

How should this be manually tested?

Any background context you want to provide?

What are the relevant issues?

Screenshots (if appropriate)

Summary by CodeRabbit

  • New Features

    • Private listings now include meta tags to prevent search engines from indexing or following the page.
  • Improvements

    • Refined eligibility question logic: the first project question is always required and cannot be toggled optional; adjusted question limits for bounties (5) and projects (10).
    • Enhanced region label logic for more accurate display values.
    • "For You" category is now visible if the user is authenticated, regardless of session status.
    • Increased and standardized font sizes and padding in sponsor credits for improved readability.
    • Simplified animated content structure in announcements.
    • Updated loader animation for a smoother and more visually appealing effect.
    • Improved loading spinner structure in pre-publish modal for better layout consistency.
  • Chores

    • Added authentication state to listing hooks for more accurate data handling.

@vercel
Copy link
Copy Markdown

vercel Bot commented Jul 24, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
earn ✅ Ready (Inspect) Visit Preview Jul 24, 2025 11:01am

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jul 24, 2025

Walkthrough

This update refactors UI components and styles across several files. It modifies layout and animation wrappers, adjusts typography and padding, updates logic for eligibility questions, alters region label handling, and enhances loader animation. It also adds search engine meta tags for private listings and includes authentication state in listings queries.

Changes

File(s) Change Summary
src/features/announcements/components/AnnouncementContent.tsx Removed AnimateChangeInHeight wrapper, replaced with static height and flex layout for content container.
src/features/announcements/sponsor/Credits.tsx Increased base font sizes and padding; removed responsive typography and padding classes.
src/features/listing-builder/components/Form/EligibilityQuestions/QuestionsForm.tsx Refined logic for required/optional questions, especially for first project question; updated question count limits and UI for bounty/project types.
src/features/listing-builder/components/Form/PrePublish/Modal.tsx Changed loader spinner structure by wrapping it in a span for improved DOM structure and styling.
src/features/listings/components/ListingPage/RegionLabel.tsx Simplified region lookup logic, removed string transformation, added debug logs, and expanded logic for determining display value.
src/features/listings/components/ListingsSection.tsx Added authenticated state to listings query parameters; changed logic for displaying "For You" category pill to include authenticated users.
src/features/listings/hooks/useListings.ts Added optional authenticated property to ListingsParams and included it in the query cache key for the useListings hook.
src/pages/listing/[slug]/index.tsx Added meta tags to prevent indexing of private bounties; wrapped main JSX in a fragment; imported Head for meta tags.
src/styles/globals.css Refactored .earn-loader animation: replaced border with box-shadow, centered and scaled animation, and simplified keyframes to animate scale and opacity.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ListingsSection
    participant usePrivy
    participant useListings

    User->>ListingsSection: Render component
    ListingsSection->>usePrivy: Get authenticated state
    ListingsSection->>useListings: Pass authenticated and other params
    useListings->>useListings: Include authenticated in queryKey
    useListings->>ListingsSection: Return listings data
    ListingsSection->>User: Render listings (show "For You" if authenticated)
Loading
sequenceDiagram
    participant User
    participant BountyDetailsPage

    User->>BountyDetailsPage: Request listing page
    BountyDetailsPage->>BountyDetailsPage: Check isPrivate on bounty
    alt isPrivate
        BountyDetailsPage->>BountyDetailsPage: Add <Head> meta tags (noindex, nofollow)
    end
    BountyDetailsPage->>User: Render page content
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~18 minutes

Possibly related PRs

  • SuperteamDAO/earn#1106: Introduced the AnimateChangeInHeight component, which is now removed from AnnouncementContent.tsx in this PR.

Poem

A loader spins with shadowed grace,
Announcements shed their height embrace.
Questions count with logic new,
Listings greet the logged-in crew.
Private bounties hide from sight—
CSS glimmers, bold and bright.
🐇 Cheers to code that feels just right!

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch staging

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@JayeshVP24 JayeshVP24 merged commit 9b4757d into main Jul 24, 2025
1 of 2 checks passed
Copy link
Copy Markdown
Contributor

@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: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9afbfc9 and fca4d53.

📒 Files selected for processing (9)
  • src/features/announcements/components/AnnouncementContent.tsx (2 hunks)
  • src/features/announcements/sponsor/Credits.tsx (1 hunks)
  • src/features/listing-builder/components/Form/EligibilityQuestions/QuestionsForm.tsx (3 hunks)
  • src/features/listing-builder/components/Form/PrePublish/Modal.tsx (1 hunks)
  • src/features/listings/components/ListingPage/RegionLabel.tsx (1 hunks)
  • src/features/listings/components/ListingsSection.tsx (2 hunks)
  • src/features/listings/hooks/useListings.ts (3 hunks)
  • src/pages/listing/[slug]/index.tsx (2 hunks)
  • src/styles/globals.css (2 hunks)
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/any-inside-generic-functions.mdc)

**/*.{ts,tsx}: When building generic functions in TypeScript, you may need to use any inside the function body to satisfy type constraints that cannot be expressed concisely.
Outside of generic functions, use any extremely sparingly in TypeScript code.

Unless explicitly required by the framework, do not use default exports in TypeScript files.

**/*.{ts,tsx}: Proactively use discriminated unions to model data that can be in one of a few different shapes.
Use switch statements to handle the results of discriminated unions.
Use discriminated unions to prevent the 'bag of optionals' problem when modeling state (e.g., fetching state).

**/*.{ts,tsx}: Do not introduce new enums into the codebase. Retain existing enums.
If you require enum-like behaviour, use an as const object instead of enums.
Remember that numeric enums behave differently to string enums. Numeric enums produce a reverse mapping, resulting in more keys than expected.

**/*.{ts,tsx}: Use import type whenever you are importing a type.
Prefer top-level import type over inline import { type ... }.

**/*.{ts,tsx}: ALWAYS prefer interfaces when modelling inheritance in TypeScript
Only use the & operator in TypeScript where interface extends is not possible, due to performance concerns

Inside generic types, functions or classes, prefix type parameters with T (e.g., TKey, TValue)

Use optional properties extremely sparingly in TypeScript. Only use them when the property is truly optional, and consider whether bugs may be caused by a failure to pass the property. For example, prefer userId: string | undefined over userId?: string when the property should always be present but may be undefined.

**/*.{ts,tsx}: Use readonly properties for object types by default. This will prevent accidental mutation at runtime.
Omit readonly only when the property is genuinely mutable.

When declaring functions on the top-level of a module, declare their return types.

Consider using a re...

Files:

  • src/features/listing-builder/components/Form/PrePublish/Modal.tsx
  • src/features/announcements/components/AnnouncementContent.tsx
  • src/features/listings/components/ListingsSection.tsx
  • src/features/announcements/sponsor/Credits.tsx
  • src/features/listings/components/ListingPage/RegionLabel.tsx
  • src/pages/listing/[slug]/index.tsx
  • src/features/listings/hooks/useListings.ts
  • src/features/listing-builder/components/Form/EligibilityQuestions/QuestionsForm.tsx
!(.cursor/rules/*.mdc)

📄 CodeRabbit Inference Engine (.cursor/rules/cursor-rules.mdc)

Never place rule files in the project root, in subdirectories outside .cursor/rules, or in any other location

Files:

  • src/features/listing-builder/components/Form/PrePublish/Modal.tsx
  • src/features/announcements/components/AnnouncementContent.tsx
  • src/features/listings/components/ListingsSection.tsx
  • src/features/announcements/sponsor/Credits.tsx
  • src/features/listings/components/ListingPage/RegionLabel.tsx
  • src/pages/listing/[slug]/index.tsx
  • src/features/listings/hooks/useListings.ts
  • src/features/listing-builder/components/Form/EligibilityQuestions/QuestionsForm.tsx
  • src/styles/globals.css
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/jsdoc-comments.mdc)

**/*.{js,jsx,ts,tsx}: Use JSDoc comments to annotate functions and types.
Be concise in JSDoc comments, and only provide JSDoc comments if the function's behaviour is not self-evident.
Use the JSDoc inline @link tag to link to other functions and types within the same file.

**/*.{js,jsx,ts,tsx}: Use camelCase for variables and function names (e.g., myVariable, myFunction())
Use UpperCamelCase (PascalCase) for classes, types, and interfaces (e.g., MyClass, MyInterface)
Use ALL_CAPS for constants and enum values (e.g., MAX_COUNT, Color.RED)

**/*.{js,jsx,ts,tsx}: Use updater functions (functional updater pattern) when performing multiple sequential updates to the same state variable in React components.
Always use updater functions for state updates inside asynchronous operations (such as async functions, API calls, or timers) to avoid stale state in React components.
Do not suppress the React hooks dependency linter (e.g., eslint-disable-next-line react-hooks/exhaustive-deps); instead, restructure code to fix missing dependencies.
Always include all reactive values (props, state, variables declared in the component body) used inside a useEffect in its dependency array.
Use Effect Events (such as useEffectEvent) for reading values inside effects without making them reactive, and only call Effect Events from inside Effects.
Avoid using useEffect for computations or deriving values from state or props; instead, calculate such values during rendering.
Avoid using useEffect for handling events; handle side effects directly in the event handler that caused the state change.
Always handle cleanup in useEffect to prevent memory leaks (e.g., remove event listeners, cancel timers, or abort network requests).
Prefer small, focused state variables over large object state in React components.
Always treat state as immutable in React; never modify state objects or arrays directly.
Extract repeated Effect logic into custom Hooks for reuse.
When migrating to new...

Files:

  • src/features/listing-builder/components/Form/PrePublish/Modal.tsx
  • src/features/announcements/components/AnnouncementContent.tsx
  • src/features/listings/components/ListingsSection.tsx
  • src/features/announcements/sponsor/Credits.tsx
  • src/features/listings/components/ListingPage/RegionLabel.tsx
  • src/pages/listing/[slug]/index.tsx
  • src/features/listings/hooks/useListings.ts
  • src/features/listing-builder/components/Form/EligibilityQuestions/QuestionsForm.tsx
**/*.*

📄 CodeRabbit Inference Engine (.cursor/rules/naming-conventions.mdc)

Use kebab-case for file names (e.g., my-component.ts)

Files:

  • src/features/listing-builder/components/Form/PrePublish/Modal.tsx
  • src/features/announcements/components/AnnouncementContent.tsx
  • src/features/listings/components/ListingsSection.tsx
  • src/features/announcements/sponsor/Credits.tsx
  • src/features/listings/components/ListingPage/RegionLabel.tsx
  • src/pages/listing/[slug]/index.tsx
  • src/features/listings/hooks/useListings.ts
  • src/features/listing-builder/components/Form/EligibilityQuestions/QuestionsForm.tsx
  • src/styles/globals.css
**/*.tsx

📄 CodeRabbit Inference Engine (.cursor/rules/return-types.mdc)

No need to declare the return type of a component which returns JSX.

Files:

  • src/features/listing-builder/components/Form/PrePublish/Modal.tsx
  • src/features/announcements/components/AnnouncementContent.tsx
  • src/features/listings/components/ListingsSection.tsx
  • src/features/announcements/sponsor/Credits.tsx
  • src/features/listings/components/ListingPage/RegionLabel.tsx
  • src/pages/listing/[slug]/index.tsx
  • src/features/listing-builder/components/Form/EligibilityQuestions/QuestionsForm.tsx
**/*.{tsx,ts}

📄 CodeRabbit Inference Engine (.cursor/rules/we-might-not-need-an-effect.mdc)

**/*.{tsx,ts}: Avoid using Effects in React components for data transformations that can be calculated during rendering; compute values directly in the render body instead of using useEffect and state.
For expensive calculations in React components, use useMemo instead of useEffect and state to cache results.
To reset all component state when a prop changes, use the key prop on the component instead of resetting state in a useEffect.
When updating state based on props in React, calculate derived values during render instead of adjusting state in useEffect.
Place event-specific logic, such as form submission or notifications, inside event handlers rather than in useEffect.
Avoid chains of state updates across multiple Effects; instead, calculate all derived state in event handlers or during render.
Show notifications and perform side effects in response to user actions within event handlers, not in useEffect.
When fetching data in useEffect, always implement proper cleanup to prevent race conditions and memory leaks.
Consider using custom Hooks for encapsulating data fetching and subscriptions in React components.
If you can calculate something during render, you don't need an Effect in React.
For expensive calculations in React, prefer useMemo over useEffect.
To reset all component state in React, use the key prop rather than useEffect.
To update state based on props in React, calculate during render when possible instead of using useEffect.
Code that runs because of an event should be in event handlers, not in useEffect.
Avoid chains of state updates in multiple Effects in React components.
Consider using custom Hooks for data fetching and subscriptions in React.
Use Effects in React only when synchronizing with external systems, such as browser APIs, third-party libraries, WebSocket connections, or non-React UI widgets.

Files:

  • src/features/listing-builder/components/Form/PrePublish/Modal.tsx
  • src/features/announcements/components/AnnouncementContent.tsx
  • src/features/listings/components/ListingsSection.tsx
  • src/features/announcements/sponsor/Credits.tsx
  • src/features/listings/components/ListingPage/RegionLabel.tsx
  • src/pages/listing/[slug]/index.tsx
  • src/features/listings/hooks/useListings.ts
  • src/features/listing-builder/components/Form/EligibilityQuestions/QuestionsForm.tsx
**/use*.{js,jsx,ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/react-state-and-effects.mdc)

**/use*.{js,jsx,ts,tsx}: Design custom Hooks to encapsulate reusable logic with clear intent, focusing on concrete use cases and minimal configuration.
Name custom Hooks after their domain-specific purpose, not after generic lifecycle events or implementation details.
Each component calling a custom Hook should receive isolated state; custom Hooks should not share state between components.
Prefer exposing primitive values over complex objects when designing custom Hooks.
Custom Hooks should create composition chains where data flows between Hooks, enabling modular and reusable logic.
Custom Hooks should encapsulate complete logic for a concern (such as networking, state management, or subscriptions), not just partial or generic lifecycle logic.
Create custom Hooks around specific use cases rather than abstract concepts.
Use the state encapsulation, subscription, and side effect encapsulation patterns when implementing custom Hooks.

Files:

  • src/features/listings/hooks/useListings.ts
🧠 Learnings (6)
📓 Common learnings
Learnt from: JayeshVP24
PR: SuperteamDAO/earn#1101
File: src/components/ui/dialog.tsx:70-74
Timestamp: 2025-06-23T03:48:55.899Z
Learning: User JayeshVP24 prefers to remove focus outlines that appear on mouse clicks as they find them irritating, even if it impacts keyboard accessibility.
src/features/listing-builder/components/Form/PrePublish/Modal.tsx (1)

Learnt from: CR
PR: SuperteamDAO/earn#0
File: .cursor/rules/we-might-not-need-an-effect.mdc:0-0
Timestamp: 2025-07-22T13:37:47.449Z
Learning: Applies to **/*.{tsx,ts} : Consider using custom Hooks for encapsulating data fetching and subscriptions in React components.

src/features/announcements/components/AnnouncementContent.tsx (12)

Learnt from: JayeshVP24
PR: #1101
File: src/features/announcements/types/announcement.ts:7-11
Timestamp: 2025-06-23T03:48:17.263Z
Learning: In the Announcement interface (src/features/announcements/types/announcement.ts), the user JayeshVP24 prefers to keep the cta field with optional link and onClick properties rather than using a discriminated union. This flexible approach is intentional to allow for various CTA configurations.

Learnt from: JayeshVP24
PR: #1101
File: src/features/announcements/components/AnnouncementModal.tsx:1-1
Timestamp: 2025-06-12T17:23:23.732Z
Learning: In this repository, the Motion library is imported from the entry point motion/react (Framer Motion’s new branding). AnimatePresence and motion should be imported from motion/react, not framer-motion.

Learnt from: CR
PR: SuperteamDAO/earn#0
File: .cursor/rules/return-types.mdc:0-0
Timestamp: 2025-07-22T13:09:31.670Z
Learning: Applies to **/*.tsx : No need to declare the return type of a component which returns JSX.

Learnt from: CR
PR: SuperteamDAO/earn#0
File: .cursor/rules/react-state-and-effects.mdc:0-0
Timestamp: 2025-06-24T03:45:48.987Z
Learning: Never suppress the React Hooks dependency linter (e.g., eslint-disable-next-line react-hooks/exhaustive-deps). Instead, refactor your code to avoid missing dependencies, often by using updater functions or restructuring logic.

Learnt from: a20hek
PR: #1123
File: src/pages/_app.tsx:58-58
Timestamp: 2025-06-25T12:03:40.223Z
Learning: The Next.js documentation officially recommends using key={router.asPath} on page components to force remounting and reset state on navigation. This is documented in the Next.js useRouter API reference as one of two official approaches (the other being useEffect with route dependencies). This pattern ensures clean state transitions between routes and is a legitimate architectural choice despite the performance implications of forced remounting.

Learnt from: a20hek
PR: #1123
File: src/pages/_app.tsx:58-58
Timestamp: 2025-06-25T12:03:40.223Z
Learning: Next.js recommends using key={router.asPath} on components to reset state after navigation when you need fresh state on route changes. This is documented in the Next.js useRouter API reference. While this pattern has performance implications (forced remounting), it's a legitimate approach for ensuring clean state transitions.

Learnt from: CR
PR: SuperteamDAO/earn#0
File: .cursor/rules/react-state-and-effects.mdc:0-0
Timestamp: 2025-06-24T03:45:48.987Z
Learning: Best practices for React state and Effects: use updater functions when new state depends on previous state, prefer small and focused state variables, treat state as immutable, keep Effects focused on a single concern, extract repeated Effect logic into custom Hooks, use Effect Events for non-reactive code, never suppress the dependency linter, prefer calculation during rendering over Effects, always handle cleanup to prevent memory leaks, and create custom Hooks around specific use cases.

Learnt from: CR
PR: SuperteamDAO/earn#0
File: .cursor/rules/we-might-not-need-an-effect.mdc:0-0
Timestamp: 2025-07-22T13:37:47.449Z
Learning: Applies to **/*.{tsx,ts} : To reset all component state in React, use the key prop rather than useEffect.

Learnt from: CR
PR: SuperteamDAO/earn#0
File: .cursor/rules/we-might-not-need-an-effect.mdc:0-0
Timestamp: 2025-07-22T13:37:47.449Z
Learning: Applies to **/*.{tsx,ts} : Avoid chains of state updates in multiple Effects in React components.

Learnt from: CR
PR: SuperteamDAO/earn#0
File: .cursor/rules/we-might-not-need-an-effect.mdc:0-0
Timestamp: 2025-06-24T03:46:07.639Z
Learning: For expensive calculations in React components, prefer useMemo over useEffect to avoid redundant state and unnecessary re-renders.

Learnt from: CR
PR: SuperteamDAO/earn#0
File: .cursor/rules/we-might-not-need-an-effect.mdc:0-0
Timestamp: 2025-06-24T03:46:07.639Z
Learning: Only use useEffect in React when synchronizing with external systems (e.g., browser APIs, third-party libraries, WebSocket connections, or non-React UI widgets), not for internal state or render-time calculations.

Learnt from: CR
PR: SuperteamDAO/earn#0
File: .cursor/rules/we-might-not-need-an-effect.mdc:0-0
Timestamp: 2025-07-22T13:37:47.449Z
Learning: Applies to **/*.{tsx,ts} : Use Effects in React only when synchronizing with external systems, such as browser APIs, third-party libraries, WebSocket connections, or non-React UI widgets.

src/features/announcements/sponsor/Credits.tsx (1)

Learnt from: JayeshVP24
PR: #1101
File: src/features/announcements/types/announcement.ts:7-11
Timestamp: 2025-06-23T03:48:17.263Z
Learning: In the Announcement interface (src/features/announcements/types/announcement.ts), the user JayeshVP24 prefers to keep the cta field with optional link and onClick properties rather than using a discriminated union. This flexible approach is intentional to allow for various CTA configurations.

src/pages/listing/[slug]/index.tsx (4)

Learnt from: CR
PR: SuperteamDAO/earn#0
File: .cursor/rules/pages-api-guidelines.mdc:0-0
Timestamp: 2025-07-22T13:07:34.907Z
Learning: Applies to src/pages/api/**/* : Use proper type imports from Next.js, such as NextApiResponse

Learnt from: CR
PR: SuperteamDAO/earn#0
File: .cursor/rules/default-exports.mdc:0-0
Timestamp: 2025-06-24T03:44:48.199Z
Learning: Frameworks like Next.js may require default exports for specific files (such as pages). In these cases, using default exports is acceptable.

Learnt from: a20hek
PR: #1120
File: src/components/ui/toploader.tsx:2-4
Timestamp: 2025-06-24T10:49:38.563Z
Learning: In Next.js applications, named imports from CommonJS packages like nprogress (e.g., import { configure, done, start } from 'nprogress') can work correctly due to bundler transformations and CommonJS interop, even though the original package only provides a default export.

Learnt from: CR
PR: SuperteamDAO/earn#0
File: .cursor/rules/pages-api-guidelines.mdc:0-0
Timestamp: 2025-06-24T03:45:32.567Z
Learning: TypeScript types should be used for all request and response objects in API handlers, and types should be imported from Next.js and relevant custom types for enhanced type safety.

src/features/listing-builder/components/Form/EligibilityQuestions/QuestionsForm.tsx (1)

Learnt from: JayeshVP24
PR: #1101
File: src/features/announcements/types/announcement.ts:7-11
Timestamp: 2025-06-23T03:48:17.263Z
Learning: In the Announcement interface (src/features/announcements/types/announcement.ts), the user JayeshVP24 prefers to keep the cta field with optional link and onClick properties rather than using a discriminated union. This flexible approach is intentional to allow for various CTA configurations.

🧬 Code Graph Analysis (2)
src/pages/listing/[slug]/index.tsx (5)
src/layouts/Listing.tsx (1)
  • ListingPageLayout (34-261)
src/features/conversion-popups/components/ListingPop.tsx (1)
  • ListingPop (67-131)
src/features/listings/components/ListingPage/ListingWinners.tsx (1)
  • ListingWinners (40-224)
src/components/ui/cloudinary-image.tsx (1)
  • ExternalImage (34-60)
src/features/listings/components/ListingPage/DescriptionUI.tsx (1)
  • DescriptionUI (16-126)
src/features/listing-builder/components/Form/EligibilityQuestions/QuestionsForm.tsx (2)
src/components/ui/form.tsx (2)
  • FormLabel (179-179)
  • FormField (177-177)
src/components/ui/switch.tsx (1)
  • Switch (33-33)
🔇 Additional comments (20)
src/features/announcements/components/AnnouncementContent.tsx (2)

108-108: Layout restructuring looks good.

The change from justify-between flex layout to a fixed height container is a clean simplification that replaces the previous animated height wrapper approach.


109-109: Inner flex wrapper is well-implemented.

The new flex-1 wrapper div properly fills the available space within the fixed height container, maintaining the intended layout behavior while simplifying the component structure.

Also applies to: 167-167

src/features/announcements/sponsor/Credits.tsx (1)

46-51: Typography and padding simplification is well-coordinated.

The changes consistently remove responsive variations and adopt larger base font sizes (text-xl, text-base) while simplifying padding to a consistent px-6 pt-4. This improves readability and aligns with the broader UI simplification theme across the PR.

src/styles/globals.css (1)

597-607: Loader animation refactoring is well-implemented.

The transition from border-based to box-shadow-based animation with proper centering (transform: translate(-50%, -50%)) and performance optimization (will-change: transform, opacity) is a solid technical improvement. The updated keyframes correctly match the new structure.

Also applies to: 615-627

src/features/listing-builder/components/Form/PrePublish/Modal.tsx (1)

174-176: Spinner DOM restructuring improves separation of concerns.

The wrapper span approach cleanly separates positioning and sizing concerns from the animation logic, providing better control over the spinner's layout while maintaining the same visual behavior.

src/pages/listing/[slug]/index.tsx (3)

2-2: LGTM: Head import added for SEO functionality.

The import is correctly placed and necessary for the new meta tags functionality.


20-26: LGTM: Proper SEO implementation for private bounties.

The conditional meta tags effectively prevent search engine indexing of private bounties. The implementation includes both robots and googlebot meta tags for comprehensive coverage, which is a good practice for ensuring privacy.


27-43: LGTM: React fragment wrapper maintains component structure.

The fragment wrapper properly maintains the single parent requirement while allowing the conditional Head element to be rendered alongside the existing layout.

src/features/listings/hooks/useListings.ts (3)

33-33: LGTM: Authenticated parameter added to interface.

The optional boolean parameter is properly typed and follows the existing pattern.


71-71: LGTM: Hook parameter destructuring updated correctly.

The authenticated parameter is properly destructured and follows the existing pattern.


71-71: Verify authenticated flag in API request

File: src/features/listings/hooks/useListings.ts
Location: inside the useListings hook, at the useQuery call

The authenticated value is included in your cache key but never forwarded to fetchListings, so auth state will only affect cache invalidation—not the network request itself.

• Current call:

useQuery({
  queryKey: [
    'listings',
    context,
    tab,
    category,
    status,
    sortBy,
    order,
    region,
    sponsor,
    authenticated,    // changes cache entries…
  ],
  queryFn: () =>
    fetchListings({     // …but this call omits `authenticated`
      context,
      tab,
      category,
      status,
      sortBy,
      order,
      region,
      sponsor,
    }),
});

• If authenticated should influence the API call, update to:

 fetchListings({
   context,
   tab,
   category,
   status,
   sortBy,
   order,
   region,
   sponsor,
+  authenticated,
 });

—and extend fetchListings’s signature and URLSearchParams logic accordingly.

Please confirm whether this omission is intentional.

src/features/listings/components/ListingsSection.tsx (2)

66-66: LGTM: Authenticated state properly passed to useListings.

The authenticated parameter is correctly passed to the useListings hook, maintaining consistency with the hook's updated interface.


169-169: LGTM: Improved "For You" pill visibility logic.

The expanded condition (potentialSession || authenticated) ensures authenticated users can access the "For You" category regardless of potential session state, which improves the user experience.

src/features/listings/components/ListingPage/RegionLabel.tsx (2)

28-36: LGTM: Enhanced fallback logic for region display values.

The expanded logic provides better fallback handling for different region data structures, improving the robustness of region display.


25-25: No action required – region lookup is already case-insensitive

The getCombinedRegion and related utilities consistently call .toLowerCase() on both the incoming region string and the stored country/region values, so removing the title-case step won’t affect lookup results. All comparisons normalize case under the hood.

src/features/listing-builder/components/Form/EligibilityQuestions/QuestionsForm.tsx (5)

67-67: LGTM: Conditional required field logic for project questions.

Making the first project question always required is good UX design, ensuring projects have at least one mandatory eligibility criterion.


71-89: LGTM: Cleaner UI for first project question.

Hiding the optional/required switch entirely for the first project question is cleaner than the previous disabled state approach, providing better visual clarity about the requirement.


81-82: LGTM: Simplified switch change handler.

The simplified logic removes unnecessary conditional checks while maintaining the draft saving functionality.


284-286: LGTM: Type-specific question limits implemented correctly.

The different limits (5 for bounties, 10 for projects) are reasonable business constraints and properly implemented with clear conditional logic.


309-311: LGTM: Dynamic limit messaging.

The conditional message clearly communicates the different limits to users based on the listing type.

Comment on lines +26 to +27
console.log('region object', regionObject);
console.log('region details', details);
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.

⚠️ Potential issue

Remove debugging console.log statements.

These console.log statements appear to be debugging code and should be removed before merging to production.

-    console.log('region object', regionObject);
-    console.log('region details', details);
-    console.log('final display value', displayValue);

Also applies to: 37-37

🤖 Prompt for AI Agents
In src/features/listings/components/ListingPage/RegionLabel.tsx around lines 26
to 27 and line 37, remove the console.log statements used for debugging. These
logs are not needed in production code and should be deleted to keep the code
clean.

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.

1 participant