| 24 | |
| 25 | // Add this helper function to convert HSL string to HslColor object |
| 26 | const hslStringToObject = (hslString: string): HslColor => { |
| 27 | const match = hslString.match(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/) |
| 28 | if (match) { |
| 29 | return { |
| 30 | h: parseInt(match[1]), |
| 31 | s: parseFloat(match[2]), |
| 32 | l: parseFloat(match[3]) |
| 33 | } |
| 34 | } |
| 35 | return { h: 0, s: 0, l: 0 } // Default color if parsing fails |
| 36 | } |
| 37 | |
| 38 | export function GroupsDialog({ isOpen, onClose, userId, onGroupsChange }: GroupsDialogProps) { |
| 39 | const [groups, setGroups] = useState<Group[]>([]) |