Skip to content

Commit 0eed469

Browse files
committed
TSJR-314 - improve validation for skills modal
1 parent ee4355c commit 0eed469

File tree

16 files changed

+314
-173
lines changed

16 files changed

+314
-173
lines changed

src/apps/admin/src/skills-manager/components/categories-accordion/CategoriesAccordion.tsx

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { FC, useMemo } from 'react'
1+
import { FC, useCallback, useMemo } from 'react'
22

33
import { Accordion, AccordionItem } from '../accordion'
44
import { SkillsList } from '../skills-list'
@@ -20,7 +20,7 @@ const CategoriesAccordion: FC<CategoriesAccordionProps> = props => {
2020
bulkEditorCtx,
2121
}: SkillsManagerContextValue = useSkillsManagerContext()
2222

23-
function handleMenuActions(action: string, category: StandardizedSkillCategory): void {
23+
const handleMenuActions = useCallback((action: string, category: StandardizedSkillCategory): void => {
2424
switch (action) {
2525
case MENU_ACTIONS.editCategory.action:
2626
setEditCategory(category)
@@ -30,9 +30,9 @@ const CategoriesAccordion: FC<CategoriesAccordionProps> = props => {
3030
break
3131
default: break
3232
}
33-
}
33+
}, [bulkEditorCtx, setEditCategory])
3434

35-
function renderCategoryAccordion(category: StandardizedSkillCategory): JSX.Element {
35+
const renderCategoryAccordion = useCallback((category: StandardizedSkillCategory): JSX.Element => {
3636
const categorySkills = groupedSkills[category.id] ?? []
3737

3838
return (!skillsFilter || categorySkills.length > 0) ? (
@@ -56,7 +56,16 @@ const CategoriesAccordion: FC<CategoriesAccordionProps> = props => {
5656
)}
5757
</AccordionItem>
5858
) : <></>
59-
}
59+
}, [
60+
bulkEditorCtx.isEditing,
61+
bulkEditorCtx.isSkillSelected,
62+
bulkEditorCtx.toggleSkill,
63+
groupedSkills,
64+
handleMenuActions,
65+
props.defaultOpen,
66+
setEditSkill,
67+
skillsFilter,
68+
])
6069

6170
// use a memo to persist the items rendering
6271
// otheriwse, the order and mapping of the categories
@@ -68,8 +77,7 @@ const CategoriesAccordion: FC<CategoriesAccordionProps> = props => {
6877
categories
6978
.map(renderCategoryAccordion)
7079
)
71-
// eslint-disable-next-line react-hooks/exhaustive-deps
72-
), [bulkEditorCtx.isEditing, categories, groupedSkills])
80+
), [bulkEditorCtx.isEditing, categories, renderCategoryAccordion])
7381

7482
return (
7583
<Accordion defaultOpen={props.defaultOpen}>

src/apps/admin/src/skills-manager/components/more-actions-menu/MoreActionsMenu.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ const MoreActionsMenu: FC<{}> = () => {
3939
>
4040
<Button
4141
primary
42-
variant='linkblue'
4342
size='xl'
4443
className={styles.triggerBtn}
4544
>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
@import '@libs/ui/styles/includes';
2+
3+
.form {
4+
:global(.input-wrapper) {
5+
> :global(.input-error) {
6+
margin-bottom: 8px;
7+
}
8+
}
9+
}
10+
11+
12+
.buttonsWrap {
13+
display: flex;
14+
align-items: center;
15+
gap: $sp-2;
16+
}
17+
18+
.primaryGroup {
19+
display: flex;
20+
align-items: center;
21+
margin-left: auto;
22+
gap: $sp-2;
23+
}

0 commit comments

Comments
 (0)