Skip to content

Commit

Permalink
fix(cypress): test
Browse files Browse the repository at this point in the history
  • Loading branch information
aliraza556 committed Oct 27, 2024
1 parent 2517933 commit 18bc670
Show file tree
Hide file tree
Showing 7 changed files with 397 additions and 388 deletions.
28 changes: 4 additions & 24 deletions src/components/App/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { useAppStore } from '~/stores/useAppStore'
import { useDataStore } from '~/stores/useDataStore'
import { useFeatureFlagStore } from '~/stores/useFeatureFlagStore'
import { useUpdateSelectedNode } from '~/stores/useGraphStore'
import { useModal } from '~/stores/useModalStore'
import { useTeachStore } from '~/stores/useTeachStore'
import { useUserStore } from '~/stores/useUserStore'
import {
Expand Down Expand Up @@ -54,18 +53,12 @@ const LazyMainToolbar = lazy(() => import('./MainToolbar').then(({ MainToolbar }
const LazyUniverse = lazy(() => import('~/components/Universe').then(({ Universe }) => ({ default: Universe })))
const LazySideBar = lazy(() => import('./SideBar').then(({ SideBar }) => ({ default: SideBar })))

const LazyOnboardingModal = lazy(() =>
import('../ModalsContainer/OnboardingFlow').then(({ OnboardingModal }) => ({ default: OnboardingModal })),
)

export const App = () => {
const [searchParams] = useSearchParams()
const query = searchParams.get('q')
const { setBudget, setNodeCount } = useUserStore((s) => s)
const queueRef = useRef<FetchDataResponse | null>(null)
const timerRef = useRef<NodeJS.Timeout | null>(null)
const { open, visible } = useModal('onboardingFlow')
const [isAdmin] = useUserStore((s) => [s.isAdmin, s.setPubKey])

const {
setSidebarOpen,
Expand All @@ -75,7 +68,6 @@ export const App = () => {
setTranscriptOpen,
universeQuestionIsOpen,
setUniverseQuestionIsOpen,
appMetaData,
} = useAppStore((s) => s)

const setTeachMeAnswer = useTeachStore((s) => s.setTeachMeAnswer)
Expand Down Expand Up @@ -330,16 +322,10 @@ export const App = () => {
}, [runningProjectId, setRunningProjectMessages])

useEffect(() => {
if (!isAdmin && appMetaData?.title && !visible) {
open()
}
}, [isAdmin, appMetaData?.title, open, visible])

useEffect(() => {
if (!splashDataLoading && !visible) {
if (!splashDataLoading) {
setUniverseQuestionIsOpen()
}
}, [setUniverseQuestionIsOpen, splashDataLoading, visible])
}, [setUniverseQuestionIsOpen, splashDataLoading])

return (
<>
Expand All @@ -350,13 +336,7 @@ export const App = () => {
<Leva hidden={!isDevelopment || true} isRoot />

<Suspense fallback={<div>Loading...</div>}>
{visible && (
<Suspense fallback={<div>Loading Onboarding...</div>}>
<LazyOnboardingModal onSuccess={setUniverseQuestionIsOpen} />
</Suspense>
)}

{!visible && !splashDataLoading && (
{!splashDataLoading ? (
<Wrapper direction="row">
<FormProvider {...form}>
<LazyMainToolbar />
Expand All @@ -371,7 +351,7 @@ export const App = () => {
<ModalsContainer />
<Toasts />
</Wrapper>
)}
) : null}
</Suspense>
</>
)
Expand Down
Loading

0 comments on commit 18bc670

Please sign in to comment.