- Added validation for team configuration updates to ensure name, description, and color are strings. - Improved member detection logic to avoid false positives by ensuring only one known member name is matched. - Refactored post-launch configuration updates to combine session history and project path updates, preventing race conditions. - Updated UI components to streamline state management for collapsible sections. These changes aim to improve data integrity and user experience in team management functionalities.
53 lines
1.5 KiB
TypeScript
53 lines
1.5 KiB
TypeScript
import { useState } from 'react';
|
|
|
|
import { Badge } from '@renderer/components/ui/badge';
|
|
import { ChevronRight } from 'lucide-react';
|
|
|
|
interface CollapsibleTeamSectionProps {
|
|
title: string;
|
|
badge?: string | number;
|
|
defaultOpen?: boolean;
|
|
forceOpen?: boolean;
|
|
action?: React.ReactNode;
|
|
children: React.ReactNode;
|
|
}
|
|
|
|
export const CollapsibleTeamSection = ({
|
|
title,
|
|
badge,
|
|
defaultOpen = true,
|
|
forceOpen,
|
|
action,
|
|
children,
|
|
}: CollapsibleTeamSectionProps): React.JSX.Element => {
|
|
const [open, setOpen] = useState(defaultOpen);
|
|
const isOpen = forceOpen ? true : open;
|
|
|
|
return (
|
|
<section className="border-b border-[var(--color-border)] py-3 last:border-b-0">
|
|
<div className="flex items-center">
|
|
<button
|
|
type="button"
|
|
className="flex flex-1 items-center gap-2 text-left"
|
|
onClick={() => setOpen((prev) => !prev)}
|
|
>
|
|
<ChevronRight
|
|
size={14}
|
|
className={`shrink-0 text-[var(--color-text-muted)] transition-transform duration-150 ${isOpen ? 'rotate-90' : ''}`}
|
|
/>
|
|
<span className="text-sm font-medium text-[var(--color-text)]">{title}</span>
|
|
{badge != null && (
|
|
<Badge
|
|
variant="secondary"
|
|
className="px-1.5 py-0.5 text-[10px] font-normal leading-none"
|
|
>
|
|
{badge}
|
|
</Badge>
|
|
)}
|
|
</button>
|
|
{action && <div className="shrink-0">{action}</div>}
|
|
</div>
|
|
{isOpen && <div className="mt-2">{children}</div>}
|
|
</section>
|
|
);
|
|
};
|