Skip to content

schema update#8

Open
Izume01 wants to merge 9 commits into
mainfrom
test
Open

schema update#8
Izume01 wants to merge 9 commits into
mainfrom
test

Conversation

@Izume01

@Izume01 Izume01 commented Aug 1, 2025

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features
    • Added a new setting to user profiles to indicate completion of onboarding.
    • Introduced new dashboard sections for Clients, Invoices, and Settings with informative placeholders.
    • Launched a multi-step onboarding questionnaire with progress tracking and answer selection.
    • Added webhook support for processing user-related events securely.
  • Chores
    • Introduced centralized database client setup for improved application consistency.
    • Added post-install and cleanup scripts to streamline development workflow.
    • Added new dependencies to support webhook handling and cleanup tasks.
    • Made minor internal formatting adjustments for improved maintainability.

@vercel

vercel Bot commented Aug 1, 2025

Copy link
Copy Markdown

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

Name Status Preview Comments Updated (UTC)
invoicify ❌ Failed (Inspect) Aug 3, 2025 6:47am

@coderabbitai

coderabbitai Bot commented Aug 1, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

This update introduces new React components and layouts for the dashboard's clients, invoices, and settings sections, along with their respective pages. It adds a POST API route for handling Clerk webhooks via Svix. The Prisma schema is updated with a new Boolean field in the User model, and a reusable Prisma client instance is provided. Package scripts and dependencies are also adjusted. The onboarding page is refactored to dynamically load an external onboarding component, which is newly created to handle multi-step onboarding logic.

Changes

Cohort / File(s) Change Summary
Prisma Schema Update
prisma/schema.prisma
Added onBoardingDone Boolean field to User model; removed output from generator; formatting adjustments.
Prisma Client Utility
src/lib/prisma.ts
New module exporting a singleton Prisma client instance for application-wide use.
Dashboard Clients Section
src/app/(dashboard)/clients/layout.tsx,
src/app/(dashboard)/clients/page.tsx
Added layout and page components for the clients dashboard section.
Dashboard Invoices Section
src/app/(dashboard)/invoices/layout.tsx,
src/app/(dashboard)/invoices/page.tsx
Added layout and page components for the invoices dashboard section.
Dashboard Settings Section
src/app/(dashboard)/settings/layout.tsx,
src/app/(dashboard)/settings/page.tsx
Added layout and page components for the settings dashboard section.
API Webhook Handler
src/app/api/clerk/webhook/route.ts
New POST route for processing Clerk webhook events using Svix verification and event-type handling.
Package Scripts & Dependencies
package.json
Added postinstall script for Prisma, new clean scripts, and dependencies on svix and rimraf.
Onboarding Page Refactor
src/app/(onboarding)/onboarding/page.tsx
Replaced local onboarding implementation with dynamic import of external onboarding component.
Onboarding Component
src/components/layouts/Onboarding.tsx
New multi-step onboarding React component with progress, question navigation, and answer state management.

Sequence Diagram(s)

sequenceDiagram
    participant User as User Browser
    participant OnboardingPage as Onboarding Page (dynamic)
    participant OnboardingComp as Onboarding Component

    User->>OnboardingPage: Load onboarding page
    OnboardingPage->>OnboardingComp: Dynamically import component
    OnboardingComp->>User: Render onboarding UI with questions and options
    User->>OnboardingComp: Select answers, navigate steps
    OnboardingComp->>OnboardingComp: Update state and progress
    OnboardingComp->>Console: Log answers on finish (placeholder for submission)
Loading
sequenceDiagram
    participant Clerk as Clerk/Svix
    participant API as /api/clerk/webhook
    participant SvixLib as Svix Webhook
    participant App as Application Logic

    Clerk->>API: POST webhook with headers & body
    API->>API: Extract Svix headers
    API->>API: Parse request body as JSON
    API->>SvixLib: Verify payload with headers & secret
    alt Verification fails
        SvixLib-->>API: Throws error
        API-->>Clerk: 400 Bad Request
    else Verification succeeds
        SvixLib-->>API: Returns verified event
        API->>App: Switch on event type (user.created, user.updated, user.deleted, etc.)
        App-->>API: (Log or handle event)
        API-->>Clerk: 200 OK
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15–25 minutes

Possibly related PRs

  • Izume01/Invoicify#7: Adds a new onboarding component and page with multi-step questionnaire, closely related to the onboarding refactor and new component introduced here.
  • Izume01/Invoicify#3: Introduces the initial Prisma schema and database migration, which the current PR directly modifies by adding a new field.
  • Izume01/Invoicify#1: Sets up the initial Prisma schema and client configuration, which is further extended in this PR.

Poem

🐇 Hopping through code with a joyful cheer,
New fields and layouts are blooming here.
Clients and invoices, settings in line,
Webhooks verified, onboarding shines.
A rabbit’s delight in each new page,
Coding adventures on every stage! 🌿✨

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 test

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.

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

🧹 Nitpick comments (1)
prisma/schema.prisma (1)

31-41: Field name onBoardingDone is likely a typo and is inconsistent with existing camel-case rules

“Onboarding” is a single word; the capital B suggests two words.
Recommend renaming to onboardingDone (lower-case b) for consistency with createdAt, updatedAt, imageUrl, etc.

-  onBoardingDone Boolean  @default(false)
+  onboardingDone Boolean  @default(false)

If data already exists in prod you must run a migration with ALTER TABLE … RENAME COLUMN … or use @@map to keep the physical column name unchanged.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c431dde and 8d5f1fe.

📒 Files selected for processing (3)
  • prisma/schema.prisma (1 hunks)
  • src/app/(api)/api/clerk/webhook/route.ts (1 hunks)
  • src/lib/prisma.ts (1 hunks)
🔇 Additional comments (1)
prisma/schema.prisma (1)

1-3: Removing the generator client output path can break consumers expecting the old location

Any build scripts or imports that referenced the custom output directory will now fail.
Please double-check all import { PrismaClient } from '<old-path>' statements and CI scripts that cache the generated client.

Comment thread src/app/(api)/api/clerk/webhook/route.ts Outdated
Comment thread src/lib/prisma.ts Outdated
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

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

🧹 Nitpick comments (3)
src/app/api/clerk/webhook/route.ts (3)

44-44: Replace any type with proper Clerk webhook event type.

Using any eliminates type safety benefits. Consider defining or importing proper types for Clerk webhook events.

-const webhookEvent = evt as any;
+// TODO: Import proper Clerk webhook event types
+const webhookEvent = evt as ClerkWebhookEvent;

15-15: Fix typo in error message.

Minor spelling error in the error message.

-return new Response("Error occured -- no svix headers", {
+return new Response("Error occurred -- no svix headers", {

38-38: Fix typo in error message.

Minor spelling error in the error message.

-return new Response("Error occured", {
+return new Response("Error occurred", {
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 8d5f1fe and 7318d57.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (9)
  • package.json (3 hunks)
  • src/app/(dashboard)/clients/layout.tsx (1 hunks)
  • src/app/(dashboard)/clients/page.tsx (1 hunks)
  • src/app/(dashboard)/invoices/layout.tsx (1 hunks)
  • src/app/(dashboard)/invoices/page.tsx (1 hunks)
  • src/app/(dashboard)/settings/layout.tsx (1 hunks)
  • src/app/(dashboard)/settings/page.tsx (1 hunks)
  • src/app/api/clerk/webhook/route.ts (1 hunks)
  • src/lib/prisma.ts (1 hunks)
✅ Files skipped from review due to trivial changes (4)
  • src/app/(dashboard)/invoices/layout.tsx
  • src/app/(dashboard)/clients/layout.tsx
  • src/app/(dashboard)/invoices/page.tsx
  • src/app/(dashboard)/settings/layout.tsx
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: in next.js dashboard layouts, when user authentication fails, redirect users to the home page using ...
Learnt from: Izume01
PR: Izume01/Invoicify#6
File: src/app/(dashboard)/dashboard/layout.tsx:12-14
Timestamp: 2025-07-28T20:02:46.247Z
Learning: In Next.js dashboard layouts, when user authentication fails, redirect users to the home page using `redirect('/')` from 'next/navigation' instead of showing error messages for better UX.

Applied to files:

  • src/app/(dashboard)/clients/page.tsx
  • src/app/(dashboard)/settings/page.tsx
🔇 Additional comments (8)
package.json (4)

10-10: LGTM! Automatic Prisma client generation.

The postinstall script ensures the Prisma client is generated after package installation, which is essential for the updated schema to work correctly.


13-14: LGTM! Clean build commands for better development experience.

The clean scripts help prevent Next.js caching issues during development and ensure fresh builds by removing the .next directory.


31-31: LGTM! Svix dependency for webhook verification.

The svix package is correctly added to support webhook verification in the Clerk webhook handler.


40-40: LGTM! Rimraf for cross-platform file deletion.

The rimraf dev dependency enables the clean scripts to work across different operating systems.

src/app/(dashboard)/clients/page.tsx (1)

1-24: LGTM! Well-structured dashboard page component.

The component follows React best practices with proper use of client directive, clear component structure, and appropriate placeholder content for future functionality. The Tailwind styling is consistent and accessible.

src/lib/prisma.ts (1)

1-10: LGTM! Correct Prisma client pattern for Next.js.

The implementation properly follows the recommended pattern to prevent connection exhaustion in Next.js development by reusing the Prisma client instance via global storage. This matches Prisma's official documentation for Next.js integration.

src/app/(dashboard)/settings/page.tsx (1)

1-24: LGTM! Consistent dashboard page implementation.

The settings page follows the same well-structured pattern as other dashboard pages, maintaining consistency in the codebase. Good use of placeholder content and proper React/Tailwind practices.

src/app/api/clerk/webhook/route.ts (1)

53-67: LGTM! Well-structured event handling with room for expansion.

The switch statement properly handles different Clerk events with clear logging and placeholder comments for future implementation. This provides a solid foundation for user lifecycle management.

const body = JSON.stringify(payload);

// Create a new Svix instance with your secret.
const wh = new Webhook(process.env.CLERK_WEBHOOK_SECRET || "");

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.

🛠️ Refactor suggestion

Validate webhook secret exists before creating Webhook instance.

Using an empty string fallback could cause silent failures. The webhook secret should be validated to exist.

-const wh = new Webhook(process.env.CLERK_WEBHOOK_SECRET || "");
+const webhookSecret = process.env.CLERK_WEBHOOK_SECRET;
+if (!webhookSecret) {
+  console.error("CLERK_WEBHOOK_SECRET is not set");
+  return new Response("Server configuration error", { status: 500 });
+}
+const wh = new Webhook(webhookSecret);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const wh = new Webhook(process.env.CLERK_WEBHOOK_SECRET || "");
const webhookSecret = process.env.CLERK_WEBHOOK_SECRET;
if (!webhookSecret) {
console.error("CLERK_WEBHOOK_SECRET is not set");
return new Response("Server configuration error", { status: 500 });
}
const wh = new Webhook(webhookSecret);
🤖 Prompt for AI Agents
In src/app/api/clerk/webhook/route.ts at line 25, the webhook secret is
currently defaulting to an empty string if the environment variable is missing,
which can cause silent failures. Before creating the Webhook instance, add a
check to ensure process.env.CLERK_WEBHOOK_SECRET is defined and not empty. If it
is missing, throw an error or handle it appropriately to prevent proceeding with
an invalid secret.

@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

🧹 Nitpick comments (3)
src/components/layouts/Onboarding.tsx (3)

12-43: Fix variable naming - should be plural

The variable name should be onboardingQuestions (plural with proper camelCase) since it contains multiple questions.

-const onboardingquestion = [
+const onboardingQuestions = [

Also update all references to this variable throughout the component.


51-58: Handle completion logic and validate answers

The TODO comment indicates this needs backend implementation. Additionally, users can proceed without selecting answers, which may cause undefined values in the answers array.

Would you like me to help implement the completion logic with proper validation? Consider adding answer validation:

 const nextStep = () => {
+    if (!answers[currentStep]) {
+        // Show validation error or prevent navigation
+        return;
+    }
     if (currentStep < onboardingquestion.length - 1) {
         setCurrentStep(currentStep + 1);
     } else {
         // Submit logic or redirect
         console.log("All answers submitted:", answers);
     }
 };

45-146: Consider extracting questions to a configuration file

The onboarding questions are currently hardcoded in the component. For better maintainability and potential A/B testing, consider moving them to a separate configuration file or fetching them from an API.

This would allow:

  • Easy updates without modifying the component
  • A/B testing different onboarding flows
  • Personalization based on user type
  • Potential backend-driven configuration
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 7318d57 and 9b5300c.

📒 Files selected for processing (2)
  • src/app/(onboarding)/onboarding/page.tsx (1 hunks)
  • src/components/layouts/Onboarding.tsx (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: in next.js dashboard layouts, when user authentication fails, redirect users to the home page using ...
Learnt from: Izume01
PR: Izume01/Invoicify#6
File: src/app/(dashboard)/dashboard/layout.tsx:12-14
Timestamp: 2025-07-28T20:02:46.247Z
Learning: In Next.js dashboard layouts, when user authentication fails, redirect users to the home page using `redirect('/')` from 'next/navigation' instead of showing error messages for better UX.

Applied to files:

  • src/app/(onboarding)/onboarding/page.tsx
  • src/components/layouts/Onboarding.tsx
🔇 Additional comments (1)
src/app/(onboarding)/onboarding/page.tsx (1)

1-3: Verify the need to disable SSR

Disabling server-side rendering can impact SEO and initial page load performance. Please ensure this is necessary (e.g., if the component uses browser-only APIs).

Consider enabling SSR if the component doesn't require browser-specific APIs:

-const OnboardingPage = dynamic(() => import("@/components/layouts/Onboarding"), { ssr: false });
+const OnboardingPage = dynamic(() => import("@/components/layouts/Onboarding"));

Comment on lines +8 to +10
export const page = () => {
return <OnboardingPage />;
} No newline at end of file

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 redundant named export - this breaks Next.js conventions

The named export page is redundant and doesn't follow Next.js app directory conventions. Next.js expects a default export for page components.

Apply this diff to fix the issue:

-
-
-export const page = () => {
-    return <OnboardingPage />;
-}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export const page = () => {
return <OnboardingPage />;
}
🤖 Prompt for AI Agents
In src/app/(onboarding)/onboarding/page.tsx around lines 8 to 10, the page
component is exported as a named export `page`, which breaks Next.js conventions
that require a default export for page components. Change the named export to a
default export by replacing `export const page` with `export default` to comply
with Next.js app directory requirements.

</div>

<div className="my-6 sm:my-10">
<h1 className="text-3xl sm:text-4xl lg:text-5xl font-bold mb-2">Welcome, [First Name]! 👋</h1>

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

Replace placeholder with actual user data

The welcome message contains a hardcoded placeholder "[First Name]". This should display the actual user's name.

Consider passing user data as props:

-const Onboarding = () => {
+interface OnboardingProps {
+    userName?: string;
+}
+
+const Onboarding = ({ userName = "there" }: OnboardingProps) => {

And update the welcome message:

-<h1 className="text-3xl sm:text-4xl lg:text-5xl font-bold mb-2">Welcome, [First Name]! 👋</h1>
+<h1 className="text-3xl sm:text-4xl lg:text-5xl font-bold mb-2">Welcome, {userName}! 👋</h1>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<h1 className="text-3xl sm:text-4xl lg:text-5xl font-bold mb-2">Welcome, [First Name]! 👋</h1>
// Add this at the top of src/components/layouts/Onboarding.tsx
interface OnboardingProps {
userName?: string;
}
-const Onboarding = () => {
+const Onboarding = ({ userName = "there" }: OnboardingProps) => {
return (
<div>
{/* …other markup… */}
- <h1 className="text-3xl sm:text-4xl lg:text-5xl font-bold mb-2">Welcome, [First Name]! 👋</h1>
+ <h1 className="text-3xl sm:text-4xl lg:text-5xl font-bold mb-2">
+ Welcome, {userName}! 👋
+ </h1>
{/* …other markup… */}
</div>
);
};
🤖 Prompt for AI Agents
In src/components/layouts/Onboarding.tsx at line 86, replace the hardcoded
placeholder "[First Name]" in the welcome message with the actual user's first
name. Pass the user data as props to the Onboarding component and update the JSX
to dynamically render the user's first name instead of the placeholder.

Comment on lines +104 to +120
{onboardingquestion[currentStep].options.map((option, index) => (
<button
key={index}
className={`w-full text-left p-3 sm:p-4 rounded-lg transition-all duration-200 border-2 text-sm sm:text-base ${
answers[currentStep] === option
? "bg-orange-600 border-orange-500 text-white font-semibold"
: "bg-gray-800 border-gray-700 hover:bg-gray-700 hover:scale-105 hover:border-gray-600"
}`}
onClick={() => {
const newAnswers = [...answers];
newAnswers[currentStep] = option;
setAnswers(newAnswers);
}}
>
{option}
</button>
))}

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.

🛠️ Refactor suggestion

Enhance accessibility for option buttons

The option buttons lack proper accessibility attributes and keyboard navigation support.

Add ARIA attributes and improve keyboard navigation:

 <button
     key={index}
+    aria-pressed={answers[currentStep] === option}
+    role="radio"
+    aria-label={`Select ${option}`}
     className={`w-full text-left p-3 sm:p-4 rounded-lg transition-all duration-200 border-2 text-sm sm:text-base ${
         answers[currentStep] === option
             ? "bg-orange-600 border-orange-500 text-white font-semibold"
             : "bg-gray-800 border-gray-700 hover:bg-gray-700 hover:scale-105 hover:border-gray-600"
     }`}
     onClick={() => {
         const newAnswers = [...answers];
         newAnswers[currentStep] = option;
         setAnswers(newAnswers);
     }}
 >
     {option}
 </button>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{onboardingquestion[currentStep].options.map((option, index) => (
<button
key={index}
className={`w-full text-left p-3 sm:p-4 rounded-lg transition-all duration-200 border-2 text-sm sm:text-base ${
answers[currentStep] === option
? "bg-orange-600 border-orange-500 text-white font-semibold"
: "bg-gray-800 border-gray-700 hover:bg-gray-700 hover:scale-105 hover:border-gray-600"
}`}
onClick={() => {
const newAnswers = [...answers];
newAnswers[currentStep] = option;
setAnswers(newAnswers);
}}
>
{option}
</button>
))}
{onboardingquestion[currentStep].options.map((option, index) => (
<button
key={index}
+ aria-pressed={answers[currentStep] === option}
+ role="radio"
+ aria-label={`Select ${option}`}
className={`w-full text-left p-3 sm:p-4 rounded-lg transition-all duration-200 border-2 text-sm sm:text-base ${
answers[currentStep] === option
? "bg-orange-600 border-orange-500 text-white font-semibold"
: "bg-gray-800 border-gray-700 hover:bg-gray-700 hover:scale-105 hover:border-gray-600"
}`}
onClick={() => {
const newAnswers = [...answers];
newAnswers[currentStep] = option;
setAnswers(newAnswers);
}}
>
{option}
</button>
))}
🤖 Prompt for AI Agents
In src/components/layouts/Onboarding.tsx around lines 104 to 120, the option
buttons lack accessibility features. To fix this, add appropriate ARIA
attributes such as aria-pressed to indicate selection state, ensure each button
has a clear accessible name, and verify keyboard navigation works by using
native button elements properly. Also, consider adding role="radio" or grouping
buttons with role="radiogroup" if they represent mutually exclusive options to
improve screen reader support.

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