//
// Copyright (c) 2025-2026 rustmailer.com (https://rustmailer.com)
//
// This file is part of the Bichon Email Archiving Project
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see .
import * as React from "react"
import { Card, CardContent, CardHeader, CardTitle, CardDescription } from "@/components/ui/card"
import { Badge } from "@/components/ui/badge"
import { ScrollArea } from "@/components/ui/scroll-area"
import { Skeleton } from "@/components/ui/skeleton"
import {
ShieldCheck,
Server,
Database,
Activity,
InfoIcon,
Mail,
Zap
} from "lucide-react"
import { get_system_configurations } from "@/api/system/api"
import { useQuery } from "@tanstack/react-query"
import { useTranslation } from "react-i18next"
const formatMB = (bytes?: number) => {
if (!bytes) return "—"
return `${(bytes / 1024 / 1024).toFixed(0)} MB`
}
function BooleanBadge({ value }: { value: boolean }) {
const { t } = useTranslation()
return value ? (
{t("systemConfig.status.enabled")}
) : (
{t("systemConfig.status.disabled")}
)
}
function SettingRow({
label,
value,
description,
}: {
label: string
value: React.ReactNode
description?: string
}) {
return (
{description && (
{description}
)}
)
}
function SettingsCard({
icon: Icon,
title,
description,
children,
}: {
icon: React.ElementType
title: string
description?: string
children: React.ReactNode
}) {
return (
{title}
{description && (
{description}
)}
{children}
)
}
function PageSkeleton() {
return (
{Array.from({ length: 6 }).map((_, i) => (
))}
)
}
export default function ServerConfigurationsPage() {
const { t } = useTranslation()
const { data, isLoading, isError } = useQuery({
queryKey: ["system-configurations"],
queryFn: get_system_configurations,
})
if (isError || (!isLoading && !data)) {
return (
{t("systemConfig.fields.loadError")}
)
}
return (
{t("systemConfig.pageTitle")}
{t("systemConfig.pageDescription")}
{isLoading ? (
) : (
}
/>
} />
} />
}
/>
{data!.bichon_root_dir}} />
{data!.bichon_data_dir} : "—"} />
{data!.bichon_index_dir} : "—"} />
{t("systemConfig.status.configured")}
) : (
{t("systemConfig.status.missing")}
)
}
/>
{data!.bichon_log_level}} />
} />
} />
} />
)}
)
}