Files
chat_room/src/components/Sidebar.tsx
T
mobiniqow 35830189ea Add user moderation, matches, and photo review pages
- New "همه کاربران" page: searchable/paginated full user list with
  block/unblock/report actions and report-count badges.
- User detail page gained block/unblock/report buttons, a report history
  section, and a recent-activity panel (via the backend's per-user
  monitoring filter).
- New "رفقا" page listing every match across the app.
- New "نظارت بر عکس‌ها" page: grid of every uploaded photo with uploader
  info and a delete action, for content review without going profile-by-profile.
2026-09-20 05:30:33 +03:30

99 lines
3.5 KiB
TypeScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"use client";
import Link from "next/link";
import { usePathname, useRouter } from "next/navigation";
import {
LayoutGrid,
ListTree,
MessageCircleQuestion,
LogOut,
Heart,
UserCheck,
Users,
HeartHandshake,
Images,
Activity,
Database,
} from "lucide-react";
import { cn } from "@/lib/utils";
import { useAuth } from "@/lib/auth-context";
const navItems = [
{ href: "/", label: "داشبورد", icon: LayoutGrid },
{ href: "/users", label: "کاربران در انتظار تایید", icon: UserCheck },
{ href: "/users/all", label: "همه کاربران", icon: Users },
{ href: "/matches", label: "رفقا (مچ‌ها)", icon: HeartHandshake },
{ href: "/photos", label: "نظارت بر عکس‌ها", icon: Images },
{ href: "/categories", label: "دسته‌بندی‌ها و گزینه‌ها", icon: ListTree },
{ href: "/questions", label: "سوالات پروفایل", icon: MessageCircleQuestion },
{ href: "/monitoring", label: "مانیتورینگ سرور", icon: Activity },
{ href: "/backups", label: "بک‌آپ دیتابیس", icon: Database },
];
export function Sidebar() {
const pathname = usePathname();
const router = useRouter();
const { user, logout } = useAuth();
function handleLogout() {
logout();
router.push("/login");
}
return (
<aside className="w-64 shrink-0 h-dvh sticky top-0 flex flex-col bg-(--color-surface-default) border-l border-(--color-border-subtle)">
<div className="flex items-center gap-2.5 px-5 h-16 border-b border-(--color-border-subtle)">
<div className="w-8 h-8 rounded-(--radius-sm) bg-(--color-brand-500) flex items-center justify-center shadow-(--shadow-cute-sm)">
<Heart size={15} className="text-white" fill="white" />
</div>
<div>
<p className="font-[var(--font-display)] font-extrabold text-[14px] leading-none">
دلدل
</p>
<p className="text-[10px] text-(--color-content-tertiary) leading-none mt-0.5">
پنل ادمین
</p>
</div>
</div>
<nav className="flex-1 flex flex-col gap-1 p-3">
{navItems.map((item) => {
const active = pathname === item.href;
const Icon = item.icon;
return (
<Link
key={item.href}
href={item.href}
className={cn(
"flex items-center gap-3 rounded-(--radius-sm) px-3.5 h-11 text-[14px] font-semibold transition-colors",
active
? "bg-(--color-brand-500) text-white shadow-(--shadow-cute-sm)"
: "text-(--color-content-secondary) hover:bg-(--color-bg-secondary)"
)}
>
<Icon size={17} />
{item.label}
</Link>
);
})}
</nav>
<div className="p-3 border-t border-(--color-border-subtle) flex flex-col gap-2">
<div className="px-2 py-2">
<p className="text-[11px] text-(--color-content-tertiary)">وارد شده به‌عنوان</p>
<p dir="ltr" className="text-[13px] font-bold text-(--color-content-primary) text-right">
{user?.phone}
</p>
</div>
<button
onClick={handleLogout}
className="flex items-center gap-3 rounded-(--radius-sm) px-3.5 h-10 text-[13px] font-semibold text-(--color-status-error) hover:bg-red-50 transition-colors"
>
<LogOut size={16} />
خروج از حساب
</button>
</div>
</aside>
);
}