diff --git a/app/main.wasp b/app/main.wasp
index fba8738..41f8353 100644
--- a/app/main.wasp
+++ b/app/main.wasp
@@ -125,6 +125,7 @@ entity Chat {=psl
team_name String?
team_status String?
chatType String?
+ shouldShowChat Boolean @default(false)
proposedUserAction String[] @default([])
userRespondedWithNextAction Boolean @default(false)
emailContent String?
diff --git a/app/migrations/20240423082334_add_a_field_to_chat_model_to_decide_whether_to_show_the_daily_analysis_chat/migration.sql b/app/migrations/20240423082334_add_a_field_to_chat_model_to_decide_whether_to_show_the_daily_analysis_chat/migration.sql
new file mode 100644
index 0000000..9e705bf
--- /dev/null
+++ b/app/migrations/20240423082334_add_a_field_to_chat_model_to_decide_whether_to_show_the_daily_analysis_chat/migration.sql
@@ -0,0 +1,2 @@
+-- AlterTable
+ALTER TABLE "Chat" ADD COLUMN "shouldShowChat" BOOLEAN NOT NULL DEFAULT false;
diff --git a/app/migrations/20240423082642_set_the_should_show_chat_value_for_existing_daily_analysis_chats/migration.sql b/app/migrations/20240423082642_set_the_should_show_chat_value_for_existing_daily_analysis_chats/migration.sql
new file mode 100644
index 0000000..17feba3
--- /dev/null
+++ b/app/migrations/20240423082642_set_the_should_show_chat_value_for_existing_daily_analysis_chats/migration.sql
@@ -0,0 +1,2 @@
+-- This migration sets the shouldShowChat value to true for all existing daily analysis chats.
+UPDATE "Chat" SET "shouldShowChat" = TRUE WHERE "chatType" = 'daily_analysis';
diff --git a/app/src/client/App.tsx b/app/src/client/App.tsx
index 8262653..de4d3d0 100644
--- a/app/src/client/App.tsx
+++ b/app/src/client/App.tsx
@@ -139,7 +139,15 @@ export default function App({ children }: { children: ReactNode }) {
- © 2024 airt. All rights reserved.
+ © 2024{' '}
+
+ airt
+
+ . All rights reserved.
diff --git a/app/src/client/app/ChatPage.tsx b/app/src/client/app/ChatPage.tsx
index 6bb7f57..a3a7d06 100644
--- a/app/src/client/app/ChatPage.tsx
+++ b/app/src/client/app/ChatPage.tsx
@@ -1,4 +1,4 @@
-import { useState } from 'react';
+import { useState, useEffect } from 'react';
import { useSocket, useSocketListener } from 'wasp/client/webSocket';
import { type User } from 'wasp/entities';
@@ -54,6 +54,20 @@ const ChatPage = ({ user }: { user: User }) => {
{ enabled: !!activeChatId }
);
+ useEffect(() => {
+ if (
+ currentChatDetails &&
+ currentChatDetails.chatType === 'daily_analysis'
+ ) {
+ updateCurrentChat({
+ id: activeChatId,
+ data: {
+ shouldShowChat: true,
+ },
+ });
+ }
+ }, [activeChatUUId, currentChatDetails]);
+
useSocketListener('smartSuggestionsAddedToDB', updateState);
useSocketListener('streamFromTeamFinished', updateState);
diff --git a/app/src/client/components/ChatSidebar.tsx b/app/src/client/components/ChatSidebar.tsx
index 85e6eb8..23db1b3 100644
--- a/app/src/client/components/ChatSidebar.tsx
+++ b/app/src/client/components/ChatSidebar.tsx
@@ -5,7 +5,7 @@ import { Link, useHistory } from 'react-router-dom';
import { NavLink, useLocation } from 'react-router-dom';
import Logo from '../static/logo-for-dark-bg.png';
import EditableChatName from './EditableChatName';
-
+import { shouldRenderChat } from '../utils/chatUtils';
import { updateCurrentChat } from 'wasp/client/operations';
interface ChatSidebarProps {
@@ -189,41 +189,44 @@ const ChatSidebar = ({
{/* */}
{chats &&
- chats.map((chat: Chat, idx) => (
-
-
-
-
-
-
- ))}
+ chats.map(
+ (chat: Chat, idx) =>
+ shouldRenderChat(chat) && (
+
+
+
+
+
+
+ )
+ )}
diff --git a/app/src/client/components/Footer.tsx b/app/src/client/components/Footer.tsx
index d4e9152..cb22e5c 100644
--- a/app/src/client/components/Footer.tsx
+++ b/app/src/client/components/Footer.tsx
@@ -9,9 +9,9 @@ const Footer = () => {
>
-
+ {/*
Company
-
+
*/}
{footerNavigation.company.map((item) => (
-
diff --git a/app/src/client/landing-page/contentSections.ts b/app/src/client/landing-page/contentSections.ts
index 084e2da..aaabdd6 100644
--- a/app/src/client/landing-page/contentSections.ts
+++ b/app/src/client/landing-page/contentSections.ts
@@ -113,8 +113,7 @@ export const footerNavigation = {
{ name: 'Blog', href: BLOG_URL },
],
company: [
- { name: 'airt', href: 'https://airt.ai/' },
- { name: 'Privacy', href: '/privacy' },
- { name: 'Terms of Service', href: '/toc' },
+ { name: 'Privacy Policy', href: '/privacy' },
+ { name: 'Terms & Conditions', href: '/toc' },
],
};
diff --git a/app/src/client/tests/chatUtils.test.ts b/app/src/client/tests/chatUtils.test.ts
index 7c6b22e..2f49d26 100644
--- a/app/src/client/tests/chatUtils.test.ts
+++ b/app/src/client/tests/chatUtils.test.ts
@@ -1,4 +1,4 @@
-import { test, expect, vi, describe } from 'vitest';
+import { test, expect, vi, describe, it } from 'vitest';
import * as operations from 'wasp/client/operations';
import { type Conversation } from 'wasp/entities';
@@ -12,7 +12,9 @@ import {
handleAgentResponse,
handleChatError,
exceptionMessage,
+ shouldRenderChat,
} from '../utils/chatUtils';
+import { type Chat } from 'wasp/entities';
vi.mock('wasp/client/operations', async (importOriginal) => {
const mod = await importOriginal();
@@ -486,3 +488,57 @@ describe('chatUtils', () => {
});
});
});
+
+const patialTestChatFields = {
+ id: 0,
+ uuid: null,
+ createdAt: new Date(),
+ updatedAt: new Date(),
+ team_id: null,
+ team_name: null,
+ team_status: null,
+ proposedUserAction: [],
+ userRespondedWithNextAction: false,
+ emailContent: null,
+ agentChatHistory: null,
+ isExceptionOccured: false,
+ showLoader: false,
+ smartSuggestions: null,
+ streamAgentResponse: false,
+ customerBrief: null,
+ userId: null,
+ name: null,
+ isChatNameUpdated: false,
+};
+
+describe('shouldRenderChat', () => {
+ it('should return true if chatType is "daily_analysis" and shouldShowChat is true', () => {
+ const chat: Chat = {
+ chatType: 'daily_analysis',
+ shouldShowChat: true,
+ ...patialTestChatFields,
+ };
+
+ expect(shouldRenderChat(chat)).toBe(true);
+ });
+
+ it('should return true if chatType is not "daily_analysis"', () => {
+ const chat = {
+ chatType: 'other_type',
+ shouldShowChat: false,
+ ...patialTestChatFields,
+ };
+
+ expect(shouldRenderChat(chat)).toBe(true);
+ });
+
+ it('should return false if shouldShowChat is false', () => {
+ const chat = {
+ chatType: 'daily_analysis',
+ shouldShowChat: false,
+ ...patialTestChatFields,
+ };
+
+ expect(shouldRenderChat(chat)).toBe(false);
+ });
+});
diff --git a/app/src/client/utils/chatUtils.ts b/app/src/client/utils/chatUtils.ts
index 59cf045..75912d8 100644
--- a/app/src/client/utils/chatUtils.ts
+++ b/app/src/client/utils/chatUtils.ts
@@ -7,7 +7,7 @@ import {
deleteLastConversationInChat,
} from 'wasp/client/operations';
-import { type Conversation } from 'wasp/entities';
+import { type Conversation, type Chat } from 'wasp/entities';
export const exceptionMessage =
"Ahoy, mate! It seems our voyage hit an unexpected squall. Let's trim the sails and set a new course. Cast off once more by clicking the button below.";
@@ -236,3 +236,7 @@ export const handleChatError = async (
});
}
};
+
+export const shouldRenderChat = (chat: Chat): boolean => {
+ return chat.chatType !== 'daily_analysis' || chat.shouldShowChat;
+};