app-tutor-ai-consumer 1.21.1 → 1.21.2

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.
Files changed (26) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/config/rspack/utils/envs.js +2 -1
  3. package/environments/.env.development +2 -0
  4. package/environments/.env.production +2 -0
  5. package/environments/.env.staging +3 -0
  6. package/environments/.env.test +4 -1
  7. package/package.json +2 -1
  8. package/src/lib/components/button/button.tsx +1 -1
  9. package/src/lib/components/horizontal-draggable-scroll/horizontal-draggable-scroll.tsx +62 -0
  10. package/src/lib/components/horizontal-draggable-scroll/index.ts +2 -0
  11. package/src/lib/components/icons/clone.svg +5 -0
  12. package/src/lib/components/icons/double-check.svg +5 -0
  13. package/src/lib/components/icons/icon-names.d.ts +7 -3
  14. package/src/lib/components/icons/paste.svg +5 -0
  15. package/src/lib/components/index.ts +1 -0
  16. package/src/modules/messages/components/message-actions/message-actions.tsx +5 -2
  17. package/src/modules/messages/components/message-item/message-item.tsx +7 -3
  18. package/src/modules/messages/components/message-item-error/message-item-error.tsx +1 -1
  19. package/src/modules/messages/components/message-skeleton/message-skeleton.tsx +8 -5
  20. package/src/modules/messages/components/message-skeleton/styles.module.css +19 -0
  21. package/src/modules/messages/components/messages-container/messages-container.tsx +90 -67
  22. package/src/modules/widget/components/avatar-animation/avatar-animation.tsx +13 -0
  23. package/src/modules/widget/components/avatar-animation/index.ts +2 -0
  24. package/src/modules/widget/components/chat-page/chat-page.tsx +7 -11
  25. package/src/modules/widget/components/index.ts +1 -0
  26. package/src/modules/widget/components/starter-page/starter-page.tsx +3 -3
package/CHANGELOG.md CHANGED
@@ -1,3 +1,5 @@
1
+ ## [1.21.2](https://github.com/Hotmart-Org/app-tutor-ai-consumer/compare/v1.21.1...v1.21.2) (2025-08-01)
2
+
1
3
  ## [1.21.1](https://github.com/Hotmart-Org/app-tutor-ai-consumer/compare/v1.21.0...v1.21.1) (2025-07-31)
2
4
 
3
5
  # [1.21.0](https://github.com/Hotmart-Org/app-tutor-ai-consumer/compare/v1.20.0...v1.21.0) (2025-07-29)
@@ -20,7 +20,8 @@ const envs = [
20
20
  'VLC_PASSWORD',
21
21
  'SECURITY_BASE_URL',
22
22
  'AUTH_CLIENT_SECRET',
23
- 'BUNDLE_PATH'
23
+ 'BUNDLE_PATH',
24
+ 'STATIC_URL'
24
25
  ]
25
26
 
26
27
  const localEnvs = ['MEMBERSHIP_SLUG']
@@ -40,3 +40,5 @@ AUTH_CLIENT_SECRET=Basic OWRiYThiNTYtMWE5OC0xMWU5LWFiMTQtZDY2M2JkODczZDkzOmFiZmR
40
40
  # BUNDLE
41
41
  BUNDLE_PATH=https://local.buildstaging.com:4223
42
42
 
43
+ # STATIC
44
+ STATIC_URL=https://static.hotmart.com
@@ -39,3 +39,5 @@ AUTH_CLIENT_SECRET=
39
39
  # BUNDLE
40
40
  BUNDLE_PATH=https://app-club-microfrontends-prod.cp.hotmart.com
41
41
 
42
+ # STATIC
43
+ STATIC_URL=https://static.hotmart.com
@@ -38,3 +38,6 @@ AUTH_CLIENT_SECRET=
38
38
 
39
39
  # BUNDLE
40
40
  BUNDLE_PATH=https://app-club-microfrontends.buildstaging.com
41
+
42
+ # STATIC
43
+ STATIC_URL=https://static.hotmart.com
@@ -40,4 +40,7 @@ AUTH_CLIENT_SECRET=
40
40
  # BUNDLE
41
41
  BUNDLE_PATH=
42
42
 
43
- VITE_REACT_QUERY_EXPERIMENTAL_PREFETCH_IN_RENDER=true
43
+ VITE_REACT_QUERY_EXPERIMENTAL_PREFETCH_IN_RENDER=true
44
+
45
+ # STATIC
46
+ STATIC_URL=
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "app-tutor-ai-consumer",
3
- "version": "1.21.1",
3
+ "version": "1.21.2",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "dev": "rspack serve --env=development --config config/rspack/rspack.config.js",
@@ -106,6 +106,7 @@
106
106
  "@hot-observability-js/react": "~1.1.0",
107
107
  "@hotmart/event-agent-js": "~1.1.2",
108
108
  "@hotmart/sparkie": "~5.1.0",
109
+ "@lottiefiles/dotlottie-react": "~0.14.4",
109
110
  "@optimizely/react-sdk": "~3.2.4",
110
111
  "@tanstack/query-sync-storage-persister": "~5.80.7",
111
112
  "@tanstack/react-query": "~5.80.6",
@@ -42,7 +42,7 @@ function Button({
42
42
  ...props
43
43
  }: ButtonProps) {
44
44
  const defaultClasses =
45
- 'rounded focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 text-base font-medium'
45
+ 'rounded outline-none focus-visible:ring-2 focus-visible:ring-blue-500 text-base font-medium'
46
46
  const defaultBorder = 'border border-transparent'
47
47
  const defaultPadding = 'px-4 py-2'
48
48
  const disabledClasses = 'cursor-not-allowed'
@@ -0,0 +1,62 @@
1
+ import { useRef, useState } from 'react'
2
+ import clsx from 'clsx'
3
+ import type { MouseEventHandler, PropsWithChildren, WheelEvent } from 'react'
4
+
5
+ export type HorizontalDraggableScrollProps = PropsWithChildren<{ className?: string }>
6
+
7
+ function HorizontalDraggableScroll({ children, className }: HorizontalDraggableScrollProps) {
8
+ const containerRef = useRef<HTMLDivElement>(null)
9
+ const [isDragging, setIsDragging] = useState(false)
10
+ const [startX, setStartX] = useState(0)
11
+ const [scrollLeft, setScrollLeft] = useState(0)
12
+
13
+ const handleMouseDown: MouseEventHandler<HTMLDivElement> = (e) => {
14
+ const container = containerRef.current
15
+
16
+ if (!container) return
17
+
18
+ setIsDragging(true)
19
+ setStartX(e.clientX)
20
+ setScrollLeft(container.scrollLeft)
21
+ }
22
+
23
+ const handleMouseMove: MouseEventHandler<HTMLDivElement> = (e) => {
24
+ const container = containerRef.current
25
+
26
+ if (!container || !isDragging) return
27
+
28
+ e.preventDefault()
29
+
30
+ const walk = e.clientX - startX
31
+
32
+ container.scrollLeft = scrollLeft - walk
33
+ }
34
+
35
+ const handleMouseUp = () => {
36
+ setIsDragging(false)
37
+ }
38
+
39
+ const handleWheel = (e: WheelEvent<HTMLDivElement>) => {
40
+ e.currentTarget.scrollLeft += e.deltaY
41
+ }
42
+
43
+ return (
44
+ <div
45
+ ref={containerRef}
46
+ onMouseDown={handleMouseDown}
47
+ onMouseMove={handleMouseMove}
48
+ onMouseUp={handleMouseUp}
49
+ onMouseLeave={handleMouseUp}
50
+ onWheel={handleWheel}
51
+ className={clsx(
52
+ {
53
+ 'cursor-grabbing select-none': isDragging
54
+ },
55
+ className
56
+ )}>
57
+ {children}
58
+ </div>
59
+ )
60
+ }
61
+
62
+ export default HorizontalDraggableScroll
@@ -0,0 +1,2 @@
1
+ export * from './horizontal-draggable-scroll'
2
+ export { default as HorizontalDraggableScroll } from './horizontal-draggable-scroll'
@@ -0,0 +1,5 @@
1
+ <svg aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg"
2
+ viewBox="0 0 512 512">
3
+ <path fill="currentColor"
4
+ d="M64 480H288c17.7 0 32-14.3 32-32V384h32v64c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V224c0-35.3 28.7-64 64-64h64v32H64c-17.7 0-32 14.3-32 32V448c0 17.7 14.3 32 32 32zM224 320H448c17.7 0 32-14.3 32-32V64c0-17.7-14.3-32-32-32H224c-17.7 0-32 14.3-32 32V288c0 17.7 14.3 32 32 32zm-64-32V64c0-35.3 28.7-64 64-64H448c35.3 0 64 28.7 64 64V288c0 35.3-28.7 64-64 64H224c-35.3 0-64-28.7-64-64z"></path>
5
+ </svg>
@@ -0,0 +1,5 @@
1
+ <svg aria-hidden="true" focusable="false" role="img"
2
+ xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
3
+ <path fill="currentColor"
4
+ d="M331.3 75.3c6.2-6.2 6.2-16.4 0-22.6s-16.4-6.2-22.6 0L160 201.4 91.3 132.7c-6.2-6.2-16.4-6.2-22.6 0s-6.2 16.4 0 22.6l80 80c6.2 6.2 16.4 6.2 22.6 0l160-160zm112 112c6.2-6.2 6.2-16.4 0-22.6s-16.4-6.2-22.6 0L160 425.4 27.3 292.7c-6.2-6.2-16.4-6.2-22.6 0s-6.2 16.4 0 22.6l144 144c6.2 6.2 16.4 6.2 22.6 0l272-272z"></path>
5
+ </svg>
@@ -5,13 +5,17 @@ export type ValidIconNames =
5
5
  | 'arrow-down'
6
6
  | 'arrow-left'
7
7
  | 'arrow-up'
8
+ | 'book'
8
9
  | 'chevron-down'
9
- | 'copy'
10
+ | 'clone'
10
11
  | 'close'
12
+ | 'copy'
13
+ | 'double-check'
14
+ | 'gallery'
11
15
  | 'info'
16
+ | 'interrogation'
12
17
  | 'like'
18
+ | 'paste'
13
19
  | 'send'
14
20
  | 'stop'
15
21
  | 'warning'
16
- | 'interrogation'
17
- | 'gallery'
@@ -0,0 +1,5 @@
1
+ <svg aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg"
2
+ viewBox="0 0 512 512">
3
+ <path fill="currentColor"
4
+ d="M160 32c11.6 0 21.3 8.2 23.5 19.2C185 58.6 191.6 64 199.2 64H208c8.8 0 16 7.2 16 16V96H96V80c0-8.8 7.2-16 16-16h8.8c7.6 0 14.2-5.4 15.7-12.8C138.7 40.2 148.4 32 160 32zM64 64h2.7C65 69 64 74.4 64 80V96c0 17.7 14.3 32 32 32H224c17.7 0 32-14.3 32-32V80c0-5.6-1-11-2.7-16H256c17.7 0 32 14.3 32 32h32c0-35.3-28.7-64-64-64H210.6c-9-18.9-28.3-32-50.6-32s-41.6 13.1-50.6 32H64C28.7 32 0 60.7 0 96V384c0 35.3 28.7 64 64 64H192V416H64c-17.7 0-32-14.3-32-32V96c0-17.7 14.3-32 32-32zM288 480c-17.7 0-32-14.3-32-32V192c0-17.7 14.3-32 32-32h96v56c0 22.1 17.9 40 40 40h56V448c0 17.7-14.3 32-32 32H288zM416 165.3L474.7 224H424c-4.4 0-8-3.6-8-8V165.3zM448 512c35.3 0 64-28.7 64-64V235.9c0-12.7-5.1-24.9-14.1-33.9l-59.9-59.9c-9-9-21.2-14.1-33.9-14.1H288c-35.3 0-64 28.7-64 64V448c0 35.3 28.7 64 64 64H448z"></path>
5
+ </svg>
@@ -1,5 +1,6 @@
1
1
  export * from './button'
2
2
  export * from './errors'
3
+ export * from './horizontal-draggable-scroll'
3
4
  export * from './icons'
4
5
  export * from './markdownrenderer'
5
6
  export * from './spinner'
@@ -18,6 +18,7 @@ export type MessageActionsProps = {
18
18
  function MessageActions({ message, className, showActions = false }: MessageActionsProps) {
19
19
  const { t } = useTranslation()
20
20
  const [copying, setCopying] = useState(false)
21
+ const [copied, setCopied] = useState(false)
21
22
  const [reaction, setReaction] = useState<ButtonReactionsType | null>(null)
22
23
 
23
24
  const copyToClipboard = (): void => {
@@ -27,11 +28,13 @@ function MessageActions({ message, className, showActions = false }: MessageActi
27
28
 
28
29
  navigator.clipboard
29
30
  .writeText(message.text)
31
+ .then(() => setCopied(true))
30
32
  .catch((err) => {
31
33
  console.error('Failed to copy text: ', err)
32
34
  })
33
35
  .finally(() => {
34
36
  setTimeout(() => setCopying(false), 1000)
37
+ setTimeout(() => setCopied(false), 3000)
35
38
  })
36
39
  }
37
40
 
@@ -72,9 +75,9 @@ function MessageActions({ message, className, showActions = false }: MessageActi
72
75
  </Button>
73
76
  <Button onClick={copyToClipboard} aria-label={t('general.buttons.copy')} disabled={copying}>
74
77
  <Icon
75
- name='copy'
78
+ name={copied ? 'paste' : 'copy'}
76
79
  className={clsx('h-3 w-3.5', {
77
- 'text-info-500': copying
80
+ 'text-info-500': copied
78
81
  })}
79
82
  />
80
83
  </Button>
@@ -25,10 +25,14 @@ function MessageItem({ message }: { message: ParsedMessage }) {
25
25
  <div
26
26
  data-test='messages-item'
27
27
  className={clsx('w-full overflow-x-hidden rounded-lg px-3', {
28
- 'bg-neutral-200': messageFromUser,
29
- 'border border-neutral-300 bg-neutral-100': messageFromAi
28
+ 'max-w-max bg-[rgb(from_var(--hc-color-neutral-300)_r_g_b_/_0.8)]': messageFromUser,
29
+ 'bg-neutral-200': messageFromAi
30
30
  })}>
31
- <MarkdownRenderer content={message?.text ?? message?.name} imgComponent={imgComponent} />
31
+ <MarkdownRenderer
32
+ content={message?.text ?? message?.name}
33
+ imgComponent={imgComponent}
34
+ className='w-full'
35
+ />
32
36
  </div>
33
37
  <MessageActions
34
38
  className={clsx('flex items-center justify-between gap-2', {
@@ -20,7 +20,7 @@ function MessageItemError({ message, retry, show = true }: MessageItemErrorProps
20
20
  if (!show) return null
21
21
 
22
22
  return (
23
- <div className='mt-2 flex justify-start gap-2 rounded border border-danger-500 bg-neutral-200 p-4 text-neutral-800'>
23
+ <div className='absolute bottom-4 flex justify-start gap-2 rounded border border-danger-500 bg-neutral-200 p-4 text-neutral-800 max-md:inset-x-[1.125rem] md:inset-x-5'>
24
24
  <span>{t('chat_page.error.loading.content')}</span>
25
25
  <Button variant='tertiary' className='px-4 text-sm/relaxed text-danger-400' onClick={retry}>
26
26
  {t('chat_page.error.loading.action')}
@@ -1,15 +1,18 @@
1
1
  import { forwardRef } from 'react'
2
+ import clsx from 'clsx'
2
3
 
3
- import { AIAvatarIcon } from '@/src/modules/widget'
4
+ import { AvatarAnimation } from '@/src/modules/widget'
5
+
6
+ import styles from './styles.module.css'
4
7
 
5
8
  const MessageSkeleton = forwardRef<HTMLDivElement>((_, ref) => {
6
9
  return (
7
10
  <div ref={ref} className='flex flex-col items-start gap-2' aria-label='Loading Component'>
8
- <AIAvatarIcon className='rounded-lg bg-ai-chat-response' />
11
+ <AvatarAnimation />
9
12
  <div className='flex w-full flex-col items-start gap-2'>
10
- <div className='h-3 w-full animate-pulse rounded-full bg-neutral-200 transition-colors delay-0' />
11
- <div className='h-3 w-[83%] animate-pulse rounded-full bg-neutral-200 transition-colors delay-75' />
12
- <div className='h-3 w-[56%] animate-pulse rounded-full bg-neutral-200 transition-colors delay-100' />
13
+ <div className={clsx('h-3 w-full rounded-full', styles.shine)} />
14
+ <div className={clsx('h-3 w-[83%] rounded-full', styles.shine)} />
15
+ <div className={clsx('h-3 w-[56%] rounded-full', styles.shine)} />
13
16
  </div>
14
17
  </div>
15
18
  )
@@ -0,0 +1,19 @@
1
+ .shine {
2
+ background: linear-gradient(
3
+ 90deg,
4
+ var(--hc-color-neutral-200) 33%,
5
+ rgb(from var(--hc-color-neutral-900) r g b / 0.3) 53%,
6
+ var(--hc-color-neutral-200) 76%
7
+ );
8
+ background-size: 295% 100%;
9
+ animation: shine 1500ms infinite alternate;
10
+ }
11
+
12
+ @keyframes shine {
13
+ 0% {
14
+ background-position: right;
15
+ }
16
+ 100% {
17
+ background-position: left;
18
+ }
19
+ }
@@ -1,4 +1,4 @@
1
- import { forwardRef, useEffect } from 'react'
1
+ import { forwardRef, lazy, Suspense, useEffect } from 'react'
2
2
  import clsx from 'clsx'
3
3
  import type { MouseEventHandler, PropsWithChildren } from 'react'
4
4
  import { createPortal } from 'react-dom'
@@ -14,79 +14,102 @@ import {
14
14
  } from '@/src/modules/widget'
15
15
  import { useScroller } from '../../hooks'
16
16
 
17
- const MessagesContainer = forwardRef<
18
- HTMLDivElement,
19
- PropsWithChildren<{
20
- showButton?: boolean
21
- loading?: boolean
22
- handleShowMore?: () => Promise<void>
23
- }>
24
- >(({ children, handleShowMore, showButton = false, loading = false }, forwardedRef) => {
25
- const { t } = useTranslation()
26
- const skeletonRef = useSkeletonRef()
27
- const [isLoadingNewMsg] = useWidgetLoadingAtom()
28
- const mainLayoutRef = usePageLayoutMainRefContext()
29
- const { scrollerRef, scrollToButtonRef, scrollToBottom, showScrollButton } =
30
- useScroller(forwardedRef)
17
+ const MessageItemError = lazy(
18
+ () => import('@/src/modules/messages/components/message-item-error/message-item-error')
19
+ )
31
20
 
32
- useEffect(() => {
33
- scrollToBottom()
34
- }, [scrollToBottom])
21
+ export type MessagesContainerProps = PropsWithChildren<{
22
+ showButton?: boolean
23
+ loading?: boolean
24
+ handleShowMore?: () => Promise<void>
25
+ error?: {
26
+ show: boolean
27
+ message: string
28
+ retry: () => void
29
+ }
30
+ }>
35
31
 
36
- const handleClickShowMore: MouseEventHandler<HTMLButtonElement> = (e) => {
37
- const scroller = scrollerRef?.current
38
- const heightBeforeRender = Number(e?.currentTarget?.scrollHeight)
32
+ const MessagesContainer = forwardRef<HTMLDivElement, MessagesContainerProps>(
33
+ ({ children, handleShowMore, error, showButton = false, loading = false }, forwardedRef) => {
34
+ const { t } = useTranslation()
35
+ const skeletonRef = useSkeletonRef()
36
+ const [isLoadingNewMsg] = useWidgetLoadingAtom()
37
+ const mainLayoutRef = usePageLayoutMainRefContext()
38
+ const { scrollerRef, scrollToButtonRef, scrollToBottom, showScrollButton } =
39
+ useScroller(forwardedRef)
39
40
 
40
- void handleShowMore?.().then(() => {
41
- if (scroller && !isNaN(heightBeforeRender)) {
42
- setTimeout(
43
- () =>
44
- scroller.scrollTo({
45
- top: heightBeforeRender + 10,
46
- behavior: 'smooth'
47
- }),
48
- 180
49
- )
50
- }
51
- })
52
- }
41
+ useEffect(() => {
42
+ scrollToBottom()
43
+ }, [scrollToBottom])
53
44
 
54
- return (
55
- <div
56
- ref={scrollerRef}
57
- className='flex h-full flex-col gap-2 overflow-auto max-md:p-[1.125rem] md:p-5'>
58
- <div className='mb-auto flex-1 self-center'>
59
- <Button
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'
61
- onClick={handleClickShowMore}
62
- loading={loading}
63
- show={showButton}>
64
- <Icon name='arrow-up' className='h-4 w-3' aria-hidden />
65
- <span className='text-nowrap'>{t('general.buttons.show_more')}</span>
66
- </Button>
67
- </div>
68
- {children}
45
+ const handleClickShowMore: MouseEventHandler<HTMLButtonElement> = (e) => {
46
+ const scroller = scrollerRef?.current
47
+ const heightBeforeRender = Number(e?.currentTarget?.scrollHeight)
48
+
49
+ void handleShowMore?.().then(() => {
50
+ if (scroller && !isNaN(heightBeforeRender)) {
51
+ setTimeout(
52
+ () =>
53
+ scroller.scrollTo({
54
+ top: heightBeforeRender + 10,
55
+ behavior: 'smooth'
56
+ }),
57
+ 180
58
+ )
59
+ }
60
+ })
61
+ }
69
62
 
70
- {mainLayoutRef.current &&
71
- createPortal(
72
- <ScrollToBottomButton
73
- ref={scrollToButtonRef}
74
- show={showScrollButton}
75
- onClick={scrollToBottom}
76
- />,
77
- mainLayoutRef.current
78
- )}
63
+ return (
79
64
  <div
80
- className={clsx({
81
- 'pointer-events-none h-0 overflow-hidden opacity-0': !isLoadingNewMsg,
82
- 'mt-2 pb-4': isLoadingNewMsg
83
- })}
84
- ref={skeletonRef}>
85
- <MessageSkeleton />
65
+ ref={scrollerRef}
66
+ className='flex h-full flex-col gap-2 overflow-auto max-md:p-[1.125rem] md:p-5'>
67
+ <div className='mb-auto flex-1 self-center'>
68
+ <Button
69
+ 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'
70
+ onClick={handleClickShowMore}
71
+ loading={loading}
72
+ show={showButton}>
73
+ <Icon name='arrow-up' className='h-4 w-3' aria-hidden />
74
+ <span className='text-nowrap'>{t('general.buttons.show_more')}</span>
75
+ </Button>
76
+ </div>
77
+ {children}
78
+
79
+ {error?.show &&
80
+ mainLayoutRef.current &&
81
+ createPortal(
82
+ <Suspense fallback={<div aria-live='polite' />}>
83
+ <MessageItemError
84
+ message={`❌ Error loading messages: ${error?.message}`}
85
+ show={error?.show}
86
+ retry={error?.retry}
87
+ />
88
+ </Suspense>,
89
+ mainLayoutRef.current
90
+ )}
91
+
92
+ {mainLayoutRef.current &&
93
+ createPortal(
94
+ <ScrollToBottomButton
95
+ ref={scrollToButtonRef}
96
+ show={showScrollButton}
97
+ onClick={scrollToBottom}
98
+ />,
99
+ mainLayoutRef.current
100
+ )}
101
+ <div
102
+ className={clsx({
103
+ 'pointer-events-none h-0 overflow-hidden opacity-0': !isLoadingNewMsg,
104
+ 'mt-2 pb-4': isLoadingNewMsg
105
+ })}
106
+ ref={skeletonRef}>
107
+ <MessageSkeleton />
108
+ </div>
86
109
  </div>
87
- </div>
88
- )
89
- })
110
+ )
111
+ }
112
+ )
90
113
 
91
114
  MessagesContainer.displayName = 'MessagesContainer'
92
115
 
@@ -0,0 +1,13 @@
1
+ import { DotLottieReact } from '@lottiefiles/dotlottie-react'
2
+
3
+ const AVATAR_ANIMATION_URL = `${process.env.STATIC_URL}/tutor/tutor_sparkle.lottie`
4
+
5
+ const AvatarAnimation = () => {
6
+ return (
7
+ <div className='flex h-11 w-11 items-center justify-center rounded-lg bg-ai-chat-response'>
8
+ <DotLottieReact src={AVATAR_ANIMATION_URL} loop autoplay className='h-auto w-full' />
9
+ </div>
10
+ )
11
+ }
12
+
13
+ export default AvatarAnimation
@@ -0,0 +1,2 @@
1
+ export * from './avatar-animation'
2
+ export { default as AvatarAnimation } from './avatar-animation'
@@ -1,4 +1,4 @@
1
- import { lazy, useEffect, useMemo, useRef } from 'react'
1
+ import { useEffect, useMemo, useRef } from 'react'
2
2
  import { useInfiniteQuery } from '@tanstack/react-query'
3
3
 
4
4
  import { isTextEmpty } from '@/src/lib/utils/is-text-empty'
@@ -15,10 +15,6 @@ import {
15
15
  import { WidgetHeader } from '../header'
16
16
  import { PageLayout } from '../page-layout'
17
17
 
18
- const MessageItemError = lazy(
19
- () => import('@/src/modules/messages/components/message-item-error/message-item-error')
20
- )
21
-
22
18
  function ChatPage() {
23
19
  const chatInputRef = useRef<HTMLTextAreaElement>(null)
24
20
  const scrollerRef = useRef<HTMLDivElement>(null)
@@ -84,13 +80,13 @@ function ChatPage() {
84
80
  await messagesQuery.fetchNextPage()
85
81
  }}
86
82
  showButton={messagesQuery.hasNextPage}
87
- loading={messagesQuery.isFetchingNextPage}>
83
+ loading={messagesQuery.isFetchingNextPage}
84
+ error={{
85
+ show: messagesQuery.isError,
86
+ message: messagesQuery.error?.message ?? '',
87
+ retry: () => void messagesQuery.refetch()
88
+ }}>
88
89
  {messagesQuery.data && <MessagesList messagesMap={messagesQuery.data} />}
89
- <MessageItemError
90
- show={messagesQuery.isError}
91
- message={`❌ Error loading messages: ${messagesQuery.error?.message ?? ''}`}
92
- retry={() => void messagesQuery.refetch()}
93
- />
94
90
  </MessagesContainer>
95
91
  </PageLayout>
96
92
  )
@@ -1,4 +1,5 @@
1
1
  export * from './ai-avatar'
2
+ export * from './avatar-animation'
2
3
  export * from './chat-page'
3
4
  export * from './container'
4
5
  export * from './greetings-card'
@@ -4,7 +4,7 @@ import clsx from 'clsx'
4
4
  import type { MouseEventHandler } from 'react'
5
5
  import { useTranslation } from 'react-i18next'
6
6
 
7
- import { Button } from '@/src/lib/components'
7
+ import { Button, HorizontalDraggableScroll } from '@/src/lib/components'
8
8
  import { useRefEventListener } from '@/src/lib/hooks'
9
9
  import { ChatInput, useChatInputValueAtom } from '@/src/modules/messages/components'
10
10
  import { getAllMessagesQuery, useSendTextMessage } from '@/src/modules/messages/hooks'
@@ -103,7 +103,7 @@ function WidgetStarterPage() {
103
103
  />
104
104
  </div>
105
105
  </div>
106
- <div className='grid-area-[b] mx-5 my-6 flex flex-shrink-0 snap-x snap-mandatory gap-2 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden'>
106
+ <HorizontalDraggableScroll className='grid-area-[b] mx-5 my-6 flex flex-shrink-0 snap-x snap-mandatory gap-2 overflow-x-auto whitespace-nowrap [scrollbar-width:none] [&::-webkit-scrollbar]:hidden'>
107
107
  <Button
108
108
  variant='gradient-outline'
109
109
  className='shrink-0 snap-end text-sm'
@@ -118,7 +118,7 @@ function WidgetStarterPage() {
118
118
  <span>📝 </span>
119
119
  {t('starter_page.wanna_summary')}
120
120
  </Button>
121
- </div>
121
+ </HorizontalDraggableScroll>
122
122
  </div>
123
123
  </PageLayout>
124
124
  )