From 64fb87d0ceb591a49aacad39bf5e885cab7decfa Mon Sep 17 00:00:00 2001
From: MohamedBassem <me@mbassem.com>
Date: Tue, 19 Mar 2024 12:41:06 +0000
Subject: feature(web): Add support for demo mode

---
 apps/web/components/ui/action-button.tsx | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

(limited to 'apps/web/components/ui/action-button.tsx')

diff --git a/apps/web/components/ui/action-button.tsx b/apps/web/components/ui/action-button.tsx
index 11b02a5f..5b862e07 100644
--- a/apps/web/components/ui/action-button.tsx
+++ b/apps/web/components/ui/action-button.tsx
@@ -1,3 +1,5 @@
+import { useClientConfig } from "@/lib/clientConfig";
+
 import type { ButtonProps } from "./button";
 import { Button } from "./button";
 import LoadingSpinner from "./spinner";
@@ -7,13 +9,18 @@ export function ActionButton({
   loading,
   spinner,
   disabled,
+  ignoreDemoMode = false,
   ...props
 }: ButtonProps & {
   loading: boolean;
   spinner?: React.ReactNode;
+  ignoreDemoMode?: boolean;
 }) {
+  const clientConfig = useClientConfig();
   spinner ||= <LoadingSpinner />;
-  if (disabled !== undefined) {
+  if (!ignoreDemoMode && clientConfig.demoMode) {
+    disabled = true;
+  } else if (disabled !== undefined) {
     disabled ||= loading;
   } else if (loading) {
     disabled = true;
-- 
cgit v1.2.3-70-g09d2

