mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-04-25 03:49:11 +00:00
fix(Editor): add an empty categories message
This commit is contained in:
parent
47fa58fd36
commit
30b9ea3a59
1 changed files with 26 additions and 15 deletions
|
@ -1,7 +1,7 @@
|
||||||
import { BreakpointText } from '@roleypoly/design-system/atoms/breakpoints';
|
import { BreakpointText } from '@roleypoly/design-system/atoms/breakpoints';
|
||||||
import { Button } from '@roleypoly/design-system/atoms/button';
|
import { Button } from '@roleypoly/design-system/atoms/button';
|
||||||
import { FaderOpacity } from '@roleypoly/design-system/atoms/fader';
|
import { FaderOpacity } from '@roleypoly/design-system/atoms/fader';
|
||||||
import { LargeText } from '@roleypoly/design-system/atoms/typography';
|
import { LargeText, Link, Text } from '@roleypoly/design-system/atoms/typography';
|
||||||
import { EditorCategory } from '@roleypoly/design-system/molecules/editor-category';
|
import { EditorCategory } from '@roleypoly/design-system/molecules/editor-category';
|
||||||
import { CategoryContainer } from '@roleypoly/design-system/organisms/role-picker/RolePicker.styled';
|
import { CategoryContainer } from '@roleypoly/design-system/organisms/role-picker/RolePicker.styled';
|
||||||
import {
|
import {
|
||||||
|
@ -96,21 +96,32 @@ export const ServerCategoryEditor = (props: Props) => {
|
||||||
Change Order <CgReorder />
|
Change Order <CgReorder />
|
||||||
</Button>
|
</Button>
|
||||||
</CategoryActions>
|
</CategoryActions>
|
||||||
{sortBy(props.guild.data.categories, ['position', 'id']).map((category, idx) => (
|
{props.guild.data.categories.length > 0 ? (
|
||||||
<CategoryContainer key={idx}>
|
sortBy(props.guild.data.categories, ['position', 'id']).map((category, idx) => (
|
||||||
<EditorCategory
|
<CategoryContainer key={idx}>
|
||||||
category={category}
|
<EditorCategory
|
||||||
title={category.name}
|
category={category}
|
||||||
unselectedRoles={unselectedRoles}
|
title={category.name}
|
||||||
roles={
|
unselectedRoles={unselectedRoles}
|
||||||
category.roles
|
roles={
|
||||||
.map((role) => props.guild.roles.find((r) => r.id === role))
|
category.roles
|
||||||
.filter((r) => r !== undefined) as Role[]
|
.map((role) => props.guild.roles.find((r) => r.id === role))
|
||||||
}
|
.filter((r) => r !== undefined) as Role[]
|
||||||
onChange={updateSingleCategory}
|
}
|
||||||
/>
|
onChange={updateSingleCategory}
|
||||||
|
/>
|
||||||
|
</CategoryContainer>
|
||||||
|
))
|
||||||
|
) : (
|
||||||
|
<CategoryContainer>
|
||||||
|
<Text>
|
||||||
|
No categories are created yet.{' '}
|
||||||
|
<Link href="#" onClick={() => createCategory()}>
|
||||||
|
Create your first category!
|
||||||
|
</Link>
|
||||||
|
</Text>
|
||||||
</CategoryContainer>
|
</CategoryContainer>
|
||||||
))}
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue