From caeaed8c6fced7a101e406deba2a943d197d13f7 Mon Sep 17 00:00:00 2001 From: Shoaibdev7 Date: Sun, 20 Oct 2024 02:22:56 +0500 Subject: [PATCH 1/4] fix(ai-chat): ai screen on default part of feature flag --- cypress/e2e/trendingTopics/trendingTopics.cy.ts | 2 -- cypress/support/commands.ts | 2 -- src/stores/useAppStore/index.ts | 7 ++++++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/cypress/e2e/trendingTopics/trendingTopics.cy.ts b/cypress/e2e/trendingTopics/trendingTopics.cy.ts index 99242b73e..f3dc7197c 100644 --- a/cypress/e2e/trendingTopics/trendingTopics.cy.ts +++ b/cypress/e2e/trendingTopics/trendingTopics.cy.ts @@ -40,8 +40,6 @@ describe('test trending topics', () => { // wait for boltwall queue to send tweets to jarvis cy.wait(70000) - cy.get('[data-testid="explore-graph-btn"]').click() - cy.wait('@getTrends').then((interception) => { const responseBody = interception.response.body diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts index d39d8ed7a..b1f0f394c 100644 --- a/cypress/support/commands.ts +++ b/cypress/support/commands.ts @@ -64,7 +64,5 @@ Cypress.Commands.add('initialSetup', (username, budget) => { cy.wait(['@loadAbout', '@loadLatest', '@loadStats']) - cy.get('[data-testid="explore-graph-btn"]', { timeout: 90000 }).should('be.visible').click() - cy.wait(['@getTrends']) }) diff --git a/src/stores/useAppStore/index.ts b/src/stores/useAppStore/index.ts index 7a68b8e15..370a08756 100644 --- a/src/stores/useAppStore/index.ts +++ b/src/stores/useAppStore/index.ts @@ -1,5 +1,6 @@ import { create } from 'zustand' import { TAboutParams } from '~/network/fetchSourcesData' +import { useFeatureFlagStore } from '~/stores/useFeatureFlagStore' export type SecondarySidebarActiveTab = '' | 'sentiment' | 'sources' | 'about' @@ -71,7 +72,11 @@ export const useAppStore = create((set, get) => ({ transcriptIsOpen: !sidebarIsOpen ? false : get().transcriptIsOpen, }), setTranscriptOpen: (transcriptIsOpen) => set({ transcriptIsOpen }), - setUniverseQuestionIsOpen: () => set({ universeQuestionIsOpen: !get().universeQuestionIsOpen }), + setUniverseQuestionIsOpen: () => { + const { chatInterfaceFeatureFlag } = useFeatureFlagStore.getState() + + set({ universeQuestionIsOpen: chatInterfaceFeatureFlag ? !get().universeQuestionIsOpen : false }) + }, setAppMetaData: (appMetaData) => set({ appMetaData }), setShowCollapseButton: (showCollapseButton) => set({ showCollapseButton }), setSelectedColor: (selectedColor) => set({ selectedColor }), From 4c6219c3fe6954690aa7d42b70b63cd13e83a2da Mon Sep 17 00:00:00 2001 From: Shoaibdev7 Date: Mon, 28 Oct 2024 08:56:40 +0500 Subject: [PATCH 2/4] fix(ai-chat): ai screen on default part of feature flag --- src/components/App/index.tsx | 6 +++--- src/stores/useAppStore/index.ts | 7 +------ 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/components/App/index.tsx b/src/components/App/index.tsx index bf355b12b..c8de1568c 100644 --- a/src/components/App/index.tsx +++ b/src/components/App/index.tsx @@ -322,10 +322,10 @@ export const App = () => { }, [runningProjectId, setRunningProjectMessages]) useEffect(() => { - if (!splashDataLoading) { + if (chatInterfaceFeatureFlag && !splashDataLoading) { setUniverseQuestionIsOpen() } - }, [setUniverseQuestionIsOpen, splashDataLoading]) + }, [setUniverseQuestionIsOpen, splashDataLoading, chatInterfaceFeatureFlag]) return ( <> @@ -340,7 +340,7 @@ export const App = () => { - {!universeQuestionIsOpen && } + {!universeQuestionIsOpen && chatInterfaceFeatureFlag && } diff --git a/src/stores/useAppStore/index.ts b/src/stores/useAppStore/index.ts index 370a08756..7a68b8e15 100644 --- a/src/stores/useAppStore/index.ts +++ b/src/stores/useAppStore/index.ts @@ -1,6 +1,5 @@ import { create } from 'zustand' import { TAboutParams } from '~/network/fetchSourcesData' -import { useFeatureFlagStore } from '~/stores/useFeatureFlagStore' export type SecondarySidebarActiveTab = '' | 'sentiment' | 'sources' | 'about' @@ -72,11 +71,7 @@ export const useAppStore = create((set, get) => ({ transcriptIsOpen: !sidebarIsOpen ? false : get().transcriptIsOpen, }), setTranscriptOpen: (transcriptIsOpen) => set({ transcriptIsOpen }), - setUniverseQuestionIsOpen: () => { - const { chatInterfaceFeatureFlag } = useFeatureFlagStore.getState() - - set({ universeQuestionIsOpen: chatInterfaceFeatureFlag ? !get().universeQuestionIsOpen : false }) - }, + setUniverseQuestionIsOpen: () => set({ universeQuestionIsOpen: !get().universeQuestionIsOpen }), setAppMetaData: (appMetaData) => set({ appMetaData }), setShowCollapseButton: (showCollapseButton) => set({ showCollapseButton }), setSelectedColor: (selectedColor) => set({ selectedColor }), From 0dbc9c78bbe54061f40f3f9b6027d40dbe6e857d Mon Sep 17 00:00:00 2001 From: Shoaibdev7 Date: Mon, 28 Oct 2024 09:08:14 +0500 Subject: [PATCH 3/4] fix(cypress): revert cypress changes --- cypress/e2e/trendingTopics/trendingTopics.cy.ts | 2 ++ cypress/support/commands.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/cypress/e2e/trendingTopics/trendingTopics.cy.ts b/cypress/e2e/trendingTopics/trendingTopics.cy.ts index f3dc7197c..99242b73e 100644 --- a/cypress/e2e/trendingTopics/trendingTopics.cy.ts +++ b/cypress/e2e/trendingTopics/trendingTopics.cy.ts @@ -40,6 +40,8 @@ describe('test trending topics', () => { // wait for boltwall queue to send tweets to jarvis cy.wait(70000) + cy.get('[data-testid="explore-graph-btn"]').click() + cy.wait('@getTrends').then((interception) => { const responseBody = interception.response.body diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts index b1f0f394c..d39d8ed7a 100644 --- a/cypress/support/commands.ts +++ b/cypress/support/commands.ts @@ -64,5 +64,7 @@ Cypress.Commands.add('initialSetup', (username, budget) => { cy.wait(['@loadAbout', '@loadLatest', '@loadStats']) + cy.get('[data-testid="explore-graph-btn"]', { timeout: 90000 }).should('be.visible').click() + cy.wait(['@getTrends']) }) From b0d469151057a5583ffda9241f734e6089e022ab Mon Sep 17 00:00:00 2001 From: Shoaibdev7 Date: Mon, 28 Oct 2024 10:03:41 +0500 Subject: [PATCH 4/4] fix(cypress): enable chat interface --- src/components/Auth/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Auth/index.tsx b/src/components/Auth/index.tsx index 540514c5e..de683c64e 100644 --- a/src/components/Auth/index.tsx +++ b/src/components/Auth/index.tsx @@ -73,7 +73,7 @@ export const AuthGuard = ({ children }: PropsWithChildren) => { setQueuedSourcesFeatureFlag(res.data.queuedSources) setCustomSchemaFeatureFlag(res.data.customSchema) setRealtimeGraphFeatureFlag(res.data.realtimeGraph || false) - setChatInterfaceFeatureFlag(res.data.chatInterface || false) + setChatInterfaceFeatureFlag(res.data.chatInterface || true) setFastFiltersFeatureFlag(res.data.fastFilters || false) }