Skip to content

Conversation

@liamgold
Copy link
Owner

Summary

Complete migration from ShadCN UI components to native Xperience by Kentico admin components, with a comprehensive dashboard-style UI redesign.

Key Changes

  • Component Migration: Removed all ShadCN dependencies and migrated to native @kentico/xperience-admin-components
  • UI Redesign: Modern dashboard layout with hero carbon rating section, stat cards grid, and collapsible resource lists
  • Bundle Optimization: Reduced bundle size from ~55 KiB to 12.2 KiB (78% reduction)
  • Bug Fix: Fixed percentage calculation in resource groups (was showing >100%)
  • Documentation: Streamlined CLAUDE.md (27% reduction), added custom agent profiles
  • Version Bump: Updated to 2.2.0

Dependencies Removed

  • @radix-ui/react-slot
  • class-variance-authority
  • clsx
  • lucide-react
  • tailwind-merge
  • tailwindcss
  • tw-animate-css

New UI Features

Hero Carbon Rating Section

  • Large 120px rating display with dynamic gradient backgrounds
  • Color-coded by rating (A+ green → F red)
  • Descriptive text and context

Stat Cards Grid

  • 2x2 grid layout showing key metrics:
    • CO₂ Emissions (per page view)
    • Page Weight (MB/KB)
    • Total Resources (count)
    • Efficiency Rating (Excellent/Good/Fair/Poor)

Collapsible Resource Lists

  • Show 3 resources by default with "Show X more" button
  • Sorted by size (largest first)
  • Percentage badges showing % of total page weight
  • Filename/path separation for better readability

XbyK-Specific Optimization Tips

  • Image Variants configuration guidance
  • AIRA AI-powered optimization features
  • Automated image metadata generation

Custom Agent Profiles

Added specialized agent profiles in .claude/agents/:

  • xbyk-component-migration.md - UI component migration expertise
  • nuget-package-maintainer.md - Versioning and package management
  • documentation-maintainer.md - Documentation accuracy and optimization
  • react-admin-ui-developer.md - Admin UI best practices
  • playwright-integration.md - Browser automation patterns

Technical Details

Components Used:

  • XbyK Native: Card, Button, Stack, Row, Column, Headline, Spacing, Divider
  • Custom: StatCard, ResourceGroupCard (specialized for sustainability metrics)

Configuration Cleanup:

  • Removed Tailwind CSS configuration and PostCSS setup
  • Removed path aliases from tsconfig.json
  • Deleted unnecessary CSS files

Breaking Changes

None - this is a purely internal implementation change. The module interface and integration remain unchanged.

Testing

  • ✅ Build successful (12.2 KiB bundle)
  • ✅ Manual testing of UI states (no data, loading, error, success)
  • ✅ Percentage calculations verified
  • ✅ Responsive layout tested

Screenshots

See updated screenshot in repository: src/images/SustainabilityReport-PageTab.jpeg


🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

liamgold and others added 4 commits October 16, 2025 22:34
- Remove ShadCN dependencies (@radix-ui/react-slot, class-variance-authority, clsx, lucide-react, tailwind-merge, tailwindcss, tw-animate-css)
- Migrate to native @kentico/xperience-admin-components (Card, Button, Stack, Row, Column, Headline, Spacing, Divider)
- Remove Tailwind CSS configuration and PostCSS setup
- Remove path aliases from tsconfig.json
- Redesign UI with dashboard-style layout:
  - Hero carbon rating section with 120px rating display and gradient backgrounds
  - 2x2 stat cards grid showing key metrics (CO₂, Page Weight, Resources, Efficiency)
  - Collapsible resource lists (show 3 by default, expandable)
  - Resource breakdown sorted by size with percentage badges
  - XbyK-specific optimization tips (Image Variants, AIRA features)
- Fix percentage calculation bug in resource groups
- Reduce bundle size from ~55 KiB to 12.2 KiB (78% reduction)
- Update CLAUDE.md with redesign details and future enhancements roadmap
- Update README.md with new screenshot

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

Co-Authored-By: Claude <noreply@anthropic.com>
- Update version from 2.1.0 to 2.2.0 in csproj
- Remove version line from CLAUDE.md to avoid maintenance burden

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

Co-Authored-By: Claude <noreply@anthropic.com>
Remove redundant sections:
- "Recently Fixed" - historical information
- "Future Enhancements" - now tracked in GitHub issues
- "Testing Strategy" - generic recommendations
- "Git Workflow" - not useful for development
- "Related Resources" - better suited for README
- "Creating a Release" - procedural info

Reduced from 389 to 285 lines (27% reduction) while keeping essential architecture documentation, configuration, common tasks, and debugging tips.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Created 5 agent profiles in .claude/agents/:
- xbyk-component-migration: UI component migration expertise
- nuget-package-maintainer: Versioning and package management
- documentation-maintainer: Doc accuracy and context optimization
- react-admin-ui-developer: Admin UI best practices
- playwright-integration: Browser automation patterns

Updated .gitignore to allow .claude/agents/ and .claude/commands/ while keeping other .claude/ files ignored.

These agents provide specialized expertise for common maintenance tasks and can be invoked when working on specific areas of the codebase.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings October 16, 2025 21:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR migrates the admin UI from ShadCN components to native Xperience by Kentico (XbyK) components, delivering a significant bundle size reduction (78%) and a modernized dashboard-style interface. The changes are purely internal implementation improvements with no breaking changes to the module's public API.

Key changes:

  • Complete removal of ShadCN UI dependencies and migration to @kentico/xperience-admin-components
  • Redesigned dashboard UI with hero carbon rating, stat cards grid, and collapsible resource lists
  • Bundle optimization from ~55 KiB to 12.2 KiB
  • Fixed percentage calculation bug in resource groups
  • Added custom agent profiles for specialized development tasks

Reviewed Changes

Copilot reviewed 17 out of 24 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/XperienceCommunity.Sustainability.csproj Version bump to 2.2.0
src/Client/tsconfig.json Removed path aliases for ShadCN components
src/Client/src/sustainability.css Removed Tailwind CSS theme configuration
src/Client/src/entry.tsx Removed CSS import for deleted Tailwind styles
src/Client/src/Sustainability/SustainabilityTabTemplate.tsx Complete UI redesign using XbyK components and custom styled components
src/Client/postcss.config.mjs Removed PostCSS configuration for Tailwind
src/Client/package.json Removed ShadCN and Tailwind dependencies
src/Client/lib/utils.ts Deleted utility file for Tailwind class merging
src/Client/components/ui/card.tsx Deleted ShadCN Card component
src/Client/components/ui/button.tsx Deleted ShadCN Button component
README.md Updated screenshot reference path
CLAUDE.md Streamlined documentation, removed version hardcoding and historical information
.claude/agents/xbyk-component-migration.md Added XbyK component migration expertise profile
.claude/agents/react-admin-ui-developer.md Added React admin UI development best practices profile
.claude/agents/playwright-integration.md Added Playwright integration patterns profile
.claude/agents/nuget-package-maintainer.md Added NuGet package versioning expertise profile
.claude/agents/documentation-maintainer.md Added documentation maintenance guidelines profile
Files not reviewed (1)
  • src/Client/package-lock.json: Language not supported

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

liamgold and others added 4 commits October 16, 2025 22:57
Extract inline styles from ResourceGroupCard component into a separate `resourceGroupCardStyles` object to improve maintainability and reduce duplication.

Benefits:
- Styles are now defined in one place
- Easier to maintain and update
- Better TypeScript type safety with 'as const' assertions
- Addresses Copilot suggestion from PR review

Bundle size: 12.5 KiB (minimal increase of 0.3 KiB for better code organization)

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

Co-Authored-By: Claude <noreply@anthropic.com>
Replace the expand/collapse button in ResourceGroupCard with the native XbyK Button component for consistency with the rest of the UI.

Benefits:
- Better accessibility (XbyK Button has built-in ARIA attributes)
- Consistent styling with other UI buttons
- Simplified code (removed manual hover handlers)
- Slightly smaller bundle size (12.5 KiB → 12.3 KiB)

Changes:
- Removed custom expandButton styles and hover handlers
- Use XbyK Button with ButtonColor.Secondary and ButtonSize.S
- Addresses second Copilot suggestion from PR review

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

Co-Authored-By: Claude <noreply@anthropic.com>
Improved button alignment by adding flexbox centering to the
expandButtonContainer. The XbyK Button component was left-aligned by
default, making it look out of place. Now properly centered for better
visual balance.

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

Co-Authored-By: Claude <noreply@anthropic.com>
Updated the UI screenshot to show the centered expand/collapse button
after the recent alignment fix.

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

Co-Authored-By: Claude <noreply@anthropic.com>
@liamgold liamgold merged commit dac2c44 into main Oct 16, 2025
1 check passed
@liamgold liamgold deleted the feature/migrate-to-native-xbyk-components branch October 16, 2025 22:10
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.

2 participants