feat: complete i18n support, telegram webhook, and security improvements
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
import { useSession, signOut } from "next-auth/react";
|
||||
import Link from "next/link";
|
||||
import { usePathname } from "next/navigation";
|
||||
import LanguageSwitcher from "./LanguageSwitcher";
|
||||
|
||||
export default function Sidebar({ dict, lang }: { dict: any; lang: string }) {
|
||||
const { data: session } = useSession();
|
||||
@@ -13,18 +14,18 @@ export default function Sidebar({ dict, lang }: { dict: any; lang: string }) {
|
||||
|
||||
const navItems = [
|
||||
{
|
||||
section: "GENEL",
|
||||
section: dict.sidebar?.general || "GENEL",
|
||||
items: [
|
||||
{ href: `/${lang}/dashboard`, label: "Dashboard", icon: HomeIcon, roles: ["SUPER_ADMIN", "DOMAIN_ADMIN"] },
|
||||
{ href: `/${lang}/dashboard/mail`, label: dict.mailClient || "Mail", icon: InboxIcon, roles: ["SUPER_ADMIN", "DOMAIN_ADMIN"] },
|
||||
{ href: `/${lang}/dashboard`, label: dict.dashboard?.title || "Dashboard", icon: HomeIcon, roles: ["SUPER_ADMIN", "DOMAIN_ADMIN"] },
|
||||
{ href: `/${lang}/dashboard/mail`, label: dict.sidebar?.mailClient || "Mail Client", icon: InboxIcon, roles: ["SUPER_ADMIN", "DOMAIN_ADMIN"] },
|
||||
],
|
||||
},
|
||||
{
|
||||
section: "YÖNETİM",
|
||||
section: dict.sidebar?.management || "YÖNETİM",
|
||||
items: [
|
||||
{ href: `/${lang}/dashboard/domains`, label: "Domainler", icon: GlobeIcon, roles: ["SUPER_ADMIN"] },
|
||||
{ href: `/${lang}/dashboard/users`, label: dict.users || "Kullanıcılar", icon: UsersIcon, roles: ["SUPER_ADMIN"] },
|
||||
{ href: `/${lang}/dashboard/mailboxes`, label: dict.mailboxes || "Mail Hesapları", icon: MailIcon, roles: ["SUPER_ADMIN", "DOMAIN_ADMIN"] },
|
||||
{ href: `/${lang}/dashboard/domains`, label: dict.domains?.title || "Domainler", icon: GlobeIcon, roles: ["SUPER_ADMIN"] },
|
||||
{ href: `/${lang}/dashboard/users`, label: dict.sidebar?.users || "Kullanıcılar", icon: UsersIcon, roles: ["SUPER_ADMIN"] },
|
||||
{ href: `/${lang}/dashboard/mailboxes`, label: dict.sidebar?.mailboxes || "Mail Hesapları", icon: MailIcon, roles: ["SUPER_ADMIN", "DOMAIN_ADMIN"] },
|
||||
],
|
||||
},
|
||||
];
|
||||
@@ -68,23 +69,26 @@ export default function Sidebar({ dict, lang }: { dict: any; lang: string }) {
|
||||
</nav>
|
||||
|
||||
<div className="sidebar-footer">
|
||||
<LanguageSwitcher currentLang={lang} />
|
||||
|
||||
<div className="user-info" style={{ marginBottom: "12px" }}>
|
||||
<div className="user-avatar">{name[0]?.toUpperCase()}</div>
|
||||
<div style={{ flex: 1, minWidth: 0 }}>
|
||||
<div className="user-name" style={{ overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{name}</div>
|
||||
<div className="user-role">{role === "SUPER_ADMIN" ? "Süper Admin" : "Domain Admin"}</div>
|
||||
<div className="user-role">{role === "SUPER_ADMIN" ? (dict.superAdmin || "Süper Admin") : (dict.domainAdmin || "Domain Admin")}</div>
|
||||
</div>
|
||||
</div>
|
||||
<button
|
||||
className="btn btn-ghost"
|
||||
style={{ width: "100%", justifyContent: "center", fontSize: "12px" }}
|
||||
onClick={async () => {
|
||||
await fetch("/api/mail/auth", { method: "DELETE" });
|
||||
await signOut({ redirect: false });
|
||||
window.location.href = `/${lang}/login`;
|
||||
}}
|
||||
>
|
||||
<LogOutIcon />
|
||||
{dict.logout || "Çıkış Yap"}
|
||||
{dict.sidebar?.logout || "Çıkış Yap"}
|
||||
</button>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
Reference in New Issue
Block a user