mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-06-15 17:19:10 +00:00
feat: add access control
This commit is contained in:
parent
9c07ff0e54
commit
3f45153b66
47 changed files with 1084 additions and 164 deletions
|
@ -0,0 +1,26 @@
|
|||
import ReactTooltip from 'react-tooltip';
|
||||
import { BreakpointsProvider } from '../../atoms/breakpoints';
|
||||
import { guildEnum, mastheadSlugs, roleypolyGuild, user } from '../../fixtures/storyData';
|
||||
import { EditorAccessControlTemplate } from './EditorAccessControl';
|
||||
|
||||
export default {
|
||||
title: 'Templates/Editor Access Control',
|
||||
component: EditorAccessControlTemplate,
|
||||
decorators: [
|
||||
(story) => (
|
||||
<BreakpointsProvider>
|
||||
{story()}
|
||||
<ReactTooltip />
|
||||
</BreakpointsProvider>
|
||||
),
|
||||
],
|
||||
args: {
|
||||
errors: { validationStatus: 0 },
|
||||
guilds: mastheadSlugs,
|
||||
user: user,
|
||||
guild: guildEnum.guilds[1],
|
||||
guildSlug: roleypolyGuild,
|
||||
},
|
||||
};
|
||||
|
||||
export const editorAccessControl = (args) => <EditorAccessControlTemplate {...args} />;
|
|
@ -0,0 +1,2 @@
|
|||
import styled from 'styled-components';
|
||||
export const EditorAccessControlStyled = styled.div``;
|
|
@ -0,0 +1,21 @@
|
|||
import { AppShell, AppShellProps } from '@roleypoly/design-system/organisms/app-shell';
|
||||
import {
|
||||
EditorAccessControl,
|
||||
EditorAccessControlProps,
|
||||
} from '@roleypoly/design-system/organisms/editor-access-control';
|
||||
|
||||
export const EditorAccessControlTemplate = (
|
||||
props: EditorAccessControlProps & Omit<AppShellProps, 'children'>
|
||||
) => {
|
||||
const { guildSlug, guild, onSubmit, onExit, ...appShellProps } = props;
|
||||
return (
|
||||
<AppShell {...appShellProps} activeGuildId={guild.id} small>
|
||||
<EditorAccessControl
|
||||
guildSlug={guildSlug}
|
||||
guild={guild}
|
||||
onSubmit={onSubmit}
|
||||
onExit={onExit}
|
||||
/>
|
||||
</AppShell>
|
||||
);
|
||||
};
|
|
@ -0,0 +1 @@
|
|||
export * from './EditorAccessControl';
|
|
@ -1,8 +0,0 @@
|
|||
import { EditorUtility } from './EditorUtility';
|
||||
|
||||
export default {
|
||||
title: 'Templates/Editor Utility',
|
||||
component: EditorUtility,
|
||||
};
|
||||
|
||||
export const editorUtility = (args) => <EditorUtility {...args} />;
|
|
@ -1,2 +0,0 @@
|
|||
import styled from 'styled-components';
|
||||
export const EditorUtilityStyled = styled.div``;
|
|
@ -1,5 +0,0 @@
|
|||
import { EditorUtilityStyled } from './EditorUtility.styled';
|
||||
|
||||
export const EditorUtility = () => (
|
||||
<EditorUtilityStyled>EditorUtility</EditorUtilityStyled>
|
||||
);
|
|
@ -1 +0,0 @@
|
|||
export * from './EditorUtility';
|
|
@ -42,6 +42,11 @@ export const errorMessages: { [code: string]: ErrorMessage } = {
|
|||
japanese: `...but it didn't believe me. :( ごめんなさい`,
|
||||
friendlyCode: 'Yo.',
|
||||
},
|
||||
accessControlViolation: {
|
||||
english: `You're not allowed to pick roles on that server.`,
|
||||
japanese: `このサーバーでは許可されていない権限です`,
|
||||
friendlyCode: 'Hold up!',
|
||||
},
|
||||
};
|
||||
|
||||
export const getMessageFromCode = (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue