@esvndev/es-react-template-chat 0.0.92 → 0.0.93
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/dist/index.js +283 -170
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +275 -170
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -21,6 +21,14 @@ require('@draft-js-plugins/mention/lib/plugin.css');
|
|
|
21
21
|
require('@draft-js-plugins/emoji/lib/plugin.css');
|
|
22
22
|
var reactRedux = require('react-redux');
|
|
23
23
|
var configureStore$1 = require('@store/configureStore');
|
|
24
|
+
var photo = require('@core/assets/images/icons/file-icons/icon-photo.svg');
|
|
25
|
+
var word = require('@core/assets/images/icons/file-icons/icon-word.svg');
|
|
26
|
+
var excel = require('@core/assets/images/icons/file-icons/icon-excel.svg');
|
|
27
|
+
var ppt = require('@core/assets/images/icons/file-icons/icon-powerpoint.svg');
|
|
28
|
+
var music = require('@core/assets/images/icons/file-icons/icon-music.svg');
|
|
29
|
+
var video = require('@core/assets/images/icons/file-icons/icon-video.svg');
|
|
30
|
+
var pdf = require('@core/assets/images/icons/file-icons/icon-pdf.svg');
|
|
31
|
+
var zip = require('@core/assets/images/icons/file-icons/icon-zip.svg');
|
|
24
32
|
var reactRouterDom = require('react-router-dom');
|
|
25
33
|
|
|
26
34
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -49,6 +57,14 @@ var ReactDOM__namespace = /*#__PURE__*/_interopNamespace(ReactDOM);
|
|
|
49
57
|
var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
|
|
50
58
|
var toast__default = /*#__PURE__*/_interopDefaultLegacy(toast);
|
|
51
59
|
var avatarDefault__default = /*#__PURE__*/_interopDefaultLegacy(avatarDefault);
|
|
60
|
+
var photo__default = /*#__PURE__*/_interopDefaultLegacy(photo);
|
|
61
|
+
var word__default = /*#__PURE__*/_interopDefaultLegacy(word);
|
|
62
|
+
var excel__default = /*#__PURE__*/_interopDefaultLegacy(excel);
|
|
63
|
+
var ppt__default = /*#__PURE__*/_interopDefaultLegacy(ppt);
|
|
64
|
+
var music__default = /*#__PURE__*/_interopDefaultLegacy(music);
|
|
65
|
+
var video__default = /*#__PURE__*/_interopDefaultLegacy(video);
|
|
66
|
+
var pdf__default = /*#__PURE__*/_interopDefaultLegacy(pdf);
|
|
67
|
+
var zip__default = /*#__PURE__*/_interopDefaultLegacy(zip);
|
|
52
68
|
|
|
53
69
|
var instances = 'ej2_instances';
|
|
54
70
|
var uid = 0;
|
|
@@ -27397,6 +27413,16 @@ const encodeUUID = (uuid) => {
|
|
|
27397
27413
|
return uuid;
|
|
27398
27414
|
}
|
|
27399
27415
|
};
|
|
27416
|
+
const formatBytes = (props, decimals = 2) => {
|
|
27417
|
+
if (!+props.size) {
|
|
27418
|
+
return '0 Bytes';
|
|
27419
|
+
}
|
|
27420
|
+
const k = 1024;
|
|
27421
|
+
const dm = decimals < 0 ? 0 : decimals;
|
|
27422
|
+
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
|
27423
|
+
const i = Math.floor(Math.log(props.size) / Math.log(k));
|
|
27424
|
+
return `${parseFloat((props.size / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;
|
|
27425
|
+
};
|
|
27400
27426
|
const isValidUrl = (string) => {
|
|
27401
27427
|
try {
|
|
27402
27428
|
// eslint-disable-next-line no-new
|
|
@@ -72044,6 +72070,167 @@ const useUploadFile = () => {
|
|
|
72044
72070
|
};
|
|
72045
72071
|
};
|
|
72046
72072
|
|
|
72073
|
+
const IconFileTypeColor = (props) => {
|
|
72074
|
+
const { fileType, width, height } = props;
|
|
72075
|
+
const normalizedType = typeof fileType === 'string' ? fileType.toLowerCase() : '';
|
|
72076
|
+
let icon;
|
|
72077
|
+
switch (normalizedType) {
|
|
72078
|
+
case '.jpg':
|
|
72079
|
+
case '.jpeg':
|
|
72080
|
+
case '.png':
|
|
72081
|
+
icon = photo__default["default"];
|
|
72082
|
+
break;
|
|
72083
|
+
case '.mp3':
|
|
72084
|
+
case '.wma':
|
|
72085
|
+
case '.wma9':
|
|
72086
|
+
case '.wav':
|
|
72087
|
+
case '.flac':
|
|
72088
|
+
case '.aac':
|
|
72089
|
+
case '.aac+':
|
|
72090
|
+
case '.ogg':
|
|
72091
|
+
case '.aiff':
|
|
72092
|
+
case '.lossless':
|
|
72093
|
+
case '.amr':
|
|
72094
|
+
case '.ac3':
|
|
72095
|
+
icon = music__default["default"];
|
|
72096
|
+
break;
|
|
72097
|
+
case '.avi':
|
|
72098
|
+
case '.mp4':
|
|
72099
|
+
case '.mkv':
|
|
72100
|
+
case '.wmv':
|
|
72101
|
+
case '.vob':
|
|
72102
|
+
case '.flv':
|
|
72103
|
+
case '.webm':
|
|
72104
|
+
case '.3gp':
|
|
72105
|
+
case '.mpeg':
|
|
72106
|
+
icon = video__default["default"];
|
|
72107
|
+
break;
|
|
72108
|
+
case '.pdf':
|
|
72109
|
+
icon = pdf__default["default"];
|
|
72110
|
+
break;
|
|
72111
|
+
case '.ppt':
|
|
72112
|
+
icon = ppt__default["default"];
|
|
72113
|
+
break;
|
|
72114
|
+
case '.xlsx':
|
|
72115
|
+
icon = excel__default["default"];
|
|
72116
|
+
break;
|
|
72117
|
+
case '.doc':
|
|
72118
|
+
case '.docx':
|
|
72119
|
+
icon = word__default["default"];
|
|
72120
|
+
break;
|
|
72121
|
+
case '.zip':
|
|
72122
|
+
case '.rar':
|
|
72123
|
+
icon = zip__default["default"];
|
|
72124
|
+
break;
|
|
72125
|
+
default:
|
|
72126
|
+
icon = '';
|
|
72127
|
+
break;
|
|
72128
|
+
}
|
|
72129
|
+
// if (fileType === "aac") {
|
|
72130
|
+
// icon = "FiletypeAac"
|
|
72131
|
+
// } else if (fileType === ".ai") {
|
|
72132
|
+
// icon = "FiletypeAi"
|
|
72133
|
+
// } else if (fileType === ".bmp") {
|
|
72134
|
+
// icon = "FiletypeBmp"
|
|
72135
|
+
// } else if (fileType === ".cs") {
|
|
72136
|
+
// icon = "FiletypeCs"
|
|
72137
|
+
// } else if (fileType === ".css") {
|
|
72138
|
+
// icon = "FiletypeCss"
|
|
72139
|
+
// } else if (fileType === ".csv") {
|
|
72140
|
+
// icon = "FiletypeCsv"
|
|
72141
|
+
// } else if (fileType === ".doc") {
|
|
72142
|
+
// icon = "FiletypeDoc"
|
|
72143
|
+
// } else if (fileType === ".docx") {
|
|
72144
|
+
// icon = "FiletypeDocx"
|
|
72145
|
+
// } else if (fileType === ".exe") {
|
|
72146
|
+
// icon = "FiletypeExe"
|
|
72147
|
+
// } else if (fileType === ".gif") {
|
|
72148
|
+
// icon = "FiletypeGif"
|
|
72149
|
+
// } else if (fileType === ".heic") {
|
|
72150
|
+
// icon = "FiletypeHeic"
|
|
72151
|
+
// } else if (fileType === ".html") {
|
|
72152
|
+
// icon = "FiletypeHtml"
|
|
72153
|
+
// } else if (fileType === ".java") {
|
|
72154
|
+
// icon = "FiletypeJava"
|
|
72155
|
+
// } else if (fileType === ".jpg" || fileType === ".jpeg") {
|
|
72156
|
+
// icon = "Image"
|
|
72157
|
+
// } else if (fileType === ".js") {
|
|
72158
|
+
// icon = "FiletypeJs"
|
|
72159
|
+
// } else if (fileType === ".json") {
|
|
72160
|
+
// icon = "FiletypeJson"
|
|
72161
|
+
// } else if (fileType === ".jsx") {
|
|
72162
|
+
// icon = "FiletypeJsx"
|
|
72163
|
+
// } else if (fileType === ".key") {
|
|
72164
|
+
// icon = "FiletypeKey"
|
|
72165
|
+
// } else if (fileType === ".m4p") {
|
|
72166
|
+
// icon = "FiletypeM4p"
|
|
72167
|
+
// } else if (fileType === ".md") {
|
|
72168
|
+
// icon = "FiletypeMd"
|
|
72169
|
+
// } else if (fileType === ".mdx") {
|
|
72170
|
+
// icon = "FiletypeMdx"
|
|
72171
|
+
// } else if (fileType === ".mov") {
|
|
72172
|
+
// icon = "FiletypeMov"
|
|
72173
|
+
// } else if (fileType === ".mp3") {
|
|
72174
|
+
// icon = "FiletypeMp3"
|
|
72175
|
+
// } else if (fileType === ".mp4") {
|
|
72176
|
+
// icon = "FiletypeMp4"
|
|
72177
|
+
// } else if (fileType === ".otf") {
|
|
72178
|
+
// icon = "FiletypeOtf"
|
|
72179
|
+
// } else if (fileType === ".pdf") {
|
|
72180
|
+
// icon = "FiletypePdf"
|
|
72181
|
+
// } else if (fileType === ".php") {
|
|
72182
|
+
// icon = "FiletypePhp"
|
|
72183
|
+
// } else if (fileType === ".png") {
|
|
72184
|
+
// icon = "Image"
|
|
72185
|
+
// } else if (fileType === ".ppt") {
|
|
72186
|
+
// icon = "FiletypePpt"
|
|
72187
|
+
// } else if (fileType === ".pptx") {
|
|
72188
|
+
// icon = "FiletypePptx"
|
|
72189
|
+
// } else if (fileType === ".psd") {
|
|
72190
|
+
// icon = "FiletypePsd"
|
|
72191
|
+
// } else if (fileType === ".py") {
|
|
72192
|
+
// icon = "FiletypePy"
|
|
72193
|
+
// } else if (fileType === ".raw") {
|
|
72194
|
+
// icon = "FiletypeRaw"
|
|
72195
|
+
// } else if (fileType === ".rb") {
|
|
72196
|
+
// icon = "FiletypeRb"
|
|
72197
|
+
// } else if (fileType === ".sass") {
|
|
72198
|
+
// icon = "FiletypeSass"
|
|
72199
|
+
// } else if (fileType === ".scss") {
|
|
72200
|
+
// icon = "FiletypeScss"
|
|
72201
|
+
// } else if (fileType === ".sh") {
|
|
72202
|
+
// icon = "FiletypeSh"
|
|
72203
|
+
// } else if (fileType === ".sql") {
|
|
72204
|
+
// icon = "FiletypeSql"
|
|
72205
|
+
// } else if (fileType === ".svg") {
|
|
72206
|
+
// icon = "FiletypeSvg"
|
|
72207
|
+
// } else if (fileType === ".tiff") {
|
|
72208
|
+
// icon = "FiletypeTiff"
|
|
72209
|
+
// } else if (fileType === ".tsx") {
|
|
72210
|
+
// icon = "FiletypeTsx"
|
|
72211
|
+
// } else if (fileType === ".ttf") {
|
|
72212
|
+
// icon = "FiletypeTtf"
|
|
72213
|
+
// } else if (fileType === ".txt") {
|
|
72214
|
+
// icon = "FiletypeTxt"
|
|
72215
|
+
// } else if (fileType === ".wav") {
|
|
72216
|
+
// icon = "FiletypeWav"
|
|
72217
|
+
// } else if (fileType === ".woff") {
|
|
72218
|
+
// icon = "FiletypeWoff"
|
|
72219
|
+
// } else if (fileType === ".xls") {
|
|
72220
|
+
// icon = "FiletypeXls"
|
|
72221
|
+
// } else if (fileType === ".xlsx") {
|
|
72222
|
+
// icon = "FiletypeXlsx"
|
|
72223
|
+
// } else if (fileType === ".xml") {
|
|
72224
|
+
// icon = "FiletypeXml"
|
|
72225
|
+
// } else if (fileType === ".yml") {
|
|
72226
|
+
// icon = "FiletypeYml"
|
|
72227
|
+
// } else if (fileType === ".zip" || fileType === ".rar") {
|
|
72228
|
+
// icon = "FileZip"
|
|
72229
|
+
// }
|
|
72230
|
+
// @ts-ignore
|
|
72231
|
+
return jsxRuntime.jsx("img", { ...props, src: icon, style: { width: width ? width : 24, height: height ? height : 'auto', ...props.style } });
|
|
72232
|
+
};
|
|
72233
|
+
|
|
72047
72234
|
const DateHeader = React.memo(({ label }) => (jsxRuntime.jsx("div", { className: "d-flex justify-content-center", children: jsxRuntime.jsx("div", { style: {
|
|
72048
72235
|
backgroundColor: "rgba(0,0,0,0.2)",
|
|
72049
72236
|
padding: "2px 15px",
|
|
@@ -72503,176 +72690,102 @@ const ChatLog = (props) => {
|
|
|
72503
72690
|
const extraCount = Math.max(0, dataParse.length - displayedItems.length);
|
|
72504
72691
|
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs("div", { children: [displayedItems.map((item, index) => (jsxRuntime.jsxs("strong", { children: [item.name, index < displayedItems.length - 1 && ", "] }, index))), dataParse.length > 3 && (jsxRuntime.jsxs("strong", { children: [jsxRuntime.jsx("span", { style: { fontWeight: "normal" }, children: " và " }), " ", extraCount, " ng\u01B0\u1EDDi kh\u00E1c"] })), " được ", chat?.createdBy?.id === dataProfile?.id ? (jsxRuntime.jsx("span", { children: "b\u1EA1n " })) : (jsxRuntime.jsx("strong", { style: { marginRight: "5px" }, children: chat?.createdByName })), "th\u00EAm v\u00E0o nh\u00F3m"] }) }));
|
|
72505
72692
|
}, [dataProfile]);
|
|
72506
|
-
|
|
72507
|
-
|
|
72508
|
-
|
|
72509
|
-
|
|
72510
|
-
|
|
72511
|
-
|
|
72512
|
-
|
|
72513
|
-
|
|
72514
|
-
|
|
72515
|
-
|
|
72516
|
-
|
|
72517
|
-
|
|
72518
|
-
|
|
72519
|
-
|
|
72520
|
-
|
|
72521
|
-
|
|
72522
|
-
|
|
72523
|
-
|
|
72524
|
-
|
|
72525
|
-
|
|
72526
|
-
|
|
72527
|
-
|
|
72528
|
-
|
|
72529
|
-
|
|
72530
|
-
|
|
72531
|
-
|
|
72532
|
-
|
|
72533
|
-
|
|
72534
|
-
|
|
72535
|
-
|
|
72536
|
-
|
|
72537
|
-
|
|
72538
|
-
|
|
72539
|
-
|
|
72540
|
-
|
|
72541
|
-
|
|
72542
|
-
|
|
72543
|
-
|
|
72544
|
-
|
|
72545
|
-
|
|
72546
|
-
|
|
72547
|
-
|
|
72548
|
-
|
|
72549
|
-
|
|
72550
|
-
|
|
72551
|
-
|
|
72552
|
-
|
|
72553
|
-
|
|
72554
|
-
|
|
72555
|
-
|
|
72556
|
-
|
|
72557
|
-
|
|
72558
|
-
|
|
72559
|
-
|
|
72560
|
-
|
|
72561
|
-
|
|
72562
|
-
|
|
72563
|
-
|
|
72564
|
-
|
|
72565
|
-
|
|
72566
|
-
|
|
72567
|
-
|
|
72568
|
-
|
|
72569
|
-
|
|
72570
|
-
|
|
72571
|
-
|
|
72572
|
-
|
|
72573
|
-
|
|
72574
|
-
|
|
72575
|
-
|
|
72576
|
-
|
|
72577
|
-
|
|
72578
|
-
|
|
72579
|
-
|
|
72580
|
-
|
|
72581
|
-
|
|
72582
|
-
|
|
72583
|
-
|
|
72584
|
-
|
|
72585
|
-
|
|
72586
|
-
|
|
72587
|
-
|
|
72588
|
-
|
|
72589
|
-
|
|
72590
|
-
|
|
72591
|
-
|
|
72592
|
-
|
|
72593
|
-
|
|
72594
|
-
|
|
72595
|
-
|
|
72596
|
-
|
|
72597
|
-
|
|
72598
|
-
|
|
72599
|
-
|
|
72600
|
-
|
|
72601
|
-
|
|
72602
|
-
// position: "absolute",
|
|
72603
|
-
// top: 6,
|
|
72604
|
-
// left: 6,
|
|
72605
|
-
// backgroundColor: "rgba(0, 0, 0, 0.6)",
|
|
72606
|
-
// color: "white",
|
|
72607
|
-
// padding: "2px 6px",
|
|
72608
|
-
// borderRadius: 4,
|
|
72609
|
-
// fontSize: "10px",
|
|
72610
|
-
// fontWeight: "bold",
|
|
72611
|
-
// zIndex: 1
|
|
72612
|
-
// }}
|
|
72613
|
-
// >
|
|
72614
|
-
// HD
|
|
72615
|
-
// </div>
|
|
72616
|
-
// {/* Overlay cho ảnh cuối nếu có nhiều hơn 6 ảnh */}
|
|
72617
|
-
// {isLastImage && (
|
|
72618
|
-
// <div
|
|
72619
|
-
// style={{
|
|
72620
|
-
// position: "absolute",
|
|
72621
|
-
// top: 0,
|
|
72622
|
-
// left: 0,
|
|
72623
|
-
// right: 0,
|
|
72624
|
-
// bottom: 0,
|
|
72625
|
-
// backgroundColor: "rgba(0, 0, 0, 0.6)",
|
|
72626
|
-
// display: "flex",
|
|
72627
|
-
// alignItems: "center",
|
|
72628
|
-
// justifyContent: "center",
|
|
72629
|
-
// color: "white",
|
|
72630
|
-
// fontSize: "20px",
|
|
72631
|
-
// fontWeight: "bold",
|
|
72632
|
-
// borderRadius: 8,
|
|
72633
|
-
// cursor: "pointer"
|
|
72634
|
-
// }}
|
|
72635
|
-
// onClick={() => handlePreview(file)}
|
|
72636
|
-
// >
|
|
72637
|
-
// +{remainingCount}
|
|
72638
|
-
// </div>
|
|
72639
|
-
// )}
|
|
72640
|
-
// </div>
|
|
72641
|
-
// )
|
|
72642
|
-
// })}
|
|
72643
|
-
// </div>
|
|
72644
|
-
// <div className="px-1 py-75">{moment(chat.time).format("HH:mm")}</div>
|
|
72645
|
-
// </>
|
|
72646
|
-
// )
|
|
72647
|
-
// }, [handlePreview])
|
|
72648
|
-
// const renderChatFile = useCallback((chat: any) => {
|
|
72649
|
-
// const files = chat?.path
|
|
72650
|
-
// return (
|
|
72651
|
-
// <>
|
|
72652
|
-
// {files?.map((file: any, index: number) => {
|
|
72653
|
-
// return (
|
|
72654
|
-
// <div key={index}>
|
|
72655
|
-
// <div className="d-flex p-50">
|
|
72656
|
-
// <div className="me-1" onClick={() => handlePreview(file)}>
|
|
72657
|
-
// {/*<IconFileType fileType={file?.type} fontSize={50} />*/}
|
|
72658
|
-
// <IconFileTypeColor fileType={file?.type} width={35} />
|
|
72659
|
-
// </div>
|
|
72660
|
-
// <div>
|
|
72661
|
-
// <p className="file-name-chat">{file.name}</p>
|
|
72662
|
-
// <p>{formatBytes({ size: file.size })}</p>
|
|
72663
|
-
// </div>
|
|
72664
|
-
// </div>
|
|
72665
|
-
// {index + 1 === files.length && (
|
|
72666
|
-
// <div className="px-1 pb-75">
|
|
72667
|
-
// {moment(chat.time).format("HH:mm")}
|
|
72668
|
-
// </div>
|
|
72669
|
-
// )}
|
|
72670
|
-
// </div>
|
|
72671
|
-
// )
|
|
72672
|
-
// })}
|
|
72673
|
-
// </>
|
|
72674
|
-
// )
|
|
72675
|
-
// }, [handlePreview])
|
|
72693
|
+
React.useCallback((chat) => {
|
|
72694
|
+
const files = chat.path;
|
|
72695
|
+
if (!files || !Array.isArray(files) || files.length === 0) {
|
|
72696
|
+
return null;
|
|
72697
|
+
}
|
|
72698
|
+
// Ảnh đơn lẻ
|
|
72699
|
+
if (files.length === 1) {
|
|
72700
|
+
const imagePath = files[0]?.path?.trim();
|
|
72701
|
+
if (!imagePath) {
|
|
72702
|
+
return null;
|
|
72703
|
+
}
|
|
72704
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: "image-container", style: { maxWidth: "100%", position: "relative" }, children: [jsxRuntime.jsx("img", { src: `${CDN_URL_VIEW}/${imagePath}`, alt: `Chat image ${chat.id + 1}`, "data-file-index": chat.id, style: {
|
|
72705
|
+
maxWidth: "100%",
|
|
72706
|
+
maxHeight: 400,
|
|
72707
|
+
borderRadius: 8,
|
|
72708
|
+
cursor: "pointer"
|
|
72709
|
+
}, onClick: () => handlePreview(files[0]) }), jsxRuntime.jsx("div", { style: {
|
|
72710
|
+
position: "absolute",
|
|
72711
|
+
top: 6,
|
|
72712
|
+
left: 6,
|
|
72713
|
+
backgroundColor: "rgba(0, 0, 0, 0.6)",
|
|
72714
|
+
color: "white",
|
|
72715
|
+
padding: "2px 6px",
|
|
72716
|
+
borderRadius: 4,
|
|
72717
|
+
fontSize: "10px",
|
|
72718
|
+
fontWeight: "bold"
|
|
72719
|
+
}, children: "HD" })] }), jsxRuntime.jsx("div", { className: "px-1 py-75", children: moment(chat.time).format("HH:mm") })] }));
|
|
72720
|
+
}
|
|
72721
|
+
// Nhiều ảnh - hiển thị dạng grid 2 cột, tối đa 6 ảnh
|
|
72722
|
+
const imagesToShow = files.slice(0, 6);
|
|
72723
|
+
const remainingCount = files.length - 6;
|
|
72724
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: "images-grid-container", style: {
|
|
72725
|
+
display: "flex",
|
|
72726
|
+
flexWrap: "wrap",
|
|
72727
|
+
maxWidth: "600px",
|
|
72728
|
+
gap: "4px"
|
|
72729
|
+
}, children: imagesToShow.map((file, index) => {
|
|
72730
|
+
const imagePath = file?.path?.trim();
|
|
72731
|
+
if (!imagePath) {
|
|
72732
|
+
return null;
|
|
72733
|
+
}
|
|
72734
|
+
const imageUrl = `${CDN_URL_VIEW}/${imagePath}`;
|
|
72735
|
+
const isLastImage = index === 5 && remainingCount > 0;
|
|
72736
|
+
// ✅ THÊM: Kiểm tra ảnh cuối khi số lượng lẻ
|
|
72737
|
+
const isOddCount = imagesToShow.length % 2 !== 0;
|
|
72738
|
+
const isLastItem = index === imagesToShow.length - 1;
|
|
72739
|
+
const isFullWidth = isOddCount && isLastItem && !isLastImage;
|
|
72740
|
+
return (jsxRuntime.jsxs("div", { style: {
|
|
72741
|
+
width: isFullWidth ? "100%" : "calc(50% - 2px)",
|
|
72742
|
+
height: "140px",
|
|
72743
|
+
position: "relative",
|
|
72744
|
+
overflow: "hidden",
|
|
72745
|
+
borderRadius: 8,
|
|
72746
|
+
border: "1px solid #e0e0e0"
|
|
72747
|
+
}, children: [jsxRuntime.jsx("img", { src: imageUrl, alt: `Chat image ${index + 1}`, style: {
|
|
72748
|
+
width: "100%",
|
|
72749
|
+
height: "100%",
|
|
72750
|
+
objectFit: "cover",
|
|
72751
|
+
borderRadius: 8,
|
|
72752
|
+
display: "block",
|
|
72753
|
+
cursor: "pointer"
|
|
72754
|
+
}, onClick: () => handlePreview(file) }), jsxRuntime.jsx("div", { style: {
|
|
72755
|
+
position: "absolute",
|
|
72756
|
+
top: 6,
|
|
72757
|
+
left: 6,
|
|
72758
|
+
backgroundColor: "rgba(0, 0, 0, 0.6)",
|
|
72759
|
+
color: "white",
|
|
72760
|
+
padding: "2px 6px",
|
|
72761
|
+
borderRadius: 4,
|
|
72762
|
+
fontSize: "10px",
|
|
72763
|
+
fontWeight: "bold",
|
|
72764
|
+
zIndex: 1
|
|
72765
|
+
}, children: "HD" }), isLastImage && (jsxRuntime.jsxs("div", { style: {
|
|
72766
|
+
position: "absolute",
|
|
72767
|
+
top: 0,
|
|
72768
|
+
left: 0,
|
|
72769
|
+
right: 0,
|
|
72770
|
+
bottom: 0,
|
|
72771
|
+
backgroundColor: "rgba(0, 0, 0, 0.6)",
|
|
72772
|
+
display: "flex",
|
|
72773
|
+
alignItems: "center",
|
|
72774
|
+
justifyContent: "center",
|
|
72775
|
+
color: "white",
|
|
72776
|
+
fontSize: "20px",
|
|
72777
|
+
fontWeight: "bold",
|
|
72778
|
+
borderRadius: 8,
|
|
72779
|
+
cursor: "pointer"
|
|
72780
|
+
}, onClick: () => handlePreview(file), children: ["+", remainingCount] }))] }, `image-${chat.id}-${index}`));
|
|
72781
|
+
}) }), jsxRuntime.jsx("div", { className: "px-1 py-75", children: moment(chat.time).format("HH:mm") })] }));
|
|
72782
|
+
}, [handlePreview]);
|
|
72783
|
+
React.useCallback((chat) => {
|
|
72784
|
+
const files = chat?.path;
|
|
72785
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: files?.map((file, index) => {
|
|
72786
|
+
return (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsxs("div", { className: "d-flex p-50", children: [jsxRuntime.jsx("div", { className: "me-1", onClick: () => handlePreview(file), children: jsxRuntime.jsx(IconFileTypeColor, { fileType: file?.type, width: 35 }) }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("p", { className: "file-name-chat", children: file.name }), jsxRuntime.jsx("p", { children: formatBytes({ size: file.size }) })] })] }), index + 1 === files.length && (jsxRuntime.jsx("div", { className: "px-1 pb-75", children: moment(chat.time).format("HH:mm") }))] }, index));
|
|
72787
|
+
}) }));
|
|
72788
|
+
}, [handlePreview]);
|
|
72676
72789
|
// const renderTaskApplication = useCallback((chat: any) => {
|
|
72677
72790
|
// const safeParse = (str: any) => {
|
|
72678
72791
|
// if (!str) { return {} }
|