code7-leia 0.2.361 → 1.0.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.
Files changed (119) hide show
  1. package/README.md +107 -1
  2. package/dist/code7-leia.css +1 -0
  3. package/dist/index.cjs.js +1053 -0
  4. package/dist/index.es.js +10512 -0
  5. package/package.json +35 -71
  6. package/dist/Leia.d.ts +0 -3
  7. package/dist/code7-leia.cjs.development.js +0 -2466
  8. package/dist/code7-leia.cjs.development.js.map +0 -1
  9. package/dist/code7-leia.cjs.production.min.js +0 -2
  10. package/dist/code7-leia.cjs.production.min.js.map +0 -1
  11. package/dist/code7-leia.esm.js +0 -2458
  12. package/dist/code7-leia.esm.js.map +0 -1
  13. package/dist/components/CustomToast/index.d.ts +0 -13
  14. package/dist/components/CustomToast/styles.d.ts +0 -6
  15. package/dist/components/EmptyState/index.d.ts +0 -16
  16. package/dist/components/EmptyState/styles.d.ts +0 -7
  17. package/dist/components/FileArea/components/AreaUpload/index.d.ts +0 -24
  18. package/dist/components/FileArea/components/AreaUpload/styles.d.ts +0 -8
  19. package/dist/components/FileArea/components/Modal/ModalButtonClose.d.ts +0 -6
  20. package/dist/components/FileArea/components/Modal/ModalContent.d.ts +0 -8
  21. package/dist/components/FileArea/components/Modal/ModalFooter.d.ts +0 -6
  22. package/dist/components/FileArea/components/Modal/ModalHeader.d.ts +0 -6
  23. package/dist/components/FileArea/components/Modal/ModalTitle.d.ts +0 -6
  24. package/dist/components/FileArea/components/Modal/index.d.ts +0 -22
  25. package/dist/components/FileArea/components/Modal/styles.d.ts +0 -25
  26. package/dist/components/FileArea/components/Search/index.d.ts +0 -9
  27. package/dist/components/FileArea/components/Search/styles.d.ts +0 -3
  28. package/dist/components/FileArea/components/Spinner/index.d.ts +0 -4
  29. package/dist/components/FileArea/components/Spinner/styles.d.ts +0 -1
  30. package/dist/components/FileArea/components/Table/index.d.ts +0 -4
  31. package/dist/components/FileArea/components/Table/styles.d.ts +0 -3
  32. package/dist/components/FileArea/index.d.ts +0 -2
  33. package/dist/components/FileArea/styles.d.ts +0 -6
  34. package/dist/components/MultiSelect/index.d.ts +0 -17
  35. package/dist/components/MultiSelect/styles.d.ts +0 -7
  36. package/dist/components/Select/index.d.ts +0 -12
  37. package/dist/components/Select/styles.d.ts +0 -1
  38. package/dist/components/Tabs/index.d.ts +0 -35
  39. package/dist/components/Tabs/styles.d.ts +0 -13
  40. package/dist/components/TestArea/components/InputTest/index.d.ts +0 -7
  41. package/dist/components/TestArea/components/InputTest/styles.d.ts +0 -3
  42. package/dist/components/TestArea/components/TextArea/index.d.ts +0 -19
  43. package/dist/components/TestArea/components/TextArea/styles.d.ts +0 -10
  44. package/dist/components/TestArea/index.d.ts +0 -2
  45. package/dist/components/TestArea/styles.d.ts +0 -8
  46. package/dist/contexts/SharedPropsProvider.d.ts +0 -19
  47. package/dist/index.d.ts +0 -11
  48. package/dist/index.js +0 -8
  49. package/dist/interface/FileData.d.ts +0 -10
  50. package/dist/interface/Language.d.ts +0 -90
  51. package/dist/interface/Table.d.ts +0 -12
  52. package/dist/service/Api.d.ts +0 -3
  53. package/dist/service/ApiDev.d.ts +0 -3
  54. package/dist/service/ApiHml.d.ts +0 -3
  55. package/dist/store/index.d.ts +0 -10
  56. package/dist/store/modules/actions.d.ts +0 -93
  57. package/dist/store/modules/reducer.d.ts +0 -13
  58. package/dist/store/modules/sagas.d.ts +0 -26
  59. package/dist/store/modules/types.d.ts +0 -18
  60. package/dist/utils/formatAxios.d.ts +0 -3
  61. package/dist/utils/getApi.d.ts +0 -1
  62. package/dist/utils/getLanguage.d.ts +0 -2
  63. package/dist/utils/languages/en.d.ts +0 -2
  64. package/dist/utils/languages/es.d.ts +0 -2
  65. package/dist/utils/languages/pt-br.d.ts +0 -2
  66. package/src/Leia.tsx +0 -44
  67. package/src/components/CustomToast/index.tsx +0 -62
  68. package/src/components/CustomToast/styles.tsx +0 -73
  69. package/src/components/EmptyState/index.tsx +0 -88
  70. package/src/components/EmptyState/styles.tsx +0 -81
  71. package/src/components/FileArea/components/AreaUpload/index.tsx +0 -137
  72. package/src/components/FileArea/components/AreaUpload/styles.tsx +0 -75
  73. package/src/components/FileArea/components/Modal/ModalButtonClose.tsx +0 -23
  74. package/src/components/FileArea/components/Modal/ModalContent.tsx +0 -26
  75. package/src/components/FileArea/components/Modal/ModalFooter.tsx +0 -18
  76. package/src/components/FileArea/components/Modal/ModalHeader.tsx +0 -18
  77. package/src/components/FileArea/components/Modal/ModalTitle.tsx +0 -18
  78. package/src/components/FileArea/components/Modal/index.tsx +0 -131
  79. package/src/components/FileArea/components/Modal/styles.tsx +0 -121
  80. package/src/components/FileArea/components/Search/index.tsx +0 -44
  81. package/src/components/FileArea/components/Search/styles.tsx +0 -26
  82. package/src/components/FileArea/components/Spinner/index.tsx +0 -22
  83. package/src/components/FileArea/components/Spinner/styles.tsx +0 -59
  84. package/src/components/FileArea/components/Table/index.tsx +0 -34
  85. package/src/components/FileArea/components/Table/styles.tsx +0 -60
  86. package/src/components/FileArea/index.tsx +0 -281
  87. package/src/components/FileArea/styles.tsx +0 -183
  88. package/src/components/MultiSelect/index.tsx +0 -102
  89. package/src/components/MultiSelect/styles.tsx +0 -77
  90. package/src/components/Select/index.tsx +0 -53
  91. package/src/components/Select/styles.tsx +0 -49
  92. package/src/components/Tabs/index.tsx +0 -71
  93. package/src/components/Tabs/styles.tsx +0 -87
  94. package/src/components/TestArea/components/InputTest/index.tsx +0 -21
  95. package/src/components/TestArea/components/InputTest/styles.tsx +0 -28
  96. package/src/components/TestArea/components/TextArea/index.tsx +0 -97
  97. package/src/components/TestArea/components/TextArea/styles.tsx +0 -171
  98. package/src/components/TestArea/index.tsx +0 -101
  99. package/src/components/TestArea/styles.tsx +0 -112
  100. package/src/contexts/SharedPropsProvider.tsx +0 -79
  101. package/src/index.tsx +0 -20
  102. package/src/interface/FileData.ts +0 -11
  103. package/src/interface/Language.ts +0 -93
  104. package/src/interface/Table.ts +0 -12
  105. package/src/service/Api.ts +0 -9
  106. package/src/service/ApiDev.ts +0 -9
  107. package/src/service/ApiHml.ts +0 -9
  108. package/src/store/index.ts +0 -13
  109. package/src/store/modules/actions.ts +0 -88
  110. package/src/store/modules/reducer.ts +0 -46
  111. package/src/store/modules/sagas.ts +0 -127
  112. package/src/store/modules/types.ts +0 -19
  113. package/src/types/image.d.ts +0 -4
  114. package/src/utils/formatAxios.tsx +0 -15
  115. package/src/utils/getApi.tsx +0 -16
  116. package/src/utils/getLanguage.tsx +0 -17
  117. package/src/utils/languages/en.ts +0 -87
  118. package/src/utils/languages/es.ts +0 -87
  119. package/src/utils/languages/pt-br.ts +0 -87
@@ -1,121 +0,0 @@
1
- import styled from 'styled-components';
2
-
3
- interface FullScreenProps {
4
- isopen: number;
5
- isfixed: number;
6
- zindex: number;
7
- }
8
-
9
- export const FullScreen = styled.div<FullScreenProps>`
10
- display: ${({ isopen }) => (isopen === 1 ? 'flex' : 'none')};
11
- cursor: ${({ isfixed }) => (isfixed === 0 ? 'pointer' : 'default')};
12
-
13
- position: fixed;
14
- top: 0;
15
- left: 0;
16
- right: 0;
17
- bottom: 0;
18
- justify-content: center;
19
- align-items: center;
20
- z-index: ${({ zindex }) => zindex};
21
- animation: fadeIn 380ms ease-in-out 1;
22
- background-color: #2f3845b8;
23
- backdrop-filter: blur(2px);
24
-
25
- @keyframes fadeIn {
26
- from {
27
- background-color: #2f384521;
28
- }
29
- to {
30
- background-color: #2f3845b8;
31
- }
32
- }
33
- `;
34
-
35
- interface ModalProps {
36
- maxwidth?: string;
37
- maxheight?: string;
38
- }
39
-
40
- export const Modal = styled.div<ModalProps>`
41
- background-color: #fff;
42
- border-radius: 3px;
43
- position: relative;
44
- cursor: default;
45
- width: 100%;
46
- max-width: ${({ maxwidth }) => maxwidth};
47
- animation: slideIn 350ms cubic-bezier(0.42, 0, 0.21, 1) 1;
48
-
49
- @keyframes slideIn {
50
- from {
51
- transform: translateY(-120px);
52
- opacity: 0;
53
- }
54
-
55
- 20% {
56
- opacity: 0;
57
- }
58
-
59
- to {
60
- transform: translateY(0);
61
- opacity: 1;
62
- }
63
- }
64
- `;
65
-
66
- interface ModalContainerProps {
67
- maxheight?: string;
68
- }
69
-
70
- export const ModalContainer = styled.div<ModalContainerProps>`
71
- width: 100%;
72
- overflow-y: auto;
73
- max-height: ${({ maxheight }) => maxheight};
74
- `;
75
-
76
- export const ModalHeader = styled.header`
77
- display: flex;
78
- justify-content: space-between;
79
- align-items: center;
80
- border-bottom: 1px solid #dadce3;
81
- padding: var(--spacement-medium);
82
- `;
83
-
84
- export const ModalTitle = styled.div`
85
- font-style: normal;
86
- font-weight: normal;
87
- font-size: 20px;
88
- line-height: 150%;
89
- letter-spacing: 0.0075em;
90
- color: var(--neutral-4);
91
- `;
92
-
93
- export const ModalButtonClose = styled.button`
94
- outline: none;
95
- cursor: pointer;
96
-
97
- :hover {
98
- opacity: 0.7;
99
- }
100
- `;
101
-
102
- interface ModalContentWrapperProps {
103
- overflowy?: string;
104
- maxheight?: string;
105
- }
106
-
107
- export const ModalContentWrapper = styled.div<ModalContentWrapperProps>`
108
- width: 100%;
109
- overflow-y: ${({ overflowy }) => overflowy};
110
- max-height: ${({ maxheight }) => maxheight};
111
- padding: var(--spacement-medium);
112
- `;
113
-
114
- export const ModalFooterWrapper = styled.div`
115
- padding: var(--spacement-medium);
116
- background: var(--neutral-0);
117
- display: flex;
118
- align-items: center;
119
- justify-content: flex-end;
120
- gap: var(--spacement-medium);
121
- `;
@@ -1,44 +0,0 @@
1
- import React from 'react';
2
- import unorm from 'unorm';
3
- import { FaSearch } from 'react-icons/fa';
4
- import { InputContainer, Input, IconContainer } from './styles';
5
- import type { FileData } from '../../../../interface/FileData';
6
-
7
- interface SearchInputProps {
8
- placeholder: string;
9
- initialFiles: FileData[];
10
- setFiles: React.Dispatch<React.SetStateAction<FileData[]>>;
11
- }
12
-
13
- const SearchInput: React.FC<SearchInputProps> = ({
14
- placeholder,
15
- setFiles,
16
- initialFiles,
17
- }) => {
18
- const searchName = (e: React.ChangeEvent<HTMLInputElement>) => {
19
- const searchTerm = e.target.value.trim();
20
- const normalizedSearchTerm = unorm.nfkd(searchTerm).toLowerCase();
21
-
22
- const newFiles = initialFiles.filter((file) => {
23
- const normalizedFileName = unorm.nfkd(file.name).toLowerCase();
24
- return normalizedFileName.includes(normalizedSearchTerm);
25
- });
26
-
27
- setFiles(searchTerm !== '' ? newFiles : initialFiles);
28
- };
29
-
30
- return (
31
- <InputContainer>
32
- <Input
33
- type="text"
34
- onChange={(e: any) => searchName(e)}
35
- placeholder={placeholder}
36
- />
37
- <IconContainer>
38
- <FaSearch />
39
- </IconContainer>
40
- </InputContainer>
41
- );
42
- };
43
-
44
- export default SearchInput;
@@ -1,26 +0,0 @@
1
- import styled from 'styled-components';
2
-
3
- export const InputContainer = styled.div`
4
- position: relative;
5
- width: 300px;
6
- `;
7
-
8
- export const Input = styled.input`
9
- padding-left: 40px;
10
- border-radius: 5px;
11
- border: 1px solid #ccc;
12
- height: 45px;
13
- width: 100%;
14
-
15
- &:focus {
16
- outline: none;
17
- box-shadow: 0 0 0 3px #6690ff;
18
- }
19
- `;
20
-
21
- export const IconContainer = styled.div`
22
- position: absolute;
23
- top: 14px;
24
- left: 10px;
25
- pointer-events: none;
26
- `;
@@ -1,22 +0,0 @@
1
- import React from 'react';
2
- import cc from 'classcat';
3
-
4
- import * as S from './styles';
5
-
6
- import { SpinnerProps } from '../../../../interface/Table'
7
-
8
- const Spinner: React.FC<SpinnerProps> = ({ color = 'neutral-3', size = 'md', className }) => {
9
- return (
10
- <S.SpinnerWrapper
11
- color={color}
12
- className={cc([`spinner--${size}`, className])}
13
- >
14
- <span />
15
- <span />
16
- <span />
17
- <span />
18
- </S.SpinnerWrapper>
19
- );
20
- };
21
-
22
- export default Spinner;
@@ -1,59 +0,0 @@
1
- import styled from 'styled-components';
2
-
3
- export const SpinnerWrapper = styled.span`
4
- display: inline-block;
5
- position: relative;
6
- display: flex;
7
- align-items: center;
8
- justify-content: center;
9
-
10
- &.spinner--sm {
11
- width: 24px;
12
- height: 24px;
13
- }
14
-
15
- &.spinner--md {
16
- width: 32px;
17
- height: 32px;
18
- }
19
-
20
- &.spinner--lg {
21
- width: 60px;
22
- height: 60px;
23
- }
24
-
25
- span {
26
- box-sizing: border-box;
27
- display: block;
28
- position: absolute;
29
- width: 100%;
30
- height: 100%;
31
- margin: 8px;
32
- border: 4px solid #fff;
33
- border-radius: 50%;
34
- animation: rotateSpinner 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
35
- border-color: ${(props) => `var(--${props.color})`} transparent transparent
36
- transparent;
37
- }
38
-
39
- & span:nth-child(1) {
40
- animation-delay: -0.45s;
41
- }
42
-
43
- & span:nth-child(2) {
44
- animation-delay: -0.3s;
45
- }
46
-
47
- & span:nth-child(3) {
48
- animation-delay: -0.15s;
49
- }
50
-
51
- @keyframes rotateSpinner {
52
- 0% {
53
- transform: rotate(0deg);
54
- }
55
- 100% {
56
- transform: rotate(360deg);
57
- }
58
- }
59
- `;
@@ -1,34 +0,0 @@
1
- import React, { forwardRef, Ref } from 'react';
2
- import PropTypes from 'prop-types';
3
- import cc from 'classcat';
4
-
5
- import * as S from './styles';
6
- import Spinner from '../Spinner';
7
-
8
- import { TableProps } from '../../../../interface/Table'
9
-
10
- const Table = forwardRef(
11
- ({ size = 'medium', children, isloading = false, className = '', ...props }: TableProps, ref: Ref<HTMLTableElement>) => {
12
- return (
13
- <S.TableWrapper className={className}>
14
- {isloading ? (
15
- <S.TableLoadingWrapper>
16
- <Spinner />
17
- </S.TableLoadingWrapper>
18
- ) : null}
19
- <S.Table className={cc([size])} ref={ref} {...props}>
20
- {children}
21
- </S.Table>
22
- </S.TableWrapper>
23
- );
24
- }
25
- );
26
-
27
- Table.propTypes = {
28
- children: PropTypes.node.isRequired,
29
- className: PropTypes.string,
30
- size: PropTypes.oneOf(['small', 'medium', 'large']),
31
- isloading: PropTypes.bool,
32
- };
33
-
34
- export default Table;
@@ -1,60 +0,0 @@
1
- import styled from 'styled-components';
2
-
3
- export const TableWrapper = styled.div`
4
- width: 100%;
5
- height: max-content;
6
- min-height: 50px;
7
- position: relative;
8
- `;
9
-
10
- export const Table = styled.table`
11
- font-size: 14px;
12
- line-height: 143%;
13
- color: black;
14
- width: 100%;
15
- border-collapse: collapse;
16
- border-radius: 4px;
17
-
18
- th {
19
- font-weight: 600;
20
- font-size: 14px;
21
- line-height: 143%;
22
- letter-spacing: 0.018em;
23
- color: #5A5D68;
24
- text-align: left;
25
- padding: 8px;
26
- border: 1px #dadce3 solid;
27
- }
28
-
29
- thead tr {
30
- background: #dadce3;
31
- }
32
-
33
- tbody tr {
34
- border: 1px solid #dadce3;
35
- }
36
-
37
- &.small td {
38
- padding: 4px;
39
- }
40
-
41
- &.medium td {
42
- padding: 8px;
43
- }
44
-
45
- &.large td {
46
- padding: 16px;
47
- }
48
- `;
49
-
50
- export const TableLoadingWrapper = styled.div`
51
- position: absolute;
52
- top: 0;
53
- left: 0;
54
- bottom: 0;
55
- right: 0;
56
- display: flex;
57
- justify-content: center;
58
- align-items: center;
59
- background-color: #f3f5f961;
60
- `;
@@ -1,281 +0,0 @@
1
- import React, { useEffect, useState} from 'react';
2
- import { useDispatch, useSelector } from 'react-redux';
3
- import { renderToString } from 'react-dom/server';
4
-
5
- import { FaUpload, FaList, FaCheck, FaFile } from 'react-icons/fa';
6
- import { GiWeightLiftingUp } from "react-icons/gi";
7
- import { TiDelete } from "react-icons/ti";
8
-
9
- import type { FileData, tag } from '../../interface/FileData'
10
-
11
- import { getLanguage } from '../../utils/getLanguage'
12
-
13
- import * as S from './styles';
14
- import Table from './components/Table';
15
- import Search from './components/Search';
16
- import Modal from './components/Modal'
17
- import ModalFooter from './components/Modal/ModalFooter'
18
- import ModalContent from './components/Modal/ModalContent'
19
- import EmptyState from '../EmptyState';
20
- import MultiSelect from '../MultiSelect';
21
- import AreaUpload from './components/AreaUpload';
22
- import { SharedPropsProvider, useSharedProps } from '../../contexts/SharedPropsProvider';
23
- import { deleteFilesAction, getFilesAction, uploadFilesAction, trainingAction } from '../../store/modules/actions';
24
-
25
- export const FileArea = () => {
26
- const { id, language, propTags, token, env, readonly } = useSharedProps();
27
- const [files, setFiles] = useState<FileData[]>([]);
28
- const [initialFiles, setInitialFiles] = useState<FileData[]>([]);
29
- const [uploadFile, setUploadFile] = useState<{ content: ArrayBuffer | string; properties: File }>();
30
- const [modal, setModal] = useState(false)
31
- const [modalDelete, setModalDelete] = useState(false)
32
- const [modalTraining, setModalTraining] = useState(false)
33
- const [fileDelete, setFileDelete] = useState('')
34
- const [optionsPresset, setOptionsPresset] = useState<{ label: any; value: any; }[]>([])
35
- const [presset, setPresset] = useState<string[]>([]);
36
- const t = getLanguage(language)
37
- const dispatch = useDispatch();
38
- const initFiles = useSelector((state: any) => state.files);
39
- const isloading = useSelector((state: any) => state.isloading);
40
- const tags = propTags ? propTags.tags : [];
41
-
42
- useEffect(() => {
43
- dispatch(getFilesAction(id, token, env))
44
- }, [id])
45
-
46
- useEffect(() => {
47
- if(tags.length > 0){
48
- const options = tags.map((tag: any) => {
49
- return { label: tag, value: tag }
50
- })
51
- setOptionsPresset(options)
52
- }else if(optionsPresset.length > 0){
53
- setOptionsPresset([])
54
- }
55
-
56
- }, [tags])
57
-
58
- useEffect(() => {
59
- if(!modal){
60
- const options = tags.map((tag: any) => {
61
- return { label: tag, value: tag }
62
- })
63
- setOptionsPresset(options)
64
- }
65
- }, [modal])
66
-
67
- useEffect(() => {
68
- if(!!initFiles){
69
- setFiles(initFiles)
70
- setInitialFiles(initFiles)
71
- }
72
- }, [initFiles])
73
-
74
- const pressetTag = (tags: [tag]) => {
75
- let html = '';
76
-
77
- html += tags.map(tag => {
78
- const checkIcon = tag.trained ? '' : renderToString(<TiDelete size={14} />);
79
- const tagClass = tag.trained ? 'trained' : '';
80
- return `<p class='tag ${tagClass}'>${tag.name} ${checkIcon}</p>`;
81
- }).join('');
82
-
83
- return html;
84
- }
85
-
86
- const handleOpenModal = () => {
87
- if(modal){
88
- setUploadFile(undefined)
89
- setPresset([])
90
- }
91
- setModal(!modal)
92
- }
93
-
94
- const handleOpenModalDelete = (name: string) => {
95
- setFileDelete(name)
96
- setModalDelete(!modalDelete)
97
- }
98
-
99
- const handleOpenModalTraining = (tags?: [tag]) => {
100
- let pressets: string[] = []
101
- tags?.map((tag) => {
102
- if(!tag.trained){
103
- pressets.push(tag.name)
104
- }
105
- })
106
- setPresset(pressets)
107
- setModalTraining(!modalTraining)
108
- }
109
-
110
- const deleteFile = () => {
111
- dispatch(deleteFilesAction(fileDelete, id, language, token, env))
112
- setModalDelete(false)
113
- }
114
-
115
- const handleUploadFile = () => {
116
- dispatch(uploadFilesAction(uploadFile, id, presset, language, token, env))
117
- setModal(false)
118
- setUploadFile(undefined)
119
- setPresset([])
120
- };
121
-
122
- const handleTrain = () => {
123
- dispatch(trainingAction(id, presset, language, token, env))
124
- setModalTraining(false)
125
- setPresset([])
126
- };
127
-
128
- const viewFile = (link: string, name: string) => {
129
- if(link){
130
- const checkIcon = renderToString(<FaFile size={14} />);
131
- return `<a href='${link}' target='_blank'>${checkIcon}</a> ${name}`;
132
- }
133
- return name
134
- };
135
-
136
- const renderFiles = () => {
137
- return (
138
- <S.Container isloading={isloading}>
139
- <div id='loading' />
140
- <S.Header>
141
- <div className='infos'>
142
- <h2>{t.files}</h2>
143
- <p>{t.fileArea.description}</p>
144
- </div>
145
- <div className='actions'>
146
- <Search placeholder={t.fileArea.search} setFiles={setFiles} initialFiles={initialFiles}></Search>
147
- <div>
148
- <button id='button-upload' disabled={readonly} onClick={handleOpenModal}><FaUpload size={14} /> {t.fileArea.fileUpload}</button>
149
- <button disabled={readonly} onClick={() => handleOpenModalTraining(undefined)} ><GiWeightLiftingUp size={14} /> {t.fileArea.training}</button>
150
- </div>
151
- </div>
152
- </S.Header>
153
- {
154
- files.length === 0 ? (
155
- <EmptyState
156
- icon={<FaList></FaList>}
157
- title={t.fileArea.emptyState.title}
158
- description={t.fileArea.emptyState.description}
159
- iconButton={<button id='button-upload' disabled={readonly} onClick={handleOpenModal}><FaUpload size={14} /> {t.fileArea.fileUpload}</button>}
160
- descriptionButton={t.fileArea.fileUpload}
161
- widthButton="230px"
162
- />
163
- ) : <Table>
164
- <thead>
165
- <tr>
166
- <th key="th_file_name" className="th_file_name">
167
- {t.fileArea.fileName}
168
- </th>
169
- <th key="th_file_name" className="th_status">
170
- {t.fileArea.status}
171
- </th>
172
- <th key="th_pressets" className="th_pressets">
173
- {t.fileArea.presset}
174
- </th>
175
- <th key="th_actions" className="th_actions">
176
- {t.fileArea.actions}
177
- </th>
178
- </tr>
179
- </thead>
180
-
181
- <tbody>
182
- {files.map((object) => (
183
- <tr>
184
- <td dangerouslySetInnerHTML={{ __html: viewFile(object.link, object.name) }} />
185
- <td>{object.trained ? <FaCheck size={14} style={{ color: 'green' }} /> : <TiDelete size={14} style={{ color: 'red' }} />}</td>
186
- <td className='tags' dangerouslySetInnerHTML={{ __html: pressetTag(object.tags) }} />
187
- <td>
188
- <div className='divDelete'>
189
- <button className='buttonTraining' disabled={readonly} onClick={() => handleOpenModalTraining(object.tags)}>{t.buttons.training}</button>
190
- <button className='buttonDelete' disabled={readonly} onClick={() => handleOpenModalDelete(object.name)}>{t.buttons.delete}</button>
191
- </div>
192
- </td>
193
- </tr>
194
- ))}
195
- </tbody>
196
- </Table>
197
- }
198
- <Modal
199
- isopen={modal}
200
- maxwidth="600px"
201
- maxheight="max-content"
202
- onClose={handleOpenModal}
203
- title={t.fileArea.modal.uploadFile}
204
- >
205
- <ModalContent>
206
- <div className='choose-file'>
207
- <AreaUpload
208
- setFile={setUploadFile}
209
- file={uploadFile?.properties.name}
210
- />
211
- </div>
212
- <div className='presset'>
213
- <p>{t.fileArea.presset}</p>
214
- <MultiSelect setOptions={setOptionsPresset} options={optionsPresset} presset={presset} setPresset={setPresset} modal={modal} language={language} hasAddNewOptions={true} />
215
- </div>
216
- </ModalContent>
217
- <ModalFooter>
218
- <button className='button cancel' onClick={handleOpenModal}>
219
- {t.buttons.cancel}
220
- </button>
221
- <button onClick={() => handleUploadFile()} className='button send' type="submit" form="form-tts">
222
- {t.buttons.send}
223
- </button>
224
- </ModalFooter>
225
-
226
- </Modal>
227
- <Modal
228
- isopen={modalDelete}
229
- maxwidth="600px"
230
- maxheight="max-content"
231
- onClose={() => handleOpenModalDelete('')}
232
- title={t.fileArea.modal.deleteFileTitle}
233
- >
234
- <ModalContent>
235
- <p id='warning'>{t.fileArea.modal.deleteFile}</p>
236
- </ModalContent>
237
- <ModalFooter>
238
- <button className='button cancel' onClick={() => handleOpenModalDelete('')}>
239
- {t.buttons.cancel}
240
- </button>
241
- <button className='button delete' type="submit" form="form-tts" onClick={deleteFile}>
242
- {t.buttons.delete}
243
- </button>
244
- </ModalFooter>
245
- </Modal>
246
- <Modal
247
- isopen={modalTraining}
248
- maxwidth="600px"
249
- maxheight="max-content"
250
- onClose={() => handleOpenModalTraining(undefined)}
251
- title={t.fileArea.modal.trainingTitle}
252
- >
253
- <ModalContent>
254
- <p id='info'>{t.fileArea.modal.trainingDescription}</p>
255
- <div className='presset'>
256
- <p>{t.fileArea.presset}</p>
257
- <MultiSelect setOptions={setOptionsPresset} options={optionsPresset} presset={presset} setPresset={setPresset} modal={modal} language={language} hasAddNewOptions={false} />
258
- </div>
259
- </ModalContent>
260
- <ModalFooter>
261
- <button className='button cancel' onClick={() => handleOpenModalTraining(undefined)}>
262
- {t.buttons.cancel}
263
- </button>
264
- <button onClick={() => handleTrain()} className='button send' type="submit" form="form-tts">
265
- {t.buttons.send}
266
- </button>
267
- </ModalFooter>
268
-
269
- </Modal>
270
- </S.Container>
271
- );
272
- }
273
-
274
- return (
275
- <SharedPropsProvider readonly={readonly} id={id} language={language} token={token} env={env} propTags={{ tags: [] }} personas={[{name: '', description: ''}]}>
276
- <S.Container>
277
- {renderFiles()}
278
- </S.Container>
279
- </SharedPropsProvider>
280
- );
281
- };