Skip to content

The Open Source DocuSign Alternative.

feat: add feature flag

David Nguyenac6da9ab4569
diff --git a/apps/web/src/app/(dashboard)/documents/[id]/document-page-view-recent-activity.tsx b/apps/web/src/app/(dashboard)/documents/[id]/document-page-view-recent-activity.tsx
index 5890f8aa2..1c632355a 100644
--- a/apps/web/src/app/(dashboard)/documents/[id]/document-page-view-recent-activity.tsx
+++ b/apps/web/src/app/(dashboard)/documents/[id]/document-page-view-recent-activity.tsx
@@ -94,6 +94,12 @@ export const DocumentPageViewRecentActivity = ({
</li>
)}
+ {documentAuditLogs.length === 0 && (
+ <div className="flex items-center justify-center py-4">
+ <p className="text-muted-foreground/70 text-sm">No recent activity</p>
+ </div>
+ )}
+
{documentAuditLogs.map((auditLog, auditLogIndex) => (
<li key={auditLog.id} className="relative flex gap-x-4">
<div
diff --git a/apps/web/src/app/(dashboard)/documents/[id]/document-page-view.tsx b/apps/web/src/app/(dashboard)/documents/[id]/document-page-view.tsx
index c64b8650a..e12a745a2 100644
--- a/apps/web/src/app/(dashboard)/documents/[id]/document-page-view.tsx
+++ b/apps/web/src/app/(dashboard)/documents/[id]/document-page-view.tsx
@@ -7,6 +7,7 @@ import { match } from 'ts-pattern';
import { DOCUMENSO_ENCRYPTION_KEY } from '@documenso/lib/constants/crypto';
import { getRequiredServerComponentSession } from '@documenso/lib/next-auth/get-server-component-session';
import { getDocumentById } from '@documenso/lib/server-only/document/get-document-by-id';
+import { getServerComponentFlag } from '@documenso/lib/server-only/feature-flags/get-server-component-feature-flag';
import { getRecipientsForDocument } from '@documenso/lib/server-only/recipient/get-recipients-for-document';
import { symmetricDecrypt } from '@documenso/lib/universal/crypto';
import { formatDocumentsPath } from '@documenso/lib/utils/teams';
@@ -55,6 +56,10 @@ export const DocumentPageView = async ({ params, team }: DocumentPageViewProps)
teamId: team?.id,
}).catch(() => null);
+ const isDocumentHistoryEnabled = await getServerComponentFlag(
+ 'app_document_page_view_history_sheet',
+ );
+
if (!document || !document.documentData) {
redirect(documentRootPath);
}
@@ -120,14 +125,16 @@ export const DocumentPageView = async ({ params, team }: DocumentPageViewProps)
</div>
</div>
- <div className="self-end">
- <DocumentHistorySheet documentId={document.id} userId={user.id}>
- <Button variant="outline">
- <Clock9 className="mr-1.5 h-4 w-4" />
- Document history
- </Button>
- </DocumentHistorySheet>
- </div>
+ {isDocumentHistoryEnabled && (
+ <div className="self-end">
+ <DocumentHistorySheet documentId={document.id} userId={user.id}>
+ <Button variant="outline">
+ <Clock9 className="mr-1.5 h-4 w-4" />
+ Document history
+ </Button>
+ </DocumentHistorySheet>
+ </div>
+ )}
</div>
<div className="mt-6 grid w-full grid-cols-12 gap-8">
diff --git a/packages/lib/constants/feature-flags.ts b/packages/lib/constants/feature-flags.ts
index 947409be1..6815b73b0 100644
--- a/packages/lib/constants/feature-flags.ts
+++ b/packages/lib/constants/feature-flags.ts
@@ -18,6 +18,7 @@ export const FEATURE_FLAG_POLL_INTERVAL = 30000;
export const LOCAL_FEATURE_FLAGS: Record<string, boolean> = {
app_billing: process.env.NEXT_PUBLIC_FEATURE_BILLING_ENABLED === 'true',
app_teams: true,
+ app_document_page_view_history_sheet: false,
marketing_header_single_player_mode: false,
} as const;