Skip to content

Comments

Feature/theme cards color circles#2412

Open
vitorbb1989 wants to merge 23 commits intokrayin:2.1from
vitorbb1989:feature/theme-cards-color-circles
Open

Feature/theme cards color circles#2412
vitorbb1989 wants to merge 23 commits intokrayin:2.1from
vitorbb1989:feature/theme-cards-color-circles

Conversation

@vitorbb1989
Copy link

Summary

  • Add compact theme selection cards with 6 color circles showing each theme's palette
  • Fix View Composer override bug (ThemeBootProvider was overwriting $availableThemes without colors)
  • Add CSS for theme card UX (cursor, user-select, checked state)
  • Add tooltips for all form fields
  • Add troubleshooting documentation

Bug Fixed

View Composer Override: ThemeBootProvider::registerViewComposers() was overwriting $availableThemes after ThemeController sent it, removing the colors array. Solution: Removed the View Composer, keeping ThemeController::getAvailableThemes() as single source of truth.

Test plan

  • Verify theme cards show different colors for each theme
  • Verify clicking a card selects the theme (blue border)
  • Verify "Ativo" badge appears on selected theme
  • Verify theme switch works correctly after save

vitorbb1989 and others added 23 commits December 21, 2025 04:27
Add complete ThemeManager package that enables comprehensive visual
customization of Krayin CRM including colors, logos, login page, and
empty states.

Features:
- Theme activation/deactivation toggle
- Primary color customization (6 color options)
- Logo management (main, light, icon, favicon)
- Login page customization (background, card, overlay)
- Empty state images for all modules
- CSS injection via middleware
- Bilingual support (EN/PT-BR)
- File upload with proper storage handling
- Cache management for performance

Technical Implementation:
- Full Concord module integration
- Repository pattern for data access
- Middleware for CSS injection
- Helper facade for theme access
- Database singleton pattern
- PSR-4 autoloading
- Storage symlink support

Configuration:
- Registered in composer.json autoload
- Added to config/app.php providers
- Registered in config/concord.php modules
- Migration for theme_configs table

Bug Fixes Applied:
- Fixed "Theme Active" select showing blank value
- Fixed logo implementation via CSS content replacement
- Fixed button visibility with proper color defaults
- Created storage symlink for file accessibility

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
feat(brandkit): complete BrandKit/Theme system with CI/CD pipeline (#1)

## Summary
- Add BrandKitResolver with precedence: CLEAR → overrides → theme_configs → theme.json → DEFAULTS
- Add PreviewSession for isolated theme preview
- Add BrandKitSnapshotService for transactional snapshots
- Add BrandKitCacheInvalidator for centralized cache management
- Add ThemeContextFactory with full config resolution
- Add CI/CD: GitHub Actions + GitLab CI with paths filter
- Add 77 unit tests (SQLite :memory: + array cache)
- Add comprehensive documentation

## Test Coverage
- BrandKitResolverTest: 16 tests (CLEAR, precedence, type casting, sanitize)
- BrandKitSnapshotServiceTest: 13 tests (transactions, atomicity, cleanup)
- BrandKitCacheInvalidatorTest: 6 tests (invalidation patterns)
- PreviewSessionTest: 16 tests (isolation, expiration, security)
- ThemeContextFactoryTest: 26 tests (factory, config resolution, cache)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add compact theme selection cards with 6 color circles
- Fix View Composer override bug (ThemeBootProvider was overwriting
  $availableThemes without colors)
- Add CSS for theme card UX (cursor, user-select, checked state)
- Add tooltips for all form fields
- Add troubleshooting documentation

Breaking change: Removed View Composer in ThemeBootProvider that was
overwriting controller data. ThemeController::getAvailableThemes() is
now the single source of truth for theme data.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Verify route admin.settings.theme.index exists and points to
  App\Http\Controllers\Admin\Settings\ThemeSettingsController
- Test ThemeCatalog returns themes with required color keys
- Validate hex color format for all theme colors
- Use Mockery mocks to avoid database dependency

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add pre-deploy and post-deploy verification checklists
- Document automatic vs manual cache invalidation
- List cache keys used by theme system
- Add testing section with commands and coverage info
- Update table of contents

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Ensure cache is cleared after all theme modifications:
- update(): clears cache after saving theme settings
- resetField(): clears cache after resetting individual field

This prevents stale cache issues in production/staging environments
where OPcache or Redis may retain old theme values.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add deploy-swarm.sh with commands for init, build, deploy, rollback,
  scale, logs, and clear-cache
- Add comprehensive DOCKER_SWARM_DEPLOY.md documentation
- Include theme cache invalidation for multi-replica environments
- Document shared storage requirements for theme assets

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Update docker-stack.yml with Traefik v3.0 configuration
- Add .env.swarm.example with all environment variables
- Add swarm-init.sh installation wizard script
- Update DOCKER_SWARM_DEPLOY.md with quick start guide

The swarm-init.sh script provides:
- Interactive configuration wizard
- Automatic secret creation
- Docker image building
- Stack deployment
- Database migrations
- Admin user creation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Change to 16:9 aspect ratio with 80px max-height preview
- Add unique visual patterns per theme (circles, waves, grid, hexagons, leaves, lines)
- Implement glassmorphism name overlay on gradient fallback
- Add diagonal "EM USO" ribbon and "Ativo" badge for selected theme
- Reduce card body to ultra-compact layout (5px padding, 3px gap)
- Display only 3 color circles (primary, success, danger)
- Remove version display from body (keep in title attribute)
- Add hover effects with subtle scale and shadow
- Remove temporary debug log from ThemeSettingsController

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Implement #krThemePreviewModal with lazy-load images and 404 fallback
- Add focus trap for keyboard navigation (Tab cycles through elements)
- Add proper ARIA attributes (role, aria-modal, aria-hidden, aria-labelledby)
- Use CSS variables with inline fallbacks for BrandKit compatibility
- Add tabindex="-1" on modal container and panel
- Implement try/finally pattern for __krSkipConfirm flag
- Add global functions: krOpenThemePreview, krCloseThemePreview, krApplyThemeFromPreview
- Add backward-compatible aliases for legacy code
- Fix Preview button not opening modal
- Add "Selecionar" button that marks radio without form submit
- Sync button states (Selecionar/Selecionado) on theme change

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Refactored Theme Colors section into a modern Color Token Editor:

## Features
- Grid layout with label/description + color chip + picker + text input + actions
- Live preview bar with buttons, badges and links
- Real-time CSS variable updates on document.documentElement
- Undo (⏪): reverts to saved value (window.__krSavedConfig)
- Reset (🔄): reverts to system defaults from config('theme-manager.defaults')
- Copy to clipboard with visual feedback

## Validation
- HEX colors: #RRGGBB format, normalized to uppercase
- RGBA colors: rgba(r,g,b,a) with range validation (0-255, 0-1)
- Invalid values blocked from propagating to hidden form inputs
- Submit hook validates all fields before form submission

## States
- .is-invalid: red border/background for validation errors
- .is-dirty: yellow border + pulsing dot for unsaved changes

## Technical
- Debug gate: logs only when APP_DEBUG=true (silent in production)
- Normalized defaults: flat keys without hardcoded fallbacks
- Responsive: <900px reorganizes to 2 lines, <600px ultra-compact
- Dark mode: proper opacity adjustments for all elements
- Upgrade-safe: only modifies override in resources/views/vendor/

## Fields (unchanged names)
- color_primary, color_primary_dark, color_primary_light
- color_success, color_warning, color_danger
- login_card_overlay_color

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add ThemeConfigObserver for universal cache invalidation
- Add InvalidateThemeCaches support class
- Add theme:doctor command for diagnostics
- Add theme:cache:clean command for cache management
- Add theme:preview:generate command for preview generation
- Add config/theme_cache.php configuration
- Add upgrade-safe checks to GitLab CI and GitHub Actions
- Improve ThemeCatalog with preview_url and disk-first default theme
- Register observer in ThemeOverridesServiceProvider

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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