diff --git a/apps/remix/app/components/tables/internal-audit-log-table.tsx b/apps/remix/app/components/tables/internal-audit-log-table.tsx new file mode 100644 index 000000000..f8eae0223 --- /dev/null +++ b/apps/remix/app/components/tables/internal-audit-log-table.tsx @@ -0,0 +1,95 @@ +import { msg } from '@lingui/macro'; +import { useLingui } from '@lingui/react'; +import { DateTime } from 'luxon'; +import type { DateTimeFormatOptions } from 'luxon'; +import { UAParser } from 'ua-parser-js'; + +import { APP_I18N_OPTIONS } from '@documenso/lib/constants/i18n'; +import type { TDocumentAuditLog } from '@documenso/lib/types/document-audit-logs'; +import { formatDocumentAuditLogAction } from '@documenso/lib/utils/document-audit-logs'; +import { + Table, + TableBody, + TableCell, + TableHead, + TableHeader, + TableRow, +} from '@documenso/ui/primitives/table'; + +export type AuditLogDataTableProps = { + logs: TDocumentAuditLog[]; +}; + +const dateFormat: DateTimeFormatOptions = { + ...DateTime.DATETIME_SHORT, + hourCycle: 'h12', +}; + +/** + * DO NOT USE TRANS. YOU MUST USE _ FOR THIS FILE AND ALL CHILDREN COMPONENTS. + */ +export const InternalAuditLogTable = ({ logs }: AuditLogDataTableProps) => { + const { _ } = useLingui(); + + const parser = new UAParser(); + + const uppercaseFistLetter = (text: string) => { + return text.charAt(0).toUpperCase() + text.slice(1); + }; + + return ( +
+ {_(msg`Document ID`)} + + {document.id} +
+ ++ {_(msg`Enclosed Document`)} + + {document.title} +
+ ++ {_(msg`Status`)} + + + {_( + document.deletedAt ? msg`Deleted` : DOCUMENT_STATUS[document.status].description, + ).toUpperCase()} + +
+ ++ {_(msg`Owner`)} + + + {document.user.name} ({document.user.email}) + +
+ ++ {_(msg`Created At`)} + + + {DateTime.fromJSDate(document.createdAt) + .setLocale(APP_I18N_OPTIONS.defaultLocale) + .toFormat('yyyy-mm-dd hh:mm:ss a (ZZZZ)')} + +
+ ++ {_(msg`Last Updated`)} + + + {DateTime.fromJSDate(document.updatedAt) + .setLocale(APP_I18N_OPTIONS.defaultLocale) + .toFormat('yyyy-mm-dd hh:mm:ss a (ZZZZ)')} + +
+ ++ {_(msg`Time Zone`)} + + + {document.documentMeta?.timezone ?? 'N/A'} + +
+ +{_(msg`Recipients`)}
+ ++ {_(msg`Signing certificate provided by`)}: +
+ +