|
1 | 1 | import * as React from 'react'; |
2 | 2 | import { Card, CardBody } from '@patternfly/react-core'; |
3 | 3 | import { ResponseMetrics } from '~/app/types'; |
| 4 | +import useDarkMode from '~/app/Chatbot/hooks/useDarkMode'; |
4 | 5 | import ChatbotPaneHeader from './components/ChatbotPaneHeader'; |
5 | 6 |
|
6 | 7 | interface ChatbotPaneProps { |
@@ -33,38 +34,42 @@ const ChatbotPane: React.FC<ChatbotPaneProps> = ({ |
33 | 34 | children, |
34 | 35 | metrics, |
35 | 36 | isLoading, |
36 | | -}) => ( |
37 | | - <Card |
38 | | - isFullHeight |
39 | | - isPlain |
40 | | - style={{ boxShadow: 'none', display: 'flex', flexDirection: 'column', height: '100%' }} |
41 | | - data-testid={`chatbot-pane-${configId}`} |
42 | | - role="region" |
43 | | - aria-label={displayLabel} |
44 | | - > |
45 | | - <ChatbotPaneHeader |
46 | | - label={displayLabel} |
47 | | - selectedModel={selectedModel} |
48 | | - onModelChange={onModelChange} |
49 | | - onSettingsClick={onSettingsClick} |
50 | | - onCloseClick={onClose} |
51 | | - metrics={metrics} |
52 | | - isLoading={isLoading} |
53 | | - hasDivider |
54 | | - testIdPrefix={`chatbot-pane-${configId}`} |
55 | | - /> |
56 | | - <CardBody |
57 | | - style={{ |
58 | | - padding: 0, |
59 | | - overflow: 'hidden', |
60 | | - flex: 1, |
61 | | - display: 'flex', |
62 | | - flexDirection: 'column', |
63 | | - }} |
| 37 | +}) => { |
| 38 | + const isDarkMode = useDarkMode(); |
| 39 | + return ( |
| 40 | + <Card |
| 41 | + isFullHeight |
| 42 | + isPlain |
| 43 | + style={{ boxShadow: 'none', display: 'flex', flexDirection: 'column', height: '100%' }} |
| 44 | + data-testid={`chatbot-pane-${configId}`} |
| 45 | + role="region" |
| 46 | + aria-label={displayLabel} |
64 | 47 | > |
65 | | - {children} |
66 | | - </CardBody> |
67 | | - </Card> |
68 | | -); |
| 48 | + <ChatbotPaneHeader |
| 49 | + label={displayLabel} |
| 50 | + selectedModel={selectedModel} |
| 51 | + onModelChange={onModelChange} |
| 52 | + onSettingsClick={onSettingsClick} |
| 53 | + onCloseClick={onClose} |
| 54 | + metrics={metrics} |
| 55 | + isLoading={isLoading} |
| 56 | + hasDivider |
| 57 | + testIdPrefix={`chatbot-pane-${configId}`} |
| 58 | + isDarkMode={isDarkMode} |
| 59 | + /> |
| 60 | + <CardBody |
| 61 | + style={{ |
| 62 | + padding: 0, |
| 63 | + overflow: 'hidden', |
| 64 | + flex: 1, |
| 65 | + display: 'flex', |
| 66 | + flexDirection: 'column', |
| 67 | + }} |
| 68 | + > |
| 69 | + {children} |
| 70 | + </CardBody> |
| 71 | + </Card> |
| 72 | + ); |
| 73 | +}; |
69 | 74 |
|
70 | 75 | export default ChatbotPane; |
0 commit comments