code7-leia 1.0.21 → 1.0.24
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.es.js +665 -637
- package/package.json +1 -1
- package/src/components/Select/index.tsx +2 -1
- package/src/components/Select/styles.tsx +17 -1
- package/src/components/TestArea/index.tsx +35 -25
package/package.json
CHANGED
|
@@ -31,7 +31,7 @@ const CustomSelect: React.FC<SelectProps> = ({
|
|
|
31
31
|
<S.Container>
|
|
32
32
|
<div className="custom-select" onClick={() => setIsOpen(!isOpen)}>
|
|
33
33
|
<div className="selected-option">
|
|
34
|
-
{selectedValue || placeholder}
|
|
34
|
+
<span>{selectedValue || placeholder}</span>
|
|
35
35
|
<span className="arrow">▼</span>
|
|
36
36
|
</div>
|
|
37
37
|
{isOpen && (
|
|
@@ -45,6 +45,7 @@ const CustomSelect: React.FC<SelectProps> = ({
|
|
|
45
45
|
color: option.value === selectedValue ? 'white' : undefined,
|
|
46
46
|
}}
|
|
47
47
|
className="option"
|
|
48
|
+
title={option.label}
|
|
48
49
|
onClick={() => handleSelectOption(option.value)}
|
|
49
50
|
>
|
|
50
51
|
{option.label}
|
|
@@ -13,12 +13,25 @@ export const Container = styled.div`
|
|
|
13
13
|
.selected-option {
|
|
14
14
|
padding: 12px;
|
|
15
15
|
border-radius: 4px;
|
|
16
|
-
border: 1px solid
|
|
16
|
+
border: 1px solid var(--neutral-2);
|
|
17
17
|
height: 45px;
|
|
18
18
|
display: flex;
|
|
19
19
|
align-items: center;
|
|
20
20
|
justify-content: space-between;
|
|
21
21
|
font-size: 14px;
|
|
22
|
+
max-width: 220px;
|
|
23
|
+
overflow: hidden;
|
|
24
|
+
white-space: nowrap;
|
|
25
|
+
|
|
26
|
+
span:nth-child(1) {
|
|
27
|
+
overflow: hidden;
|
|
28
|
+
text-overflow: ellipsis;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
span:nth-child(2) {
|
|
32
|
+
color: var(--neutral-3);
|
|
33
|
+
margin-left: 6px;
|
|
34
|
+
}
|
|
22
35
|
}
|
|
23
36
|
|
|
24
37
|
.options {
|
|
@@ -38,6 +51,9 @@ export const Container = styled.div`
|
|
|
38
51
|
transition: background-color 0.1s;
|
|
39
52
|
letter-spacing: 0.5px;
|
|
40
53
|
font-size: 14px;
|
|
54
|
+
white-space: nowrap;
|
|
55
|
+
overflow: hidden;
|
|
56
|
+
text-overflow: ellipsis;
|
|
41
57
|
|
|
42
58
|
&:hover {
|
|
43
59
|
background-color: #6690ff;
|
|
@@ -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
|
|
16
|
+
const { id, language, personas, propTags, token, env } = useLeia();
|
|
17
17
|
const t = getLanguage(language)
|
|
18
18
|
const results = useSelector((state: any) => state.message);
|
|
19
19
|
const isloading = useSelector((state: any) => state.isloading);
|
|
@@ -24,7 +24,6 @@ export const TestArea = () => {
|
|
|
24
24
|
const dispatch = useDispatch();
|
|
25
25
|
const tags = propTags ? propTags.tags : [];
|
|
26
26
|
|
|
27
|
-
|
|
28
27
|
const optionsPersona = personas && personas.map(persona => {
|
|
29
28
|
return { label: persona.name, value: persona.name }
|
|
30
29
|
})
|
|
@@ -33,21 +32,13 @@ export const TestArea = () => {
|
|
|
33
32
|
return { label: tag, value: tag }
|
|
34
33
|
})
|
|
35
34
|
|
|
36
|
-
const handleSelectPersona = (value: string) =>
|
|
37
|
-
setProfile(value);
|
|
38
|
-
};
|
|
35
|
+
const handleSelectPersona = (value: string) => setProfile(value);
|
|
39
36
|
|
|
40
|
-
const handleSelectPresset = (value: string) =>
|
|
41
|
-
setPresset(value);
|
|
42
|
-
};
|
|
37
|
+
const handleSelectPresset = (value: string) => setPresset(value);
|
|
43
38
|
|
|
44
|
-
const handleSearch = (value: string) =>
|
|
45
|
-
setSearch(value);
|
|
46
|
-
};
|
|
39
|
+
const handleSearch = (value: string) => setSearch(value);
|
|
47
40
|
|
|
48
|
-
const handlePrompt = (value: string) =>
|
|
49
|
-
setPrompt(value);
|
|
50
|
-
};
|
|
41
|
+
const handlePrompt = (value: string) => setPrompt(value);
|
|
51
42
|
|
|
52
43
|
const handleTest = () => {
|
|
53
44
|
dispatch(testAction(search, prompt, profile, presset, id, token, env))
|
|
@@ -65,27 +56,46 @@ export const TestArea = () => {
|
|
|
65
56
|
</S.Header>
|
|
66
57
|
<S.Inputs>
|
|
67
58
|
<InputTest placeholder={t.testArea.typeSentence} onChange={handleSearch} />
|
|
68
|
-
<Select
|
|
69
|
-
|
|
70
|
-
|
|
59
|
+
<Select
|
|
60
|
+
placeholder={t.testArea.selectPersona}
|
|
61
|
+
options={optionsPersona}
|
|
62
|
+
onSelect={handleSelectPersona}
|
|
63
|
+
/>
|
|
64
|
+
<Select
|
|
65
|
+
placeholder={t.testArea.selectPresset}
|
|
66
|
+
options={optionsPresset}
|
|
67
|
+
onSelect={handleSelectPresset}
|
|
68
|
+
/>
|
|
69
|
+
<button onClick={handleTest}><PiWaveformBold />
|
|
70
|
+
{t.buttons.test}
|
|
71
|
+
</button>
|
|
71
72
|
</S.Inputs>
|
|
72
73
|
<S.Inputs>
|
|
73
|
-
{profile === "Custom" &&
|
|
74
|
+
{profile === "Custom" && (
|
|
75
|
+
<TextArea
|
|
76
|
+
className="textarea-message"
|
|
77
|
+
placeholder={t.testArea.typePrompt}
|
|
78
|
+
value={prompt}
|
|
79
|
+
onChange={(e) => handlePrompt(e.target.value)}
|
|
80
|
+
/>
|
|
81
|
+
)}
|
|
74
82
|
</S.Inputs>
|
|
75
83
|
{
|
|
76
84
|
!results ? (
|
|
77
85
|
<EmptyState
|
|
78
|
-
icon={<FaList
|
|
86
|
+
icon={<FaList />}
|
|
79
87
|
title={t.testArea.emptyState.title}
|
|
80
88
|
description={t.testArea.emptyState.description}
|
|
81
89
|
activeButton={false}
|
|
82
90
|
/>
|
|
83
|
-
) :
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
</
|
|
91
|
+
) : (
|
|
92
|
+
<S.Result>
|
|
93
|
+
<div className="icon">
|
|
94
|
+
<MdPerson2 />
|
|
95
|
+
</div>
|
|
96
|
+
<div className="text">{results}</div>
|
|
97
|
+
</S.Result>
|
|
98
|
+
)
|
|
89
99
|
}
|
|
90
100
|
</S.Container>
|
|
91
101
|
)
|