Skip to content

refactor: replace hardcoded colors with theme variables#152

Open
mahek2016 wants to merge 2 commits intoAOSSIE-Org:mainfrom
mahek2016:refactor/color-variables
Open

refactor: replace hardcoded colors with theme variables#152
mahek2016 wants to merge 2 commits intoAOSSIE-Org:mainfrom
mahek2016:refactor/color-variables

Conversation

@mahek2016
Copy link

@mahek2016 mahek2016 commented Mar 10, 2026

Addressed Issues:

Fixes #137

Screenshots/Recordings:

After replacing hardcoded colors with theme variables in the BiasMeter component.

BiasMeter Screenshot

Additional Notes:

This change replaces hardcoded Tailwind color classes (text-green-500, text-yellow-500, text-red-500) in the BiasMeter component with theme-based variables (text-primary, text-secondary, text-destructive).

This ensures consistency with the project's Tailwind theme configuration and improves maintainability across the UI.

Tested locally using npm run dev and verified that the BiasMeter renders correctly on the /analyze/results page.

AI Usage Disclosure:

  • This PR does not contain AI-generated code at all.
  • This PR contains AI-generated code. I have read the AI Usage Policy and this PR complies with the policy. I have tested the code locally and I am responsible for it.

I have used the following AI models and tools: ChatGPT

Checklist

  • My PR addresses a single issue, fixes a single bug or makes a single improvement.
  • My code follows the project's code style and conventions
  • If applicable, I have made corresponding changes or additions to the documentation
  • If applicable, I have made corresponding changes or additions to tests
  • My changes generate no new warnings or errors
  • I have joined the Discord server and I will share a link to this PR with the project maintainers there
  • I have read the Contribution Guidelines
  • Once I submit my PR, CodeRabbit AI will automatically review it and I will address CodeRabbit's comments.
  • I have filled this PR template completely and carefully, and I understand that my PR may be closed without review otherwise.

Summary by CodeRabbit

Release Notes

  • New Features
    • Added a new header to the application with branding and navigation elements
    • Header includes a home link, "Analyze" navigation option, and theme toggle button
    • Header positioned at the top of all pages

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 10, 2026

Warning

Rate limit exceeded

@mahek2016 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 11 minutes and 27 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5e66cf6c-e2c7-412d-8a82-4b9a0e2a95fd

📥 Commits

Reviewing files that changed from the base of the PR and between 3e198fa and bbfcc13.

📒 Files selected for processing (1)
  • frontend/app/layout.tsx
📝 Walkthrough

Walkthrough

A new client-side Header component was added and integrated into the root layout (wrapped by ThemeProvider), rendering a "Perspective" home link, an "Analyze" link, and a ThemeToggle at the top of all pages.

Changes

Cohort / File(s) Summary
Header Component & Layout Integration
frontend/components/header.tsx, frontend/app/layout.tsx
Adds a new client header component ("use client") that renders navigation: "Perspective" home link, "Analyze" link, and ThemeToggle. The root layout.tsx imports and includes <Header /> inside the existing ThemeProvider (minor formatting adjusted).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰
I hopped in with a brand-new bar,
A header bright to guide afar,
Links to roam and themes to spar,
Perspective gleams — a UI star,
My whiskers twitch, hooray, hurrah! ✨

🚥 Pre-merge checks | ✅ 1 | ❌ 4

❌ Failed checks (4 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title claims to replace hardcoded colors with theme variables, but the actual changes add a Header component with theme integration rather than refactoring color definitions. Update the title to accurately reflect the primary changes, such as 'feat: add header component with theme toggle' or provide color refactoring changes matching the title.
Linked Issues check ⚠️ Warning Issue #137 requires replacing hardcoded color classes with theme variables in components, but the PR adds a new Header component without addressing the core refactoring objective. Include changes that replace hardcoded colors (text-green-500, text-yellow-500, text-red-500) with theme variables in the BiasMeter or other components as specified in issue #137.
Out of Scope Changes check ⚠️ Warning The PR introduces new Header and layout changes unrelated to the color variable refactoring objective defined in issue #137. Remove out-of-scope Header and layout changes, or align them with issue #137 by implementing the color variable refactoring mentioned in the PR objectives.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@mahek2016 mahek2016 force-pushed the refactor/color-variables branch from 2bcd31f to 3e198fa Compare March 10, 2026 15:42
Copy link
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.

🧹 Nitpick comments (1)
frontend/app/layout.tsx (1)

30-35: Explicit disableTransitionOnChange={false} is redundant.

The false value is the default for disableTransitionOnChange in next-themes. Consider removing it unless you want to document the intent explicitly for future maintainers.

♻️ Optional cleanup
         <ThemeProvider
           attribute="class"
           defaultTheme="system"
           enableSystem
-          disableTransitionOnChange={false}
         >
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/app/layout.tsx` around lines 30 - 35, The ThemeProvider usage
explicitly sets disableTransitionOnChange={false}, which is redundant because
next-themes defaults this prop to false; remove the disableTransitionOnChange
prop from the ThemeProvider component (or replace it with a short comment if you
want to document the intentional default) to clean up the JSX while leaving
ThemeProvider, attribute, defaultTheme, and enableSystem unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@frontend/app/layout.tsx`:
- Around line 30-35: The ThemeProvider usage explicitly sets
disableTransitionOnChange={false}, which is redundant because next-themes
defaults this prop to false; remove the disableTransitionOnChange prop from the
ThemeProvider component (or replace it with a short comment if you want to
document the intentional default) to clean up the JSX while leaving
ThemeProvider, attribute, defaultTheme, and enableSystem unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 176083d6-531f-4ab1-8219-edf0084446f8

📥 Commits

Reviewing files that changed from the base of the PR and between 2bcd31f and 3e198fa.

📒 Files selected for processing (2)
  • frontend/app/layout.tsx
  • frontend/components/header.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/components/header.tsx

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.

[FEATURE]: Use variables of colors in the frontend and replace the hardcoded oens

1 participant