feat: complete i18n support, telegram webhook, and security improvements
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
"use client";
|
||||
import type { MailMessage } from "@/app/[lang]/dashboard/mail/page";
|
||||
import { formatBytes } from "@/lib/format";
|
||||
import { useDictionary } from "@/components/DictionaryContext";
|
||||
import { useParams } from "next/navigation";
|
||||
|
||||
function getFileIcon(contentType: string, filename: string): string {
|
||||
if (contentType.startsWith("image/")) return "🖼️";
|
||||
@@ -24,8 +26,11 @@ export default function MessageView({ message, onReply, onDelete, folder }: {
|
||||
onDelete: () => void;
|
||||
folder: string;
|
||||
}) {
|
||||
const dict = useDictionary();
|
||||
const params = useParams();
|
||||
const lang = (params.lang as string) || "en";
|
||||
const from = message.from[0];
|
||||
const date = new Date(message.date).toLocaleString("tr-TR", {
|
||||
const date = new Date(message.date).toLocaleString(lang === "tr" ? "tr-TR" : "en-US", {
|
||||
day: "numeric", month: "long", year: "numeric", hour: "2-digit", minute: "2-digit",
|
||||
});
|
||||
|
||||
@@ -48,13 +53,13 @@ export default function MessageView({ message, onReply, onDelete, folder }: {
|
||||
<div className="message-view">
|
||||
{/* Header */}
|
||||
<div className="message-view-header">
|
||||
<h2 className="message-view-subject">{message.subject}</h2>
|
||||
<h2 className="message-view-subject">{message.subject || dict.mailClient.noSubject || "(Konu Yok)"}</h2>
|
||||
<div className="message-view-actions">
|
||||
<button className="btn btn-ghost btn-sm" onClick={onReply} title="Yanıtla">
|
||||
<ReplyIcon /> Yanıtla
|
||||
<button className="btn btn-ghost btn-sm" onClick={onReply} title={dict.mailClient.reply || "Yanıtla"}>
|
||||
<ReplyIcon /> {dict.mailClient.reply || "Yanıtla"}
|
||||
</button>
|
||||
<button className="btn btn-danger btn-sm" onClick={onDelete} title="Sil">
|
||||
<TrashIcon /> Sil
|
||||
<button className="btn btn-danger btn-sm" onClick={onDelete} title={dict.mailClient.delete || "Sil"}>
|
||||
<TrashIcon /> {dict.mailClient.delete || "Sil"}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -76,7 +81,7 @@ export default function MessageView({ message, onReply, onDelete, folder }: {
|
||||
{message.attachments.length > 0 && (
|
||||
<div className="message-attachments">
|
||||
<div style={{ width: "100%", fontSize: 12, fontWeight: 600, color: "var(--text-secondary)", marginBottom: 6 }}>
|
||||
📎 {message.attachments.length} ek
|
||||
📎 {message.attachments.length} {dict.mailClient.attachments || "ek"}
|
||||
</div>
|
||||
{message.attachments.map((att, i) => (
|
||||
<div key={i} className="attachment-chip" onClick={() => handleAttachment(att, false)}>
|
||||
@@ -89,7 +94,7 @@ export default function MessageView({ message, onReply, onDelete, folder }: {
|
||||
<button
|
||||
className="att-btn"
|
||||
onClick={(e) => { e.stopPropagation(); handleAttachment(att, false); }}
|
||||
title="İndir"
|
||||
title={dict.mailClient.download || "İndir"}
|
||||
>
|
||||
⬇
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user