code7-leia 1.0.20 → 1.0.21

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "code7-leia",
3
- "version": "1.0.20",
3
+ "version": "1.0.21",
4
4
  "author": "code7-xlab",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.es.js",
@@ -1,11 +1,11 @@
1
1
  import { useState, useEffect } from "react";
2
- import { getLanguage } from '../../utils/getLanguage';
3
- import { FaPlus, FaCopy, FaEdit, FaTrash } from 'react-icons/fa';
4
- import Modal from '../Modal';
5
- import Input from '../TestArea/components/InputTest';
6
- import TextArea from '../TestArea/components/TextArea';
7
- import Search from '../FileArea/components/Search';
8
- import LengthCounter from '../LengthCounter';
2
+ import { getLanguage } from "../../utils/getLanguage";
3
+ import { FaPlus, FaCopy, FaEdit, FaTrash } from "react-icons/fa";
4
+ import Modal from "../Modal";
5
+ import Input from "../TestArea/components/InputTest";
6
+ import TextArea from "../TestArea/components/TextArea";
7
+ import Search from "../FileArea/components/Search";
8
+ import LengthCounter from "../LengthCounter";
9
9
 
10
10
  import { useLeia } from "../../contexts/LeiaProvider";
11
11
 
@@ -22,7 +22,7 @@ interface Persona {
22
22
  }
23
23
 
24
24
  export const PersonasArea = () => {
25
- const { language } = useLeia();
25
+ const { language, readonly } = useLeia();
26
26
  const t = getLanguage(language);
27
27
  const { createPersona, personas, updatePersona, deletePersona } = useLeia();
28
28
 
@@ -122,9 +122,11 @@ export const PersonasArea = () => {
122
122
  <h2>{t.personas?.title}</h2>
123
123
  <p>{t.personas?.description}</p>
124
124
  </div>
125
- <button onClick={openCreate}>
126
- <FaPlus /> {t.personas?.add}
127
- </button>
125
+ {!readonly && (
126
+ <button onClick={openCreate}>
127
+ <FaPlus /> {t.personas?.add}
128
+ </button>
129
+ )}
128
130
  </S.Header>
129
131
  <S.Search>
130
132
  <Search
@@ -146,7 +148,7 @@ export const PersonasArea = () => {
146
148
  </div>
147
149
  </td>
148
150
  <td className="td-actions">
149
- {persona.created_at && (
151
+ {!readonly && persona.created_at && (
150
152
  <div className="actions">
151
153
  <button onClick={() => openEdit(persona)}>
152
154
  <FaEdit /> {t.edit}
@@ -191,7 +193,9 @@ export const PersonasArea = () => {
191
193
  label={t.personas?.fields.prompt}
192
194
  maxLength={10000}
193
195
  value={form.prompt}
194
- onChange={(e: any) => setForm({ ...form, prompt: e.target.value })}
196
+ onChange={(e: any) =>
197
+ setForm({ ...form, prompt: e.target.value })
198
+ }
195
199
  />
196
200
  <LengthCounter value={form.prompt} maxLength={10000} />
197
201
  </div>