Skip to content

Commit 114aeec

Browse files
Refactor chat functionality and UI components
- Created ChatContainer and ChatInput components for better separation of concerns in chat UI. - Updated AIAssistantModal to utilize new ChatContainer and ChatInput components. - Enhanced styling for chat components in respective SCSS files. - Implemented chat service for managing message sending and AI responses. - Added tests for ChatPage and components to ensure proper functionality. - Integrated chat functionality into the app's navigation.
1 parent 7668e16 commit 114aeec

File tree

18 files changed

+809
-329
lines changed

18 files changed

+809
-329
lines changed

frontend/src/common/components/AIAssistant/AIAssistantModal.scss

Lines changed: 32 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55
--box-shadow: 0 -0.25rem 1rem rgba(0, 0, 0, 0.1);
66
--backdrop-opacity: 0.3;
77
align-items: flex-end;
8+
transition: --height 0.3s ease-out, --max-height 0.3s ease-out;
89

910
&.expanded {
1011
--height: 85vh;
1112
--max-height: 85vh;
1213

1314
&::part(content) {
14-
margin: 2rem 1rem;
15+
margin: 2rem 1rem 5rem 1rem;
1516
}
1617
}
1718

@@ -20,156 +21,53 @@
2021
margin: 0 1rem 5rem 1rem;
2122
display: flex;
2223
flex-direction: column;
24+
transition: margin 0.3s ease-out;
2325
}
2426

2527
.ai-assistant-header {
2628
ion-toolbar {
2729
--padding-top: 0.5rem;
2830
--padding-bottom: 0.5rem;
2931
}
30-
31-
ion-title {
32-
font-weight: 600;
33-
font-size: 1.125rem;
34-
display: flex;
35-
align-items: center;
36-
37-
.ai-assistant-title-icon {
38-
height: 1.5rem;
39-
margin-right: 0.5rem;
40-
}
41-
}
32+
}
33+
34+
.ai-assistant-toolbar {
35+
--background: transparent;
36+
--border-color: transparent;
37+
--border-width: 0;
38+
--padding-start: 1rem;
39+
}
40+
41+
.ai-assistant-title-container {
42+
display: flex;
43+
align-items: center;
44+
width: 100%;
45+
text-align: left;
46+
}
47+
48+
.ai-assistant-title-icon {
49+
height: 1.5rem;
50+
margin-right: 0.5rem;
51+
}
52+
53+
.ai-assistant-title-text {
54+
font-weight: 600;
55+
font-size: 1.125rem;
4256
}
4357

4458
.ai-assistant-content {
4559
--padding: 0;
4660
flex: 1;
4761
overflow: hidden;
48-
49-
.chat-container {
50-
display: flex;
51-
flex-direction: column;
52-
gap: 0.75rem;
53-
padding: 1rem;
54-
height: 100%;
55-
overflow-y: auto;
56-
57-
.chat-empty-state {
58-
display: flex;
59-
align-items: center;
60-
justify-content: center;
61-
height: 100%;
62-
color: var(--ion-color-medium);
63-
font-style: italic;
64-
text-align: center;
65-
padding: 0 2rem;
66-
}
67-
68-
.chat-message {
69-
display: flex;
70-
flex-direction: column;
71-
max-width: 90%;
72-
margin-bottom: 0.75rem;
73-
74-
.message-content {
75-
padding: 0.75rem 1rem;
76-
border-radius: 1rem;
77-
78-
p {
79-
margin: 0;
80-
white-space: pre-wrap;
81-
word-break: break-word;
82-
}
83-
}
84-
85-
&.user-message {
86-
align-self: flex-end;
87-
88-
.message-content {
89-
background-color: var(--ion-color-primary);
90-
color: var(--ion-color-primary-contrast);
91-
border-bottom-right-radius: 0.25rem;
92-
}
93-
}
94-
95-
&.assistant-message {
96-
align-self: flex-start;
97-
98-
.message-content {
99-
background-color: var(--ion-color-light);
100-
color: var(--ion-color-dark);
101-
border-bottom-left-radius: 0.25rem;
102-
}
103-
}
104-
105-
// Avatar styling
106-
.message-avatar {
107-
width: 1.5rem;
108-
height: 1.5rem;
109-
border-radius: 50%;
110-
margin-bottom: 0.25rem;
111-
112-
&.user-avatar {
113-
align-self: flex-end;
114-
margin-right: 0.25rem;
115-
}
116-
117-
&.assistant-avatar {
118-
align-self: flex-start;
119-
margin-left: 0.25rem;
120-
background-color: var(--ion-color-primary);
121-
display: flex;
122-
align-items: center;
123-
justify-content: center;
124-
125-
svg, img {
126-
width: 1rem;
127-
height: 1rem;
128-
filter: brightness(0) invert(1);
129-
}
130-
}
131-
}
132-
}
133-
}
13462
}
13563

13664
.ai-assistant-footer {
137-
padding: 0.5rem 1rem 1rem;
13865
background: transparent;
139-
position: sticky;
140-
bottom: 0;
141-
width: 100%;
142-
z-index: 2;
143-
144-
.input-container {
145-
display: flex;
146-
align-items: center;
147-
background-color: var(--ion-color-light);
148-
border-radius: 1.5rem;
149-
padding: 0 0.5rem;
150-
151-
.message-input {
152-
--padding-start: 1rem;
153-
--padding-end: 0.5rem;
154-
--placeholder-color: var(--ion-color-medium);
155-
--placeholder-opacity: 0.8;
156-
}
157-
158-
.send-button {
159-
margin: 0;
160-
--padding-start: 0.5rem;
161-
--padding-end: 0.5rem;
162-
163-
&:disabled {
164-
opacity: 0.5;
165-
}
166-
167-
ion-icon {
168-
font-size: 1.25rem;
169-
color: var(--ion-color-primary);
170-
}
171-
}
172-
}
66+
position: relative;
67+
display: flex;
68+
justify-content: center;
69+
align-items: center;
70+
padding: 0.5rem 0;
17371
}
17472
}
17573

0 commit comments

Comments
 (0)