From 1400c335a5291a272ea82b1d7c113632c029d6da Mon Sep 17 00:00:00 2001 From: David Nguyen Date: Tue, 9 Apr 2024 11:31:53 +0700 Subject: [PATCH] fix: improve document loading ui consistency (#1082) ## Description General UI updates ## Changes Made - Add consistent spacing between document edit/view/log pages - Add document status to document audit log page - Update document loading page to reserve space for the document status below the title - Update the document audit log page to show full dates in the correct locale --- .../[id]/edit/document-edit-page-view.tsx | 2 +- .../(dashboard)/documents/[id]/loading.tsx | 9 ++++- .../[id]/logs/document-logs-page-view.tsx | 39 +++++++++++++++---- 3 files changed, 40 insertions(+), 10 deletions(-) diff --git a/apps/web/src/app/(dashboard)/documents/[id]/edit/document-edit-page-view.tsx b/apps/web/src/app/(dashboard)/documents/[id]/edit/document-edit-page-view.tsx index cab17c841..8a78ca9aa 100644 --- a/apps/web/src/app/(dashboard)/documents/[id]/edit/document-edit-page-view.tsx +++ b/apps/web/src/app/(dashboard)/documents/[id]/edit/document-edit-page-view.tsx @@ -100,7 +100,7 @@ export const DocumentEditPageView = async ({ params, team }: DocumentEditPageVie @@ -13,7 +15,12 @@ export default function Loading() {

Loading Document...

-
+ +
+ +
+ +
diff --git a/apps/web/src/app/(dashboard)/documents/[id]/logs/document-logs-page-view.tsx b/apps/web/src/app/(dashboard)/documents/[id]/logs/document-logs-page-view.tsx index 019ced57e..33d6cb8fe 100644 --- a/apps/web/src/app/(dashboard)/documents/[id]/logs/document-logs-page-view.tsx +++ b/apps/web/src/app/(dashboard)/documents/[id]/logs/document-logs-page-view.tsx @@ -2,16 +2,21 @@ import Link from 'next/link'; import { redirect } from 'next/navigation'; import { ChevronLeft, DownloadIcon } from 'lucide-react'; +import { DateTime } from 'luxon'; import { getRequiredServerComponentSession } from '@documenso/lib/next-auth/get-server-component-session'; import { getDocumentById } from '@documenso/lib/server-only/document/get-document-by-id'; +import { getLocale } from '@documenso/lib/server-only/headers/get-locale'; import { getRecipientsForDocument } from '@documenso/lib/server-only/recipient/get-recipients-for-document'; import { formatDocumentsPath } from '@documenso/lib/utils/teams'; import type { Recipient, Team } from '@documenso/prisma/client'; import { Button } from '@documenso/ui/primitives/button'; import { Card } from '@documenso/ui/primitives/card'; -import { FRIENDLY_STATUS_MAP } from '~/components/formatter/document-status'; +import { + DocumentStatus as DocumentStatusComponent, + FRIENDLY_STATUS_MAP, +} from '~/components/formatter/document-status'; import { DocumentLogsDataTable } from './document-logs-data-table'; @@ -23,6 +28,8 @@ export type DocumentLogsPageViewProps = { }; export const DocumentLogsPageView = async ({ params, team }: DocumentLogsPageViewProps) => { + const locale = getLocale(); + const { id } = params; const documentId = Number(id); @@ -67,15 +74,21 @@ export const DocumentLogsPageView = async ({ params, team }: DocumentLogsPageVie }, { description: 'Created by', - value: document.User.name ?? document.User.email, + value: document.User.name + ? `${document.User.name} (${document.User.email})` + : document.User.email, }, { description: 'Date created', - value: document.createdAt.toISOString(), + value: DateTime.fromJSDate(document.createdAt) + .setLocale(locale) + .toLocaleString(DateTime.DATETIME_MED_WITH_SECONDS), }, { description: 'Last updated', - value: document.updatedAt.toISOString(), + value: DateTime.fromJSDate(document.updatedAt) + .setLocale(locale) + .toLocaleString(DateTime.DATETIME_MED_WITH_SECONDS), }, { description: 'Time zone', @@ -90,7 +103,7 @@ export const DocumentLogsPageView = async ({ params, team }: DocumentLogsPageVie text = `${recipient.name} (${recipient.email})`; } - return `${text} - ${recipient.role}`; + return `[${recipient.role}] ${text}`; }; return ( @@ -104,9 +117,19 @@ export const DocumentLogsPageView = async ({ params, team }: DocumentLogsPageVie
-

- {document.title} -

+
+

+ {document.title} +

+ +
+ +
+