mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-06-15 00:59:09 +00:00
fix(RolePicker): prevent render of hidden categories
This commit is contained in:
parent
95dad8effa
commit
b7f82593df
1 changed files with 31 additions and 28 deletions
|
@ -82,34 +82,37 @@ export const RolePicker = (props: RolePickerProps) => {
|
|||
{props.guildData.categories.length !== 0 ? (
|
||||
<>
|
||||
<div>
|
||||
{sortBy(props.guildData.categories, 'position').map(
|
||||
(category, idx) => (
|
||||
<CategoryContainer key={idx}>
|
||||
<PickerCategory
|
||||
key={idx}
|
||||
category={category}
|
||||
title={category.name}
|
||||
selectedRoles={selectedRoles.filter((roleId) =>
|
||||
category.roles.includes(roleId)
|
||||
)}
|
||||
roles={
|
||||
category.roles
|
||||
.map((role) =>
|
||||
props.roles.find((r) => r.id === role)
|
||||
)
|
||||
.filter((r) => r !== undefined) as Role[]
|
||||
}
|
||||
onChange={handleChange(category)}
|
||||
wikiMode={false}
|
||||
type={
|
||||
category.type === CategoryType.Single
|
||||
? 'single'
|
||||
: 'multi'
|
||||
}
|
||||
/>
|
||||
</CategoryContainer>
|
||||
)
|
||||
)}
|
||||
{sortBy(
|
||||
props.guildData.categories.filter(
|
||||
(category) => !category.hidden
|
||||
),
|
||||
'position'
|
||||
).map((category, idx) => (
|
||||
<CategoryContainer key={idx}>
|
||||
<PickerCategory
|
||||
key={idx}
|
||||
category={category}
|
||||
title={category.name}
|
||||
selectedRoles={selectedRoles.filter((roleId) =>
|
||||
category.roles.includes(roleId)
|
||||
)}
|
||||
roles={
|
||||
category.roles
|
||||
.map((role) =>
|
||||
props.roles.find((r) => r.id === role)
|
||||
)
|
||||
.filter((r) => r !== undefined) as Role[]
|
||||
}
|
||||
onChange={handleChange(category)}
|
||||
wikiMode={false}
|
||||
type={
|
||||
category.type === CategoryType.Single
|
||||
? 'single'
|
||||
: 'multi'
|
||||
}
|
||||
/>
|
||||
</CategoryContainer>
|
||||
))}
|
||||
</div>
|
||||
<FaderOpacity
|
||||
isVisible={xor(selectedRoles, props.member.roles).length !== 0}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue