Skip to content

Commit e30edae

Browse files
Phase 1 - Add AI Chat functionality and assets
- Introduced new AI chat feature with components: AIChat, AIChatContainer, ChatHeader, ChatInput, and ChatMessage. - Added AIChatBanner for easy access from the HomePage. - Included multiple images for AI chat interface. - Updated routing to include a dedicated ChatPage. - Enhanced HomePage with AI chat integration for improved user experience.
1 parent 7840c22 commit e30edae

File tree

24 files changed

+780
-6
lines changed

24 files changed

+780
-6
lines changed
70.2 KB
Loading
110 KB
Loading
187 KB
Loading
108 KB
Loading
140 KB
Loading
129 KB
Loading
101 KB
Loading

frontend/src/common/components/Router/TabNavigation.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import UserEditPage from 'pages/Users/components/UserEdit/UserEditPage';
1111
import AccountPage from 'pages/Account/AccountPage';
1212
import ProfilePage from 'pages/Account/components/Profile/ProfilePage';
1313
import DiagnosticsPage from 'pages/Account/components/Diagnostics/DiagnosticsPage';
14+
import ChatPage from 'pages/Chat/ChatPage';
1415

1516
/**
1617
* The `TabNavigation` component provides a router outlet for all of the
@@ -56,6 +57,9 @@ const TabNavigation = (): JSX.Element => {
5657
<Route exact path="/tabs/account/diagnostics">
5758
<DiagnosticsPage />
5859
</Route>
60+
<Route exact path="/tabs/chat">
61+
<ChatPage />
62+
</Route>
5963
<Route exact path="/">
6064
<Redirect to="/tabs/home" />
6165
</Route>

frontend/src/pages/Chat/ChatPage.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import { IonContent, IonHeader, IonPage, IonTitle, IonToolbar } from '@ionic/react';
22
import { useTranslation } from 'react-i18next';
3+
import AIChatContainer from './components/AIChatContainer/AIChatContainer';
34

45
/**
56
* The `ChatPage` component displays the chat interface.
7+
* This page can be accessed from the tab navigation and serves as the full
8+
* page version of the AI chat functionality.
69
* @returns JSX
710
*/
811
const ChatPage = (): JSX.Element => {
@@ -20,6 +23,12 @@ const ChatPage = (): JSX.Element => {
2023
<h1>{t('pages.chat.subtitle')}</h1>
2124
<p>{t('pages.chat.description')}</p>
2225
</div>
26+
27+
{/*
28+
We're using the same AIChatContainer component here
29+
This demonstrates how we can reuse the component across different views
30+
*/}
31+
<AIChatContainer />
2332
</IonContent>
2433
</IonPage>
2534
);
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
.ai-chat {
2+
display: flex;
3+
flex-direction: column;
4+
width: 100%;
5+
height: 100%;
6+
background-color: #ffffff;
7+
border-radius: 1.25rem 1.25rem 0 0;
8+
box-shadow: 0 -0.25rem 1rem rgba(0, 0, 0, 0.1);
9+
overflow: hidden;
10+
transition: height 0.3s ease-in-out;
11+
position: relative;
12+
13+
&--expanded {
14+
border-radius: 1.25rem;
15+
height: 90vh;
16+
max-height: 40rem;
17+
}
18+
19+
&__content {
20+
flex: 1;
21+
overflow-y: auto;
22+
padding: 1rem;
23+
}
24+
25+
&__messages {
26+
display: flex;
27+
flex-direction: column;
28+
gap: 1rem;
29+
padding-bottom: 1rem;
30+
}
31+
32+
&__empty-state {
33+
display: flex;
34+
align-items: center;
35+
justify-content: center;
36+
height: 100%;
37+
text-align: center;
38+
color: #666;
39+
padding: 2rem;
40+
41+
p {
42+
font-size: 1rem;
43+
max-width: 20rem;
44+
margin: 0 auto;
45+
}
46+
}
47+
48+
&__loading {
49+
display: flex;
50+
align-items: center;
51+
margin: 0.5rem 0;
52+
padding-left: 1rem;
53+
}
54+
55+
&__loading-dots {
56+
display: flex;
57+
align-items: center;
58+
gap: 0.25rem;
59+
60+
span {
61+
width: 0.5rem;
62+
height: 0.5rem;
63+
background-color: #4765ff;
64+
border-radius: 50%;
65+
display: inline-block;
66+
animation: bounce 1.4s infinite ease-in-out both;
67+
68+
&:nth-child(1) {
69+
animation-delay: -0.32s;
70+
}
71+
72+
&:nth-child(2) {
73+
animation-delay: -0.16s;
74+
}
75+
}
76+
}
77+
}
78+
79+
@keyframes bounce {
80+
0%, 80%, 100% {
81+
transform: scale(0);
82+
}
83+
40% {
84+
transform: scale(1);
85+
}
86+
}

0 commit comments

Comments
 (0)