Skip to content

Commit

Permalink
fix: minor UI tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
lynchee-owo committed Mar 27, 2024
1 parent fafe209 commit 6d11ff9
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 31 deletions.
68 changes: 37 additions & 31 deletions src/common/NewKnowledgeForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ const NewKnowledgeForm = ({
size="sm"
colorScheme="red"
variant="ghost"
zIndex="docked"
onClick={() => {
const updatedRules = values.rules.filter(
(_, idx) => idx !== ruleIndex,
Expand Down Expand Up @@ -221,21 +222,23 @@ const NewKnowledgeForm = ({
placeholder="Enter regex to match pathname"
/>
<InputRightElement>
<IconButton
aria-label="Remove regex"
icon={<SmallCloseIcon />}
variant="ghost"
onClick={() => {
const updatedRegexes = [
...values.rules[ruleIndex].regexes,
];
updatedRegexes.splice(regexIndex, 1);
setFieldValue(
`rules[${ruleIndex}].regexes`,
updatedRegexes,
);
}}
/>
{rule.regexes.length > 1 && (
<IconButton
aria-label="Remove regex"
icon={<SmallCloseIcon />}
variant="ghost"
onClick={() => {
const updatedRegexes = [
...values.rules[ruleIndex].regexes,
];
updatedRegexes.splice(regexIndex, 1);
setFieldValue(
`rules[${ruleIndex}].regexes`,
updatedRegexes,
);
}}
/>
)}
</InputRightElement>
</InputGroup>
</FormControl>
Expand Down Expand Up @@ -271,22 +274,25 @@ const NewKnowledgeForm = ({
placeholder="Enter note"
/>
<InputRightElement>
<IconButton
aria-label="Remove note"
icon={<SmallCloseIcon />}
variant="ghost"
onClick={() => {
const updatedNotes = [
...(values.rules[ruleIndex].knowledge.notes ||
[]),
];
updatedNotes.splice(noteIndex, 1);
setFieldValue(
`rules[${ruleIndex}].knowledge.notes`,
updatedNotes,
);
}}
/>
{rule.knowledge.notes &&
rule.knowledge.notes.length > 1 && (
<IconButton
aria-label="Remove note"
icon={<SmallCloseIcon />}
variant="ghost"
onClick={() => {
const updatedNotes = [
...(values.rules[ruleIndex].knowledge.notes ||
[]),
];
updatedNotes.splice(noteIndex, 1);
setFieldValue(
`rules[${ruleIndex}].knowledge.notes`,
updatedNotes,
);
}}
/>
)}
</InputRightElement>
</InputGroup>
))}
Expand Down
1 change: 1 addition & 0 deletions src/common/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ const Settings = ({ setInSettingsView }: SettingsProps) => {
<FormLabel mb="0">Turn On Voice Mode</FormLabel>
<Spacer />
<Switch
id="voiceModeSwitch"
isChecked={state.voiceMode}
onChange={(e) => {
const isEnabled = e.target.checked;
Expand Down

0 comments on commit 6d11ff9

Please sign in to comment.