Skip to content

Commit f4d390c

Browse files
committed
Improve state of welcome screen
1 parent 7e7f5e0 commit f4d390c

File tree

2 files changed

+55
-4
lines changed

2 files changed

+55
-4
lines changed

web/screens/Chat/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ const ChatScreen = () => {
6767
setIsWaitingToSend(false)
6868
sendChatMessage()
6969
}
70+
// eslint-disable-next-line react-hooks/exhaustive-deps
7071
}, [waitingToSendMessage, activeConversationId])
7172

7273
const handleKeyDown = async (

web/screens/Welcome/index.tsx

Lines changed: 54 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
1+
import { Fragment } from 'react'
2+
3+
import { Badge, Button } from '@janhq/uikit'
4+
15
import LogoMark from '@/containers/Brand/Logo/Mark'
26

7+
import { MainViewState } from '@/constants/screens'
8+
9+
import { useActiveModel } from '@/hooks/useActiveModel'
10+
import { useGetDownloadedModels } from '@/hooks/useGetDownloadedModels'
11+
12+
import { useMainViewState } from '@/hooks/useMainViewState'
13+
314
const WelcomeScreen = () => {
15+
const { downloadedModels } = useGetDownloadedModels()
16+
const { activeModel } = useActiveModel()
17+
const { setMainViewState } = useMainViewState()
18+
419
return (
520
<div className="flex h-full items-center justify-center px-4">
621
<div className="text-center">
@@ -9,10 +24,45 @@ const WelcomeScreen = () => {
924
width={56}
1025
height={56}
1126
/>
12-
<h1 data-testid="testid-welcome-title" className="text-2xl font-bold">
13-
Welcome to Jan
14-
</h1>
15-
<p className="">{`let’s download your first model`}</p>
27+
28+
{downloadedModels.length === 0 && !activeModel && (
29+
<Fragment>
30+
<h1
31+
data-testid="testid-welcome-title"
32+
className="text-2xl font-bold"
33+
>
34+
Welcome to Jan
35+
</h1>
36+
<p className="mt-1">{`let’s download your first model`}</p>
37+
<Button
38+
className="mt-4"
39+
onClick={() => setMainViewState(MainViewState.ExploreModels)}
40+
>
41+
Explore Models
42+
</Button>
43+
</Fragment>
44+
)}
45+
{downloadedModels.length >= 1 && !activeModel && (
46+
<Fragment>
47+
<h1 className="mt-2 text-lg font-medium">{`You don’t have any actively running models`}</h1>
48+
<p className="mt-1">{`Please start a downloaded model in My Models page to use this feature.`}</p>
49+
<Badge className="mt-4" themes="secondary">
50+
⌘e to show your model
51+
</Badge>
52+
</Fragment>
53+
)}
54+
{downloadedModels.length >= 1 && activeModel && (
55+
<Fragment>
56+
<h1 className="mt-2 text-lg font-medium">{`Your Model is Active`}</h1>
57+
<p className="mt-1">{`You are ready to start conversations.`}</p>
58+
<Button
59+
className="mt-4"
60+
onClick={() => setMainViewState(MainViewState.Chat)}
61+
>
62+
Start a conversation
63+
</Button>
64+
</Fragment>
65+
)}
1666
</div>
1767
</div>
1868
)

0 commit comments

Comments
 (0)