// // Copyright (c) 2025 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 { ScrollArea } from '@/components/ui/scroll-area' import { Badge } from '@/components/ui/badge' import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card' import { Checkbox } from '@/components/ui/checkbox' import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '@/components/ui/dialog' import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs' import { useTranslation } from 'react-i18next' import { AccountModel } from '@/api/account/api' interface Props { open: boolean onOpenChange: (open: boolean) => void currentRow: AccountModel } export function AccountDetailDrawer({ open, onOpenChange, currentRow }: Props) { const { t } = useTranslation() const sinceText = (() => { if (currentRow.date_since?.fixed) { return currentRow.date_since.fixed; } if (currentRow.date_since?.relative?.value) { return `${t('accounts.sinceRelativeValue', { value: currentRow.date_since!.relative!.value, unit: t(`accounts.${currentRow.date_since!.relative!.unit!.toLowerCase()}`) })}`; } return t('accounts.syncAll'); })(); const hasSince = !!currentRow.date_since; const hasBefore = !!currentRow.date_before?.value; return ( {currentRow.email} {t('accounts.accountDetails')}
{/* Account Details Card */}
{t('accounts.id')}: {currentRow.id}
{t('accounts.email')}: {currentRow.email}
{t('accounts.name')}: {currentRow.name ?? t('accounts.notAvailable')}
{t('accounts.enabled')}:
{t('accounts.incrementalSyncInterval')}: {t('accounts.everyMinutes', { minutes: currentRow.sync_interval_min })}
{t('accounts.syncBatchSize')}: {currentRow.sync_batch_size}
{t('accounts.capabilities')}: {currentRow.capabilities ? currentRow.capabilities.join(", ") : t('accounts.notAvailable')}
{t('accounts.syncScope')}: {hasSince && (
{t('accounts.sinceFixed')}: {sinceText}
)} {hasBefore && (
{t('accounts.beforeRelative')}: {t('accounts.beforeRelativeValue', { value: currentRow.date_before!.value, unit: t(`accounts.${currentRow.date_before!.unit!.toLowerCase()}`) })}
)} {!hasSince && !hasBefore && ( {t('accounts.syncAll')} )}
{t('accounts.folderLimit')}: {currentRow.folder_limit ? currentRow.folder_limit : t('accounts.notAvailable')}
{t('accounts.serverConfiguration')}
{t('accounts.host')}: {currentRow.imap?.host}
{t('accounts.port')}: {currentRow.imap?.port}
{t('accounts.encryption')}: {currentRow.imap?.encryption}
{t('accounts.useDangerous')}: {`${currentRow.use_dangerous}`}
{t('accounts.auth')}: {currentRow.imap?.auth.auth_type === "OAuth2" ? ( OAuth2 ) : ( Password )}
{t('accounts.useProxyField')}: {currentRow.imap?.use_proxy ? "true" : "false"}
{t('accounts.syncFoldersTitle')} {currentRow.sync_folders?.length ? (
{t('accounts.foldersConfiguredForSync', { count: currentRow.sync_folders.length })}
{currentRow.sync_folders.map((folder, index) => (
{folder}
))}
) : (
No folders configured for sync
)}
) }