feat: complete i18n support, telegram webhook, and security improvements

This commit is contained in:
AyrisAI
2026-05-14 13:46:17 +03:00
parent 4c9a07e3ef
commit cc65a2bd72
23 changed files with 798 additions and 205 deletions

View File

@@ -1,5 +1,6 @@
"use client";
import type { MailFolder } from "@/app/[lang]/dashboard/mail/page";
import { useDictionary } from "@/components/DictionaryContext";
const FOLDER_ICONS: Record<string, string> = {
"\\Inbox": "📥",
@@ -10,15 +11,6 @@ const FOLDER_ICONS: Record<string, string> = {
"\\Archive": "📦",
};
const FOLDER_LABELS: Record<string, string> = {
INBOX: "Gelen Kutusu",
Sent: "Gönderilenler",
Drafts: "Taslaklar",
Trash: "Çöp Kutusu",
Junk: "Spam",
Archive: "Arşiv",
};
function getFolderIcon(folder: MailFolder): string {
if (folder.specialUse && FOLDER_ICONS[folder.specialUse]) return FOLDER_ICONS[folder.specialUse];
const lower = folder.path.toLowerCase();
@@ -31,15 +23,25 @@ function getFolderIcon(folder: MailFolder): string {
return "📁";
}
function getFolderLabel(folder: MailFolder): string {
return FOLDER_LABELS[folder.name] ?? FOLDER_LABELS[folder.path] ?? folder.name;
}
export default function FolderList({ folders, active, onSelect }: {
folders: MailFolder[];
active: string;
onSelect: (path: string) => void;
}) {
const dict = useDictionary();
const getFolderLabel = (folder: MailFolder): string => {
const name = folder.name || folder.path;
const lower = name.toLowerCase();
if (lower === "inbox") return dict.mailClient.inbox || "Inbox";
if (lower === "sent") return dict.mailClient.sent || "Sent";
if (lower === "drafts") return dict.mailClient.drafts || "Drafts";
if (lower === "trash") return dict.mailClient.trash || "Trash";
if (lower === "junk" || lower === "spam") return dict.mailClient.junk || "Junk";
if (lower === "archive") return dict.mailClient.archive || "Archive";
return name;
};
const sorted = [...folders].sort((a, b) => {
if (a.path === "INBOX") return -1;
if (b.path === "INBOX") return 1;