2026-07-11 21:21:29 +03:30
|
|
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
|
|
import {
|
|
|
|
|
|
Clock,
|
|
|
|
|
|
MoreVertical,
|
|
|
|
|
|
Send,
|
|
|
|
|
|
UserCheck,
|
|
|
|
|
|
UserPlus,
|
|
|
|
|
|
X,
|
|
|
|
|
|
} from "lucide-react";
|
|
|
|
|
|
import { useState } from "react";
|
|
|
|
|
|
|
|
|
|
|
|
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
|
|
|
|
|
|
import { Badge } from "@/components/ui/badge";
|
|
|
|
|
|
import { Button } from "@/components/ui/button";
|
|
|
|
|
|
import {
|
|
|
|
|
|
Dialog,
|
|
|
|
|
|
DialogContent,
|
|
|
|
|
|
DialogDescription,
|
|
|
|
|
|
DialogFooter,
|
|
|
|
|
|
DialogHeader,
|
|
|
|
|
|
DialogTitle,
|
|
|
|
|
|
DialogTrigger,
|
|
|
|
|
|
} from "@/components/ui/dialog";
|
|
|
|
|
|
import {
|
|
|
|
|
|
DropdownMenu,
|
|
|
|
|
|
DropdownMenuContent,
|
|
|
|
|
|
DropdownMenuItem,
|
|
|
|
|
|
DropdownMenuTrigger,
|
|
|
|
|
|
} from "@/components/ui/dropdown-menu";
|
|
|
|
|
|
import { Input } from "@/components/ui/input";
|
|
|
|
|
|
import { Label } from "@/components/ui/label";
|
|
|
|
|
|
import {
|
|
|
|
|
|
Select,
|
|
|
|
|
|
SelectContent,
|
|
|
|
|
|
SelectItem,
|
|
|
|
|
|
SelectTrigger,
|
|
|
|
|
|
SelectValue,
|
|
|
|
|
|
} from "@/components/ui/select";
|
|
|
|
|
|
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
|
|
|
|
|
import { cn } from "@/lib/utils";
|
|
|
|
|
|
|
|
|
|
|
|
interface ActiveMember {
|
|
|
|
|
|
id: string;
|
|
|
|
|
|
name: string;
|
|
|
|
|
|
email: string;
|
|
|
|
|
|
role: string;
|
|
|
|
|
|
avatar?: string;
|
|
|
|
|
|
lastActive: string;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
interface PendingInvite {
|
|
|
|
|
|
id: string;
|
|
|
|
|
|
email: string;
|
|
|
|
|
|
role: string;
|
|
|
|
|
|
sentAt: string;
|
|
|
|
|
|
expiresIn: string;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
interface SettingsMembers5Props {
|
|
|
|
|
|
heading?: string;
|
|
|
|
|
|
description?: string;
|
|
|
|
|
|
activeMembers?: ActiveMember[];
|
|
|
|
|
|
pendingInvites?: PendingInvite[];
|
|
|
|
|
|
className?: string;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const SettingsMembers5 = ({
|
|
|
|
|
|
heading = "مدیریت تیم",
|
2026-07-15 20:22:14 +02:00
|
|
|
|
description = "اعضای فعال فضای کاری را ببینید و دعوتهای باز را پیگیری کنید.",
|
2026-07-11 21:21:29 +03:30
|
|
|
|
activeMembers = [
|
|
|
|
|
|
{
|
|
|
|
|
|
id: "1",
|
2026-07-15 20:22:14 +02:00
|
|
|
|
name: "پریا شمیرانی",
|
2026-07-11 21:21:29 +03:30
|
|
|
|
email: "priya@designlab.io",
|
|
|
|
|
|
role: "مالک",
|
|
|
|
|
|
avatar:
|
|
|
|
|
|
"/block-media/shadcnblocks/block/avatar/avatar11.jpg",
|
|
|
|
|
|
lastActive: "الان",
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
id: "2",
|
2026-07-15 20:22:14 +02:00
|
|
|
|
name: "کاوه ابریشمی",
|
2026-07-11 21:21:29 +03:30
|
|
|
|
email: "kevin@designlab.io",
|
2026-07-15 20:22:14 +02:00
|
|
|
|
role: "مدیر عملیات",
|
2026-07-11 21:21:29 +03:30
|
|
|
|
avatar:
|
|
|
|
|
|
"/block-media/shadcnblocks/block/avatar/avatar12.jpg",
|
|
|
|
|
|
lastActive: "۲ ساعت پیش",
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
id: "3",
|
2026-07-15 20:22:14 +02:00
|
|
|
|
name: "یگانه تنکابنی",
|
2026-07-11 21:21:29 +03:30
|
|
|
|
email: "yuki@designlab.io",
|
2026-07-15 20:22:14 +02:00
|
|
|
|
role: "فروشنده",
|
2026-07-11 21:21:29 +03:30
|
|
|
|
avatar:
|
|
|
|
|
|
"/block-media/shadcnblocks/block/avatar/avatar13.jpg",
|
|
|
|
|
|
lastActive: "دیروز",
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
id: "4",
|
2026-07-15 20:22:14 +02:00
|
|
|
|
name: "کیان منتظری",
|
2026-07-11 21:21:29 +03:30
|
|
|
|
email: "carlos@designlab.io",
|
2026-07-15 20:22:14 +02:00
|
|
|
|
role: "فروشنده",
|
2026-07-11 21:21:29 +03:30
|
|
|
|
avatar:
|
|
|
|
|
|
"/block-media/shadcnblocks/block/avatar/avatar14.jpg",
|
|
|
|
|
|
lastActive: "۳ روز پیش",
|
|
|
|
|
|
},
|
|
|
|
|
|
],
|
|
|
|
|
|
pendingInvites = [
|
|
|
|
|
|
{
|
|
|
|
|
|
id: "p1",
|
|
|
|
|
|
email: "maya.wilson@gmail.com",
|
2026-07-15 20:22:14 +02:00
|
|
|
|
role: "فروشنده",
|
|
|
|
|
|
sentAt: "۱۵ ژانویه ۲۰۲۶",
|
2026-07-11 21:21:29 +03:30
|
|
|
|
expiresIn: "۵ روز",
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
id: "p2",
|
|
|
|
|
|
email: "alex.foster@outlook.com",
|
2026-07-15 20:22:14 +02:00
|
|
|
|
role: "فقط مشاهده",
|
|
|
|
|
|
sentAt: "۲۰ ژانویه ۲۰۲۶",
|
2026-07-11 21:21:29 +03:30
|
|
|
|
expiresIn: "۱۰ روز",
|
|
|
|
|
|
},
|
|
|
|
|
|
],
|
|
|
|
|
|
className,
|
|
|
|
|
|
}: SettingsMembers5Props) => {
|
|
|
|
|
|
const [isInviteOpen, setIsInviteOpen] = useState(false);
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
2026-07-15 20:22:14 +02:00
|
|
|
|
<section dir="rtl" lang="fa" className={cn("w-full py-32", className)}>
|
|
|
|
|
|
<div className="w-full px-4 sm:px-6 lg:px-8">
|
|
|
|
|
|
<div className="flex w-full flex-col gap-6">
|
2026-07-11 21:21:29 +03:30
|
|
|
|
<div className="flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between">
|
|
|
|
|
|
<div className="space-y-1">
|
|
|
|
|
|
<h2 className="text-xl font-semibold tracking-tight">
|
|
|
|
|
|
{heading}
|
|
|
|
|
|
</h2>
|
|
|
|
|
|
<p className="text-sm text-muted-foreground">{description}</p>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<Dialog open={isInviteOpen} onOpenChange={setIsInviteOpen}>
|
|
|
|
|
|
<DialogTrigger asChild>
|
|
|
|
|
|
<Button>
|
|
|
|
|
|
<UserPlus className="size-4" />
|
2026-07-15 20:22:14 +02:00
|
|
|
|
دعوت عضو
|
2026-07-11 21:21:29 +03:30
|
|
|
|
</Button>
|
|
|
|
|
|
</DialogTrigger>
|
|
|
|
|
|
<DialogContent>
|
|
|
|
|
|
<DialogHeader>
|
|
|
|
|
|
<DialogTitle>دعوت عضو جدید</DialogTitle>
|
|
|
|
|
|
<DialogDescription>
|
2026-07-15 20:22:14 +02:00
|
|
|
|
دعوتنامه ایمیلی برای پیوستن به فضای کاری ارسال کنید.
|
2026-07-11 21:21:29 +03:30
|
|
|
|
</DialogDescription>
|
|
|
|
|
|
</DialogHeader>
|
|
|
|
|
|
<form
|
|
|
|
|
|
onSubmit={(e) => {
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
setIsInviteOpen(false);
|
|
|
|
|
|
}}
|
|
|
|
|
|
className="space-y-4"
|
|
|
|
|
|
>
|
|
|
|
|
|
<div className="space-y-2">
|
2026-07-15 20:22:14 +02:00
|
|
|
|
<Label htmlFor="new-email">ایمیل سازمانی</Label>
|
2026-07-11 21:21:29 +03:30
|
|
|
|
<Input
|
|
|
|
|
|
id="new-email"
|
|
|
|
|
|
type="email"
|
|
|
|
|
|
placeholder="colleague@example.com"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div className="space-y-2">
|
2026-07-15 20:22:14 +02:00
|
|
|
|
<Label htmlFor="new-role">نقش دسترسی</Label>
|
2026-07-11 21:21:29 +03:30
|
|
|
|
<Select defaultValue="editor">
|
|
|
|
|
|
<SelectTrigger id="new-role">
|
|
|
|
|
|
<SelectValue placeholder="انتخاب نقش" />
|
|
|
|
|
|
</SelectTrigger>
|
|
|
|
|
|
<SelectContent>
|
2026-07-15 20:22:14 +02:00
|
|
|
|
<SelectItem value="admin">مدیر عملیات</SelectItem>
|
|
|
|
|
|
<SelectItem value="editor">فروشنده</SelectItem>
|
|
|
|
|
|
<SelectItem value="viewer">فقط مشاهده</SelectItem>
|
2026-07-11 21:21:29 +03:30
|
|
|
|
</SelectContent>
|
|
|
|
|
|
</Select>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<DialogFooter>
|
|
|
|
|
|
<Button
|
|
|
|
|
|
type="button"
|
|
|
|
|
|
variant="outline"
|
|
|
|
|
|
onClick={() => setIsInviteOpen(false)}
|
|
|
|
|
|
>
|
|
|
|
|
|
انصراف
|
|
|
|
|
|
</Button>
|
|
|
|
|
|
<Button type="submit">
|
|
|
|
|
|
<Send className="size-4" />
|
2026-07-15 20:22:14 +02:00
|
|
|
|
ارسال دعوتنامه
|
2026-07-11 21:21:29 +03:30
|
|
|
|
</Button>
|
|
|
|
|
|
</DialogFooter>
|
|
|
|
|
|
</form>
|
|
|
|
|
|
</DialogContent>
|
|
|
|
|
|
</Dialog>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<Tabs defaultValue="active" className="w-full">
|
|
|
|
|
|
<TabsList className="w-full justify-start">
|
|
|
|
|
|
<TabsTrigger value="active" className="gap-2">
|
|
|
|
|
|
<UserCheck className="size-4" />
|
2026-07-15 20:22:14 +02:00
|
|
|
|
اعضای فعال
|
2026-07-11 21:21:29 +03:30
|
|
|
|
<Badge
|
|
|
|
|
|
variant="secondary"
|
|
|
|
|
|
className="ms-1 size-5 justify-center rounded-full p-0 text-xs"
|
|
|
|
|
|
>
|
|
|
|
|
|
{activeMembers.length.toLocaleString("fa-IR")}
|
|
|
|
|
|
</Badge>
|
|
|
|
|
|
</TabsTrigger>
|
|
|
|
|
|
<TabsTrigger value="pending" className="gap-2">
|
|
|
|
|
|
<Clock className="size-4" />
|
2026-07-15 20:22:14 +02:00
|
|
|
|
دعوتهای باز
|
2026-07-11 21:21:29 +03:30
|
|
|
|
{pendingInvites.length > 0 && (
|
|
|
|
|
|
<Badge
|
|
|
|
|
|
variant="secondary"
|
|
|
|
|
|
className="ms-1 size-5 justify-center rounded-full bg-amber-100 p-0 text-xs text-amber-700 dark:bg-amber-900/30 dark:text-amber-400"
|
|
|
|
|
|
>
|
|
|
|
|
|
{pendingInvites.length.toLocaleString("fa-IR")}
|
|
|
|
|
|
</Badge>
|
|
|
|
|
|
)}
|
|
|
|
|
|
</TabsTrigger>
|
|
|
|
|
|
</TabsList>
|
|
|
|
|
|
|
|
|
|
|
|
<TabsContent value="active" className="mt-4">
|
|
|
|
|
|
<div className="rounded-lg border">
|
|
|
|
|
|
<ul className="divide-y">
|
|
|
|
|
|
{activeMembers.map((member) => (
|
|
|
|
|
|
<li
|
|
|
|
|
|
key={member.id}
|
|
|
|
|
|
className="flex items-center justify-between gap-4 px-4 py-3"
|
|
|
|
|
|
>
|
|
|
|
|
|
<div className="flex items-center gap-3">
|
|
|
|
|
|
<Avatar className="size-10">
|
2026-07-15 20:22:14 +02:00
|
|
|
|
<AvatarImage src={member.avatar} alt={`آواتار ${member.name}`} />
|
2026-07-11 21:21:29 +03:30
|
|
|
|
<AvatarFallback>
|
|
|
|
|
|
{member.name
|
|
|
|
|
|
.split(" ")
|
|
|
|
|
|
.map((n) => n[0])
|
|
|
|
|
|
.join("")}
|
|
|
|
|
|
</AvatarFallback>
|
|
|
|
|
|
</Avatar>
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<p className="text-sm font-medium">{member.name}</p>
|
|
|
|
|
|
<p className="text-xs text-muted-foreground">
|
|
|
|
|
|
{member.email}
|
|
|
|
|
|
</p>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div className="flex items-center gap-3">
|
|
|
|
|
|
<div className="hidden text-end sm:block">
|
|
|
|
|
|
<Badge variant="outline" className="font-normal">
|
|
|
|
|
|
{member.role}
|
|
|
|
|
|
</Badge>
|
|
|
|
|
|
<p className="mt-1 text-xs text-muted-foreground">
|
|
|
|
|
|
{member.lastActive === "الان" ? (
|
|
|
|
|
|
<span className="flex items-center gap-1">
|
|
|
|
|
|
<span className="size-2 rounded-full bg-green-500" />
|
|
|
|
|
|
آنلاین
|
|
|
|
|
|
</span>
|
|
|
|
|
|
) : (
|
2026-07-15 20:22:14 +02:00
|
|
|
|
`آخرین فعالیت · ${member.lastActive}`
|
2026-07-11 21:21:29 +03:30
|
|
|
|
)}
|
|
|
|
|
|
</p>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<DropdownMenu>
|
|
|
|
|
|
<DropdownMenuTrigger asChild>
|
|
|
|
|
|
<Button
|
|
|
|
|
|
variant="ghost"
|
|
|
|
|
|
size="icon"
|
|
|
|
|
|
className="size-8"
|
|
|
|
|
|
>
|
|
|
|
|
|
<MoreVertical className="size-4" />
|
|
|
|
|
|
</Button>
|
|
|
|
|
|
</DropdownMenuTrigger>
|
|
|
|
|
|
<DropdownMenuContent align="end">
|
2026-07-15 20:22:14 +02:00
|
|
|
|
<DropdownMenuItem>ویرایش سطح دسترسی</DropdownMenuItem>
|
|
|
|
|
|
<DropdownMenuItem>مشاهده پروفایل عضو</DropdownMenuItem>
|
2026-07-11 21:21:29 +03:30
|
|
|
|
<DropdownMenuItem className="text-destructive">
|
2026-07-15 20:22:14 +02:00
|
|
|
|
حذف از تیم
|
2026-07-11 21:21:29 +03:30
|
|
|
|
</DropdownMenuItem>
|
|
|
|
|
|
</DropdownMenuContent>
|
|
|
|
|
|
</DropdownMenu>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</li>
|
|
|
|
|
|
))}
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</TabsContent>
|
|
|
|
|
|
|
|
|
|
|
|
<TabsContent value="pending" className="mt-4">
|
|
|
|
|
|
{pendingInvites.length === 0 ? (
|
|
|
|
|
|
<div className="flex flex-col items-center justify-center rounded-lg border border-dashed py-12 text-center">
|
|
|
|
|
|
<Clock className="mb-3 size-10 text-muted-foreground/50" />
|
2026-07-15 20:22:14 +02:00
|
|
|
|
<p className="text-sm font-medium">دعوت بازی وجود ندارد</p>
|
2026-07-11 21:21:29 +03:30
|
|
|
|
<p className="text-xs text-muted-foreground">
|
2026-07-15 20:22:14 +02:00
|
|
|
|
برای گسترش تیم، اعضای جدید را دعوت کنید
|
2026-07-11 21:21:29 +03:30
|
|
|
|
</p>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
) : (
|
|
|
|
|
|
<div className="rounded-lg border">
|
|
|
|
|
|
<ul className="divide-y">
|
|
|
|
|
|
{pendingInvites.map((invite) => (
|
|
|
|
|
|
<li
|
|
|
|
|
|
key={invite.id}
|
|
|
|
|
|
className="flex items-center justify-between gap-4 px-4 py-3"
|
|
|
|
|
|
>
|
|
|
|
|
|
<div className="flex items-center gap-3">
|
|
|
|
|
|
<div className="flex size-10 items-center justify-center rounded-full bg-muted">
|
|
|
|
|
|
<Clock className="size-4 text-muted-foreground" />
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<p className="text-sm font-medium">
|
|
|
|
|
|
{invite.email}
|
|
|
|
|
|
</p>
|
|
|
|
|
|
<p className="text-xs text-muted-foreground">
|
2026-07-15 20:22:14 +02:00
|
|
|
|
ارسال در {invite.sentAt} · انقضا:{" "}
|
2026-07-11 21:21:29 +03:30
|
|
|
|
{invite.expiresIn}
|
|
|
|
|
|
</p>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div className="flex items-center gap-2">
|
|
|
|
|
|
<Badge variant="outline" className="font-normal">
|
|
|
|
|
|
{invite.role}
|
|
|
|
|
|
</Badge>
|
|
|
|
|
|
<Button variant="ghost" size="sm">
|
|
|
|
|
|
<Send className="size-4" />
|
2026-07-15 20:22:14 +02:00
|
|
|
|
ارسال مجدد دعوت
|
2026-07-11 21:21:29 +03:30
|
|
|
|
</Button>
|
|
|
|
|
|
<Button
|
|
|
|
|
|
variant="ghost"
|
|
|
|
|
|
size="icon"
|
|
|
|
|
|
className="size-8 text-muted-foreground hover:text-destructive"
|
|
|
|
|
|
>
|
|
|
|
|
|
<X className="size-4" />
|
|
|
|
|
|
</Button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</li>
|
|
|
|
|
|
))}
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
)}
|
|
|
|
|
|
</TabsContent>
|
|
|
|
|
|
</Tabs>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</section>
|
|
|
|
|
|
);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
export { SettingsMembers5 };
|