Add account hierarchy framework with migrations, RLS policies, and UI components
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
'use client';
|
||||
|
||||
import { useCallback, useState } from 'react';
|
||||
import { useAction } from 'next-safe-action/hooks';
|
||||
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { toast } from '@kit/ui/sonner';
|
||||
|
||||
import { Plus } from 'lucide-react';
|
||||
import { useAction } from 'next-safe-action/hooks';
|
||||
|
||||
import { createDepartment } from '@kit/member-management/actions/member-actions';
|
||||
import { Button } from '@kit/ui/button';
|
||||
import { Input } from '@kit/ui/input';
|
||||
import { Label } from '@kit/ui/label';
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
@@ -16,15 +18,17 @@ import {
|
||||
DialogTitle,
|
||||
DialogTrigger,
|
||||
} from '@kit/ui/dialog';
|
||||
import { Plus } from 'lucide-react';
|
||||
|
||||
import { createDepartment } from '@kit/member-management/actions/member-actions';
|
||||
import { Input } from '@kit/ui/input';
|
||||
import { Label } from '@kit/ui/label';
|
||||
import { toast } from '@kit/ui/sonner';
|
||||
|
||||
interface CreateDepartmentDialogProps {
|
||||
accountId: string;
|
||||
}
|
||||
|
||||
export function CreateDepartmentDialog({ accountId }: CreateDepartmentDialogProps) {
|
||||
export function CreateDepartmentDialog({
|
||||
accountId,
|
||||
}: CreateDepartmentDialogProps) {
|
||||
const router = useRouter();
|
||||
const [open, setOpen] = useState(false);
|
||||
const [name, setName] = useState('');
|
||||
@@ -49,7 +53,11 @@ export function CreateDepartmentDialog({ accountId }: CreateDepartmentDialogProp
|
||||
(e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
if (!name.trim()) return;
|
||||
execute({ accountId, name: name.trim(), description: description.trim() || undefined });
|
||||
execute({
|
||||
accountId,
|
||||
name: name.trim(),
|
||||
description: description.trim() || undefined,
|
||||
});
|
||||
},
|
||||
[execute, accountId, name, description],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user