@admin-layout/tailwind-chat-pro 12.2.4-alpha.102
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 +77 -0
- package/LICENSE +21 -0
- package/lib/components/index.d.ts +2 -0
- package/lib/components/index.d.ts.map +1 -0
- package/lib/components/messages-container-ui/DefaultInputToolBar.d.ts +21 -0
- package/lib/components/messages-container-ui/DefaultInputToolBar.d.ts.map +1 -0
- package/lib/components/messages-container-ui/DefaultInputToolBar.js +46 -0
- package/lib/components/messages-container-ui/DefaultInputToolBar.js.map +1 -0
- package/lib/components/messages-container-ui/DefaultMessageGroup.d.ts +16 -0
- package/lib/components/messages-container-ui/DefaultMessageGroup.d.ts.map +1 -0
- package/lib/components/messages-container-ui/DefaultMessageGroup.js +64 -0
- package/lib/components/messages-container-ui/DefaultMessageGroup.js.map +1 -0
- package/lib/components/messages-container-ui/ErrorFixCard.d.ts +10 -0
- package/lib/components/messages-container-ui/ErrorFixCard.d.ts.map +1 -0
- package/lib/components/messages-container-ui/ErrorFixCard.js +219 -0
- package/lib/components/messages-container-ui/ErrorFixCard.js.map +1 -0
- package/lib/components/messages-container-ui/FilesList.d.ts +19 -0
- package/lib/components/messages-container-ui/FilesList.d.ts.map +1 -0
- package/lib/components/messages-container-ui/FilesList.js +75 -0
- package/lib/components/messages-container-ui/FilesList.js.map +1 -0
- package/lib/components/messages-container-ui/MessagesContainerUI.d.ts +98 -0
- package/lib/components/messages-container-ui/MessagesContainerUI.d.ts.map +1 -0
- package/lib/components/messages-container-ui/MessagesContainerUI.js +88 -0
- package/lib/components/messages-container-ui/MessagesContainerUI.js.map +1 -0
- package/lib/components/messages-container-ui/ModernMessageGroup.d.ts +46 -0
- package/lib/components/messages-container-ui/ModernMessageGroup.d.ts.map +1 -0
- package/lib/components/messages-container-ui/ModernMessageGroup.js +1568 -0
- package/lib/components/messages-container-ui/ModernMessageGroup.js.map +1 -0
- package/lib/components/messages-container-ui/PlanModeView.d.ts +107 -0
- package/lib/components/messages-container-ui/PlanModeView.d.ts.map +1 -0
- package/lib/components/messages-container-ui/PlanModeView.js +294 -0
- package/lib/components/messages-container-ui/PlanModeView.js.map +1 -0
- package/lib/components/messages-container-ui/index.d.ts +12 -0
- package/lib/components/messages-container-ui/index.d.ts.map +1 -0
- package/lib/components/messages-container-ui/messenger-slot-fill-name-enum.d.ts +16 -0
- package/lib/components/messages-container-ui/messenger-slot-fill-name-enum.d.ts.map +1 -0
- package/lib/components/messages-container-ui/messenger-slot-fill-name-enum.js +16 -0
- package/lib/components/messages-container-ui/messenger-slot-fill-name-enum.js.map +1 -0
- package/lib/components/messages-container-ui/modernStreaming.d.ts +11 -0
- package/lib/components/messages-container-ui/modernStreaming.d.ts.map +1 -0
- package/lib/components/messages-container-ui/modernStreaming.js +17 -0
- package/lib/components/messages-container-ui/modernStreaming.js.map +1 -0
- package/lib/components/messages-container-ui/types.d.ts +63 -0
- package/lib/components/messages-container-ui/types.d.ts.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -0
- package/lib/routes.json +1 -0
- package/package.json +48 -0
- package/rollup.config.mjs +34 -0
- package/src/components/index.ts +1 -0
- package/src/components/messages-container-ui/DefaultInputToolBar.tsx +63 -0
- package/src/components/messages-container-ui/DefaultMessageGroup.tsx +75 -0
- package/src/components/messages-container-ui/ErrorFixCard.tsx +239 -0
- package/src/components/messages-container-ui/FilesList.tsx +89 -0
- package/src/components/messages-container-ui/MessagesContainerUI.tsx +178 -0
- package/src/components/messages-container-ui/ModernMessageGroup.tsx +1885 -0
- package/src/components/messages-container-ui/PlanModeView.tsx +457 -0
- package/src/components/messages-container-ui/index.ts +18 -0
- package/src/components/messages-container-ui/messenger-slot-fill-name-enum.ts +15 -0
- package/src/components/messages-container-ui/modernStreaming.tsx +18 -0
- package/src/components/messages-container-ui/types.ts +68 -0
- package/src/index.ts +1 -0
- package/tsconfig.json +27 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
## [12.2.4-alpha.102](https://github.com/CDEBase/admin-layout/compare/v12.2.4-alpha.101...v12.2.4-alpha.102) (2026-07-30)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @admin-layout/tailwind-chat-pro
|
|
9
|
+
|
|
10
|
+
## [12.2.4-alpha.99](https://github.com/CDEBase/admin-layout/compare/v12.2.4-alpha.98...v12.2.4-alpha.99) (2026-07-24)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @admin-layout/tailwind-chat-pro
|
|
13
|
+
|
|
14
|
+
## [12.2.4-alpha.98](https://github.com/CDEBase/admin-layout/compare/v12.2.4-alpha.97...v12.2.4-alpha.98) (2026-07-23)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @admin-layout/tailwind-chat-pro
|
|
17
|
+
|
|
18
|
+
## [12.2.4-alpha.97](https://github.com/CDEBase/admin-layout/compare/v12.2.4-alpha.96...v12.2.4-alpha.97) (2026-07-23)
|
|
19
|
+
|
|
20
|
+
**Note:** Version bump only for package @admin-layout/tailwind-chat-pro
|
|
21
|
+
|
|
22
|
+
## [12.2.4-alpha.90](https://github.com/CDEBase/admin-layout/compare/v12.2.4-alpha.89...v12.2.4-alpha.90) (2026-07-15)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @admin-layout/tailwind-chat-pro
|
|
25
|
+
|
|
26
|
+
## [12.2.4-alpha.89](https://github.com/CDEBase/admin-layout/compare/v12.2.4-alpha.88...v12.2.4-alpha.89) (2026-07-15)
|
|
27
|
+
|
|
28
|
+
**Note:** Version bump only for package @admin-layout/tailwind-chat-pro
|
|
29
|
+
|
|
30
|
+
## [12.2.4-alpha.88](https://github.com/CDEBase/admin-layout/compare/v12.2.4-alpha.87...v12.2.4-alpha.88) (2026-07-14)
|
|
31
|
+
|
|
32
|
+
**Note:** Version bump only for package @admin-layout/tailwind-chat-pro
|
|
33
|
+
|
|
34
|
+
## [12.2.4-alpha.87](https://github.com/CDEBase/admin-layout/compare/v12.2.4-alpha.86...v12.2.4-alpha.87) (2026-07-13)
|
|
35
|
+
|
|
36
|
+
**Note:** Version bump only for package @admin-layout/tailwind-chat-pro
|
|
37
|
+
|
|
38
|
+
## [12.2.4-alpha.86](https://github.com/CDEBase/admin-layout/compare/v12.2.4-alpha.85...v12.2.4-alpha.86) (2026-07-10)
|
|
39
|
+
|
|
40
|
+
**Note:** Version bump only for package @admin-layout/tailwind-chat-pro
|
|
41
|
+
|
|
42
|
+
## [12.2.4-alpha.85](https://github.com/CDEBase/admin-layout/compare/v12.2.4-alpha.84...v12.2.4-alpha.85) (2026-07-01)
|
|
43
|
+
|
|
44
|
+
**Note:** Version bump only for package @admin-layout/tailwind-chat-pro
|
|
45
|
+
|
|
46
|
+
## [12.2.4-alpha.82](https://github.com/CDEBase/admin-layout/compare/v12.2.4-alpha.81...v12.2.4-alpha.82) (2026-06-30)
|
|
47
|
+
|
|
48
|
+
### Features
|
|
49
|
+
|
|
50
|
+
- **tailwind-chat-pro:** bring the rich Modern message renderer in-package ([f30b75b](https://github.com/CDEBase/admin-layout/commit/f30b75b11782d6e63bef333b53e09c74acea51a3)), closes [#1652](https://github.com/CDEBase/admin-layout/issues/1652)
|
|
51
|
+
|
|
52
|
+
## [12.2.4-alpha.81](https://github.com/CDEBase/admin-layout/compare/v12.2.4-alpha.80...v12.2.4-alpha.81) (2026-06-29)
|
|
53
|
+
|
|
54
|
+
**Note:** Version bump only for package @admin-layout/tailwind-chat-pro
|
|
55
|
+
|
|
56
|
+
## [12.2.4-alpha.80](https://github.com/CDEBase/admin-layout/compare/v12.2.4-alpha.79...v12.2.4-alpha.80) (2026-06-29)
|
|
57
|
+
|
|
58
|
+
**Note:** Version bump only for package @admin-layout/tailwind-chat-pro
|
|
59
|
+
|
|
60
|
+
## [12.2.4-alpha.79](https://github.com/CDEBase/admin-layout/compare/v12.2.4-alpha.78...v12.2.4-alpha.79) (2026-06-29)
|
|
61
|
+
|
|
62
|
+
**Note:** Version bump only for package @admin-layout/tailwind-chat-pro
|
|
63
|
+
|
|
64
|
+
## [12.2.4-alpha.76](https://github.com/CDEBase/admin-layout/compare/v12.2.4-alpha.75...v12.2.4-alpha.76) (2026-06-27)
|
|
65
|
+
|
|
66
|
+
**Note:** Version bump only for package @admin-layout/tailwind-chat-pro
|
|
67
|
+
|
|
68
|
+
## [12.2.4-alpha.75](https://github.com/CDEBase/admin-layout/compare/v12.2.4-alpha.74...v12.2.4-alpha.75) (2026-06-27)
|
|
69
|
+
|
|
70
|
+
**Note:** Version bump only for package @admin-layout/tailwind-chat-pro
|
|
71
|
+
|
|
72
|
+
## [12.2.4-alpha.74](https://github.com/CDEBase/admin-layout/compare/v12.2.4-alpha.73...v12.2.4-alpha.74) (2026-06-27)
|
|
73
|
+
|
|
74
|
+
### Features
|
|
75
|
+
|
|
76
|
+
- **tailwind-chat-pro:** customizable base MessagesContainerUI ([a4bc1b3](https://github.com/CDEBase/admin-layout/commit/a4bc1b38152d27adbb6ece4a50c70b8a6829b5c9))
|
|
77
|
+
- **tailwind-chat-pro:** default input toolbar to @admin-layout/tailwind-ui InputToolBar ([b9e9ab8](https://github.com/CDEBase/admin-layout/commit/b9e9ab846786d0f370db9ca98c0c16aa1a201d13))
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017 CDMBase LLC.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { PlanModeViewInputToolbarProps } from './types';
|
|
3
|
+
export interface DefaultInputToolBarProps extends PlanModeViewInputToolbarProps {
|
|
4
|
+
placeholder?: string;
|
|
5
|
+
/** When true, the send button shows a stop affordance (wired to onStop). */
|
|
6
|
+
isLoading?: boolean;
|
|
7
|
+
onStop?: () => void;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* DefaultInputToolBar — the input composer used when no `renderInputToolbar` is
|
|
12
|
+
* provided. It wraps `@admin-layout/tailwind-ui`'s `InputToolBar` (the shared
|
|
13
|
+
* "ai-tool-box") wired to the base's toolbar props: a built-in textarea
|
|
14
|
+
* (Enter sends, Shift+Enter newlines) plus the mic/send/stop button.
|
|
15
|
+
*
|
|
16
|
+
* Consumers that need the richer composer (mode switcher, templates, attachments,
|
|
17
|
+
* project settings, …) pass their own `renderInputToolbar` instead.
|
|
18
|
+
*/
|
|
19
|
+
export declare const DefaultInputToolBar: React.FC<DefaultInputToolBarProps>;
|
|
20
|
+
export default DefaultInputToolBar;
|
|
21
|
+
//# sourceMappingURL=DefaultInputToolBar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultInputToolBar.d.ts","sourceRoot":"","sources":["../../../src/components/messages-container-ui/DefaultInputToolBar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,SAAS,CAAC;AAE7D,MAAM,WAAW,wBAAyB,SAAQ,6BAA6B;IAC3E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4EAA4E;IAC5E,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAuClE,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {jsx}from'react/jsx-runtime';import {InputToolBar}from'@admin-layout/tailwind-ui';/**
|
|
2
|
+
* DefaultInputToolBar — the input composer used when no `renderInputToolbar` is
|
|
3
|
+
* provided. It wraps `@admin-layout/tailwind-ui`'s `InputToolBar` (the shared
|
|
4
|
+
* "ai-tool-box") wired to the base's toolbar props: a built-in textarea
|
|
5
|
+
* (Enter sends, Shift+Enter newlines) plus the mic/send/stop button.
|
|
6
|
+
*
|
|
7
|
+
* Consumers that need the richer composer (mode switcher, templates, attachments,
|
|
8
|
+
* project settings, …) pass their own `renderInputToolbar` instead.
|
|
9
|
+
*/
|
|
10
|
+
const DefaultInputToolBar = ({
|
|
11
|
+
value,
|
|
12
|
+
onChange,
|
|
13
|
+
onSend,
|
|
14
|
+
disabled = false,
|
|
15
|
+
placeholder = 'Message',
|
|
16
|
+
isLoading = false,
|
|
17
|
+
onStop,
|
|
18
|
+
className
|
|
19
|
+
}) => {
|
|
20
|
+
const hasContent = value.trim().length > 0;
|
|
21
|
+
return jsx(InputToolBar, {
|
|
22
|
+
className: className,
|
|
23
|
+
inputConfig: {
|
|
24
|
+
value,
|
|
25
|
+
onChange: e => onChange(e.target.value),
|
|
26
|
+
placeholder,
|
|
27
|
+
disabled,
|
|
28
|
+
onKeyDown: e => {
|
|
29
|
+
if (e.key === 'Enter' && !e.shiftKey) {
|
|
30
|
+
e.preventDefault();
|
|
31
|
+
if (hasContent && !disabled && !isLoading) onSend();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
micSendButton: {
|
|
36
|
+
hasContent,
|
|
37
|
+
onSend,
|
|
38
|
+
onMic: () => {
|
|
39
|
+
/* voice input not wired in the base default */
|
|
40
|
+
},
|
|
41
|
+
disabled,
|
|
42
|
+
isLoading,
|
|
43
|
+
onStop: isLoading ? onStop : undefined
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
};export{DefaultInputToolBar};//# sourceMappingURL=DefaultInputToolBar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultInputToolBar.js","sources":["../../../src/components/messages-container-ui/DefaultInputToolBar.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":"yFAYA;;;;;;;;AAQG;AACI,MAAM,mBAAmB,GAAuC,CAAC;OAUpE;UAEA;;AAKY,EAAA,QAAA,GAAA,KAAA;aACA,GAAA,SAAW;cACX,KAAA;AACA,EAAA,MAAA;;;AAGQ,EAAA,MAAA,UAAA,GAAA,aAAc,MAAK,GAAA,CAAA;AAAwB,EAAA,OAAAA,GAAA,CAAA,YAAA,EAAA;wBAC9C;eACJ,EAAA;AACJ,MAAA,KACD;cACI,EAAA,CAAA,IAAA,QAAU,CAAA,CAAA,CAAA,MAAA,CAAA,KAAA,CAAA;iBACV;cACA;iBACI,CAAA,IAAA;YACJ,CAAC,CAAA,GAAA,KAAA,OAAA,IAAA,CAAA,CAAA,CAAA,QAAA,EAAA;YACD,cAAQ,EAAA;cACR,UAAS,IAAA,CAAA,QAAA,IAAA,CAAA,SAAA,EAAA,MAAA,EAAA;;AAEZ,MAAA;AAGb,KAAE;AAEF,IAAA;;;;;;;;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { MessageGroupRenderProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* DefaultMessageGroup — the base renderer used when no `MessageGroupComponent`
|
|
5
|
+
* is injected. Renders the post's text in a left/right aligned bubble with an
|
|
6
|
+
* optional author name, avatar and timestamp. Whitespace is preserved so
|
|
7
|
+
* plain-text replies read naturally.
|
|
8
|
+
*
|
|
9
|
+
* Consumers that need rich rendering (markdown, code blocks, media/travel/
|
|
10
|
+
* workflow widget cards, …) inject their own component via
|
|
11
|
+
* `MessagesContainerUI`'s `MessageGroupComponent` prop — e.g. messenger-box's
|
|
12
|
+
* `ModernMessageGroupComponent`.
|
|
13
|
+
*/
|
|
14
|
+
export declare const DefaultMessageGroup: React.FC<MessageGroupRenderProps>;
|
|
15
|
+
export default DefaultMessageGroup;
|
|
16
|
+
//# sourceMappingURL=DefaultMessageGroup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultMessageGroup.d.ts","sourceRoot":"","sources":["../../../src/components/messages-container-ui/DefaultMessageGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAMvD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAqDjE,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import {jsx,jsxs}from'react/jsx-runtime';import clsx from'clsx';const ASSISTANT_BUBBLE_BG = 'bg-card';
|
|
2
|
+
const USER_BUBBLE_BG = 'bg-indigo-50';
|
|
3
|
+
const BORDER_COLOR = 'border-border';
|
|
4
|
+
/**
|
|
5
|
+
* DefaultMessageGroup — the base renderer used when no `MessageGroupComponent`
|
|
6
|
+
* is injected. Renders the post's text in a left/right aligned bubble with an
|
|
7
|
+
* optional author name, avatar and timestamp. Whitespace is preserved so
|
|
8
|
+
* plain-text replies read naturally.
|
|
9
|
+
*
|
|
10
|
+
* Consumers that need rich rendering (markdown, code blocks, media/travel/
|
|
11
|
+
* workflow widget cards, …) inject their own component via
|
|
12
|
+
* `MessagesContainerUI`'s `MessageGroupComponent` prop — e.g. messenger-box's
|
|
13
|
+
* `ModernMessageGroupComponent`.
|
|
14
|
+
*/
|
|
15
|
+
const DefaultMessageGroup = ({
|
|
16
|
+
messages,
|
|
17
|
+
onMessageClick,
|
|
18
|
+
showAuthorName = false,
|
|
19
|
+
showAvatar = false,
|
|
20
|
+
showTimestamp = false
|
|
21
|
+
}) => {
|
|
22
|
+
const post = messages?.[0];
|
|
23
|
+
if (!post) return null;
|
|
24
|
+
const role = post?.propsConfiguration?.contents?.role;
|
|
25
|
+
const isUser = role === 'USER' || role === 'user' || post?.author?.isCurrentUser === true;
|
|
26
|
+
const text = typeof post?.message === 'string' ? post.message : '';
|
|
27
|
+
const author = post?.author ?? {};
|
|
28
|
+
const name = author.fullName || author.givenName || author.username || (isUser ? 'You' : 'Assistant');
|
|
29
|
+
const picture = author.picture ?? null;
|
|
30
|
+
const created = post?.createdAt ? new Date(post.createdAt) : null;
|
|
31
|
+
const timeLabel = created && !Number.isNaN(created.getTime()) ? created.toLocaleTimeString() : '';
|
|
32
|
+
return jsx("div", {
|
|
33
|
+
className: clsx('flex w-full', isUser ? 'justify-end' : 'justify-start'),
|
|
34
|
+
children: jsxs("div", {
|
|
35
|
+
className: clsx('flex max-w-[85%] gap-2', isUser ? 'flex-row-reverse' : 'flex-row'),
|
|
36
|
+
children: [showAvatar && jsx("div", {
|
|
37
|
+
className: "flex-shrink-0",
|
|
38
|
+
children: picture ?
|
|
39
|
+
// eslint-disable-next-line @next/next/no-img-element
|
|
40
|
+
jsx("img", {
|
|
41
|
+
src: picture,
|
|
42
|
+
alt: name,
|
|
43
|
+
className: "w-7 h-7 rounded-full object-cover"
|
|
44
|
+
}) : jsx("div", {
|
|
45
|
+
className: "w-7 h-7 rounded-full bg-gray-200 flex items-center justify-center text-xs font-medium text-gray-600",
|
|
46
|
+
children: name.charAt(0).toUpperCase()
|
|
47
|
+
})
|
|
48
|
+
}), jsxs("div", {
|
|
49
|
+
className: clsx('min-w-0', isUser ? 'text-right' : 'text-left'),
|
|
50
|
+
children: [showAuthorName && jsx("div", {
|
|
51
|
+
className: "mb-0.5 text-xs font-medium text-gray-500",
|
|
52
|
+
children: name
|
|
53
|
+
}), jsx("div", {
|
|
54
|
+
onClick: onMessageClick ? () => onMessageClick(post) : undefined,
|
|
55
|
+
className: clsx('inline-block rounded-2xl px-4 py-2.5 text-[15px] leading-relaxed text-foreground', 'whitespace-pre-wrap break-words border', BORDER_COLOR, isUser ? USER_BUBBLE_BG : ASSISTANT_BUBBLE_BG, onMessageClick && 'cursor-pointer'),
|
|
56
|
+
children: text
|
|
57
|
+
}), showTimestamp && timeLabel && jsx("div", {
|
|
58
|
+
className: "mt-0.5 text-[11px] text-gray-400",
|
|
59
|
+
children: timeLabel
|
|
60
|
+
})]
|
|
61
|
+
})]
|
|
62
|
+
})
|
|
63
|
+
});
|
|
64
|
+
};export{DefaultMessageGroup};//# sourceMappingURL=DefaultMessageGroup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultMessageGroup.js","sources":["../../../src/components/messages-container-ui/DefaultMessageGroup.tsx"],"sourcesContent":[null],"names":[],"mappings":"gEAIA,MAAM,mBAAmB,GAAG,SAAS;AACrC,MAAM,cAAc,GAAG,cAAc;AACrC,MAAM,YAAY,GAAG,eAAe;AAEpC;;;;;;;;;;AAUG;MACU,mBAAmB,GAAsC,CAAC;AAOnE,EAAA,QAAM;AACN,EAAA,cAAS;AAAE,EAAA,iBAAW,KAAC;YAEjB,QAAO;AACb,EAAA,gBAAY;AACZ,CAAA,KAAA;AACA,EAAA,MAAA,eAAmB,GAAE,CAAA,CAAA;MACrB,CAAA,IAAM,EAAA,OAAe,IAAO;AAC5B,EAAA,MAAA,WAAa,EAAkB,4BAAuB,EAAA,IAAA;AACtD,EAAA,MAAA,SAAa,IAAG,KAAM,MAAA,IAAU,IAAE,WAAa,IAAC,IAAA,EAAS,QAAQ,aAAC,KAAA,IAAA;QAClE,IAAM,GAAA,OAAY,IAAA,EAAA,YAAkB,QAAO,GAAA,IAAQ,CAAA,UAAW,EAAE;QAEhE,qBACS,IAAA,EAAS;qBAKM,CAAA,QAAA,IAAA,MAAA,CAAA,SAAA,IAAA,MAAA,CAAA,QAAA,KAAqD,MAAA,GAAA,KAAA,GAAA,WAAA,CAAA;AACrD,EAAA,MAAA,OAAA,GAAA,MAAA,CAAA,OAAA,IAAK,IAAK;AA2BtC,EAAE,MAAA,OAAA,GAAA,IAAA,EAAA,SAAA,GAAA,IAAA,IAAA,CAAA,IAAA,CAAA,SAAA,CAAA,GAAA,IAAA;AAEF,EAAA,MAAA,8BAAmC,CAAA,KAAA,CAAA,OAAA,CAAA,OAAA,EAAA,CAAA,GAAA,OAAA,CAAA,kBAAA,EAAA,GAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface ErrorFixCardProps {
|
|
3
|
+
error: any;
|
|
4
|
+
onFixError: (errorMessage: string) => Promise<void>;
|
|
5
|
+
currentFiles?: Record<string, string>;
|
|
6
|
+
isFixing?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const ErrorFixCard: React.FC<ErrorFixCardProps>;
|
|
9
|
+
export default ErrorFixCard;
|
|
10
|
+
//# sourceMappingURL=ErrorFixCard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorFixCard.d.ts","sourceRoot":"","sources":["../../../src/components/messages-container-ui/ErrorFixCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAkExC,UAAU,iBAAiB;IACvB,KAAK,EAAE,GAAG,CAAC;IACX,UAAU,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpD,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAmKpD,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import {jsx,jsxs}from'react/jsx-runtime';import {useState}from'react';const IconAlertTriangle = props => jsxs("svg", {
|
|
2
|
+
viewBox: "0 0 24 24",
|
|
3
|
+
fill: "none",
|
|
4
|
+
stroke: "currentColor",
|
|
5
|
+
strokeWidth: "2",
|
|
6
|
+
strokeLinecap: "round",
|
|
7
|
+
strokeLinejoin: "round",
|
|
8
|
+
...props,
|
|
9
|
+
children: [jsx("path", {
|
|
10
|
+
d: "M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"
|
|
11
|
+
}), jsx("line", {
|
|
12
|
+
x1: "12",
|
|
13
|
+
y1: "9",
|
|
14
|
+
x2: "12",
|
|
15
|
+
y2: "13"
|
|
16
|
+
}), jsx("line", {
|
|
17
|
+
x1: "12",
|
|
18
|
+
y1: "17",
|
|
19
|
+
x2: "12.01",
|
|
20
|
+
y2: "17"
|
|
21
|
+
})]
|
|
22
|
+
});
|
|
23
|
+
const IconRefreshCw = props => jsxs("svg", {
|
|
24
|
+
viewBox: "0 0 24 24",
|
|
25
|
+
fill: "none",
|
|
26
|
+
stroke: "currentColor",
|
|
27
|
+
strokeWidth: "2",
|
|
28
|
+
strokeLinecap: "round",
|
|
29
|
+
strokeLinejoin: "round",
|
|
30
|
+
...props,
|
|
31
|
+
children: [jsx("polyline", {
|
|
32
|
+
points: "23 4 23 10 17 10"
|
|
33
|
+
}), jsx("polyline", {
|
|
34
|
+
points: "1 20 1 14 7 14"
|
|
35
|
+
}), jsx("path", {
|
|
36
|
+
d: "M3.51 9a9 9 0 0114.13-3.36L23 10"
|
|
37
|
+
}), jsx("path", {
|
|
38
|
+
d: "M20.49 15a9 9 0 01-14.13 3.36L1 14"
|
|
39
|
+
})]
|
|
40
|
+
});
|
|
41
|
+
const IconCode = props => jsxs("svg", {
|
|
42
|
+
viewBox: "0 0 24 24",
|
|
43
|
+
fill: "none",
|
|
44
|
+
stroke: "currentColor",
|
|
45
|
+
strokeWidth: "2",
|
|
46
|
+
strokeLinecap: "round",
|
|
47
|
+
strokeLinejoin: "round",
|
|
48
|
+
...props,
|
|
49
|
+
children: [jsx("polyline", {
|
|
50
|
+
points: "16 18 22 12 16 6"
|
|
51
|
+
}), jsx("polyline", {
|
|
52
|
+
points: "8 6 2 12 8 18"
|
|
53
|
+
})]
|
|
54
|
+
});
|
|
55
|
+
const IconExternalLink = props => jsxs("svg", {
|
|
56
|
+
viewBox: "0 0 24 24",
|
|
57
|
+
fill: "none",
|
|
58
|
+
stroke: "currentColor",
|
|
59
|
+
strokeWidth: "2",
|
|
60
|
+
strokeLinecap: "round",
|
|
61
|
+
strokeLinejoin: "round",
|
|
62
|
+
...props,
|
|
63
|
+
children: [jsx("path", {
|
|
64
|
+
d: "M18 13v6a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"
|
|
65
|
+
}), jsx("polyline", {
|
|
66
|
+
points: "15 3 21 3 21 9"
|
|
67
|
+
}), jsx("line", {
|
|
68
|
+
x1: "10",
|
|
69
|
+
y1: "14",
|
|
70
|
+
x2: "21",
|
|
71
|
+
y2: "3"
|
|
72
|
+
})]
|
|
73
|
+
});
|
|
74
|
+
const ErrorFixCard = ({
|
|
75
|
+
error,
|
|
76
|
+
onFixError,
|
|
77
|
+
currentFiles,
|
|
78
|
+
isFixing = false
|
|
79
|
+
}) => {
|
|
80
|
+
const [isExpanded, setIsExpanded] = useState(false);
|
|
81
|
+
const [isFixingError, setIsFixingError] = useState(false);
|
|
82
|
+
const handleFixError = async () => {
|
|
83
|
+
setIsFixingError(true);
|
|
84
|
+
try {
|
|
85
|
+
const errorContext = `
|
|
86
|
+
ERROR DETECTED IN SANDBOX:
|
|
87
|
+
|
|
88
|
+
Error Type: ${error.errorType}
|
|
89
|
+
Timestamp: ${error.timestamp}
|
|
90
|
+
Sandbox ID: ${error.sandboxId}
|
|
91
|
+
|
|
92
|
+
Error Message:
|
|
93
|
+
${error.message}
|
|
94
|
+
|
|
95
|
+
${error.stack ? `Stack Trace:\n${error.stack}` : ''}
|
|
96
|
+
|
|
97
|
+
${currentFiles && Object.keys(currentFiles).length > 0 ? `
|
|
98
|
+
Current Files in Project:
|
|
99
|
+
${Object.entries(currentFiles).map(([path, content]) => `
|
|
100
|
+
--- ${path} ---
|
|
101
|
+
${content}
|
|
102
|
+
`).join('\n')}
|
|
103
|
+
` : ''}
|
|
104
|
+
|
|
105
|
+
Please analyze this error and fix the code. Make sure to:
|
|
106
|
+
1. Identify the root cause of the error
|
|
107
|
+
2. Update the necessary files to resolve the issue
|
|
108
|
+
3. Ensure the fix maintains the existing functionality
|
|
109
|
+
4. Test that the solution compiles and runs correctly
|
|
110
|
+
`.trim();
|
|
111
|
+
await onFixError(errorContext);
|
|
112
|
+
} catch (error) {
|
|
113
|
+
console.error('Failed to trigger error fix:', error);
|
|
114
|
+
} finally {
|
|
115
|
+
setIsFixingError(false);
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
const getErrorTypeColor = errorType => {
|
|
119
|
+
switch (errorType) {
|
|
120
|
+
case 'COMPILATION_ERROR':
|
|
121
|
+
return 'text-red-600 bg-red-50 border-red-200';
|
|
122
|
+
case 'RUNTIME_ERROR':
|
|
123
|
+
return 'text-orange-600 bg-orange-50 border-orange-200';
|
|
124
|
+
case 'DEPENDENCY_ERROR':
|
|
125
|
+
return 'text-yellow-600 bg-yellow-50 border-yellow-200';
|
|
126
|
+
case 'SERVER_START_ERROR':
|
|
127
|
+
return 'text-purple-600 bg-purple-50 border-purple-200';
|
|
128
|
+
case 'SANDBOX_DISCONNECTED':
|
|
129
|
+
return 'text-gray-600 bg-gray-50 border-gray-200';
|
|
130
|
+
case 'TEST_ERROR':
|
|
131
|
+
return 'text-blue-600 bg-blue-50 border-blue-200';
|
|
132
|
+
default:
|
|
133
|
+
return 'text-red-600 bg-red-50 border-red-200';
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
const formatErrorType = errorType => {
|
|
137
|
+
return errorType.replace(/_/g, ' ').toLowerCase().replace(/\b\w/g, l => l.toUpperCase());
|
|
138
|
+
};
|
|
139
|
+
return jsx("div", {
|
|
140
|
+
className: "flex w-full justify-start mb-2",
|
|
141
|
+
children: jsxs("div", {
|
|
142
|
+
className: `rounded-lg p-2 border w-fit max-w-[75%] min-w-0 break-all overflow-hidden ${getErrorTypeColor(error.errorType)}`,
|
|
143
|
+
children: [jsx("div", {
|
|
144
|
+
className: "flex items-start justify-between mb-1",
|
|
145
|
+
children: jsxs("div", {
|
|
146
|
+
className: "flex items-center space-x-1",
|
|
147
|
+
children: [jsx(IconAlertTriangle, {
|
|
148
|
+
className: "w-3 h-3 text-red-600 flex-shrink-0"
|
|
149
|
+
}), jsx("span", {
|
|
150
|
+
className: "font-semibold text-xs",
|
|
151
|
+
children: formatErrorType(error.errorType)
|
|
152
|
+
}), jsx("span", {
|
|
153
|
+
className: "text-xs opacity-60",
|
|
154
|
+
children: new Date(error.timestamp).toLocaleTimeString()
|
|
155
|
+
}), error.url && jsxs("a", {
|
|
156
|
+
href: error.url,
|
|
157
|
+
target: "_blank",
|
|
158
|
+
rel: "noopener noreferrer",
|
|
159
|
+
className: "text-xs hover:underline flex items-center space-x-1",
|
|
160
|
+
children: [jsx(IconExternalLink, {
|
|
161
|
+
className: "w-3 h-3"
|
|
162
|
+
}), jsx("span", {
|
|
163
|
+
children: "View Sandbox"
|
|
164
|
+
})]
|
|
165
|
+
})]
|
|
166
|
+
})
|
|
167
|
+
}), jsxs("div", {
|
|
168
|
+
className: "text-sm mb-3",
|
|
169
|
+
children: [jsx("div", {
|
|
170
|
+
className: "break-words whitespace-pre-wrap font-mono text-xs leading-relaxed overflow-hidden",
|
|
171
|
+
style: {
|
|
172
|
+
display: '-webkit-box',
|
|
173
|
+
WebkitLineClamp: isExpanded ? 'none' : 3,
|
|
174
|
+
WebkitBoxOrient: 'vertical',
|
|
175
|
+
maxHeight: isExpanded ? 'none' : '3.6em'
|
|
176
|
+
},
|
|
177
|
+
children: error.message
|
|
178
|
+
}), error.message.length > 150 && jsx("button", {
|
|
179
|
+
onClick: () => setIsExpanded(!isExpanded),
|
|
180
|
+
className: "text-xs hover:underline mt-1 font-sans",
|
|
181
|
+
children: isExpanded ? 'Show less' : 'Show more'
|
|
182
|
+
})]
|
|
183
|
+
}), isExpanded && error.stack && jsxs("div", {
|
|
184
|
+
className: "mt-3 p-3 bg-black bg-opacity-10 rounded text-xs font-mono",
|
|
185
|
+
children: [jsxs("div", {
|
|
186
|
+
className: "flex items-center space-x-2 mb-2",
|
|
187
|
+
children: [jsx(IconCode, {
|
|
188
|
+
className: "w-3 h-3"
|
|
189
|
+
}), jsx("span", {
|
|
190
|
+
className: "font-semibold",
|
|
191
|
+
children: "Stack Trace"
|
|
192
|
+
})]
|
|
193
|
+
}), jsx("pre", {
|
|
194
|
+
className: "whitespace-pre-wrap text-xs break-all",
|
|
195
|
+
children: error.stack
|
|
196
|
+
})]
|
|
197
|
+
}), error.fixable && jsx("div", {
|
|
198
|
+
className: "mt-4 flex justify-start",
|
|
199
|
+
children: jsxs("button", {
|
|
200
|
+
onClick: handleFixError,
|
|
201
|
+
disabled: isFixingError || isFixing,
|
|
202
|
+
className: `
|
|
203
|
+
flex items-center space-x-2 px-4 py-2 rounded-md text-sm font-medium
|
|
204
|
+
transition-colors duration-200
|
|
205
|
+
${isFixingError || isFixing ? 'bg-gray-100 text-gray-400 cursor-not-allowed' : 'bg-red-600 text-white hover:bg-red-700 shadow-sm hover:shadow-md'}
|
|
206
|
+
`,
|
|
207
|
+
children: [jsx(IconRefreshCw, {
|
|
208
|
+
className: `w-4 h-4 ${isFixingError || isFixing ? 'animate-spin' : ''}`
|
|
209
|
+
}), jsx("span", {
|
|
210
|
+
children: isFixingError || isFixing ? 'Fixing...' : 'Fix Error'
|
|
211
|
+
})]
|
|
212
|
+
})
|
|
213
|
+
}), !error.fixable && jsx("div", {
|
|
214
|
+
className: "mt-3 text-xs opacity-75",
|
|
215
|
+
children: "This error may require manual intervention or environment changes."
|
|
216
|
+
})]
|
|
217
|
+
})
|
|
218
|
+
});
|
|
219
|
+
};export{ErrorFixCard};//# sourceMappingURL=ErrorFixCard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorFixCard.js","sources":["../../../src/components/messages-container-ui/ErrorFixCard.tsx"],"sourcesContent":[null],"names":["_jsx","_jsxs"],"mappings":"sEAEA,MAAM,iBAAiB,GAA4C,KAAC,QAChE,CAAA,KAAA,EAAA;AAeJ,EAAA,OAAM,EAAA,WAAyD;AAiB/D,EAAA,IAAM,EAAA,MAAQ;AAed,EAAA,MAAM,EAAA,cAAgB;AAuBtB,EAAA,WAAa,EAAA,GAAA;eACF,EAAA,OAAY;gBACZ,EAAA,OAAa;AAEpB,EAAA,GAAA,KAAM;UACF,EAAA,CAAAA,GAAA,CAAA,MAAgB,EAAC;AACjB,IAAA,CAAA,EAAA;AACI,GAAA,CAAA,EAAAA,GAAA,CAAA,MAAA;;;AAGE,IAAA,EAAA,EAAA,IAAA;AACD,IAAA,EAAA,EAAA;AACC,GAAA,CAAA,EAAAA,GAAA,CAAA,MAAA,EAAK;;;AAGjB,IAAA,EAAA,EAAM,OAAO;;AAEb,GAAA,CAAA;;MAGE,aAAgB,GAAA,KAAO,cAAiB,EAAE;AACtC,EAAA,OAAA,EAAA,WAAE;;AAER,EAAA,MAAM,EAAC,cAAQ;;eAGP,EAAA,OAAA;EACR,cAAO,EAAA,OAAA;EAEJ,GAAA,KAAA;6BACS;AACb,IAAA,MAAA,EAAA;AACO,GAAA,CAAA,EAAAA,GAAA,CAAA,UACR,EAAA;;;;;;;CAOC,CAAC;AAEU,MAAA,QAAA,GAAA,KAAM,IAAAC,IAAW,CAAA,KAAA,EAAA;SACpB,EAAA,WAAA;QAAC,MAAA;AACE,EAAA,MAAA,EAAA,cAAQ;aACX,EAAA,GAAA;iBAAU,OAAA;gBACP,EAAA,OAAA;UACH;AACL,EAAA,QAAE,EAAA,CAAAD,GAAA,CAAA,UAAA,EAAA;AAEF,IAAA,MAAM,EAAA;SACF,CAAA,UAAQ,EAAA;AACJ,IAAA,MAAA,EAAA;AACI,GAAA,CAAA;AACJ,CAAA,CAAA;AACI,MAAA,gBAAA;AACJ,EAAA,OAAA,EAAA,WAAK;AACD,EAAA,IAAA,EAAA,MAAA;AACJ,EAAA,MAAA,EAAA,cAAK;AACD,EAAA,WAAA,EAAA,GAAA;AACJ,EAAA,aAAA,EAAK,OAAA;AACD,EAAA,cAAA,EAAA;AACJ,EAAA,GAAA,KAAA;AACI,EAAA,QAAA,EAAA,CAAAA,GAAA,CAAA;AACJ,IAAA,CAAA,EAAA;AACI,GAAA,CAAA,EAAAA,GAAA,CAAA,UAAA,EAAO;UACd,EAAA;AACL,GAAA,CAAA,EAAEA,GAAA,CAAA,MAAA,EAAA;AAEF,IAAA,EAAA,EAAA,IAAM;AACF,IAAA,EAAA,EAAA,IAAA;AACK,IAAA,EAAA,EAAA,IAAA;AACA,IAAA,EAAA,EAAA;AACA,GAAA,CAAA;AACT,CAAA,CAAA;AAGI,MAAA,YAAA,GAAK,CAAA;AA6Be,EAAA,KAAA;;AAEA,EAAA,YAAA;;;;;AAmCN,EAAA,MAAA,cAAA,GAAA,YAAiB;AACb,IAAA,gBAAA,CAAA,IAAA,CAAA;AACA,IAAA,IAAA;wBAET,GAAA;AAgBjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
interface FilesListProps {
|
|
2
|
+
files: any[];
|
|
3
|
+
uploaded?: boolean;
|
|
4
|
+
FileElementProps?: Omit<FileElementProps, 'file' | 'uploaded' | 'onRemove'>;
|
|
5
|
+
onRemove?: () => Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
interface FileElementProps {
|
|
8
|
+
file: any;
|
|
9
|
+
uploaded: boolean;
|
|
10
|
+
width?: number;
|
|
11
|
+
height?: number;
|
|
12
|
+
onRemove?: () => Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
export declare function FilesList({ files, uploaded }: FilesListProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare namespace FilesList {
|
|
16
|
+
var FileElement: ({ file, uploaded, width, height }: FileElementProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=FilesList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilesList.d.ts","sourceRoot":"","sources":["../../../src/components/messages-container-ui/FilesList.tsx"],"names":[],"mappings":"AAGA,UAAU,cAAc;IACpB,KAAK,EAAE,GAAG,EAAE,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gBAAgB,CAAC,EAAE,IAAI,CAAC,gBAAgB,EAAE,MAAM,GAAG,UAAU,GAAG,UAAU,CAAC,CAAC;IAC5E,QAAQ,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAClC;AAED,UAAU,gBAAgB;IACtB,IAAI,EAAE,GAAG,CAAC;IACV,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAClC;AAED,wBAAgB,SAAS,CAAC,EAAE,KAAK,EAAE,QAAgB,EAAE,EAAE,cAAc,2CAQpE;yBARe,SAAS;yDAU+C,gBAAgB"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {useState,useMemo}from'react';import {useFileUrlQuery}from'common/graphql';function FilesList({
|
|
2
|
+
files,
|
|
3
|
+
uploaded = false
|
|
4
|
+
}) {
|
|
5
|
+
return jsx("div", {
|
|
6
|
+
className: "flex flex-row",
|
|
7
|
+
children: files.map((file, index) => jsx(FilesList.FileElement, {
|
|
8
|
+
uploaded: uploaded,
|
|
9
|
+
file: file
|
|
10
|
+
}, `${index}`))
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
FilesList.FileElement = ({
|
|
14
|
+
file,
|
|
15
|
+
uploaded,
|
|
16
|
+
width = 120,
|
|
17
|
+
height = 120
|
|
18
|
+
}) => {
|
|
19
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
20
|
+
const src = useMemo(() => uploaded ? file.url : URL.createObjectURL(file), [file, uploaded]);
|
|
21
|
+
const {
|
|
22
|
+
data
|
|
23
|
+
} = useFileUrlQuery({
|
|
24
|
+
variables: {
|
|
25
|
+
id: file?.id
|
|
26
|
+
},
|
|
27
|
+
skip: !file?.id
|
|
28
|
+
});
|
|
29
|
+
const onOpen = () => setIsOpen(true);
|
|
30
|
+
const onClose = () => setIsOpen(false);
|
|
31
|
+
return jsxs(Fragment, {
|
|
32
|
+
children: [jsx("img", {
|
|
33
|
+
className: "cursor-pointer m-2 object-cover rounded",
|
|
34
|
+
style: {
|
|
35
|
+
height: `${height}px`,
|
|
36
|
+
width: `${width}px`
|
|
37
|
+
},
|
|
38
|
+
src: src,
|
|
39
|
+
onClick: onOpen,
|
|
40
|
+
alt: "File preview"
|
|
41
|
+
}), isOpen && jsxs("div", {
|
|
42
|
+
className: "fixed inset-0 z-50 flex items-center justify-center p-4",
|
|
43
|
+
children: [jsx("div", {
|
|
44
|
+
className: "fixed inset-0 bg-black bg-opacity-75",
|
|
45
|
+
onClick: onClose
|
|
46
|
+
}), jsxs("div", {
|
|
47
|
+
className: "relative bg-white rounded-lg shadow-xl max-w-4xl max-h-[90vh] overflow-hidden",
|
|
48
|
+
children: [jsx("button", {
|
|
49
|
+
onClick: onClose,
|
|
50
|
+
className: "absolute top-4 right-4 z-10 p-2 rounded-full bg-black bg-opacity-50 hover:bg-opacity-70 transition-all duration-200",
|
|
51
|
+
children: jsx("svg", {
|
|
52
|
+
className: "w-6 h-6 text-white",
|
|
53
|
+
fill: "none",
|
|
54
|
+
stroke: "currentColor",
|
|
55
|
+
viewBox: "0 0 24 24",
|
|
56
|
+
children: jsx("path", {
|
|
57
|
+
strokeLinecap: "round",
|
|
58
|
+
strokeLinejoin: "round",
|
|
59
|
+
strokeWidth: 2,
|
|
60
|
+
d: "M6 18L18 6M6 6l12 12"
|
|
61
|
+
})
|
|
62
|
+
})
|
|
63
|
+
}), jsx("div", {
|
|
64
|
+
className: "p-4 flex items-center justify-center",
|
|
65
|
+
children: jsx("img", {
|
|
66
|
+
src: data?.fileInfo?.url || src,
|
|
67
|
+
alt: "File full view",
|
|
68
|
+
className: "max-w-full max-h-[80vh] object-contain cursor-pointer",
|
|
69
|
+
onClick: onClose
|
|
70
|
+
})
|
|
71
|
+
})]
|
|
72
|
+
})]
|
|
73
|
+
})]
|
|
74
|
+
});
|
|
75
|
+
};export{FilesList};//# sourceMappingURL=FilesList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilesList.js","sources":["../../../src/components/messages-container-ui/FilesList.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":"oIAkBM,SAAU,SAAS,CAAC;AACtB,EAAA,KAAA;AAOJ,EAAC,QAAA,GAAA;AAED,CAAA,EAAA;SACIA,GAAO,CAAA,KAAQ,EAAA;AACf,IAAA,SAAS,EAAA,eAAiB;AAC1B,IAAA,QAAQ,EAAA,KAAM,CAAA,gBAAkB,KAACA,GAAA,CAAA,SAAA,CAAA,WAAA,EAAA;AAC7B,MAAA,QAAA,EAAA,QAAW;YACP;AACH,KAAA,EAAA,CAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AACD,GAAA,CAAA;AACH;SAED,CAAM,WAAS,GAAK,CAAC;MACrB;AAEA,EAAA,QAAA;AA+CJ,EAAE,KAAA,GAAA,GAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|