From d2fc26d47c518379f39bfe7f63707ad7deb0104e Mon Sep 17 00:00:00 2001
From: Timothy Carambat <rambat1010@gmail.com>
Date: Mon, 18 Mar 2024 09:25:03 -0700
Subject: [PATCH] change default workspace message for default user (#922)

---
 .../ChatContainer/ChatHistory/index.jsx       | 28 ++++++++++++-------
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/index.jsx b/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/index.jsx
index 6af66ea65..87c90c80b 100644
--- a/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/index.jsx
+++ b/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/index.jsx
@@ -5,8 +5,10 @@ import { useManageWorkspaceModal } from "../../../Modals/MangeWorkspace";
 import ManageWorkspace from "../../../Modals/MangeWorkspace";
 import { ArrowDown } from "@phosphor-icons/react";
 import debounce from "lodash.debounce";
+import useUser from "@/hooks/useUser";
 
 export default function ChatHistory({ history = [], workspace, sendCommand }) {
+  const { user } = useUser();
   const { showing, showModal, hideModal } = useManageWorkspaceModal();
   const [isAtBottom, setIsAtBottom] = useState(true);
   const chatHistoryRef = useRef(null);
@@ -56,16 +58,22 @@ export default function ChatHistory({ history = [], workspace, sendCommand }) {
           <p className="text-white/60 text-lg font-base py-4">
             Welcome to your new workspace.
           </p>
-          <p className="w-full items-center text-white/60 text-lg font-base flex flex-col md:flex-row gap-x-1">
-            To get started either{" "}
-            <span
-              className="underline font-medium cursor-pointer"
-              onClick={showModal}
-            >
-              upload a document
-            </span>
-            or <b className="font-medium italic">send a chat.</b>
-          </p>
+          {!user || user.role !== "default" ? (
+            <p className="w-full items-center text-white/60 text-lg font-base flex flex-col md:flex-row gap-x-1">
+              To get started either{" "}
+              <span
+                className="underline font-medium cursor-pointer"
+                onClick={showModal}
+              >
+                upload a document
+              </span>
+              or <b className="font-medium italic">send a chat.</b>
+            </p>
+          ) : (
+            <p className="w-full items-center text-white/60 text-lg font-base flex flex-col md:flex-row gap-x-1">
+              To get started <b className="font-medium italic">send a chat.</b>
+            </p>
+          )}
           <WorkspaceChatSuggestions
             suggestions={workspace?.suggestedMessages ?? []}
             sendSuggestion={handleSendSuggestedMessage}
-- 
GitLab