code7-leia 0.2.31 → 0.2.34

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.
@@ -9,6 +9,7 @@ interface Props {
9
9
  name: string;
10
10
  description: string;
11
11
  }];
12
+ readonly: boolean;
12
13
  token: string;
13
14
  env: string;
14
15
  children?: React.ReactNode;
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ export declare type Props = PropsWithChildren<{
4
4
  id: string;
5
5
  activeTab: string;
6
6
  language: "en" | "pt-br" | "es";
7
+ readonly: boolean;
7
8
  loading: ReactElement;
8
9
  token: string;
9
10
  }>;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.2.31",
2
+ "version": "0.2.34",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -23,7 +23,7 @@ import { SharedPropsProvider, useSharedProps } from '../../contexts/SharedPropsP
23
23
  import { deleteFilesAction, getFilesAction, uploadFilesAction, trainingAction } from '../../store/modules/actions';
24
24
 
25
25
  export const FileArea = () => {
26
- const { id, language, propTags, token, env } = useSharedProps();
26
+ const { id, language, propTags, token, env, readonly } = useSharedProps();
27
27
  const [files, setFiles] = useState<FileData[]>([]);
28
28
  const [initialFiles, setInitialFiles] = useState<FileData[]>([]);
29
29
  const [uploadFile, setUploadFile] = useState<{ content: ArrayBuffer | string; properties: File }>();
@@ -145,8 +145,8 @@ export const FileArea = () => {
145
145
  <div className='actions'>
146
146
  <Search placeholder={t.fileArea.search} setFiles={setFiles} initialFiles={initialFiles}></Search>
147
147
  <div>
148
- <button id='button-upload' onClick={handleOpenModal}><FaUpload size={14} /> {t.fileArea.fileUpload}</button>
149
- <button onClick={() => handleOpenModalTraining(undefined)}><GiWeightLiftingUp size={14} /> {t.fileArea.training}</button>
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
150
  </div>
151
151
  </div>
152
152
  </S.Header>
@@ -156,7 +156,7 @@ export const FileArea = () => {
156
156
  icon={<FaList></FaList>}
157
157
  title={t.fileArea.emptyState.title}
158
158
  description={t.fileArea.emptyState.description}
159
- iconButton={<button id='button-upload' onClick={handleOpenModal}><FaUpload size={14} /> {t.fileArea.fileUpload}</button>}
159
+ iconButton={<button id='button-upload' disabled={readonly} onClick={handleOpenModal}><FaUpload size={14} /> {t.fileArea.fileUpload}</button>}
160
160
  descriptionButton={t.fileArea.fileUpload}
161
161
  widthButton="230px"
162
162
  />
@@ -186,8 +186,8 @@ export const FileArea = () => {
186
186
  <td className='tags' dangerouslySetInnerHTML={{ __html: pressetTag(object.tags) }} />
187
187
  <td>
188
188
  <div className='divDelete'>
189
- <button className='buttonTraining' onClick={() => handleOpenModalTraining(object.tags)}>{t.buttons.training}</button>
190
- <button className='buttonDelete' onClick={() => handleOpenModalDelete(object.name)}>{t.buttons.delete}</button>
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
191
  </div>
192
192
  </td>
193
193
  </tr>
@@ -272,7 +272,7 @@ export const FileArea = () => {
272
272
  }
273
273
 
274
274
  return (
275
- <SharedPropsProvider id={id} language={language} token={token} env={env} propTags={{ tags: [] }} personas={[{name: '', description: ''}]}>
275
+ <SharedPropsProvider readonly={readonly} id={id} language={language} token={token} env={env} propTags={{ tags: [] }} personas={[{name: '', description: ''}]}>
276
276
  <S.Container>
277
277
  {renderFiles()}
278
278
  </S.Container>
@@ -1,4 +1,4 @@
1
- import styled, { css } from 'styled-components';
1
+ import styled, { css } from 'styled-components';
2
2
 
3
3
  interface ContainerProps {
4
4
  isloading?: boolean;
@@ -162,6 +162,11 @@ export const Header = styled.div`
162
162
  padding: 10px 20px;
163
163
  color: white;
164
164
  border-radius: 4px;
165
+
166
+ &:disabled {
167
+ cursor: not-allowed;
168
+ opacity: 0.5;
169
+ }
165
170
  }
166
171
  }
167
172
 
@@ -13,7 +13,7 @@ import { useDispatch, useSelector } from 'react-redux';
13
13
  import { testAction } from '../../store/modules/actions';
14
14
 
15
15
  export const TestArea = () => {
16
- const { id, language, personas, propTags, token, env } = useSharedProps();
16
+ const { id, language, personas, propTags, token, env, readonly } = useSharedProps();
17
17
  const t = getLanguage(language)
18
18
  const results = useSelector((state: any) => state.message);
19
19
  const isloading = useSelector((state: any) => state.isloading);
@@ -92,7 +92,7 @@ export const TestArea = () => {
92
92
  }
93
93
 
94
94
  return (
95
- <SharedPropsProvider id={id} token={token} language={language} env={env} propTags={{ tags: [] }} personas={[{name: '', description: ''}]}>
95
+ <SharedPropsProvider id={id} token={token} readonly={readonly} language={language} env={env} propTags={{ tags: [] }} personas={[{name: '', description: ''}]}>
96
96
  <S.Container>
97
97
  {returnTest()}
98
98
  </S.Container>
@@ -4,8 +4,9 @@ import { getApi } from '../utils/getApi';
4
4
  interface Props {
5
5
  id: string;
6
6
  language: "en" | "pt-br" | "es";
7
- propTags: { tags: [] }
7
+ propTags: { tags: [] };
8
8
  personas: [{ name: string, description: string }];
9
+ readonly: boolean;
9
10
  token: string;
10
11
  env: string;
11
12
  children?: React.ReactNode;
package/src/index.tsx CHANGED
@@ -8,7 +8,8 @@ export type Props = PropsWithChildren<{
8
8
  id: string;
9
9
  activeTab: string;
10
10
  language: "en" | "pt-br" | "es";
11
- loading: ReactElement
11
+ readonly: boolean;
12
+ loading: ReactElement;
12
13
  token: string;
13
14
  }>;
14
15