Skip to content

Conversation

@Innocent-Akim
Copy link
Contributor

@Innocent-Akim Innocent-Akim commented Dec 31, 2025

  • Add SelectLayout component with side-by-side layout display
  • Integrate SelectLayout as first item in Settings modal
  • Replace column layout with horizontal grid with thumbnails
  • Works in both DEMO and NON-DEMO modes
  • Layout change is immediate with toast notification

Summary

Related Issues

Description

Changes Made

  • [ ]
  • [ ]
  • [ ]

Screenshots / Videos

Type of Change

  • 🐛 Bug fix (non-breaking change addressing an issue)
  • ✨ New feature (non-breaking change adding functionality)
  • 💥 Breaking change (fix or feature causing existing functionality to change)
  • 📝 Documentation update
  • 🔧 Configuration change
  • 🧪 Test addition or modification
  • 🛠️ CI/CD infrastructure improvement
  • ♻️ Refactoring (no functional changes)
  • 🎨 Code style/formatting update
  • 🚀 Performance improvement

Implementation Details

Testing Instructions

Deployment Notes

Checklist

  • I have performed a self-review of my code
  • I have added/updated tests that prove my fix is effective or my feature works
  • I have updated relevant documentation
  • My changes generate no new warnings or errors
  • I have verified my changes in multiple browsers/environments (if applicable)
  • New and existing unit tests pass locally with my changes
  • I have made corresponding changes to the documentation
  • My code follows the established code style of the project
  • I have commented my code, particularly in hard-to-understand areas

Additional Context


Summary by cubic

Moved the layout switch into the Settings modal with a new side-by-side preview selector. Layout changes apply instantly with a toast confirmation in both demo and non-demo modes.

  • New Features

    • Added SelectLayout component with two visual previews (Home 1, Home 2) in a horizontal grid with thumbnails.
    • Inserted SelectLayout as the first section in the Settings modal.
    • Dark/light-aware preview images using next-themes and next/image.
    • Active state indicator and small hover animations for clearer selection.
  • Bug Fixes

    • Corrected Tailwind gradient classes in layout previews and hover overlay.

Written for commit 4b11b8f. Summary will update on new commits.

Summary by CodeRabbit

  • New Features
    • Added a layout selector to the settings modal with live previews of available layout options
    • Users can now switch between layouts with visual previews and receive confirmation of their selection

✏️ Tip: You can customize this high-level summary in your review settings.

- Add SelectLayout component with side-by-side layout display
- Integrate SelectLayout as first item in Settings modal
- Replace column layout with horizontal grid with thumbnails
- Works in both DEMO and NON-DEMO modes
- Layout change is immediate with toast notification
@vercel
Copy link

vercel bot commented Dec 31, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
ever-works-website-template Ready Ready Preview, Comment Dec 31, 2025 7:58pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 31, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

This PR introduces a new SelectLayout component for choosing display layouts with live previews and adds it to the SettingsModal. The component integrates with layout/theme context and next-themes, displays dark/light mode variants, supports internationalization, and notifies users via toast on selection. Minor formatting updates are applied to the modal for consistency.

Changes

Cohort / File(s) Summary
Settings Modal Integration
components/settings-modal.tsx
Adds new <SelectLayout /> section to modal content; refactors string literals to single quotes; wraps className groupings with cn utility; updates translation key to single-quoted format. No behavioral changes to existing functionality.
New Layout Selector Component
components/ui/select-layout.tsx
New client component providing two-option layout selector with live preview images (dark/light variants). Reads/updates layout via context, detects dark mode via next-themes, supports translations, shows toast on selection, and handles disabled state.

Sequence Diagram

sequenceDiagram
    actor User
    participant SettingsModal
    participant SelectLayout
    participant LayoutContext as Layout/Theme<br/>Context
    participant NextThemes
    participant Toast

    User->>SettingsModal: Opens settings
    SettingsModal->>SelectLayout: Renders component
    SelectLayout->>LayoutContext: Read current layout
    SelectLayout->>NextThemes: Check dark mode
    SelectLayout->>SelectLayout: Render preview images<br/>(dark/light variants)
    
    User->>SelectLayout: Click layout option
    alt Layout changed
        SelectLayout->>LayoutContext: Update layout state
        LayoutContext-->>SelectLayout: Layout updated
        SelectLayout->>Toast: Show notification
        Toast-->>User: Display confirmation
    else Same layout selected
        SelectLayout->>User: No change
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • evereq

Poem

🐰✨ A layout selector hops into view,
With preview images—dark mode and light, too!
Users pick layouts with a click and a toast,
The settings modal's now what they love most!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: moving the layout switch feature into the settings modal, which aligns with the primary objective of integrating SelectLayout as the first section in the Settings modal.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/settings-layout-switch

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.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

@Innocent-Akim Innocent-Akim self-assigned this Dec 31, 2025
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 31, 2025

Greptile Summary

This PR moves the layout selection functionality from a standalone switcher into the Settings modal as the first configuration option. The implementation introduces a new SelectLayout component that displays layout options side-by-side with preview thumbnails that adapt to the current theme (light/dark mode).

Key Changes:

  • Created new SelectLayout component with horizontal grid layout showing preview images
  • Integrated component into SettingsModal as first configuration item
  • Layout changes are immediate with toast notifications
  • Fully functional in both DEMO and NON-DEMO modes
  • All translation keys are properly defined in locale files
  • Preview images exist in public directory

Issues Found:

  • Two critical CSS syntax errors: bg-linear-to-br and bg-linear-to-t should be bg-gradient-to-br and bg-gradient-to-t respectively (lines 157-161, 171)

Confidence Score: 3/5

  • This PR needs CSS syntax fixes before merging to avoid rendering issues
  • The implementation is well-structured with proper context usage, translation keys, and preview images, but contains two critical CSS syntax errors (bg-linear-to-* instead of bg-gradient-to-*) that will cause the gradient backgrounds to not render properly. These must be fixed before deployment.
  • components/ui/select-layout.tsx requires fixes for CSS syntax errors on lines 157-161 and 171

Important Files Changed

Filename Overview
components/settings-modal.tsx Added SelectLayout component import and integrated it as first settings option; updated quote style from double to single quotes
components/ui/select-layout.tsx New SelectLayout component with side-by-side layout previews and theme-aware images; contains CSS syntax errors with bg-linear-to-* instead of bg-gradient-to-*

Sequence Diagram

sequenceDiagram
    participant User
    participant SettingsModal
    participant SelectLayout
    participant LayoutThemeContext
    participant LocalStorage
    participant Toast

    User->>SettingsModal: Opens settings modal
    SettingsModal->>SelectLayout: Renders SelectLayout component
    SelectLayout->>LayoutThemeContext: useLayoutTheme() - get current layout
    LayoutThemeContext->>LocalStorage: Read layoutHome from localStorage
    LocalStorage-->>LayoutThemeContext: Return saved layout or default
    LayoutThemeContext-->>SelectLayout: Return layoutHome state
    SelectLayout->>SelectLayout: Render layout options with previews
    SelectLayout-->>User: Display current and available layouts

    User->>SelectLayout: Clicks layout option
    SelectLayout->>SelectLayout: handleLayoutChange(layout)
    SelectLayout->>LayoutThemeContext: setLayoutHome(layout)
    LayoutThemeContext->>LocalStorage: Save layoutHome to localStorage
    LocalStorage-->>LayoutThemeContext: Success
    SelectLayout->>Toast: toast.success(label, description)
    Toast-->>User: Show success notification
    SelectLayout-->>User: Update UI with new active layout
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

Replace invalid bg-linear-to-br and bg-linear-to-t with correct
bg-gradient-to-br and bg-gradient-to-t syntax.

- Fix gradient syntax in layout preview background
- Fix gradient syntax in hover overlay
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.

Actionable comments posted: 0

♻️ Duplicate comments (2)
components/ui/select-layout.tsx (2)

157-161: Previous gradient syntax issue has been resolved.

The Tailwind gradient syntax has been corrected from the invalid bg-linear-to-br to the proper bg-gradient-to-br. This issue was fixed in commit "fix(ui): correct invalid Tailwind CSS gradient syntax".


171-171: Previous gradient syntax issue has been resolved.

The Tailwind gradient syntax has been corrected from the invalid bg-linear-to-t to the proper bg-gradient-to-t. This issue was fixed in commit "fix(ui): correct invalid Tailwind CSS gradient syntax".

🧹 Nitpick comments (2)
components/ui/select-layout.tsx (2)

23-23: Simplify redundant dark mode check.

The resolvedTheme already handles the system theme case and returns the actual resolved value, so the second condition is redundant.

🔎 Proposed simplification
-	const isDark = resolvedTheme === 'dark' || (theme === 'system' && resolvedTheme === 'dark');
+	const isDark = resolvedTheme === 'dark';

131-197: Consider adding ARIA attributes for better accessibility.

The layout selection buttons would benefit from additional ARIA attributes to improve screen reader support. Consider adding aria-label or aria-labelledby to describe each option, and aria-pressed or aria-current to indicate the active state.

🔎 Proposed accessibility improvements
 							<button
 								key={layout.key}
 								onClick={() => handleLayoutChange(layout.key)}
 								disabled={disabled}
+								aria-label={`${layout.label}: ${layout.description}`}
+								aria-pressed={isActive}
 								className={cn(
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3f4d9d8 and 4b11b8f.

📒 Files selected for processing (2)
  • components/settings-modal.tsx
  • components/ui/select-layout.tsx
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{js,ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use Node.js >= 20.19.0

Files:

  • components/ui/select-layout.tsx
  • components/settings-modal.tsx
components/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

components/**/*.{ts,tsx}: UI components should be placed in the components/** directory
Keep React components mostly presentational and lean, avoiding complex business logic

Files:

  • components/ui/select-layout.tsx
  • components/settings-modal.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Prefer TypeScript files over JavaScript

Run pnpm tsc --noEmit for TypeScript type-checking

Files:

  • components/ui/select-layout.tsx
  • components/settings-modal.tsx
components/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Place UI and layout components in components/**

Files:

  • components/ui/select-layout.tsx
  • components/settings-modal.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Prefer TypeScript for all code

Files:

  • components/ui/select-layout.tsx
  • components/settings-modal.tsx
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{js,jsx,ts,tsx}: Follow Prettier config with tabs, 4-space tabWidth, and 120-char printWidth
Prefer async/await over raw Promise chains in TypeScript/JavaScript code
Validate input with Zod where appropriate; follow existing schemas in lib/validations
Keep i18n-friendly: avoid hard-coded English strings in logic; use next-intl messages where relevant

Files:

  • components/ui/select-layout.tsx
  • components/settings-modal.tsx
**/components/**/*.{jsx,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/components/**/*.{jsx,tsx}: For forms, prefer react-hook-form + Zod; follow patterns in existing auth/profile forms
Place business logic in lib/services or lib/repositories, not in components; keep components mostly presentational and data-fetching

Files:

  • components/ui/select-layout.tsx
  • components/settings-modal.tsx
🧠 Learnings (3)
📚 Learning: 2025-11-24T18:35:04.571Z
Learnt from: CR
Repo: ever-works/ever-works-website-template PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T18:35:04.571Z
Learning: Applies to components/**/*.{ts,tsx,js,jsx} : Place UI and layout components in components/**

Applied to files:

  • components/ui/select-layout.tsx
📚 Learning: 2025-11-24T18:34:28.233Z
Learnt from: CR
Repo: ever-works/ever-works-website-template PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T18:34:28.233Z
Learning: Applies to components/**/*.{ts,tsx} : Keep React components mostly presentational and lean, avoiding complex business logic

Applied to files:

  • components/ui/select-layout.tsx
📚 Learning: 2025-11-30T21:22:22.296Z
Learnt from: CR
Repo: ever-works/ever-works-website-template PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-30T21:22:22.296Z
Learning: Applies to **/components/**/*.{jsx,tsx} : For forms, prefer react-hook-form + Zod; follow patterns in existing auth/profile forms

Applied to files:

  • components/ui/select-layout.tsx
🧬 Code graph analysis (2)
components/ui/select-layout.tsx (1)
hooks/use-theme.ts (1)
  • useTheme (84-129)
components/settings-modal.tsx (3)
lib/utils.ts (1)
  • cn (5-7)
hooks/use-settings-modal.tsx (1)
  • useSettingsModal (6-12)
lib/content.ts (1)
  • Settings (248-256)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Lint and Build
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (11)
components/ui/select-layout.tsx (7)

1-11: LGTM: Clean imports and proper client directive.

The imports are well-organized and appropriate for the component's functionality. The 'use client' directive is correctly placed for this interactive Next.js component.


12-15: LGTM: Well-defined component props.

The interface is clean and follows TypeScript best practices with optional props for customization.


47-57: LGTM: Robust change handler with good UX.

The function properly handles edge cases (disabled state, no-op changes) and provides clear user feedback via toast notifications.


59-94: LGTM: Polished container styling with glassmorphism effects.

The container styling uses modern design patterns with proper dark mode support and smooth animations. The spring-like easing creates a pleasant interaction feel.


95-124: LGTM: Well-structured header with proper semantics.

The header section uses proper semantic HTML (h3 for title) and provides clear, translated text with an animated icon. Typography and contrast are appropriate for accessibility.


163-169: LGTM: Proper Next.js Image optimization.

The Image component is correctly configured with the fill prop, object-cover, and a proper sizes attribute for responsive loading. The alt text is descriptive for accessibility.


25-45: All required layout preview images are present in the public directory. The component correctly references existing assets for both dark and light theme variants.

components/settings-modal.tsx (4)

9-9: LGTM: SelectLayout properly imported.

The new SelectLayout component is correctly imported and ready for use in the modal.


17-42: LGTM: Formatting improvements align with project standards.

The formatting changes (quote style consistency and cn utility grouping) improve code consistency without altering functionality.


85-126: LGTM: Consistent formatting in modal header.

The header section now consistently uses the cn utility for className composition and single-quoted strings, matching the project's formatting standards.


130-131: LGTM: SelectLayout properly integrated as first settings option.

The new SelectLayout component is appropriately placed as the first unconditional section in the settings modal, providing immediate access to layout selection. The comment clearly documents its visibility behavior.

@evereq evereq merged commit 5677af7 into develop Jan 1, 2026
10 checks passed
@evereq evereq deleted the feature/settings-layout-switch branch January 1, 2026 10:39
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.

3 participants