Files
chat_room/web/src/app/(main)/settings/page.tsx
T
mobiniqow cba4bc30da chore: merge web repo history into monorepo at web/
git-subtree-dir: web
git-subtree-mainline: 75a0ba593d
git-subtree-split: 8f624e7416
2026-09-27 10:31:24 +03:30

73 lines
2.4 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 { useRouter } from "next/navigation";
import { Bell, Shield, HelpCircle, LogOut, ChevronLeft } from "lucide-react";
import { Card } from "@/components/ui/Card";
import { Button } from "@/components/ui/Button";
import { useAuth } from "@/lib/auth-context";
const settingsLinks = [
{ icon: Bell, label: "اعلان‌ها", href: "/settings/notifications" },
{ icon: Shield, label: "حریم خصوصی و امنیت", href: "/settings/privacy" },
{ icon: HelpCircle, label: "راهنما و پشتیبانی", href: "/settings/help" },
];
export default function SettingsPage() {
const router = useRouter();
const { user, logout } = useAuth();
function handleLogout() {
logout();
router.push("/login");
}
return (
<div className="flex flex-col gap-4 px-5 pt-[calc(env(safe-area-inset-top)+16px)] pb-8">
<h1 className="font-[var(--font-display)] font-extrabold text-[22px] px-1">
تنظیمات ⚙️
</h1>
<Card className="flex items-center justify-between">
<div>
<p className="text-[13px] text-(--color-content-tertiary)">شماره موبایل</p>
<p dir="ltr" className="text-[15px] font-bold text-(--color-content-primary)">
{user?.phone}
</p>
</div>
</Card>
<Card padded={false} className="overflow-hidden">
{settingsLinks.map((item, i) => {
const Icon = item.icon;
return (
<button
key={item.label}
onClick={() => router.push(item.href)}
className={`w-full flex items-center gap-3 px-4 py-3.5 text-right hover:bg-(--color-bg-secondary) transition-colors ${
i !== settingsLinks.length - 1 ? "border-b border-(--color-border-subtle)" : ""
}`}
>
<Icon size={18} className="text-(--color-content-secondary) shrink-0" />
<span className="flex-1 text-[14px] text-(--color-content-primary)">
{item.label}
</span>
<ChevronLeft size={16} className="text-(--color-content-tertiary)" />
</button>
);
})}
</Card>
<Button
variant="tertiary"
size="lg"
isBlock
icon={<LogOut size={17} />}
onClick={handleLogout}
className="!text-(--color-status-error) !border-red-200 mt-4"
>
خروج از حساب
</Button>
</div>
);
}