mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-04-26 04:19:11 +00:00
chore: move types to @roleypoly/types package
This commit is contained in:
parent
38ee680a33
commit
a374030438
46 changed files with 244 additions and 59 deletions
|
@ -1,9 +1,5 @@
|
||||||
|
import { CategoryType, Features, GuildData as GuildDataT } from '@roleypoly/types';
|
||||||
import KSUID from 'ksuid';
|
import KSUID from 'ksuid';
|
||||||
import {
|
|
||||||
CategoryType,
|
|
||||||
Features,
|
|
||||||
GuildData as GuildDataT,
|
|
||||||
} from '../../../src/common/types';
|
|
||||||
import { onlyRootUsers, respond } from '../utils/api-tools';
|
import { onlyRootUsers, respond } from '../utils/api-tools';
|
||||||
import { GuildData } from '../utils/kv';
|
import { GuildData } from '../utils/kv';
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,4 @@
|
||||||
import {
|
import { DiscordUser, GuildSlug, PresentableGuild, SessionData } from '@roleypoly/types';
|
||||||
DiscordUser,
|
|
||||||
GuildSlug,
|
|
||||||
PresentableGuild,
|
|
||||||
SessionData,
|
|
||||||
} from '../../../src/common/types';
|
|
||||||
import { respond, withSession } from '../utils/api-tools';
|
import { respond, withSession } from '../utils/api-tools';
|
||||||
import { getGuild, getGuildData, getGuildMemberRoles } from '../utils/guild';
|
import { getGuild, getGuildData, getGuildMemberRoles } from '../utils/guild';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { SessionData } from '../../../src/common/types';
|
import { SessionData } from '@roleypoly/types';
|
||||||
import { respond, withSession } from '../utils/api-tools';
|
import { respond, withSession } from '../utils/api-tools';
|
||||||
|
|
||||||
export const GetSession = withSession((session?: SessionData) => (): Response => {
|
export const GetSession = withSession((session?: SessionData) => (): Response => {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { GuildSlug } from '../../../src/common/types';
|
import { GuildSlug } from '@roleypoly/types';
|
||||||
import { respond } from '../utils/api-tools';
|
import { respond } from '../utils/api-tools';
|
||||||
import { getGuild } from '../utils/guild';
|
import { getGuild } from '../utils/guild';
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
|
import { AuthTokenResponse, DiscordUser, GuildSlug, SessionData } from '@roleypoly/types';
|
||||||
import KSUID from 'ksuid';
|
import KSUID from 'ksuid';
|
||||||
import {
|
|
||||||
AuthTokenResponse,
|
|
||||||
DiscordUser,
|
|
||||||
GuildSlug,
|
|
||||||
SessionData,
|
|
||||||
} from '../../../src/common/types';
|
|
||||||
import {
|
import {
|
||||||
AuthType,
|
AuthType,
|
||||||
discordFetch,
|
discordFetch,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { SessionData } from '../../../src/common/types';
|
import { SessionData } from '@roleypoly/types';
|
||||||
import { formData, respond, userAgent, withSession } from '../utils/api-tools';
|
import { formData, respond, userAgent, withSession } from '../utils/api-tools';
|
||||||
import { botClientID, botClientSecret } from '../utils/config';
|
import { botClientID, botClientSecret } from '../utils/config';
|
||||||
import { Sessions } from '../utils/kv';
|
import { Sessions } from '../utils/kv';
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import { difference, groupBy, keyBy, union } from 'lodash';
|
|
||||||
import {
|
import {
|
||||||
GuildData,
|
GuildData,
|
||||||
Member,
|
Member,
|
||||||
|
@ -8,7 +7,8 @@ import {
|
||||||
RoleUpdate,
|
RoleUpdate,
|
||||||
SessionData,
|
SessionData,
|
||||||
TransactionType,
|
TransactionType,
|
||||||
} from '../../../src/common/types';
|
} from '@roleypoly/types';
|
||||||
|
import { difference, groupBy, keyBy, union } from 'lodash';
|
||||||
import { AuthType, discordFetch, respond, withSession } from '../utils/api-tools';
|
import { AuthType, discordFetch, respond, withSession } from '../utils/api-tools';
|
||||||
import { botToken } from '../utils/config';
|
import { botToken } from '../utils/config';
|
||||||
import {
|
import {
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
"start": "yarn workspace @roleypoly/worker-emulator start --basePath `pwd`"
|
"start": "yarn workspace @roleypoly/worker-emulator start --basePath `pwd`"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@roleypoly/types": "*",
|
||||||
"@roleypoly/worker-emulator": "*",
|
"@roleypoly/worker-emulator": "*",
|
||||||
"ksuid": "^2.0.0",
|
"ksuid": "^2.0.0",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { SessionData, UserGuildPermissions } from '../../../src/common/types';
|
import { SessionData, UserGuildPermissions } from '@roleypoly/types';
|
||||||
import {
|
import {
|
||||||
evaluatePermission,
|
evaluatePermission,
|
||||||
permissions as Permissions,
|
permissions as Permissions,
|
||||||
|
|
|
@ -5,7 +5,7 @@ import {
|
||||||
OwnRoleInfo,
|
OwnRoleInfo,
|
||||||
Role,
|
Role,
|
||||||
RoleSafety,
|
RoleSafety,
|
||||||
} from '../../../src/common/types';
|
} from '@roleypoly/types';
|
||||||
import { evaluatePermission, permissions } from '../../../src/common/utils/hasPermission';
|
import { evaluatePermission, permissions } from '../../../src/common/utils/hasPermission';
|
||||||
import { AuthType, cacheLayer, discordFetch } from './api-tools';
|
import { AuthType, cacheLayer, discordFetch } from './api-tools';
|
||||||
import { botClientID, botToken } from './config';
|
import { botClientID, botToken } from './config';
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { numberToChroma } from '@roleypoly/design-system/atoms/colors';
|
import { numberToChroma } from '@roleypoly/design-system/atoms/colors';
|
||||||
|
import { Role as RPCRole, RoleSafety } from '@roleypoly/types';
|
||||||
import chroma from 'chroma-js';
|
import chroma from 'chroma-js';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { FaCheck, FaTimes } from 'react-icons/fa';
|
import { FaCheck, FaTimes } from 'react-icons/fa';
|
||||||
import { Role as RPCRole, RoleSafety } from '../../../../src/common/types';
|
|
||||||
import {
|
import {
|
||||||
evaluatePermission,
|
evaluatePermission,
|
||||||
permissions,
|
permissions,
|
||||||
|
|
|
@ -11,7 +11,7 @@ import {
|
||||||
Role,
|
Role,
|
||||||
RoleSafety,
|
RoleSafety,
|
||||||
RoleypolyUser,
|
RoleypolyUser,
|
||||||
} from '../../../src/common/types';
|
} from '@roleypoly/types';
|
||||||
|
|
||||||
export const roleCategory: Role[] = [
|
export const roleCategory: Role[] = [
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Typist } from '@roleypoly/design-system/atoms/typist';
|
import { Typist } from '@roleypoly/design-system/atoms/typist';
|
||||||
|
import { demoData } from '@roleypoly/types/demoData';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { demoData } from '../../../../src/common/types/demoData';
|
|
||||||
import {
|
import {
|
||||||
Base,
|
Base,
|
||||||
InputBox,
|
InputBox,
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { Role } from '@roleypoly/design-system/atoms/role';
|
import { Role } from '@roleypoly/design-system/atoms/role';
|
||||||
|
import { Role as RPCRole } from '@roleypoly/types';
|
||||||
|
import { demoData } from '@roleypoly/types/demoData';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { Role as RPCRole } from '../../../../src/common/types';
|
|
||||||
import { demoData } from '../../../../src/common/types/demoData';
|
|
||||||
|
|
||||||
const Container = styled.div`
|
const Container = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
|
@ -6,9 +6,9 @@ import { Space } from '@roleypoly/design-system/atoms/space';
|
||||||
import { TextInput, TextInputWithIcon } from '@roleypoly/design-system/atoms/text-input';
|
import { TextInput, TextInputWithIcon } from '@roleypoly/design-system/atoms/text-input';
|
||||||
import { Text } from '@roleypoly/design-system/atoms/typography';
|
import { Text } from '@roleypoly/design-system/atoms/typography';
|
||||||
import { RoleSearch } from '@roleypoly/design-system/molecules/role-search';
|
import { RoleSearch } from '@roleypoly/design-system/molecules/role-search';
|
||||||
|
import { Category, CategoryType, Role as RoleType } from '@roleypoly/types';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { GoSearch } from 'react-icons/go';
|
import { GoSearch } from 'react-icons/go';
|
||||||
import { Category, CategoryType, Role as RoleType } from '../../../../src/common/types';
|
|
||||||
import { RoleContainer } from './EditorCategory.styled';
|
import { RoleContainer } from './EditorCategory.styled';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { NavSlug } from '@roleypoly/design-system/molecules/nav-slug';
|
import { NavSlug } from '@roleypoly/design-system/molecules/nav-slug';
|
||||||
|
import { GuildSlug, UserGuildPermissions } from '@roleypoly/types';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import Scrollbars from 'react-custom-scrollbars';
|
import Scrollbars from 'react-custom-scrollbars';
|
||||||
import { GoStar, GoZap } from 'react-icons/go';
|
import { GoStar, GoZap } from 'react-icons/go';
|
||||||
import ReactTooltip from 'react-tooltip';
|
import ReactTooltip from 'react-tooltip';
|
||||||
import { GuildSlug, UserGuildPermissions } from '../../../../src/common/types';
|
|
||||||
import { sortBy } from '../../../../src/common/utils/sortBy';
|
import { sortBy } from '../../../../src/common/utils/sortBy';
|
||||||
import { GuildNavItem } from './GuildNav.styled';
|
import { GuildNavItem } from './GuildNav.styled';
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Avatar, utils } from '@roleypoly/design-system/atoms/avatar';
|
import { Avatar, utils } from '@roleypoly/design-system/atoms/avatar';
|
||||||
|
import { GuildSlug } from '@roleypoly/types';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { GoOrganization } from 'react-icons/go';
|
import { GoOrganization } from 'react-icons/go';
|
||||||
import { GuildSlug } from '../../../../src/common/types';
|
|
||||||
import { SlugContainer, SlugName } from './NavSlug.styled';
|
import { SlugContainer, SlugName } from './NavSlug.styled';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
|
|
|
@ -1,13 +1,9 @@
|
||||||
import { Role } from '@roleypoly/design-system/atoms/role';
|
import { Role } from '@roleypoly/design-system/atoms/role';
|
||||||
import { AmbientLarge, LargeText } from '@roleypoly/design-system/atoms/typography';
|
import { AmbientLarge, LargeText } from '@roleypoly/design-system/atoms/typography';
|
||||||
|
import { Category as RPCCategory, Role as RPCRole, RoleSafety } from '@roleypoly/types';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import ReactTooltip from 'react-tooltip';
|
import ReactTooltip from 'react-tooltip';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import {
|
|
||||||
Category as RPCCategory,
|
|
||||||
Role as RPCRole,
|
|
||||||
RoleSafety,
|
|
||||||
} from '../../../../src/common/types';
|
|
||||||
import { sortBy } from '../../../../src/common/utils/sortBy';
|
import { sortBy } from '../../../../src/common/utils/sortBy';
|
||||||
import { Head, HeadSub, HeadTitle } from './PickerCategory.styled';
|
import { Head, HeadSub, HeadTitle } from './PickerCategory.styled';
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { Avatar, utils as avatarUtils } from '@roleypoly/design-system/atoms/avatar';
|
import { Avatar, utils as avatarUtils } from '@roleypoly/design-system/atoms/avatar';
|
||||||
import { Space } from '@roleypoly/design-system/atoms/space';
|
import { Space } from '@roleypoly/design-system/atoms/space';
|
||||||
import { AccentTitle } from '@roleypoly/design-system/atoms/typography';
|
import { AccentTitle } from '@roleypoly/design-system/atoms/typography';
|
||||||
|
import { GuildSlug } from '@roleypoly/types';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { GuildSlug } from '../../../../src/common/types';
|
|
||||||
|
|
||||||
type GreetingProps = {
|
type GreetingProps = {
|
||||||
guildSlug: GuildSlug;
|
guildSlug: GuildSlug;
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { Role } from '@roleypoly/design-system/atoms/role';
|
import { Role } from '@roleypoly/design-system/atoms/role';
|
||||||
import { Space } from '@roleypoly/design-system/atoms/space';
|
import { Space } from '@roleypoly/design-system/atoms/space';
|
||||||
import { TextInputWithIcon } from '@roleypoly/design-system/atoms/text-input';
|
import { TextInputWithIcon } from '@roleypoly/design-system/atoms/text-input';
|
||||||
|
import { Role as RoleType } from '@roleypoly/types';
|
||||||
import Fuse from 'fuse.js';
|
import Fuse from 'fuse.js';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { GoSearch } from 'react-icons/go';
|
import { GoSearch } from 'react-icons/go';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { Role as RoleType } from '../../../../src/common/types';
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
roles: RoleType[];
|
roles: RoleType[];
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { Avatar, utils } from '@roleypoly/design-system/atoms/avatar';
|
import { Avatar, utils } from '@roleypoly/design-system/atoms/avatar';
|
||||||
import { Collapse } from '@roleypoly/design-system/atoms/collapse';
|
import { Collapse } from '@roleypoly/design-system/atoms/collapse';
|
||||||
|
import { GuildSlug, UserGuildPermissions } from '@roleypoly/types';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { GoPerson, GoStar, GoZap } from 'react-icons/go';
|
import { GoPerson, GoStar, GoZap } from 'react-icons/go';
|
||||||
import { GuildSlug, UserGuildPermissions } from '../../../../src/common/types';
|
|
||||||
import {
|
import {
|
||||||
CardBase,
|
CardBase,
|
||||||
CardLine,
|
CardLine,
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { Avatar, utils } from '@roleypoly/design-system/atoms/avatar';
|
import { Avatar, utils } from '@roleypoly/design-system/atoms/avatar';
|
||||||
import { AccentTitle, AmbientLarge } from '@roleypoly/design-system/atoms/typography';
|
import { AccentTitle, AmbientLarge } from '@roleypoly/design-system/atoms/typography';
|
||||||
|
import { GuildSlug } from '@roleypoly/types';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { GoPencil } from 'react-icons/go';
|
import { GoPencil } from 'react-icons/go';
|
||||||
import { GuildSlug } from '../../../../src/common/types';
|
|
||||||
import { Editable, Icon, Name, Wrapper } from './ServerMasthead.styled';
|
import { Editable, Icon, Name, Wrapper } from './ServerMasthead.styled';
|
||||||
|
|
||||||
export type ServerMastheadProps = {
|
export type ServerMastheadProps = {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Avatar, utils } from '@roleypoly/design-system/atoms/avatar';
|
import { Avatar, utils } from '@roleypoly/design-system/atoms/avatar';
|
||||||
|
import { DiscordUser } from '@roleypoly/types';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { DiscordUser } from '../../../../src/common/types';
|
|
||||||
import { Collapse, Discriminator, Group, GroupText } from './UserAvatarGroup.styled';
|
import { Collapse, Discriminator, Group, GroupText } from './UserAvatarGroup.styled';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { CompletelyStylelessLink } from '@roleypoly/design-system/atoms/typography';
|
import { CompletelyStylelessLink } from '@roleypoly/design-system/atoms/typography';
|
||||||
import { UserAvatarGroup } from '@roleypoly/design-system/molecules/user-avatar-group';
|
import { UserAvatarGroup } from '@roleypoly/design-system/molecules/user-avatar-group';
|
||||||
|
import { DiscordUser } from '@roleypoly/types';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { GoGear, GoSignOut } from 'react-icons/go';
|
import { GoGear, GoSignOut } from 'react-icons/go';
|
||||||
import { DiscordUser } from '../../../../src/common/types';
|
|
||||||
import { Base, NavAction } from './UserPopover.styled';
|
import { Base, NavAction } from './UserPopover.styled';
|
||||||
|
|
||||||
type UserPopoverProps = {
|
type UserPopoverProps = {
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { GlobalStyleColors } from '@roleypoly/design-system/atoms/colors';
|
import { GlobalStyleColors } from '@roleypoly/design-system/atoms/colors';
|
||||||
import { Footer } from '@roleypoly/design-system/molecules/footer';
|
import { Footer } from '@roleypoly/design-system/molecules/footer';
|
||||||
import * as Masthead from '@roleypoly/design-system/organisms/masthead';
|
import * as Masthead from '@roleypoly/design-system/organisms/masthead';
|
||||||
|
import { DiscordUser, GuildSlug } from '@roleypoly/types';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { Scrollbars } from 'react-custom-scrollbars';
|
import { Scrollbars } from 'react-custom-scrollbars';
|
||||||
import { DiscordUser, GuildSlug } from '../../../../src/common/types';
|
|
||||||
import { Content, GlobalStyles } from './AppShell.styled';
|
import { Content, GlobalStyles } from './AppShell.styled';
|
||||||
|
|
||||||
export type AppShellProps = {
|
export type AppShellProps = {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Tab, TabView } from '@roleypoly/design-system/atoms/tab-view';
|
import { Tab, TabView } from '@roleypoly/design-system/atoms/tab-view';
|
||||||
|
import { PresentableGuild } from '@roleypoly/types';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { PresentableGuild } from '../../../../src/common/types';
|
|
||||||
import { EditorCategory } from '../../molecules/editor-category';
|
import { EditorCategory } from '../../molecules/editor-category';
|
||||||
import { CategoryContainer } from './EditorShell.styled';
|
import { CategoryContainer } from './EditorShell.styled';
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { numberToChroma, palette } from '@roleypoly/design-system/atoms/colors';
|
import { numberToChroma, palette } from '@roleypoly/design-system/atoms/colors';
|
||||||
|
import { Role } from '@roleypoly/types';
|
||||||
import styled, { css } from 'styled-components';
|
import styled, { css } from 'styled-components';
|
||||||
import { Role } from '../../../../src/common/types';
|
|
||||||
|
|
||||||
export const DiscordBase = styled.div`
|
export const DiscordBase = styled.div`
|
||||||
background-color: ${palette.discord100};
|
background-color: ${palette.discord100};
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { palette } from '@roleypoly/design-system/atoms/colors';
|
import { palette } from '@roleypoly/design-system/atoms/colors';
|
||||||
import { HalfsiesContainer, HalfsiesItem } from '@roleypoly/design-system/atoms/halfsies';
|
import { HalfsiesContainer, HalfsiesItem } from '@roleypoly/design-system/atoms/halfsies';
|
||||||
import { SparkleOverlay } from '@roleypoly/design-system/atoms/sparkle';
|
import { SparkleOverlay } from '@roleypoly/design-system/atoms/sparkle';
|
||||||
|
import { Role } from '@roleypoly/types';
|
||||||
|
import { demoData } from '@roleypoly/types/demoData';
|
||||||
import chroma from 'chroma-js';
|
import chroma from 'chroma-js';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { FaCheck, FaTimes } from 'react-icons/fa';
|
import { FaCheck, FaTimes } from 'react-icons/fa';
|
||||||
import { Role } from '../../../../src/common/types';
|
|
||||||
import { demoData } from '../../../../src/common/types/demoData';
|
|
||||||
import { DiscordBase, DiscordRole } from './WhyNoRoles.styled';
|
import { DiscordBase, DiscordRole } from './WhyNoRoles.styled';
|
||||||
|
|
||||||
const adminRoles: Role[] = [
|
const adminRoles: Role[] = [
|
||||||
|
|
|
@ -4,9 +4,9 @@ import { GuildNav } from '@roleypoly/design-system/molecules/guild-nav';
|
||||||
import { NavSlug } from '@roleypoly/design-system/molecules/nav-slug';
|
import { NavSlug } from '@roleypoly/design-system/molecules/nav-slug';
|
||||||
import { UserAvatarGroup } from '@roleypoly/design-system/molecules/user-avatar-group';
|
import { UserAvatarGroup } from '@roleypoly/design-system/molecules/user-avatar-group';
|
||||||
import { UserPopover } from '@roleypoly/design-system/molecules/user-popover';
|
import { UserPopover } from '@roleypoly/design-system/molecules/user-popover';
|
||||||
|
import { DiscordUser, GuildSlug } from '@roleypoly/types';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { GoOrganization } from 'react-icons/go';
|
import { GoOrganization } from 'react-icons/go';
|
||||||
import { DiscordUser, GuildSlug } from '../../../../src/common/types';
|
|
||||||
import {
|
import {
|
||||||
GuildPopoverHead,
|
GuildPopoverHead,
|
||||||
InteractionBase,
|
InteractionBase,
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { Button } from '@roleypoly/design-system/atoms/button';
|
import { Button } from '@roleypoly/design-system/atoms/button';
|
||||||
import { PreauthGreeting } from '@roleypoly/design-system/molecules/preauth-greeting';
|
import { PreauthGreeting } from '@roleypoly/design-system/molecules/preauth-greeting';
|
||||||
|
import { GuildSlug } from '@roleypoly/types';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { FaDiscord } from 'react-icons/fa';
|
import { FaDiscord } from 'react-icons/fa';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { GuildSlug } from '../../../../src/common/types';
|
|
||||||
|
|
||||||
export type PreauthProps = {
|
export type PreauthProps = {
|
||||||
guildSlug?: GuildSlug;
|
guildSlug?: GuildSlug;
|
||||||
|
|
|
@ -4,9 +4,6 @@ import { Link } from '@roleypoly/design-system/atoms/typography';
|
||||||
import { PickerCategory } from '@roleypoly/design-system/molecules/picker-category';
|
import { PickerCategory } from '@roleypoly/design-system/molecules/picker-category';
|
||||||
import { ResetSubmit } from '@roleypoly/design-system/molecules/reset-submit';
|
import { ResetSubmit } from '@roleypoly/design-system/molecules/reset-submit';
|
||||||
import { ServerMasthead } from '@roleypoly/design-system/molecules/server-masthead';
|
import { ServerMasthead } from '@roleypoly/design-system/molecules/server-masthead';
|
||||||
import { isEqual, xor } from 'lodash';
|
|
||||||
import * as React from 'react';
|
|
||||||
import { GoInfo } from 'react-icons/go';
|
|
||||||
import {
|
import {
|
||||||
Category,
|
Category,
|
||||||
CategoryType,
|
CategoryType,
|
||||||
|
@ -14,7 +11,10 @@ import {
|
||||||
GuildSlug,
|
GuildSlug,
|
||||||
Member,
|
Member,
|
||||||
Role,
|
Role,
|
||||||
} from '../../../../src/common/types';
|
} from '@roleypoly/types';
|
||||||
|
import { isEqual, xor } from 'lodash';
|
||||||
|
import * as React from 'react';
|
||||||
|
import { GoInfo } from 'react-icons/go';
|
||||||
import { ReactifyNewlines } from '../../../../src/common/utils/ReactifyNewlines';
|
import { ReactifyNewlines } from '../../../../src/common/utils/ReactifyNewlines';
|
||||||
import { sortBy } from '../../../../src/common/utils/sortBy';
|
import { sortBy } from '../../../../src/common/utils/sortBy';
|
||||||
import {
|
import {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { UserGuildPermissions } from '../../../../src/common/types';
|
import { UserGuildPermissions } from '@roleypoly/types';
|
||||||
import { mastheadSlugs } from '../../fixtures/storyData';
|
import { mastheadSlugs } from '../../fixtures/storyData';
|
||||||
import { ServerSetup } from './ServerSetup';
|
import { ServerSetup } from './ServerSetup';
|
||||||
|
|
||||||
|
|
|
@ -3,10 +3,10 @@ import { Button } from '@roleypoly/design-system/atoms/button';
|
||||||
import { DotOverlay } from '@roleypoly/design-system/atoms/dot-overlay';
|
import { DotOverlay } from '@roleypoly/design-system/atoms/dot-overlay';
|
||||||
import { Hero } from '@roleypoly/design-system/atoms/hero';
|
import { Hero } from '@roleypoly/design-system/atoms/hero';
|
||||||
import { AccentTitle, SmallTitle } from '@roleypoly/design-system/atoms/typography';
|
import { AccentTitle, SmallTitle } from '@roleypoly/design-system/atoms/typography';
|
||||||
|
import { GuildSlug, UserGuildPermissions } from '@roleypoly/types';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { FaDiscord } from 'react-icons/fa';
|
import { FaDiscord } from 'react-icons/fa';
|
||||||
import { GoArrowLeft } from 'react-icons/go';
|
import { GoArrowLeft } from 'react-icons/go';
|
||||||
import { GuildSlug, UserGuildPermissions } from '../../../../src/common/types';
|
|
||||||
import { evaluatePermission } from '../../../../src/common/utils/hasPermission';
|
import { evaluatePermission } from '../../../../src/common/utils/hasPermission';
|
||||||
import { FlexLine, FlexWrap } from './ServerSetup.styled';
|
import { FlexLine, FlexWrap } from './ServerSetup.styled';
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { CompletelyStylelessLink } from '@roleypoly/design-system/atoms/typography';
|
import { CompletelyStylelessLink } from '@roleypoly/design-system/atoms/typography';
|
||||||
import { ServerListingCard } from '@roleypoly/design-system/molecules/server-listing-card';
|
import { ServerListingCard } from '@roleypoly/design-system/molecules/server-listing-card';
|
||||||
|
import { GuildSlug } from '@roleypoly/types';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { GuildSlug } from '../../../../src/common/types';
|
|
||||||
import { sortBy } from '../../../../src/common/utils/sortBy';
|
import { sortBy } from '../../../../src/common/utils/sortBy';
|
||||||
import { CardContainer, ContentContainer } from './ServersListing.styled';
|
import { CardContainer, ContentContainer } from './ServersListing.styled';
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
"start": "start-storybook -p 6006"
|
"start": "start-storybook -p 6006"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@roleypoly/types": "*",
|
||||||
"chroma-js": "^2.1.0",
|
"chroma-js": "^2.1.0",
|
||||||
"isomorphic-unfetch": "^3.1.0",
|
"isomorphic-unfetch": "^3.1.0",
|
||||||
"ksuid": "^2.0.0",
|
"ksuid": "^2.0.0",
|
||||||
|
|
|
@ -5,8 +5,8 @@ import {
|
||||||
ErrorMessage,
|
ErrorMessage,
|
||||||
} from '@roleypoly/design-system/molecules/error-banner';
|
} from '@roleypoly/design-system/molecules/error-banner';
|
||||||
import { AppShell } from '@roleypoly/design-system/organisms/app-shell';
|
import { AppShell } from '@roleypoly/design-system/organisms/app-shell';
|
||||||
|
import { DiscordUser } from '@roleypoly/types';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { DiscordUser } from '../../../../src/common/types';
|
|
||||||
import { getMessageFromCode } from './errorStrings';
|
import { getMessageFromCode } from './errorStrings';
|
||||||
|
|
||||||
export type ErrorProps = {
|
export type ErrorProps = {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { AppShell, AppShellProps } from '@roleypoly/design-system/organisms/app-shell';
|
import { AppShell, AppShellProps } from '@roleypoly/design-system/organisms/app-shell';
|
||||||
import { ServersListing } from '@roleypoly/design-system/organisms/servers-listing/ServersListing';
|
import { ServersListing } from '@roleypoly/design-system/organisms/servers-listing/ServersListing';
|
||||||
|
import { GuildSlug } from '@roleypoly/types';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { GuildSlug } from '../../../../src/common/types';
|
|
||||||
|
|
||||||
type ServerTemplateProps = Omit<AppShellProps, 'children'> & {
|
type ServerTemplateProps = Omit<AppShellProps, 'children'> & {
|
||||||
guilds: GuildSlug[];
|
guilds: GuildSlug[];
|
||||||
|
|
13
packages/types/Category.ts
Normal file
13
packages/types/Category.ts
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
export enum CategoryType {
|
||||||
|
Single = 0,
|
||||||
|
Multi,
|
||||||
|
}
|
||||||
|
|
||||||
|
export type Category = {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
roles: string[];
|
||||||
|
hidden: boolean;
|
||||||
|
type: CategoryType;
|
||||||
|
position: number;
|
||||||
|
};
|
47
packages/types/Guild.ts
Normal file
47
packages/types/Guild.ts
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
import { Category } from './Category';
|
||||||
|
import { Role } from './Role';
|
||||||
|
import { Member } from './User';
|
||||||
|
|
||||||
|
export type Guild = {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
icon: string;
|
||||||
|
roles: Role[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export enum Features {
|
||||||
|
None,
|
||||||
|
Preview = None,
|
||||||
|
}
|
||||||
|
|
||||||
|
export type GuildData = {
|
||||||
|
id: string;
|
||||||
|
message: string;
|
||||||
|
categories: Category[];
|
||||||
|
features: Features;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type PresentableGuild = {
|
||||||
|
id: string;
|
||||||
|
guild: GuildSlug;
|
||||||
|
member: Member;
|
||||||
|
data: GuildData;
|
||||||
|
roles: Role[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export type GuildEnumeration = {
|
||||||
|
guilds: PresentableGuild[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export enum UserGuildPermissions {
|
||||||
|
User,
|
||||||
|
Manager = 1 << 1,
|
||||||
|
Admin = 1 << 2,
|
||||||
|
}
|
||||||
|
|
||||||
|
export type GuildSlug = {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
icon: string;
|
||||||
|
permissionLevel: UserGuildPermissions;
|
||||||
|
};
|
37
packages/types/Role.ts
Normal file
37
packages/types/Role.ts
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
export enum RoleSafety {
|
||||||
|
Safe = 0,
|
||||||
|
HigherThanBot = 1 << 1,
|
||||||
|
DangerousPermissions = 1 << 2,
|
||||||
|
ManagedRole = 1 << 3,
|
||||||
|
}
|
||||||
|
|
||||||
|
export type Role = {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
color: number;
|
||||||
|
managed: boolean;
|
||||||
|
position: number;
|
||||||
|
safety: RoleSafety;
|
||||||
|
/** Permissions is should be used as a BigInt, NOT a number. */
|
||||||
|
permissions: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type OwnRoleInfo = {
|
||||||
|
highestRolePosition: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
export enum TransactionType {
|
||||||
|
None = 0,
|
||||||
|
Remove = 1 << 1,
|
||||||
|
Add = 1 << 2,
|
||||||
|
}
|
||||||
|
|
||||||
|
export type RoleTransaction = {
|
||||||
|
id: string;
|
||||||
|
action: TransactionType;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type RoleUpdate = {
|
||||||
|
knownState: Role['id'][];
|
||||||
|
transactions: RoleTransaction[];
|
||||||
|
};
|
18
packages/types/Session.ts
Normal file
18
packages/types/Session.ts
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
import { GuildSlug } from './Guild';
|
||||||
|
import { DiscordUser } from './User';
|
||||||
|
|
||||||
|
export type AuthTokenResponse = {
|
||||||
|
access_token: string;
|
||||||
|
token_type: 'Bearer';
|
||||||
|
expires_in: number;
|
||||||
|
refresh_token: string;
|
||||||
|
scope: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type SessionData = {
|
||||||
|
/** sessionID is a KSUID */
|
||||||
|
sessionID: string;
|
||||||
|
tokens: AuthTokenResponse;
|
||||||
|
user: DiscordUser;
|
||||||
|
guilds: GuildSlug[];
|
||||||
|
};
|
18
packages/types/User.ts
Normal file
18
packages/types/User.ts
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
export type DiscordUser = {
|
||||||
|
id: string;
|
||||||
|
username: string;
|
||||||
|
discriminator: string;
|
||||||
|
avatar: string;
|
||||||
|
bot: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type Member = {
|
||||||
|
guildid?: string;
|
||||||
|
roles: string[];
|
||||||
|
nick?: string;
|
||||||
|
user?: DiscordUser;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type RoleypolyUser = {
|
||||||
|
discorduser: DiscordUser;
|
||||||
|
};
|
58
packages/types/demoData.ts
Normal file
58
packages/types/demoData.ts
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
import { Role } from '.';
|
||||||
|
|
||||||
|
export const demoData: Role[] = [
|
||||||
|
{
|
||||||
|
id: '557812805546541066',
|
||||||
|
name: 'a cute role ♡',
|
||||||
|
color: 0xd19494,
|
||||||
|
permissions: '0',
|
||||||
|
safety: 0,
|
||||||
|
managed: false,
|
||||||
|
position: 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '557812901717737472',
|
||||||
|
name: 'a vanity role ♡',
|
||||||
|
color: 0xd1d194,
|
||||||
|
permissions: '0',
|
||||||
|
safety: 0,
|
||||||
|
managed: false,
|
||||||
|
position: 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '557812915386843170',
|
||||||
|
name: 'a brave role ♡',
|
||||||
|
color: 0x94d194,
|
||||||
|
permissions: '0',
|
||||||
|
safety: 0,
|
||||||
|
managed: false,
|
||||||
|
position: 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '557824893241131029',
|
||||||
|
name: 'a proud role ♡',
|
||||||
|
color: 0x94d1d1,
|
||||||
|
permissions: '0',
|
||||||
|
safety: 0,
|
||||||
|
managed: false,
|
||||||
|
position: 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '557824994269200384',
|
||||||
|
name: 'a wonderful role ♡',
|
||||||
|
color: 0x9494d1,
|
||||||
|
permissions: '0',
|
||||||
|
safety: 0,
|
||||||
|
managed: false,
|
||||||
|
position: 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '557825026406088717',
|
||||||
|
name: 'a 日本語 role ♡',
|
||||||
|
color: 0xd194d1,
|
||||||
|
permissions: '0',
|
||||||
|
safety: 0,
|
||||||
|
managed: false,
|
||||||
|
position: 0,
|
||||||
|
},
|
||||||
|
];
|
5
packages/types/index.ts
Normal file
5
packages/types/index.ts
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
export * from './Category';
|
||||||
|
export * from './Guild';
|
||||||
|
export * from './Role';
|
||||||
|
export * from './Session';
|
||||||
|
export * from './User';
|
4
packages/types/package.json
Normal file
4
packages/types/package.json
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"name": "@roleypoly/types",
|
||||||
|
"version": "0.1.0"
|
||||||
|
}
|
|
@ -10,6 +10,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@reach/router": "^1.3.4",
|
"@reach/router": "^1.3.4",
|
||||||
"@roleypoly/design-system": "*",
|
"@roleypoly/design-system": "*",
|
||||||
|
"@roleypoly/types": "*",
|
||||||
"@testing-library/jest-dom": "^5.11.9",
|
"@testing-library/jest-dom": "^5.11.9",
|
||||||
"@testing-library/react": "^11.2.5",
|
"@testing-library/react": "^11.2.5",
|
||||||
"@testing-library/user-event": "^12.8.3",
|
"@testing-library/user-event": "^12.8.3",
|
||||||
|
|
Loading…
Add table
Reference in a new issue