fix: update page title to use appName from configuration
This commit is contained in:
@@ -41,11 +41,13 @@ import { isFilePreviewable } from "@/lib/file-preview";
|
|||||||
import { Search, Filter, ChevronDown, X, Paperclip, Star, Mail, MailOpen, RotateCcw, PenSquare, PenLine, CheckSquare, Square } from "lucide-react";
|
import { Search, Filter, ChevronDown, X, Paperclip, Star, Mail, MailOpen, RotateCcw, PenSquare, PenLine, CheckSquare, Square } from "lucide-react";
|
||||||
import { ResizeHandle } from "@/components/layout/resize-handle";
|
import { ResizeHandle } from "@/components/layout/resize-handle";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
|
import { useConfig } from "@/hooks/use-config";
|
||||||
|
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const t = useTranslations();
|
const t = useTranslations();
|
||||||
const tCommon = useTranslations('common');
|
const tCommon = useTranslations('common');
|
||||||
|
const { appName } = useConfig();
|
||||||
const [showComposer, setShowComposer] = useState(false);
|
const [showComposer, setShowComposer] = useState(false);
|
||||||
const [composerMode, setComposerMode] = useState<'compose' | 'reply' | 'replyAll' | 'forward'>('compose');
|
const [composerMode, setComposerMode] = useState<'compose' | 'reply' | 'replyAll' | 'forward'>('compose');
|
||||||
const [composerDraftText, setComposerDraftText] = useState("");
|
const [composerDraftText, setComposerDraftText] = useState("");
|
||||||
@@ -224,7 +226,7 @@ export default function Home() {
|
|||||||
|
|
||||||
// Update page title based on context
|
// Update page title based on context
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let title = tCommon('app_title');
|
let title = appName;
|
||||||
|
|
||||||
if (showComposer) {
|
if (showComposer) {
|
||||||
// Composing email
|
// Composing email
|
||||||
@@ -234,11 +236,11 @@ export default function Home() {
|
|||||||
replyAll: t('email_composer.reply_all'),
|
replyAll: t('email_composer.reply_all'),
|
||||||
forward: t('email_composer.forward'),
|
forward: t('email_composer.forward'),
|
||||||
}[composerMode] || t('email_composer.new_message');
|
}[composerMode] || t('email_composer.new_message');
|
||||||
title = `${modeText} - ${tCommon('app_title')}`;
|
title = `${modeText} - ${appName}`;
|
||||||
} else if (selectedEmail) {
|
} else if (selectedEmail) {
|
||||||
// Reading email
|
// Reading email
|
||||||
const subject = selectedEmail.subject || t('email_viewer.no_subject');
|
const subject = selectedEmail.subject || t('email_viewer.no_subject');
|
||||||
title = `${subject} - ${tCommon('app_title')}`;
|
title = `${subject} - ${appName}`;
|
||||||
} else if (selectedMailbox && mailboxes.length > 0) {
|
} else if (selectedMailbox && mailboxes.length > 0) {
|
||||||
// Mailbox view
|
// Mailbox view
|
||||||
const mailbox = mailboxes.find(mb => mb.id === selectedMailbox);
|
const mailbox = mailboxes.find(mb => mb.id === selectedMailbox);
|
||||||
@@ -246,13 +248,13 @@ export default function Home() {
|
|||||||
const mailboxName = mailbox.name;
|
const mailboxName = mailbox.name;
|
||||||
const unreadCount = mailbox.unreadEmails || 0;
|
const unreadCount = mailbox.unreadEmails || 0;
|
||||||
title = unreadCount > 0
|
title = unreadCount > 0
|
||||||
? `${mailboxName} (${unreadCount}) - ${tCommon('app_title')}`
|
? `${mailboxName} (${unreadCount}) - ${appName}`
|
||||||
: `${mailboxName} - ${tCommon('app_title')}`;
|
: `${mailboxName} - ${appName}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
document.title = title;
|
document.title = title;
|
||||||
}, [showComposer, composerMode, selectedEmail, selectedMailbox, mailboxes, t, tCommon]);
|
}, [showComposer, composerMode, selectedEmail, selectedMailbox, mailboxes, t, appName]);
|
||||||
|
|
||||||
// Check auth on mount
|
// Check auth on mount
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@ const geistMono = Geist_Mono({
|
|||||||
});
|
});
|
||||||
|
|
||||||
export const metadata: Metadata = {
|
export const metadata: Metadata = {
|
||||||
title: "Bulwark Webmail",
|
title: process.env.APP_NAME || process.env.NEXT_PUBLIC_APP_NAME || "Webmail",
|
||||||
description: "Minimalist webmail client using JMAP protocol",
|
description: "Minimalist webmail client using JMAP protocol",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user