-
Notifications
You must be signed in to change notification settings - Fork 12
Preview / Test PR: #41 Feat/dark theme preview #44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Reverted package versions to match main branch: - next: 16.0.0 → 13.5.1 - postcss: ^8.5.6 → 8.4.30 - react-syntax-highlighter: ^16.0.0 → ^15.5.0 - tsconfig.json: jsx setting updated to "preserve" for Next.js compatibility The workflow's Node.js version upgrade to 20.x is retained. This fixes the CI/CD pipeline error where `next lint` was failing due to version incompatibilities introduced by the Next.js 16 upgrade. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add "docs" to tsconfig.json exclude list to prevent TypeScript errors from Docusaurus files that don't have their dependencies installed - Sync tsconfig.json formatting with main branch - This fixes the CI/CD TypeScript check failure 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add "npm ci" before building in deploy-preview job - This fixes "next: not found" error when vercel build falls back to npm run build - Dependencies are now installed before attempting to build the project The error occurred because: 1. Vercel build failed (VERCEL_TOKEN not configured) 2. Fallback to npm run build was triggered 3. But dependencies were never installed, causing "next: not found" 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
WalkthroughThe pull request introduces dark/light theme switching functionality using the next-themes library. A new ThemeToggle component is added to enable user theme selection. Color variables in globals.css are refactored from RGB to HSL format. GitHub repository links are updated to point to a specific repository. A dependency installation step is added to the CI/CD pipeline. Changes
Sequence DiagramsequenceDiagram
actor User
participant Header as Site Header
participant ThemeToggle as Theme Toggle
participant NextThemes as next-themes
participant DOM as DOM/localStorage
User->>Header: Page loads
Header->>ThemeToggle: Render ThemeToggle
ThemeToggle->>NextThemes: useTheme hook
NextThemes->>DOM: Read theme from localStorage or system
NextThemes-->>ThemeToggle: resolvedTheme & setTheme
ThemeToggle->>DOM: Render with current theme
User->>ThemeToggle: Click toggle button
ThemeToggle->>NextThemes: setTheme("dark" or "light")
NextThemes->>DOM: Update class on html element
NextThemes->>DOM: Save to localStorage
DOM-->>User: Theme switches (CSS applies)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested labels
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
Contributor License Agreement (CLA)Thank you for your contribution to ToolBox. By submitting this pull request, you automatically agree to our Contributor License Agreement (CLA). Key Terms
Full AgreementPlease review the complete CLA for all terms and conditions. QuestionsIf you have questions about the CLA, please comment on this pull request or open a discussion. By continuing with this pull request, you confirm your acceptance of the CLA. |
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||
🚀 Preview Deployment✅ Your changes have been deployed to preview! Build Details:
Preview URL: https://tool-jzhmf314f-rishabhs-projects-fef8118d.vercel.app CI Checks: ✅ All passed This comment is automatically updated for each commit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
components/theme-toggle.tsx (1)
7-30: Theme toggle implementation follows best practices.The component correctly:
- Uses the
"use client"directive for client-side interactivity- Implements the mounted pattern to prevent hydration mismatches
- Uses
resolvedThemeto get the actual theme (not "system")- Includes proper accessibility attributes
For added robustness, consider handling the edge case where
resolvedThememight be undefined:- onClick={() => setTheme(resolvedTheme === "dark" ? "light" : "dark")} + onClick={() => setTheme(resolvedTheme === "dark" ? "light" : "dark")} className="relative inline-flex h-10 w-10 items-center justify-center rounded-md border border-input bg-background hover:bg-accent hover:text-accent-foreground transition-colors" - aria-label="Toggle theme" + aria-label={`Switch to ${resolvedTheme === "dark" ? "light" : "dark"} mode`}Or add a guard:
if (!mounted || !resolvedTheme) return null;However, the current implementation works correctly in practice since the mounted check ensures the theme is loaded before rendering.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (8)
.github/workflows/ci-cd-pipeline.yml(1 hunks)app/globals.css(3 hunks)app/layout.tsx(2 hunks)app/page.tsx(1 hunks)components/site-footer.tsx(2 hunks)components/site-header.tsx(2 hunks)components/theme-toggle.tsx(1 hunks)package.json(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
app/layout.tsx (2)
components/site-header.tsx (1)
SiteHeader(15-54)components/site-footer.tsx (1)
SiteFooter(4-36)
components/site-header.tsx (1)
components/theme-toggle.tsx (1)
ThemeToggle(7-30)
🔇 Additional comments (7)
.github/workflows/ci-cd-pipeline.yml (1)
324-326: Good addition for deployment consistency.Installing dependencies before the Vercel build ensures that all required packages are available for the build process. This aligns with the dependency installation pattern used in other jobs.
components/site-footer.tsx (1)
16-26: Link updates look good.The GitHub links now correctly point to the specific ToolBox repository, maintaining consistency with the updates in the header and landing page.
app/globals.css (1)
98-118: Color function updates align with variable format.Changing from
rgb(var(--...))tohsl(var(--...))is correct since the CSS variables are defined as HSL triplets (e.g.,--muted: 0 0% 96.1%). This ensures proper color interpretation across light and dark themes.app/page.tsx (1)
78-78: Repository link updated correctly.The GitHub CTA now points to the specific ToolBox repository, maintaining consistency across the site.
components/site-header.tsx (1)
8-8: Theme toggle integration looks good.The ThemeToggle component is properly imported and positioned in the header alongside the GitHub button. The repository link is updated consistently with other components.
Also applies to: 44-46
app/layout.tsx (1)
6-6: ThemeProvider integration is correctly implemented.The setup follows next-themes best practices:
attribute="class"enables class-based theming (.darkselector in CSS)defaultTheme="system"respects user's OS preferenceenableSystemallows automatic system theme detectionstorageKey="devtools-theme"provides localStorage persistencedisableTransitionOnChangeprevents CSS transition flickering during theme switchessuppressHydrationWarningon the html element correctly handles potential mismatches between server-rendered theme and client-side themeThis provides a smooth theme switching experience aligned with the ThemeToggle component.
Also applies to: 22-36
package.json (1)
51-52: Upstash dependencies are confirmed present in the final state.Verification confirms that
@upstash/ratelimitand@upstash/redisare indeed present in package.json as shown in the code snippet. The AI summary's claim that they were "temporarily introduced and later removed, resulting in no net change" is inaccurate. These dependencies are part of the actual project changes.
|
@CodeRabbit the theme toggle is still not working in deployment can you check the code and suggest them as commitable changes so that i can commit and fix them? other stuff looks good to me but this toggle is not working |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain@rishabh3562, I'll investigate the theme toggle issue in your deployment. Let me examine the relevant files to identify the problem. 🏁 Script executed: Length of output: 8598 @rishabh3562, I found the issue! The problem is with how the theme toggle logic handles the Here's the fix: Updated
|
User description
Purpose
This PR is created to preview/test fork changes (
aryadharmadhikari:feat/dark-theme) in our repo with full CI/CD and Vercel deployment.Changes Included
Steps to Test
Notes
PR Type
Enhancement
Description
Add dark mode support with next-themes integration
Fix GitHub repository links to correct fork URL
Update CSS color format from rgb to hsl for consistency
Add npm install step to CI/CD deploy-preview job
Add rate limiting dependencies for API protection
Diagram Walkthrough
File Walkthrough
globals.css
Update CSS color format and remove legacy theme variablesapp/globals.css
rgb()tohsl()for consistencylayout.tsx
Integrate ThemeProvider for dark mode supportapp/layout.tsx
ThemeProviderfrom next-themessuppressHydrationWarningto html elementsite-header.tsx
Add theme toggle and fix GitHub linkcomponents/site-header.tsx
ThemeTogglecomponent to headertheme-toggle.tsx
Create theme toggle component with animationscomponents/theme-toggle.tsx
resolvedThemefrom next-themes for reliable theme detectionci-cd-pipeline.yml
Add npm install step to deploy-preview job.github/workflows/ci-cd-pipeline.yml
npm ci --prefer-offlinestep before Vercel CLI installationpage.tsx
Fix GitHub repository link in hero sectionapp/page.tsx
https://github.comtohttps://github.com/rishabh3562/ToolBoxsite-footer.tsx
Fix GitHub repository links in footercomponents/site-footer.tsx
https://github.comwithhttps://github.com/rishabh3562/ToolBoxpackage.json
Add Upstash rate limiting dependenciespackage.json
@upstash/ratelimitand@upstash/redisdependenciesSummary by CodeRabbit
New Features
Updates