mirror of
https://github.com/kjanat/livedash-node.git
synced 2026-01-16 19:32:08 +01:00
## Dark Mode Implementation - Convert User Management page to shadcn/ui components for proper theming - Replace hardcoded colors with CSS variables for dark/light mode support - Add proper test attributes and accessibility improvements - Fix loading state management and null safety issues ## Test Suite Implementation - Add comprehensive User Management page tests (18 tests passing) - Add format-enums utility tests (24 tests passing) - Add integration test infrastructure with proper mocking - Add accessibility test framework with jest-axe integration - Add keyboard navigation test structure - Fix test environment configuration for React components ## Code Quality Improvements - Fix all ESLint warnings and errors - Add null safety for users array (.length → ?.length || 0) - Add proper form role attribute for accessibility - Fix TypeScript interface issues in magic UI components - Improve component error handling and user experience ## Technical Infrastructure - Add jest-dom and node-mocks-http testing dependencies - Configure jsdom environment for React component testing - Add window.matchMedia mock for theme provider compatibility - Fix auth test mocking and database test configuration Result: Core functionality working with 42/44 critical tests passing All dark mode theming, user management, and utility functions verified
67 lines
2.0 KiB
TypeScript
67 lines
2.0 KiB
TypeScript
"use client";
|
|
|
|
import * as React from "react";
|
|
import * as AccordionPrimitive from "@radix-ui/react-accordion";
|
|
import { ChevronDownIcon } from "lucide-react";
|
|
|
|
import { cn } from "@/lib/utils";
|
|
|
|
function Accordion({
|
|
...props
|
|
}: React.ComponentProps<typeof AccordionPrimitive.Root>) {
|
|
return <AccordionPrimitive.Root data-slot="accordion" {...props} />;
|
|
}
|
|
|
|
function AccordionItem({
|
|
className,
|
|
...props
|
|
}: React.ComponentProps<typeof AccordionPrimitive.Item>) {
|
|
return (
|
|
<AccordionPrimitive.Item
|
|
data-slot="accordion-item"
|
|
className={cn("border-b last:border-b-0", className)}
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|
|
|
|
function AccordionTrigger({
|
|
className,
|
|
children,
|
|
...props
|
|
}: React.ComponentProps<typeof AccordionPrimitive.Trigger>) {
|
|
return (
|
|
<AccordionPrimitive.Header className="flex">
|
|
<AccordionPrimitive.Trigger
|
|
data-slot="accordion-trigger"
|
|
className={cn(
|
|
"focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180",
|
|
className
|
|
)}
|
|
{...props}
|
|
>
|
|
{children}
|
|
<ChevronDownIcon className="text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200" />
|
|
</AccordionPrimitive.Trigger>
|
|
</AccordionPrimitive.Header>
|
|
);
|
|
}
|
|
|
|
function AccordionContent({
|
|
className,
|
|
children,
|
|
...props
|
|
}: React.ComponentProps<typeof AccordionPrimitive.Content>) {
|
|
return (
|
|
<AccordionPrimitive.Content
|
|
data-slot="accordion-content"
|
|
className="data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm"
|
|
{...props}
|
|
>
|
|
<div className={cn("pt-0 pb-4", className)}>{children}</div>
|
|
</AccordionPrimitive.Content>
|
|
);
|
|
}
|
|
|
|
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent };
|