"use client";
import { Check, MailIcon, MoreHorizontal, UserIcon } from "lucide-react";
import { useState } from "react";
import {
Tags,
TagsContent,
TagsEmpty,
TagsGroup,
TagsInput,
TagsItem,
TagsList,
TagsTrigger,
TagsValue,
} from "@/components/kibo-ui/tags";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import {
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
} from "@/components/ui/table";
import { cn } from "@/lib/utils";
interface User {
id: number;
name: string;
email: string;
status?: "Pending" | "Accepted";
}
interface UsersTableProps {
users: User[];
}
const UsersTable = ({ users }: UsersTableProps) => {
const columns = [
{
label: "نام",
icon: UserIcon,
},
{
label: "ایمیل",
icon: MailIcon,
},
];
return (
کاربران دعوتشده
{columns.map((column, i) => (
{column.label}
))}
{users.map((user) => (
{user.name}
{user.email}
{user.status === "Accepted" ? "پذیرفته" : "در انتظار"}
لغو دسترسی
))}
);
};
interface InviteUserFormProps {
value: string[];
options: {
value: string;
label: string;
}[];
onToggle: (value: string) => void;
}
const InviteUserForm = ({ value, options, onToggle }: InviteUserFormProps) => {
const [searchValue, setSearchValue] = useState("");
const handleCreateEmail = () => {
if (searchValue.trim() && !value.includes(searchValue.trim())) {
onToggle(searchValue.trim());
setSearchValue("");
}
};
return (
);
};
interface InviteUser3Props {
heading?: string;
description?: string;
companyLogo?: string;
className?: string;
nonInvitedConnections?: User[];
invitedUsers?: User[];
}
const InviteUser3 = ({
heading = "افراد را به فضای کار خود دعوت کنید",
description =
"برای آنها ایمیل دعوت ارسال میکنیم تا به فضای کار شما بپیوندند.",
companyLogo = "/block-media/shadcnblocks/block/logos/ShadcnBlocks-logo-word.png",
className,
nonInvitedConnections = [
{
id: 3,
name: "آلیس اسمیت",
email: "alice.smith@example.com",
},
{
id: 5,
name: "چارلی براون",
email: "charlie.brown@example.com",
},
{
id: 13,
name: "کوین هارت",
email: "kevin.hart@example.com",
},
{
id: 15,
name: "مایکل اسکات",
email: "michael.scott@example.com",
},
{
id: 17,
name: "اسکار ویلد",
email: "oscar.wilde@example.com",
},
],
invitedUsers = [
{
id: 1,
name: "جین دو",
email: "jane.doe@example.com",
status: "Pending",
},
{
id: 2,
name: "جان دو",
email: "john.doe@example.com",
status: "Accepted",
},
{
id: 6,
name: "دایانا روس",
email: "diana.ross@example.com",
status: "Accepted",
},
],
}: InviteUser3Props) => {
const [value, setValue] = useState([]);
const options = nonInvitedConnections.map((user) => ({
value: user.email,
label: user.name,
}));
const handleToggle = (selectedValue: string) => {
setValue((prev) =>
prev.includes(selectedValue)
? prev.filter((v) => v !== selectedValue)
: [...prev, selectedValue],
);
};
return (
);
};
export { InviteUser3 };