app-tutor-ai-consumer 1.21.0 → 1.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/package.json +1 -1
- package/src/config/datahub/schemas/tutor/constants.ts +1 -1
- package/src/lib/components/button/button.tsx +25 -78
- package/src/lib/components/icons/info.svg +3 -3
- package/src/modules/messages/components/chat-input/chat-input.tsx +1 -1
- package/src/modules/messages/components/message-actions/message-actions.tsx +34 -9
- package/src/modules/messages/components/messages-container/messages-container.tsx +3 -1
- package/src/modules/messages/hooks/use-scroller/use-scroller.tsx +1 -1
- package/src/modules/widget/components/ai-avatar/ai-avatar.tsx +2 -2
- package/src/modules/widget/components/chat-page/chat-page.tsx +1 -15
- package/src/modules/widget/components/header/header.tsx +49 -27
- package/src/modules/widget/components/header/styles.module.css +11 -0
- package/src/modules/widget/components/information-page/information-page.tsx +11 -17
- package/src/modules/widget/components/loading-page/loading-page.tsx +1 -1
- package/src/modules/widget/components/starter-page/starter-page.tsx +2 -6
- package/src/modules/widget/store/widget-tabs.atom.ts +1 -1
- package/tailwind.config.js +6 -8
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -5,6 +5,26 @@ import { Spinner } from '../spinner'
|
|
|
5
5
|
|
|
6
6
|
import styles from './styles.module.css'
|
|
7
7
|
|
|
8
|
+
function ButtonContent({
|
|
9
|
+
children,
|
|
10
|
+
loading
|
|
11
|
+
}: PropsWithChildren<{
|
|
12
|
+
loading?: boolean
|
|
13
|
+
}>) {
|
|
14
|
+
if (loading)
|
|
15
|
+
return (
|
|
16
|
+
<div className='col-start-1 row-start-1'>
|
|
17
|
+
<Spinner className='col-start-1 row-start-1 mx-auto my-auto h-[1em] w-[1em] text-current' />
|
|
18
|
+
</div>
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<span data-label='text-content' className='col-start-1 row-start-1 flex flex-nowrap gap-2'>
|
|
23
|
+
{children}
|
|
24
|
+
</span>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
8
28
|
export type ButtonProps = PropsWithChildren<
|
|
9
29
|
ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
10
30
|
variant?: 'brand' | 'secondary' | 'primary' | 'tertiary' | 'gradient-outline'
|
|
@@ -77,20 +97,7 @@ function Button({
|
|
|
77
97
|
{...props}
|
|
78
98
|
disabled={props.disabled || loading}
|
|
79
99
|
aria-busy={loading}>
|
|
80
|
-
<
|
|
81
|
-
data-label='text-content'
|
|
82
|
-
className={clsx('flex flex-nowrap gap-2 [grid-area:stack]', {
|
|
83
|
-
visible: !loading,
|
|
84
|
-
invisible: loading
|
|
85
|
-
})}>
|
|
86
|
-
{children}
|
|
87
|
-
</span>
|
|
88
|
-
<Spinner
|
|
89
|
-
className={clsx('mx-auto my-auto h-[1em] w-[1em] text-current', '[grid-area:stack]', {
|
|
90
|
-
visible: loading,
|
|
91
|
-
invisible: !loading
|
|
92
|
-
})}
|
|
93
|
-
/>
|
|
100
|
+
<ButtonContent loading={loading}>{children}</ButtonContent>
|
|
94
101
|
</button>
|
|
95
102
|
)
|
|
96
103
|
case 'secondary':
|
|
@@ -107,20 +114,7 @@ function Button({
|
|
|
107
114
|
{...props}
|
|
108
115
|
disabled={props.disabled || loading}
|
|
109
116
|
aria-busy={loading}>
|
|
110
|
-
<
|
|
111
|
-
data-label='text-content'
|
|
112
|
-
className={clsx('flex flex-nowrap gap-2 [grid-area:stack]', {
|
|
113
|
-
visible: !loading,
|
|
114
|
-
invisible: loading
|
|
115
|
-
})}>
|
|
116
|
-
{children}
|
|
117
|
-
</span>
|
|
118
|
-
<Spinner
|
|
119
|
-
className={clsx('mx-auto my-auto h-[1em] w-[1em] text-current', '[grid-area:stack]', {
|
|
120
|
-
visible: loading,
|
|
121
|
-
invisible: !loading
|
|
122
|
-
})}
|
|
123
|
-
/>
|
|
117
|
+
<ButtonContent loading={loading}>{children}</ButtonContent>
|
|
124
118
|
</button>
|
|
125
119
|
)
|
|
126
120
|
case 'tertiary':
|
|
@@ -134,28 +128,7 @@ function Button({
|
|
|
134
128
|
{...props}
|
|
135
129
|
disabled={props.disabled || loading}
|
|
136
130
|
aria-busy={loading}>
|
|
137
|
-
<
|
|
138
|
-
data-label='text-content'
|
|
139
|
-
className={clsx(`col-start-1 row-start-1 flex flex-nowrap gap-2`, {
|
|
140
|
-
invisible: loading,
|
|
141
|
-
visible: !loading
|
|
142
|
-
})}>
|
|
143
|
-
{children}
|
|
144
|
-
</span>
|
|
145
|
-
|
|
146
|
-
{loading && (
|
|
147
|
-
<div className='col-start-1 row-start-1'>
|
|
148
|
-
<Spinner
|
|
149
|
-
className={clsx(
|
|
150
|
-
'col-start-1 row-start-1 mx-auto my-auto h-[1em] w-[1em] text-current',
|
|
151
|
-
{
|
|
152
|
-
visible: loading,
|
|
153
|
-
invisible: !loading
|
|
154
|
-
}
|
|
155
|
-
)}
|
|
156
|
-
/>
|
|
157
|
-
</div>
|
|
158
|
-
)}
|
|
131
|
+
<ButtonContent loading={loading}>{children}</ButtonContent>
|
|
159
132
|
</button>
|
|
160
133
|
)
|
|
161
134
|
case 'brand':
|
|
@@ -172,20 +145,7 @@ function Button({
|
|
|
172
145
|
{...props}
|
|
173
146
|
disabled={props.disabled || loading}
|
|
174
147
|
aria-busy={loading}>
|
|
175
|
-
<
|
|
176
|
-
data-label='text-content'
|
|
177
|
-
className={clsx('flex flex-nowrap gap-2 [grid-area:stack]', {
|
|
178
|
-
visible: !loading,
|
|
179
|
-
invisible: loading
|
|
180
|
-
})}>
|
|
181
|
-
{children}
|
|
182
|
-
</span>
|
|
183
|
-
<Spinner
|
|
184
|
-
className={clsx('mx-auto my-auto h-[1em] w-[1em] text-current', '[grid-area:stack]', {
|
|
185
|
-
visible: loading,
|
|
186
|
-
invisible: !loading
|
|
187
|
-
})}
|
|
188
|
-
/>
|
|
148
|
+
<ButtonContent loading={loading}>{children}</ButtonContent>
|
|
189
149
|
</button>
|
|
190
150
|
)
|
|
191
151
|
default:
|
|
@@ -205,20 +165,7 @@ function Button({
|
|
|
205
165
|
{...props}
|
|
206
166
|
disabled={props.disabled || loading}
|
|
207
167
|
aria-busy={loading}>
|
|
208
|
-
<
|
|
209
|
-
data-label='text-content'
|
|
210
|
-
className={clsx('flex flex-nowrap gap-2 [grid-area:stack]', {
|
|
211
|
-
visible: !loading,
|
|
212
|
-
invisible: loading
|
|
213
|
-
})}>
|
|
214
|
-
{children}
|
|
215
|
-
</span>
|
|
216
|
-
<Spinner
|
|
217
|
-
className={clsx('mx-auto my-auto h-[1em] w-[1em] text-current', '[grid-area:stack]', {
|
|
218
|
-
visible: loading,
|
|
219
|
-
invisible: !loading
|
|
220
|
-
})}
|
|
221
|
-
/>
|
|
168
|
+
<ButtonContent loading={loading}>{children}</ButtonContent>
|
|
222
169
|
</button>
|
|
223
170
|
)
|
|
224
171
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
<svg viewBox="0 0 16
|
|
1
|
+
<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
2
|
<path fill-rule="evenodd" clip-rule="evenodd"
|
|
3
|
-
d="M0
|
|
4
|
-
fill="currentColor" />
|
|
3
|
+
d="M0 8C0 3.58172 3.58172 0 8 0C12.4183 0 16 3.58172 16 8C16 12.4183 12.4183 16 8 16C3.58172 16 0 12.4183 0 8ZM8 1C4.13401 1 1 4.13401 1 8C1 11.866 4.13401 15 8 15C11.866 15 15 11.866 15 8C15 4.13401 11.866 1 8 1ZM7 5C7 4.44772 7.44772 4 8 4C8.55229 4 9 4.44772 9 5C9 5.55228 8.55229 6 8 6C7.44772 6 7 5.55228 7 5ZM7 7H7.5C8.32843 7 9 7.67157 9 8.5V12H8V8.5C8 8.22386 7.77614 8 7.5 8H7V7Z"
|
|
4
|
+
fill="currentColor" shape-rendering="geometricPrecision" />
|
|
5
5
|
</svg>
|
|
@@ -71,7 +71,7 @@ const ChatInput = forwardRef<HTMLTextAreaElement, ChatInputProps>(
|
|
|
71
71
|
ref={ref}
|
|
72
72
|
className={clsx(
|
|
73
73
|
clsx(
|
|
74
|
-
'max-h-12 w-full resize-none border-none bg-transparent text-neutral-900 outline-none outline-0 placeholder:text-neutral-600',
|
|
74
|
+
'max-h-12 w-full resize-none border-none bg-transparent text-sm/normal text-neutral-900 outline-none outline-0 placeholder:text-neutral-600',
|
|
75
75
|
styles.textArea
|
|
76
76
|
),
|
|
77
77
|
{ 'cursor-not-allowed opacity-40': inputDisabled }
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { type CSSProperties, useState } from 'react'
|
|
1
2
|
import clsx from 'clsx'
|
|
2
3
|
import dayjs from 'dayjs'
|
|
3
|
-
import type { CSSProperties } from 'react'
|
|
4
4
|
import { useTranslation } from 'react-i18next'
|
|
5
5
|
|
|
6
6
|
import { DataHubService } from '@/src/config/datahub'
|
|
@@ -17,18 +17,28 @@ export type MessageActionsProps = {
|
|
|
17
17
|
|
|
18
18
|
function MessageActions({ message, className, showActions = false }: MessageActionsProps) {
|
|
19
19
|
const { t } = useTranslation()
|
|
20
|
+
const [copying, setCopying] = useState(false)
|
|
21
|
+
const [reaction, setReaction] = useState<ButtonReactionsType | null>(null)
|
|
20
22
|
|
|
21
23
|
const copyToClipboard = (): void => {
|
|
22
24
|
if (!message.text) return
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
setCopying(true)
|
|
27
|
+
|
|
28
|
+
navigator.clipboard
|
|
29
|
+
.writeText(message.text)
|
|
30
|
+
.catch((err) => {
|
|
31
|
+
console.error('Failed to copy text: ', err)
|
|
32
|
+
})
|
|
33
|
+
.finally(() => {
|
|
34
|
+
setTimeout(() => setCopying(false), 1000)
|
|
35
|
+
})
|
|
27
36
|
}
|
|
28
37
|
|
|
29
38
|
const handleReaction = (reactionType: ButtonReactionsType = ButtonReactions.LIKE): void => {
|
|
30
39
|
const schema = new ClickHotmartTutor({ messageId: message.id, reactionType })
|
|
31
|
-
|
|
40
|
+
DataHubService.sendEvent({ schema })
|
|
41
|
+
setReaction(reactionType)
|
|
32
42
|
}
|
|
33
43
|
|
|
34
44
|
return (
|
|
@@ -42,16 +52,31 @@ function MessageActions({ message, className, showActions = false }: MessageActi
|
|
|
42
52
|
hidden: !showActions
|
|
43
53
|
})}>
|
|
44
54
|
<Button onClick={() => handleReaction()} aria-label={t('general.buttons.like')}>
|
|
45
|
-
<Icon
|
|
55
|
+
<Icon
|
|
56
|
+
name='like'
|
|
57
|
+
className={clsx('h-3 w-3.5', {
|
|
58
|
+
'text-info-500': reaction === ButtonReactions.LIKE
|
|
59
|
+
})}
|
|
60
|
+
/>
|
|
46
61
|
</Button>
|
|
47
62
|
<Button
|
|
48
63
|
className='rotate-180 scale-x-[-1]'
|
|
49
64
|
onClick={() => handleReaction(ButtonReactions.DISLIKE)}
|
|
50
65
|
aria-label={t('general.buttons.dislike')}>
|
|
51
|
-
<Icon
|
|
66
|
+
<Icon
|
|
67
|
+
name='like'
|
|
68
|
+
className={clsx('h-3 w-3.5', {
|
|
69
|
+
'text-danger-500': reaction === ButtonReactions.DISLIKE
|
|
70
|
+
})}
|
|
71
|
+
/>
|
|
52
72
|
</Button>
|
|
53
|
-
<Button onClick={copyToClipboard} aria-label={t('general.buttons.copy')}>
|
|
54
|
-
<Icon
|
|
73
|
+
<Button onClick={copyToClipboard} aria-label={t('general.buttons.copy')} disabled={copying}>
|
|
74
|
+
<Icon
|
|
75
|
+
name='copy'
|
|
76
|
+
className={clsx('h-3 w-3.5', {
|
|
77
|
+
'text-info-500': copying
|
|
78
|
+
})}
|
|
79
|
+
/>
|
|
55
80
|
</Button>
|
|
56
81
|
</div>
|
|
57
82
|
</div>
|
|
@@ -52,7 +52,9 @@ const MessagesContainer = forwardRef<
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
return (
|
|
55
|
-
<div
|
|
55
|
+
<div
|
|
56
|
+
ref={scrollerRef}
|
|
57
|
+
className='flex h-full flex-col gap-2 overflow-auto max-md:p-[1.125rem] md:p-5'>
|
|
56
58
|
<div className='mb-auto flex-1 self-center'>
|
|
57
59
|
<Button
|
|
58
60
|
className='max-w-max rounded-full border border-neutral-300 bg-neutral-200 px-2 py-1 text-xs/normal tracking-wide text-neutral-900'
|
|
@@ -11,8 +11,8 @@ function AIAvatar({
|
|
|
11
11
|
}: AIAvatarProps) {
|
|
12
12
|
return (
|
|
13
13
|
<figure
|
|
14
|
-
className={clsx('flex h-
|
|
15
|
-
<div className={clsx('flex h-
|
|
14
|
+
className={clsx('flex h-9 w-9 items-center justify-center rounded-full', styles.avatar)}>
|
|
15
|
+
<div className={clsx('flex h-8 w-8 items-center justify-center', className)}>
|
|
16
16
|
<Icon name='ai-color' className='h-6 w-6' aria-label='AI avatar Icon' />
|
|
17
17
|
</div>
|
|
18
18
|
</figure>
|
|
@@ -19,13 +19,6 @@ const MessageItemError = lazy(
|
|
|
19
19
|
() => import('@/src/modules/messages/components/message-item-error/message-item-error')
|
|
20
20
|
)
|
|
21
21
|
|
|
22
|
-
const MessageItemEndOfScroll = lazy(
|
|
23
|
-
() =>
|
|
24
|
-
import(
|
|
25
|
-
'@/src/modules/messages/components/message-item-end-of-scroll/message-item-end-of-scroll'
|
|
26
|
-
)
|
|
27
|
-
)
|
|
28
|
-
|
|
29
22
|
function ChatPage() {
|
|
30
23
|
const chatInputRef = useRef<HTMLTextAreaElement>(null)
|
|
31
24
|
const scrollerRef = useRef<HTMLDivElement>(null)
|
|
@@ -82,7 +75,7 @@ function ChatPage() {
|
|
|
82
75
|
buttonDisabled={messagesQuery?.isLoading || !value.trim()}
|
|
83
76
|
/>
|
|
84
77
|
}>
|
|
85
|
-
<div className='
|
|
78
|
+
<div className='max-md:px-[1.125rem] max-md:pt-[1.125rem] md:px-5 md:pt-5'>
|
|
86
79
|
<WidgetHeader enabledButtons={['info', 'close']} tutorName={settings?.tutorName} />
|
|
87
80
|
</div>
|
|
88
81
|
<MessagesContainer
|
|
@@ -92,13 +85,6 @@ function ChatPage() {
|
|
|
92
85
|
}}
|
|
93
86
|
showButton={messagesQuery.hasNextPage}
|
|
94
87
|
loading={messagesQuery.isFetchingNextPage}>
|
|
95
|
-
<MessageItemEndOfScroll
|
|
96
|
-
show={
|
|
97
|
-
!messagesQuery.isFetching &&
|
|
98
|
-
!messagesQuery.hasNextPage &&
|
|
99
|
-
Number(messagesQuery.data?.size) > 0
|
|
100
|
-
}
|
|
101
|
-
/>
|
|
102
88
|
{messagesQuery.data && <MessagesList messagesMap={messagesQuery.data} />}
|
|
103
89
|
<MessageItemError
|
|
104
90
|
show={messagesQuery.isError}
|
|
@@ -1,31 +1,42 @@
|
|
|
1
|
+
import clsx from 'clsx'
|
|
1
2
|
import { useTranslation } from 'react-i18next'
|
|
2
3
|
|
|
3
4
|
import { Button, Icon } from '@/src/lib/components'
|
|
4
5
|
import { TutorWidgetEvents } from '../../events'
|
|
5
|
-
import { useWidgetTabsAtom } from '../../store'
|
|
6
|
+
import { useWidgetGoBackTabAtom, useWidgetTabsAtom } from '../../store'
|
|
6
7
|
import { AIAvatar } from '../ai-avatar'
|
|
7
8
|
|
|
8
9
|
import type { WidgetHeaderContentProps, WidgetHeaderProps } from './types'
|
|
9
10
|
|
|
11
|
+
import styles from './styles.module.css'
|
|
12
|
+
|
|
10
13
|
export function WidgetHeaderContent({ tutorName }: WidgetHeaderContentProps) {
|
|
11
14
|
return (
|
|
12
15
|
<div className='flex w-full gap-2'>
|
|
13
16
|
<AIAvatar />
|
|
14
17
|
<div className='flex flex-col justify-center'>
|
|
15
|
-
{tutorName && <h4 className='text-
|
|
18
|
+
{tutorName && <h4 className='text-sm/loose font-bold'>{tutorName}</h4>}
|
|
16
19
|
</div>
|
|
17
20
|
</div>
|
|
18
21
|
)
|
|
19
22
|
}
|
|
20
23
|
|
|
21
24
|
export function WidgetHeaderContentWithoutMeta({ name }: { name?: string }) {
|
|
25
|
+
const [, goBack] = useWidgetGoBackTabAtom()
|
|
26
|
+
|
|
22
27
|
return (
|
|
23
|
-
<div
|
|
24
|
-
|
|
25
|
-
|
|
28
|
+
<div
|
|
29
|
+
className={clsx(
|
|
30
|
+
'grid-areas-[a_b] grid grid-cols-[auto_1fr] items-center gap-1',
|
|
31
|
+
styles.withoutMetaContainer
|
|
32
|
+
)}>
|
|
33
|
+
<Button className='grid-area-[a]' aria-label='Arrow Left Icon' onClick={goBack}>
|
|
34
|
+
<Icon name='arrow-left' className='h-3.5 w-3.5' aria-hidden />
|
|
26
35
|
</Button>
|
|
27
|
-
<div className='grid-area-[b] flex justify-center'>
|
|
28
|
-
<span>
|
|
36
|
+
<div className='grid-area-[b] flex min-h-6 justify-center text-center'>
|
|
37
|
+
<span className='absolute bottom-0 left-1/2 -translate-x-1/2 text-base font-bold'>
|
|
38
|
+
{name}
|
|
39
|
+
</span>
|
|
29
40
|
</div>
|
|
30
41
|
</div>
|
|
31
42
|
)
|
|
@@ -50,33 +61,44 @@ function WidgetHeader({
|
|
|
50
61
|
}
|
|
51
62
|
|
|
52
63
|
return (
|
|
53
|
-
<div className='
|
|
54
|
-
<div className='
|
|
55
|
-
|
|
56
|
-
{showContentWithoutMeta && !showContent && <WidgetHeaderContentWithoutMeta name={name} />}
|
|
57
|
-
</div>
|
|
58
|
-
<div className='shrink-0'>
|
|
59
|
-
<div className='grid-area-[b] ml-auto flex max-w-max gap-3 text-neutral-700'>
|
|
60
|
-
<Button
|
|
61
|
-
show={enabledButtons.includes('archive')}
|
|
62
|
-
onClick={handleClickArchive}
|
|
63
|
-
aria-label='Archive Icon'>
|
|
64
|
-
<Icon name='archive' className='h-4 w-4' aria-hidden />
|
|
65
|
-
</Button>
|
|
66
|
-
<Button
|
|
67
|
-
show={enabledButtons.includes('info')}
|
|
68
|
-
aria-label='Info Icon'
|
|
69
|
-
onClick={handleClickInfo}>
|
|
70
|
-
<Icon name='info' className='h-4 w-4' aria-hidden />
|
|
71
|
-
</Button>
|
|
64
|
+
<div className='mt-0.5 flex flex-col gap-2 text-neutral-900'>
|
|
65
|
+
<div className='flex justify-end'>
|
|
66
|
+
<div className={styles.closeContainer}>
|
|
72
67
|
<Button
|
|
68
|
+
className='text-neutral-500'
|
|
73
69
|
show={enabledButtons.includes('close')}
|
|
74
70
|
onClick={() => TutorWidgetEvents['c3po-app-widget-hide'].dispatch()}
|
|
75
71
|
aria-label='Close Icon'>
|
|
76
|
-
<Icon name='close' className='h-
|
|
72
|
+
<Icon name='close' className='h-3 w-3' aria-hidden />
|
|
77
73
|
</Button>
|
|
78
74
|
</div>
|
|
79
75
|
</div>
|
|
76
|
+
<div className='grid-areas-[a_b] grid grid-cols-[1fr_auto] items-center'>
|
|
77
|
+
<div className='grid-area-[a] relative'>
|
|
78
|
+
{showContent && !showContentWithoutMeta && <WidgetHeaderContent tutorName={name} />}
|
|
79
|
+
{showContentWithoutMeta && !showContent && <WidgetHeaderContentWithoutMeta name={name} />}
|
|
80
|
+
</div>
|
|
81
|
+
<div className='shrink-0'>
|
|
82
|
+
<div
|
|
83
|
+
className={clsx(
|
|
84
|
+
'grid-area-[b] ml-auto flex max-w-max gap-3 text-neutral-700',
|
|
85
|
+
styles.btnContainer
|
|
86
|
+
)}>
|
|
87
|
+
<Button
|
|
88
|
+
show={enabledButtons.includes('archive')}
|
|
89
|
+
onClick={handleClickArchive}
|
|
90
|
+
aria-label='Archive Icon'>
|
|
91
|
+
<Icon name='archive' className='h-4 w-4' aria-hidden />
|
|
92
|
+
</Button>
|
|
93
|
+
<Button
|
|
94
|
+
show={enabledButtons.includes('info')}
|
|
95
|
+
aria-label='Info Icon'
|
|
96
|
+
onClick={handleClickInfo}>
|
|
97
|
+
<Icon name='info' className='h-4 w-4' aria-hidden />
|
|
98
|
+
</Button>
|
|
99
|
+
</div>
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
80
102
|
</div>
|
|
81
103
|
)
|
|
82
104
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import clsx from 'clsx'
|
|
2
2
|
import { useTranslation } from 'react-i18next'
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
import { useWidgetSettingsAtom, useWidgetTabsAtom } from '../../store'
|
|
4
|
+
import { useWidgetSettingsAtom } from '../../store'
|
|
6
5
|
import { AIAvatar } from '../ai-avatar'
|
|
6
|
+
import { WidgetHeader } from '../header'
|
|
7
7
|
import { PageLayout } from '../page-layout'
|
|
8
8
|
|
|
9
9
|
import { infoItems } from './constants'
|
|
@@ -11,27 +11,21 @@ import { InformationCard } from './information-card'
|
|
|
11
11
|
|
|
12
12
|
function WidgetInformationPage() {
|
|
13
13
|
const { t } = useTranslation()
|
|
14
|
-
const [, setWidgetTabs] = useWidgetTabsAtom()
|
|
15
14
|
const [settings] = useWidgetSettingsAtom()
|
|
16
15
|
const isDarkMode = settings?.config?.theme === 'dark'
|
|
17
16
|
|
|
18
17
|
return (
|
|
19
|
-
<PageLayout className='
|
|
20
|
-
<div
|
|
21
|
-
|
|
22
|
-
'
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
aria-label='Return Button'
|
|
28
|
-
onClick={() => setWidgetTabs('chat')}>
|
|
29
|
-
<Icon name='arrow-left' width={16} height={16} />
|
|
30
|
-
</button>
|
|
31
|
-
<h1 className='mx-auto font-bold'>{t('info.title')}</h1>
|
|
18
|
+
<PageLayout className='flex min-h-0 flex-col text-neutral-900 max-md:p-[1.125rem] md:p-5'>
|
|
19
|
+
<div className='mb-4'>
|
|
20
|
+
<WidgetHeader
|
|
21
|
+
enabledButtons={['close']}
|
|
22
|
+
showContent={false}
|
|
23
|
+
showContentWithoutMeta
|
|
24
|
+
tutorName={t('info.title')}
|
|
25
|
+
/>
|
|
32
26
|
</div>
|
|
33
27
|
|
|
34
|
-
<div className='
|
|
28
|
+
<div className='my-8 flex justify-center'>
|
|
35
29
|
<div className='flex flex-col items-center gap-2'>
|
|
36
30
|
<AIAvatar />
|
|
37
31
|
|
|
@@ -32,7 +32,7 @@ function WidgetLoadingPage() {
|
|
|
32
32
|
return (
|
|
33
33
|
<PageLayout
|
|
34
34
|
asideChild={<ChatInput name='new-chat-msg-input' ref={chatInputRef} loading={true} />}>
|
|
35
|
-
<div className='
|
|
35
|
+
<div className='flex h-full flex-col justify-start max-md:p-[1.125rem] md:p-5'>
|
|
36
36
|
<WidgetHeader enabledButtons={['close']} showContent={false} />
|
|
37
37
|
<div className='mt-auto'>
|
|
38
38
|
<MessageSkeleton />
|
|
@@ -90,14 +90,10 @@ function WidgetStarterPage() {
|
|
|
90
90
|
}>
|
|
91
91
|
<div className='grid-areas-[a_b] grid h-full grid-cols-1 grid-rows-[1fr_auto]'>
|
|
92
92
|
<div
|
|
93
|
-
className={clsx('grid-area-[a] flex min-h-0 flex-col
|
|
93
|
+
className={clsx('grid-area-[a] flex min-h-0 flex-col max-md:p-[1.125rem] md:p-5', {
|
|
94
94
|
[styles.bg]: settings?.config?.theme === 'dark'
|
|
95
95
|
})}>
|
|
96
|
-
<WidgetHeader
|
|
97
|
-
enabledButtons={['archive', 'info', 'close']}
|
|
98
|
-
tutorName={name}
|
|
99
|
-
showContent={false}
|
|
100
|
-
/>
|
|
96
|
+
<WidgetHeader enabledButtons={['archive', 'info', 'close']} tutorName={name} />
|
|
101
97
|
|
|
102
98
|
<div className='my-auto'>
|
|
103
99
|
<GreetingsCard
|
|
@@ -51,4 +51,4 @@ export const goBackTabAtom = atom(null, (get, set) => {
|
|
|
51
51
|
export const useGetWidgetTabsAtom = () => useAtom(widgetTabsAtom)
|
|
52
52
|
export const useWidgetTabsAtom = () => useAtom(setWidgetTabsAtom)
|
|
53
53
|
export const useWidgetTabsValueAtom = () => useAtomValue(setWidgetTabsAtom)
|
|
54
|
-
export const
|
|
54
|
+
export const useWidgetGoBackTabAtom = () => useAtom(goBackTabAtom)
|
package/tailwind.config.js
CHANGED
|
@@ -90,14 +90,12 @@ module.exports = {
|
|
|
90
90
|
900: 'var(--hc-color-neutral-900)',
|
|
91
91
|
1000: 'var(--hc-color-neutral-1000)'
|
|
92
92
|
},
|
|
93
|
-
ai:
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
'gradient-accent': 'var(--ai-color-gradient-accent)'
|
|
100
|
-
}
|
|
93
|
+
'ai-primary': 'var(--ai-color-primary)',
|
|
94
|
+
'ai-secondary': 'var(--ai-color-secondary)',
|
|
95
|
+
'ai-dark': 'var(--ai-color-dark)',
|
|
96
|
+
'ai-chat-response': 'var(--ai-color-chat-response)',
|
|
97
|
+
'ai-gradient-primary': 'var(--ai-color-gradient-primary)',
|
|
98
|
+
'ai-gradient-accent': 'var(--ai-color-gradient-accent)'
|
|
101
99
|
}
|
|
102
100
|
}
|
|
103
101
|
},
|