ran prettier

This commit is contained in:
Kalle (Sendou) 2020-10-16 01:05:14 +03:00
parent 3c9cd98245
commit f7d2a2f395
46 changed files with 15131 additions and 1602 deletions

View File

@ -1,7 +1,9 @@
import { gql } from '@apollo/client';
import * as Apollo from '@apollo/client';
import { gql } from "@apollo/client";
import * as Apollo from "@apollo/client";
export type Maybe<T> = T | null;
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
export type Exact<T extends { [key: string]: unknown }> = {
[K in keyof T]: T[K];
};
/** All built-in and custom scalars, mapped to their actual values */
export type Scalars = {
ID: string;
@ -12,75 +14,80 @@ export type Scalars = {
};
export type Profile = {
__typename?: 'Profile';
customUrlPath?: Maybe<Scalars['String']>;
twitchName?: Maybe<Scalars['String']>;
youtubeId?: Maybe<Scalars['String']>;
country?: Maybe<Scalars['String']>;
bio?: Maybe<Scalars['String']>;
sensMotion?: Maybe<Scalars['Int']>;
sensStick?: Maybe<Scalars['Int']>;
weaponPool: Array<Scalars['String']>;
__typename?: "Profile";
customUrlPath?: Maybe<Scalars["String"]>;
twitchName?: Maybe<Scalars["String"]>;
youtubeId?: Maybe<Scalars["String"]>;
country?: Maybe<Scalars["String"]>;
bio?: Maybe<Scalars["String"]>;
sensMotion?: Maybe<Scalars["Int"]>;
sensStick?: Maybe<Scalars["Int"]>;
weaponPool: Array<Scalars["String"]>;
};
export type Query = {
__typename?: 'Query';
__typename?: "Query";
getUserByIdentifier?: Maybe<User>;
};
export type QueryGetUserByIdentifierArgs = {
identifier: Scalars['String'];
identifier: Scalars["String"];
};
export type User = {
__typename?: 'User';
discordId: Scalars['String'];
username: Scalars['String'];
discriminator: Scalars['String'];
discordAvatar?: Maybe<Scalars['String']>;
__typename?: "User";
discordId: Scalars["String"];
username: Scalars["String"];
discriminator: Scalars["String"];
discordAvatar?: Maybe<Scalars["String"]>;
profile?: Maybe<Profile>;
fullUsername: Scalars['String'];
avatarUrl?: Maybe<Scalars['String']>;
profilePath: Scalars['String'];
fullUsername: Scalars["String"];
avatarUrl?: Maybe<Scalars["String"]>;
profilePath: Scalars["String"];
};
export type GetUserByIdentifierQueryVariables = Exact<{
identifier: Scalars['String'];
identifier: Scalars["String"];
}>;
export type GetUserByIdentifierQuery = (
{ __typename?: 'Query' }
& { getUserByIdentifier?: Maybe<(
{ __typename?: 'User' }
& Pick<User, 'fullUsername' | 'avatarUrl'>
& { profile?: Maybe<(
{ __typename?: 'Profile' }
& Pick<Profile, 'customUrlPath' | 'twitchName' | 'youtubeId' | 'country' | 'bio' | 'sensMotion' | 'sensStick' | 'weaponPool'>
)> }
)> }
);
export type GetUserByIdentifierQuery = { __typename?: "Query" } & {
getUserByIdentifier?: Maybe<
{ __typename?: "User" } & Pick<User, "fullUsername" | "avatarUrl"> & {
profile?: Maybe<
{ __typename?: "Profile" } & Pick<
Profile,
| "customUrlPath"
| "twitchName"
| "youtubeId"
| "country"
| "bio"
| "sensMotion"
| "sensStick"
| "weaponPool"
>
>;
}
>;
};
export const GetUserByIdentifierDocument = gql`
query GetUserByIdentifier($identifier: String!) {
getUserByIdentifier(identifier: $identifier) {
fullUsername
avatarUrl
profile {
customUrlPath
twitchName
youtubeId
country
bio
sensMotion
sensStick
weaponPool
query GetUserByIdentifier($identifier: String!) {
getUserByIdentifier(identifier: $identifier) {
fullUsername
avatarUrl
profile {
customUrlPath
twitchName
youtubeId
country
bio
sensMotion
sensStick
weaponPool
}
}
}
}
`;
`;
/**
* __useGetUserByIdentifierQuery__
@ -98,12 +105,35 @@ export const GetUserByIdentifierDocument = gql`
* },
* });
*/
export function useGetUserByIdentifierQuery(baseOptions?: Apollo.QueryHookOptions<GetUserByIdentifierQuery, GetUserByIdentifierQueryVariables>) {
return Apollo.useQuery<GetUserByIdentifierQuery, GetUserByIdentifierQueryVariables>(GetUserByIdentifierDocument, baseOptions);
}
export function useGetUserByIdentifierLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<GetUserByIdentifierQuery, GetUserByIdentifierQueryVariables>) {
return Apollo.useLazyQuery<GetUserByIdentifierQuery, GetUserByIdentifierQueryVariables>(GetUserByIdentifierDocument, baseOptions);
}
export type GetUserByIdentifierQueryHookResult = ReturnType<typeof useGetUserByIdentifierQuery>;
export type GetUserByIdentifierLazyQueryHookResult = ReturnType<typeof useGetUserByIdentifierLazyQuery>;
export type GetUserByIdentifierQueryResult = Apollo.QueryResult<GetUserByIdentifierQuery, GetUserByIdentifierQueryVariables>;
export function useGetUserByIdentifierQuery(
baseOptions?: Apollo.QueryHookOptions<
GetUserByIdentifierQuery,
GetUserByIdentifierQueryVariables
>
) {
return Apollo.useQuery<
GetUserByIdentifierQuery,
GetUserByIdentifierQueryVariables
>(GetUserByIdentifierDocument, baseOptions);
}
export function useGetUserByIdentifierLazyQuery(
baseOptions?: Apollo.LazyQueryHookOptions<
GetUserByIdentifierQuery,
GetUserByIdentifierQueryVariables
>
) {
return Apollo.useLazyQuery<
GetUserByIdentifierQuery,
GetUserByIdentifierQueryVariables
>(GetUserByIdentifierDocument, baseOptions);
}
export type GetUserByIdentifierQueryHookResult = ReturnType<
typeof useGetUserByIdentifierQuery
>;
export type GetUserByIdentifierLazyQueryHookResult = ReturnType<
typeof useGetUserByIdentifierLazyQuery
>;
export type GetUserByIdentifierQueryResult = Apollo.QueryResult<
GetUserByIdentifierQuery,
GetUserByIdentifierQueryVariables
>;

View File

@ -1,9 +1,9 @@
import { PrismaClient } from "@prisma/client";
const prisma = new PrismaClient({log: ["query"]});
const prisma = new PrismaClient({ log: ["query"] });
export interface Context {
prisma: PrismaClient;
}
export const createContext = (): Context => ({ prisma })
export const createContext = (): Context => ({ prisma });

View File

@ -3,7 +3,6 @@ import * as userTypes from "graphql/schema/user";
import { nexusSchemaPrisma } from "nexus-plugin-prisma/schema";
import path from "path";
export const schema = makeSchema({
types: [userTypes],
plugins: [nexusSchemaPrisma()],
@ -14,7 +13,7 @@ export const schema = makeSchema({
},
nonNullDefaults: {
input: true,
output: true
output: true,
},
typegenAutoConfig: {
contextType: "Context.Context",
@ -29,4 +28,4 @@ export const schema = makeSchema({
},
],
},
});
});

View File

@ -4,21 +4,23 @@ export const User = objectType({
name: "User",
// FIXME: Remove properties that don't need to be exposed: username, avatar & discriminator
definition(t) {
t.model.discordId()
t.model.username()
t.model.discriminator()
t.model.discordAvatar()
t.model.discordId();
t.model.username();
t.model.discriminator();
t.model.discordAvatar();
// FIXME: this seems to generate extra query (on top of the one it's expected to generatei thi)
t.model.profile()
t.model.profile();
t.string("fullUsername", {
resolve: (root) => `${root.username}#${root.discriminator}`})
resolve: (root) => `${root.username}#${root.discriminator}`,
});
t.string("avatarUrl", {
resolve: (root) => `https://cdn.discordapp.com/avatars/${root.discordId}/${root.discordAvatar}.jpg`,
nullable: true
})
resolve: (root) =>
`https://cdn.discordapp.com/avatars/${root.discordId}/${root.discordAvatar}.jpg`,
nullable: true,
});
t.string("profilePath", {
resolve: (root) => `/u/${root.discordId}`
})
resolve: (root) => `/u/${root.discordId}`,
});
},
});
@ -26,17 +28,17 @@ export const Profile = objectType({
name: "Profile",
definition(t) {
// FIXME: Add Twitter
t.model.customUrlPath()
t.model.twitchName()
t.model.youtubeId()
t.model.country()
t.model.bio()
t.model.customUrlPath();
t.model.twitchName();
t.model.youtubeId();
t.model.country();
t.model.bio();
// FIXME: Sens as float
t.model.sensMotion()
t.model.sensStick()
t.model.weaponPool()
}
})
t.model.sensMotion();
t.model.sensStick();
t.model.weaponPool();
},
});
export const Query = queryType({
definition(t) {
@ -44,26 +46,26 @@ export const Query = queryType({
type: User,
nullable: true,
args: {
identifier: stringArg({required: true})
identifier: stringArg({ required: true }),
},
resolve: (_root, {identifier}, ctx) => {
console.log({ctx})
resolve: (_root, { identifier }, ctx) => {
console.log({ ctx });
return ctx.prisma.user.findFirst({
where: {
// this is ok because the values are mutually exclusive: customUrlPath can't contain only numbers etc.
OR: [
{
discordId: identifier
},
{
profile: {
customUrlPath: identifier.toLowerCase()
}
},
]
},
})
}
})
}
})
where: {
// this is ok because the values are mutually exclusive: customUrlPath can't contain only numbers etc.
OR: [
{
discordId: identifier,
},
{
profile: {
customUrlPath: identifier.toLowerCase(),
},
},
],
},
});
},
});
},
});

View File

@ -3,38 +3,38 @@
import {
ApolloClient,
InMemoryCache,
NormalizedCacheObject
} from '@apollo/client'
import { IncomingMessage, ServerResponse } from 'http'
import { useMemo } from 'react'
NormalizedCacheObject,
} from "@apollo/client";
import { IncomingMessage, ServerResponse } from "http";
import { useMemo } from "react";
let apolloClient: ApolloClient<NormalizedCacheObject> | undefined
let apolloClient: ApolloClient<NormalizedCacheObject> | undefined;
export type ResolverContext = {
req?: IncomingMessage
res?: ServerResponse
}
req?: IncomingMessage;
res?: ServerResponse;
};
function createIsomorphLink(context: ResolverContext = {}) {
if (typeof window === 'undefined') {
const { SchemaLink } = require('@apollo/client/link/schema')
const { schema } = require('graphql/schema')
return new SchemaLink({ schema, context })
if (typeof window === "undefined") {
const { SchemaLink } = require("@apollo/client/link/schema");
const { schema } = require("graphql/schema");
return new SchemaLink({ schema, context });
} else {
const { HttpLink } = require('@apollo/client')
const { HttpLink } = require("@apollo/client");
return new HttpLink({
uri: '/api/graphql',
credentials: 'same-origin',
})
uri: "/api/graphql",
credentials: "same-origin",
});
}
}
function createApolloClient(context?: ResolverContext) {
return new ApolloClient({
ssrMode: typeof window === 'undefined',
ssrMode: typeof window === "undefined",
link: createIsomorphLink(context),
cache: new InMemoryCache(),
})
});
}
export function initializeApollo(
@ -43,22 +43,22 @@ export function initializeApollo(
// a custom context which will be used by `SchemaLink` to server render pages
context?: ResolverContext
) {
const _apolloClient = apolloClient ?? createApolloClient(context)
const _apolloClient = apolloClient ?? createApolloClient(context);
// If your page has Next.js data fetching methods that use Apollo Client, the initial state
// get hydrated here
if (initialState) {
_apolloClient.cache.restore(initialState)
_apolloClient.cache.restore(initialState);
}
// For SSG and SSR always create a new Apollo Client
if (typeof window === 'undefined') return _apolloClient
if (typeof window === "undefined") return _apolloClient;
// Create the Apollo Client once in the client
if (!apolloClient) apolloClient = _apolloClient
if (!apolloClient) apolloClient = _apolloClient;
return _apolloClient
return _apolloClient;
}
export function useApollo(initialState: any) {
const store = useMemo(() => initializeApollo(initialState), [initialState])
return store
}
const store = useMemo(() => initializeApollo(initialState), [initialState]);
return store;
}

File diff suppressed because it is too large Load Diff

View File

@ -44,11 +44,10 @@ const theme = {
textColor: "whiteAlpha.900",
gray: "gray.300",
},
} as const
} as const;
export const useMyTheme = () => {
const { colorMode } = useColorMode()
return theme[colorMode]
}
const { colorMode } = useColorMode();
return theme[colorMode];
};

View File

@ -1,2 +1,2 @@
const withImages = require('next-images')
module.exports = withImages()
const withImages = require("next-images");
module.exports = withImages();

View File

@ -3,14 +3,12 @@
* Do not make changes to this file directly
*/
import * as Context from "./graphql/context"
import * as Context from "./graphql/context";
declare global {
interface NexusGenCustomOutputProperties<TypeName extends string> {
model: NexusPrisma<TypeName, 'model'>
crud: any
model: NexusPrisma<TypeName, "model">;
crud: any;
}
}
@ -18,22 +16,21 @@ declare global {
interface NexusGen extends NexusGenTypes {}
}
export interface NexusGenInputs {
}
export interface NexusGenInputs {}
export interface NexusGenEnums {
}
export interface NexusGenEnums {}
export interface NexusGenScalars {
String: string
Int: number
Float: number
Boolean: boolean
ID: string
String: string;
Int: number;
Float: number;
Boolean: boolean;
ID: string;
}
export interface NexusGenRootTypes {
Profile: { // root type
Profile: {
// root type
bio?: string | null; // String
country?: string | null; // String
customUrlPath?: string | null; // String
@ -42,26 +39,28 @@ export interface NexusGenRootTypes {
twitchName?: string | null; // String
weaponPool: string[]; // [String!]!
youtubeId?: string | null; // String
}
};
Query: {};
User: { // root type
User: {
// root type
discordAvatar?: string | null; // String
discordId: string; // String!
discriminator: string; // String!
username: string; // String!
}
};
}
export interface NexusGenAllTypes extends NexusGenRootTypes {
String: NexusGenScalars['String'];
Int: NexusGenScalars['Int'];
Float: NexusGenScalars['Float'];
Boolean: NexusGenScalars['Boolean'];
ID: NexusGenScalars['ID'];
String: NexusGenScalars["String"];
Int: NexusGenScalars["Int"];
Float: NexusGenScalars["Float"];
Boolean: NexusGenScalars["Boolean"];
ID: NexusGenScalars["ID"];
}
export interface NexusGenFieldTypes {
Profile: { // field return type
Profile: {
// field return type
bio: string | null; // String
country: string | null; // String
customUrlPath: string | null; // String
@ -70,32 +69,34 @@ export interface NexusGenFieldTypes {
twitchName: string | null; // String
weaponPool: string[]; // [String!]!
youtubeId: string | null; // String
}
Query: { // field return type
getUserByIdentifier: NexusGenRootTypes['User'] | null; // User
}
User: { // field return type
};
Query: {
// field return type
getUserByIdentifier: NexusGenRootTypes["User"] | null; // User
};
User: {
// field return type
avatarUrl: string | null; // String
discordAvatar: string | null; // String
discordId: string; // String!
discriminator: string; // String!
fullUsername: string; // String!
profile: NexusGenRootTypes['Profile'] | null; // Profile
profile: NexusGenRootTypes["Profile"] | null; // Profile
profilePath: string; // String!
username: string; // String!
}
};
}
export interface NexusGenArgTypes {
Query: {
getUserByIdentifier: { // args
getUserByIdentifier: {
// args
identifier: string; // String!
}
}
};
};
}
export interface NexusGenAbstractResolveReturnTypes {
}
export interface NexusGenAbstractResolveReturnTypes {}
export interface NexusGenInheritedFields {}
@ -125,19 +126,28 @@ export interface NexusGenTypes {
interfaceNames: NexusGenInterfaceNames;
scalarNames: NexusGenScalarNames;
unionNames: NexusGenUnionNames;
allInputTypes: NexusGenTypes['inputNames'] | NexusGenTypes['enumNames'] | NexusGenTypes['scalarNames'];
allOutputTypes: NexusGenTypes['objectNames'] | NexusGenTypes['enumNames'] | NexusGenTypes['unionNames'] | NexusGenTypes['interfaceNames'] | NexusGenTypes['scalarNames'];
allNamedTypes: NexusGenTypes['allInputTypes'] | NexusGenTypes['allOutputTypes']
abstractTypes: NexusGenTypes['interfaceNames'] | NexusGenTypes['unionNames'];
allInputTypes:
| NexusGenTypes["inputNames"]
| NexusGenTypes["enumNames"]
| NexusGenTypes["scalarNames"];
allOutputTypes:
| NexusGenTypes["objectNames"]
| NexusGenTypes["enumNames"]
| NexusGenTypes["unionNames"]
| NexusGenTypes["interfaceNames"]
| NexusGenTypes["scalarNames"];
allNamedTypes:
| NexusGenTypes["allInputTypes"]
| NexusGenTypes["allOutputTypes"];
abstractTypes: NexusGenTypes["interfaceNames"] | NexusGenTypes["unionNames"];
abstractResolveReturn: NexusGenAbstractResolveReturnTypes;
}
declare global {
interface NexusGenPluginTypeConfig<TypeName extends string> {
}
interface NexusGenPluginFieldConfig<TypeName extends string, FieldName extends string> {
}
interface NexusGenPluginSchemaConfig {
}
}
interface NexusGenPluginTypeConfig<TypeName extends string> {}
interface NexusGenPluginFieldConfig<
TypeName extends string,
FieldName extends string
> {}
interface NexusGenPluginSchemaConfig {}
}

View File

@ -1559,4 +1559,4 @@
"PLACEMENTS_COUNT": "Top 500 Platzierungen",
"Score": "Ergebnis"
}
}
}

View File

@ -1551,4 +1551,4 @@
"What are you looking from a team?": "O que você espera de um time?",
"Free word": "Texto livre"
}
}
}

View File

@ -4,7 +4,7 @@ import { Redirect, RouteComponentProps } from "@reach/router";
import React, { useState } from "react";
import {
MutationUpdatePlayerIdArgs,
useUpdatePlayerIdMutation
useUpdatePlayerIdMutation,
} from "../../generated/graphql";
import { USER } from "../../graphql/queries/user";
import { UserData } from "../../types";

View File

@ -4,7 +4,7 @@ import React, { useState } from "react";
import { END_VOTING } from "../../graphql/mutations/endVoting";
import {
StartVotingVars,
START_VOTING
START_VOTING,
} from "../../graphql/mutations/startVoting";
import { PlusInfoData, PLUS_INFO } from "../../graphql/queries/plusInfo";
import Error from "../common/Error";

View File

@ -1,4 +1,12 @@
import { Badge, Box, Button, Flex, FormLabel, Switch, Wrap } from "@chakra-ui/core";
import {
Badge,
Box,
Button,
Flex,
FormLabel,
Switch,
Wrap,
} from "@chakra-ui/core";
import { RouteComponentProps, useLocation } from "@reach/router";
import React, { useContext, useEffect, useState } from "react";
import { Helmet } from "react-helmet-async";

View File

@ -8,12 +8,12 @@ import {
ClothingOnlyAbility,
HeadOnlyAbility,
ShoesOnlyAbility,
StackableAbility
StackableAbility,
} from "../../types";
import {
clothingOnlyAbilities,
headOnlyAbilities,
shoesOnlyAbilities
shoesOnlyAbilities,
} from "../../utils/lists";
import ViewSlots from "../builds/ViewSlots";
import AbilityButtons from "../user/AbilityButtons";

View File

@ -1,24 +1,26 @@
import { useMutation } from "@apollo/client";
import {
Box, Button, Flex,
Box,
Button,
Flex,
FormControl,
FormErrorMessage,
FormHelperText,
Image,
useToast
useToast,
} from "@chakra-ui/core";
import React, { useState } from "react";
import {
DeleteCompetitiveFeedEventVars,
DELETE_COMPETITIVE_FEED_EVENT
DELETE_COMPETITIVE_FEED_EVENT,
} from "../../graphql/mutations/deleteCompetitiveFeedEvent";
import {
UpdateCompetitiveFeedEventVars,
UPDATE_COMPETITIVE_FEED_EVENT
UPDATE_COMPETITIVE_FEED_EVENT,
} from "../../graphql/mutations/updateCompetitiveFeedEvent";
import {
CompetitiveFeedEvent,
UPCOMING_EVENTS
UPCOMING_EVENTS,
} from "../../graphql/queries/upcomingEvents";
import DatePicker from "../elements/DatePicker";
import Input from "../elements/Input";

View File

@ -1,6 +1,8 @@
import { useMutation } from "@apollo/client";
import {
Box, Button, Checkbox,
Box,
Button,
Checkbox,
CheckboxGroup,
Flex,
FormControl,
@ -9,13 +11,13 @@ import {
Radio,
RadioGroup,
Stack,
useToast
useToast,
} from "@chakra-ui/core";
import React, { useContext, useState } from "react";
import { useTranslation } from "react-i18next";
import {
AddFreeAgentPostVars,
ADD_FREE_AGENT_POST
ADD_FREE_AGENT_POST,
} from "../../graphql/mutations/addFreeAgentPost";
import { HIDE_FREE_AGENT_POST } from "../../graphql/mutations/hideFreeAgentPost";
import { UPDATE_FREE_AGENT_POST } from "../../graphql/mutations/updateFreeAgentPost";
@ -171,7 +173,10 @@ const FAPostModal: React.FC<FAPostModalProps> = ({ closeModal, post }) => {
<Box color={grayWithShade}>{t("freeagents;deleteNotif")}</Box>
<Flex flexWrap="wrap" mt="1em">
<Box mr="1em">
<Button onClick={() => hideFreeAgentPost()} isLoading={hideLoading}>
<Button
onClick={() => hideFreeAgentPost()}
isLoading={hideLoading}
>
{t("freeagents;Confirm deletion")}
</Button>
</Box>

View File

@ -7,7 +7,7 @@ import { useTranslation } from "react-i18next";
import { FaFilter } from "react-icons/fa";
import {
FreeAgentMatchesData,
FREE_AGENT_MATCHES
FREE_AGENT_MATCHES,
} from "../../graphql/queries/freeAgentMatches";
import { FREE_AGENT_POSTS } from "../../graphql/queries/freeAgentPosts";
import { USER } from "../../graphql/queries/user";
@ -15,7 +15,7 @@ import {
FreeAgentPost,
FreeAgentPostsData,
UserData,
Weapon
Weapon,
} from "../../types";
import { continents } from "../../utils/lists";
import Error from "../common/Error";

View File

@ -6,7 +6,7 @@ import { useTranslation } from "react-i18next";
import { FiClock, FiInfo } from "react-icons/fi";
import {
UpcomingEventsData,
UPCOMING_EVENTS
UPCOMING_EVENTS,
} from "../../graphql/queries/upcomingEvents";
import MyThemeContext from "../../themeContext";
import { getWeek } from "../../utils/helperFunctions";

View File

@ -8,7 +8,7 @@ import {
FaBomb,
FaFileDownload,
FaFileImage,
FaFileUpload
FaFileUpload,
} from "react-icons/fa";
import useBreakPoints from "../../hooks/useBreakPoints";
import { Stage, Weapon } from "../../types";
@ -330,7 +330,11 @@ const MapPlannerPage: React.FC<RouteComponentProps> = () => {
>
{t("plans;Download as .json")}
</Button>
<Button onClick={() => handleUpload()} leftIcon={<FaFileUpload />} variant="outline">
<Button
onClick={() => handleUpload()}
leftIcon={<FaFileUpload />}
variant="outline"
>
{t("plans;Load from .json")}
</Button>
</Flex>

View File

@ -1,6 +1,8 @@
import { useMutation } from "@apollo/client";
import {
Box, Button, Flex,
Box,
Button,
Flex,
FormControl,
FormErrorMessage,
FormHelperText,
@ -8,7 +10,7 @@ import {
Radio,
RadioGroup,
Stack,
useToast
useToast,
} from "@chakra-ui/core";
import React, { useContext, useState } from "react";
import { ADD_SUGGESTION } from "../../graphql/mutations/addSuggestion";

View File

@ -4,9 +4,9 @@ import { Link } from "@reach/router";
import React, { useContext, useState } from "react";
import { PlusInfoData, PLUS_INFO } from "../../graphql/queries/plusInfo";
import {
Suggestion,
SUGGESTIONS,
SuggestionsData
Suggestion,
SUGGESTIONS,
SuggestionsData,
} from "../../graphql/queries/suggestions";
import { USER } from "../../graphql/queries/user";
import { VOUCHES } from "../../graphql/queries/vouches";

View File

@ -8,7 +8,7 @@ import { USER } from "../../graphql/queries/user";
import {
UsersForVotingData,
USERS_FOR_VOTING,
VotingSuggested
VotingSuggested,
} from "../../graphql/queries/usersForVoting";
import MyThemeContext from "../../themeContext";
import { UserData } from "../../types";

View File

@ -10,7 +10,7 @@ import { mapIcons } from "../../assets/imageImports";
import {
SearchForDraftCupData,
SearchForDraftCupVars,
SEARCH_FOR_DRAFT_CUP
SEARCH_FOR_DRAFT_CUP,
} from "../../graphql/queries/searchForDraftCup";
import MyThemeContext from "../../themeContext";
import {
@ -18,7 +18,7 @@ import {
ClothingGear,
DetailedTeamInfo,
HeadGear,
ShoesGear
ShoesGear,
} from "../../types";
import AbilityIcon from "../builds/AbilityIcon";
import GearImage from "../builds/GearImage";

View File

@ -1,14 +1,16 @@
import { useQuery } from "@apollo/client";
import {
Box, Button, Flex,
Grid,
IconButton,
Menu,
MenuButton,
MenuGroup,
MenuItem,
MenuList,
useColorMode
Box,
Button,
Flex,
Grid,
IconButton,
Menu,
MenuButton,
MenuGroup,
MenuItem,
MenuList,
useColorMode,
} from "@chakra-ui/core";
import { Link } from "@reach/router";
import React, { Suspense, useContext } from "react";

View File

@ -10,14 +10,14 @@ import {
ArrayParam,
encodeQueryParams,
StringParam,
useQueryParams
useQueryParams,
} from "use-query-params";
import { modeIconMap } from "../../assets/icons";
import { mapIcons } from "../../assets/imageImports";
import {
SearchForTournamentByIdData,
SearchForTournamentByIdVars,
SEARCH_FOR_TOURNAMENT_BY_ID
SEARCH_FOR_TOURNAMENT_BY_ID,
} from "../../graphql/queries/searchForTournamentById";
import MyThemeContext from "../../themeContext";
import { Ability, Weapon } from "../../types";

File diff suppressed because it is too large Load Diff

View File

@ -2,14 +2,11 @@ import { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import {
Ability,
AnalyzerBuild, Build,
SpecialWeapon, SubWeapon, Weapon
AnalyzerBuild,
Build,
SpecialWeapon,
SubWeapon,
Weapon,
} from "../types";
import abilityJson from "../utils/abilityData.json";
import { getEffect } from "../utils/getAbilityEffect";
@ -354,13 +351,15 @@ export default function useAbilityEffects(
const tank = build.weapon.includes("Jr.") ? 1.1 : 1;
let percentage = parseFloat(
(((effect[0] * inkConsumption) / tank) * 100).toFixed(2))
(((effect[0] * inkConsumption) / tank) * 100).toFixed(2)
);
const morePrecisePercentage = parseFloat(
(((effect[0] * inkConsumption) / tank) * 100).toFixed(5))
(((effect[0] * inkConsumption) / tank) * 100).toFixed(5)
);
if (percentage === 50 && morePrecisePercentage > 50) {
percentage = 50.01
percentage = 50.01;
}
const subWeaponTranslated = t(`game;${subWeapon}`);

View File

@ -3,10 +3,8 @@ import useLocalStorage from "@rehooks/local-storage";
import { ThemeColor } from "../types";
export function useTheme(): Parameters<typeof extendTheme>[0] {
const { colorMode } = useColorMode()
const defaultThemeColor = colorMode === "light"
? "pink"
: "orange";
const { colorMode } = useColorMode();
const defaultThemeColor = colorMode === "light" ? "pink" : "orange";
const [themeColor = defaultThemeColor] = useLocalStorage<ThemeColor>(
"colorPreference"
);
@ -22,10 +20,10 @@ export function useTheme(): Parameters<typeof extendTheme>[0] {
},*/
Button: {
defaultProps: {
colorScheme: themeColor
}
}
colorScheme: themeColor,
},
},
},
config: { useSystemColorMode: true }
} as const
}
config: { useSystemColorMode: true },
} as const;
}

File diff suppressed because one or more lines are too long

View File

@ -2,10 +2,10 @@ const {
UserInputError,
AuthenticationError,
gql,
} = require("apollo-server-express")
const Maplist = require("../mongoose-models/maplist")
const MapBallot = require("../mongoose-models/mapballot") //[PositiveVoteCount!]!
const maps = require("../utils/maps")
} = require("apollo-server-express");
const Maplist = require("../mongoose-models/maplist");
const MapBallot = require("../mongoose-models/mapballot"); //[PositiveVoteCount!]!
const maps = require("../utils/maps");
const typeDef = gql`
extend type Query {
@ -53,133 +53,133 @@ const typeDef = gql`
rm: Int!
cb: Int!
}
`
`;
const resolvers = {
Query: {
maplists: (root, args) => {
const criteria = args.name ? { name: args.name } : {}
const criteria = args.name ? { name: args.name } : {};
return Maplist.find(criteria)
.sort({ order: "asc" })
.catch((e) => {
throw new UserInputError(e.message, {
invalidArgs: args,
})
})
});
});
},
plusMaplists: (root, args) => {
return Maplist.find({ plus: { $ne: null } }).sort({
"plus.year": "desc",
"plus.month": "desc",
})
});
},
mapVotes: async (root, args, ctx) => {
if (!ctx.user || !ctx.user.plus || !ctx.user.plus.membership_status) {
return null
return null;
}
const mapBallot = await MapBallot.findOne({
discord_id: ctx.user.discord_id,
})
});
if (!mapBallot) {
return maps.map((map) => ({ name: map, sz: 0, tc: 0, rm: 0, cb: 0 }))
return maps.map((map) => ({ name: map, sz: 0, tc: 0, rm: 0, cb: 0 }));
}
return mapBallot.maps
return mapBallot.maps;
},
positiveVotes: async (root, args, ctx) => {
const ballots = await MapBallot.find({})
const ballots = await MapBallot.find({});
const count = {}
const count = {};
ballots.forEach((ballot) => {
ballot.maps.forEach((stage) => {
let toIcrement = 0
if (stage[args.mode.toLowerCase()] === 1) toIcrement = 1
let toIcrement = 0;
if (stage[args.mode.toLowerCase()] === 1) toIcrement = 1;
const votes = count[stage.name] ? count[stage.name] : 0
count[stage.name] = votes + toIcrement
})
})
const votes = count[stage.name] ? count[stage.name] : 0;
count[stage.name] = votes + toIcrement;
});
});
return true
return true;
},
},
Mutation: {
addMapVotes: async (root, args, ctx) => {
if (!ctx.user || !ctx.user.plus || !ctx.user.plus.membership_status) {
throw new AuthenticationError("Insufficient access")
throw new AuthenticationError("Insufficient access");
}
const legitVotes = [-1, 0, 1]
const legitVotes = [-1, 0, 1];
args.votes.forEach((vote, index) => {
if (vote.name !== maps[index]) {
throw new UserInputError(
`Invalid map or position: ${vote.name} on the index ${index}`
)
);
}
if (legitVotes.indexOf(vote.sz) === -1) {
throw new UserInputError(`Invalid vote for sz: ${vote.sz}`)
throw new UserInputError(`Invalid vote for sz: ${vote.sz}`);
}
if (legitVotes.indexOf(vote.tc) === -1) {
throw new UserInputError(`Invalid vote for sz: ${vote.tc}`)
throw new UserInputError(`Invalid vote for sz: ${vote.tc}`);
}
if (legitVotes.indexOf(vote.rm) === -1) {
throw new UserInputError(`Invalid vote for sz: ${vote.rm}`)
throw new UserInputError(`Invalid vote for sz: ${vote.rm}`);
}
if (legitVotes.indexOf(vote.cb) === -1) {
throw new UserInputError(`Invalid vote for sz: ${vote.cb}`)
throw new UserInputError(`Invalid vote for sz: ${vote.cb}`);
}
})
});
const discord_id = ctx.user.discord_id
const discord_id = ctx.user.discord_id;
await MapBallot.findOneAndUpdate(
{ discord_id },
{ discord_id, maps: args.votes },
{ upsert: true }
)
);
return true
return true;
},
generateMaplistFromVotes: async (root, args, ctx) => {
if (!ctx.user) throw new AuthenticationError("Not logged in")
if (!ctx.user) throw new AuthenticationError("Not logged in");
if (ctx.user.discord_id !== process.env.ADMIN_ID)
throw new AuthenticationError("Not admin")
throw new AuthenticationError("Not admin");
const ballots = await MapBallot.find({}).populate("discord_user")
const ballots = await MapBallot.find({}).populate("discord_user");
const validBallots = ballots.filter(
(ballot) => !!ballot.discord_user.plus.membership_status
)
);
const voter_count = validBallots.length
const voter_count = validBallots.length;
const vote_counts = maps.map((stage) => ({
name: stage,
sz: [0, 0, 0],
tc: [0, 0, 0],
rm: [0, 0, 0],
cb: [0, 0, 0],
}))
}));
validBallots.forEach((ballot) =>
ballot.maps.forEach((stage, index) => {
const { sz, tc, rm, cb } = stage
const { sz, tc, rm, cb } = stage;
// one is added to the index so -1 vote goes to 0 index, 0 to 1 and 1 to 2
vote_counts[index].sz[sz + 1] = vote_counts[index].sz[sz + 1] + 1
vote_counts[index].tc[tc + 1] = vote_counts[index].tc[tc + 1] + 1
vote_counts[index].rm[rm + 1] = vote_counts[index].rm[rm + 1] + 1
vote_counts[index].cb[cb + 1] = vote_counts[index].cb[cb + 1] + 1
vote_counts[index].sz[sz + 1] = vote_counts[index].sz[sz + 1] + 1;
vote_counts[index].tc[tc + 1] = vote_counts[index].tc[tc + 1] + 1;
vote_counts[index].rm[rm + 1] = vote_counts[index].rm[rm + 1] + 1;
vote_counts[index].cb[cb + 1] = vote_counts[index].cb[cb + 1] + 1;
})
)
);
let allMaps = []
let allMaps = [];
vote_counts.forEach((count) => {
;["sz", "tc", "rm", "cb"].forEach((mode) => {
["sz", "tc", "rm", "cb"].forEach((mode) => {
allMaps.push({
name: count.name,
score: +(
@ -187,29 +187,29 @@ const resolvers = {
voter_count
).toFixed(2),
mode,
})
})
})
});
});
});
allMaps = allMaps.sort((a, b) => b.score - a.score)
allMaps = allMaps.sort((a, b) => b.score - a.score);
szMapPool = []
tcMapPool = []
rmMapPool = []
cbMapPool = []
szMapPool = [];
tcMapPool = [];
rmMapPool = [];
cbMapPool = [];
const pools = {
sz: szMapPool,
tc: tcMapPool,
rm: rmMapPool,
cb: cbMapPool,
}
};
const mapCount = {}
const mapCount = {};
// we switch monthly to add variance
const now = new Date()
const month = now.getMonth() + 1
const now = new Date();
const month = now.getMonth() + 1;
const monthModes = [
null,
"sz",
@ -224,14 +224,14 @@ const resolvers = {
"tc",
"rm",
"cb",
]
let modeToAddTo = monthModes[month]
];
let modeToAddTo = monthModes[month];
const nextModeDict = {
sz: "tc",
tc: "rm",
rm: "cb",
cb: "sz",
}
};
while (
szMapPool.length < 8 ||
@ -240,40 +240,40 @@ const resolvers = {
cbMapPool.length < 8
) {
for (const stageObj of allMaps) {
const pool = pools[modeToAddTo]
const pool = pools[modeToAddTo];
if (pool.length === 8) {
break
break;
}
const alreadyInCount = mapCount[stageObj.name]
? mapCount[stageObj.name]
: 0
: 0;
if (alreadyInCount === 2) {
continue
continue;
}
if (stageObj.mode !== modeToAddTo) {
continue
continue;
}
if (pool.indexOf(stageObj.name) !== -1) {
continue
continue;
}
mapCount[stageObj.name] = alreadyInCount + 1
pool.push(stageObj.name)
break
mapCount[stageObj.name] = alreadyInCount + 1;
pool.push(stageObj.name);
break;
}
modeToAddTo = nextModeDict[modeToAddTo]
modeToAddTo = nextModeDict[modeToAddTo];
}
szMapPool.sort((a, b) => maps.indexOf(a) - maps.indexOf(b))
tcMapPool.sort((a, b) => maps.indexOf(a) - maps.indexOf(b))
rmMapPool.sort((a, b) => maps.indexOf(a) - maps.indexOf(b))
cbMapPool.sort((a, b) => maps.indexOf(a) - maps.indexOf(b))
szMapPool.sort((a, b) => maps.indexOf(a) - maps.indexOf(b));
tcMapPool.sort((a, b) => maps.indexOf(a) - maps.indexOf(b));
rmMapPool.sort((a, b) => maps.indexOf(a) - maps.indexOf(b));
cbMapPool.sort((a, b) => maps.indexOf(a) - maps.indexOf(b));
const maplist = {
name: `Plus Server ${now.toLocaleString("default", {
@ -290,17 +290,17 @@ const resolvers = {
voter_count,
vote_counts,
},
}
};
await Maplist.updateMany({ order: 0 }, { order: 1 })
await Maplist.create(maplist)
await Maplist.updateMany({ order: 0 }, { order: 1 });
await Maplist.create(maplist);
return true
return true;
},
},
}
};
module.exports = {
Maplist: typeDef,
maplistResolvers: resolvers,
}
};

View File

@ -29,7 +29,7 @@ const { General, generalResolvers } = require("./graphql-schemas/general");
SalmonRunRecord,
salmonRunRecordResolvers,
} = require("./graphql-schemas/salmonRunRecord")*/
const { Maplist, maplistResolvers} = require("./graphql-schemas/maps")
const { Maplist, maplistResolvers } = require("./graphql-schemas/maps");
const Query = gql`
type Query {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

56
package-lock.json generated
View File

@ -28,6 +28,7 @@
"@graphql-codegen/typescript-react-apollo": "2.0.7",
"@prisma/cli": "^2.8.0",
"@types/react": "^16.9.49",
"prettier": "^2.1.2",
"ts-node": "^9.0.0",
"typescript": "^4.0.3"
}
@ -3438,7 +3439,7 @@
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/@prisma/cli/-/cli-2.9.0.tgz",
"integrity": "sha512-wPk4ehyTtVM7ZarWs16MhOc6kwLV/gZFardMvUeh46rlBwrklMdKtNChzzPa3wurrUPQ5KTbuRBz5Mgf7AdD/w==",
"dev": true,
"devOptional": true,
"hasInstallScript": true,
"bin": {
"prisma": "build/index.js",
@ -11268,6 +11269,18 @@
"node": ">=4"
}
},
"node_modules/prettier": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.1.2.tgz",
"integrity": "sha512-16c7K+x4qVlJg9rEbXl7HEGmQyZlG4R9AgP+oHKRMsMsuk8s+ATStlf1NpDqyBI1HpVyfjLOeMhH2LvuNvV5Vg==",
"dev": true,
"bin": {
"prettier": "bin-prettier.js"
},
"engines": {
"node": ">=10.13.0"
}
},
"node_modules/process": {
"version": "0.11.10",
"resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
@ -16722,7 +16735,8 @@
"@chakra-ui/css-reset": {
"version": "1.0.0-rc.5",
"resolved": "https://registry.npmjs.org/@chakra-ui/css-reset/-/css-reset-1.0.0-rc.5.tgz",
"integrity": "sha512-9NzQnUR7Jjtb2Ixiwys6fVkii6WE7TPcBFg2FxGJTvtElweR4gKVoyc6lyGH1LRTBZd1kMT55iY3FyLPOYFfsw=="
"integrity": "sha512-9NzQnUR7Jjtb2Ixiwys6fVkii6WE7TPcBFg2FxGJTvtElweR4gKVoyc6lyGH1LRTBZd1kMT55iY3FyLPOYFfsw==",
"requires": {}
},
"@chakra-ui/descendant": {
"version": "1.0.0-rc.5",
@ -16819,7 +16833,8 @@
"@chakra-ui/live-region": {
"version": "1.0.0-rc.5",
"resolved": "https://registry.npmjs.org/@chakra-ui/live-region/-/live-region-1.0.0-rc.5.tgz",
"integrity": "sha512-k90pMnoUCT73D3SahBKv4xdW0P4uhUrAQ/GW7OXC9W3hTS41DVV6g8EvGoOKVkh16LJhpbM35VbEBwS07mN/0A=="
"integrity": "sha512-k90pMnoUCT73D3SahBKv4xdW0P4uhUrAQ/GW7OXC9W3hTS41DVV6g8EvGoOKVkh16LJhpbM35VbEBwS07mN/0A==",
"requires": {}
},
"@chakra-ui/media-query": {
"version": "1.0.0-rc.5",
@ -17796,7 +17811,8 @@
"@graphql-typed-document-node/core": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/@graphql-typed-document-node/core/-/core-3.1.0.tgz",
"integrity": "sha512-wYn6r8zVZyQJ6rQaALBEln5B1pzxb9shV5Ef97kTvn6yVGrqyXVnDqnU24MXnFubR+rZjBY9NWuxX3FB2sTsjg=="
"integrity": "sha512-wYn6r8zVZyQJ6rQaALBEln5B1pzxb9shV5Ef97kTvn6yVGrqyXVnDqnU24MXnFubR+rZjBY9NWuxX3FB2sTsjg==",
"requires": {}
},
"@hapi/accept": {
"version": "5.0.1",
@ -17869,7 +17885,8 @@
"@next/react-refresh-utils": {
"version": "9.5.5",
"resolved": "https://registry.npmjs.org/@next/react-refresh-utils/-/react-refresh-utils-9.5.5.tgz",
"integrity": "sha512-Gz5z0+ID+KAGto6Tkgv1a340damEw3HG6ANLKwNi5/QSHqQ3JUAVxMuhz3qnL54505I777evpzL89ofWEMIWKw=="
"integrity": "sha512-Gz5z0+ID+KAGto6Tkgv1a340damEw3HG6ANLKwNi5/QSHqQ3JUAVxMuhz3qnL54505I777evpzL89ofWEMIWKw==",
"requires": {}
},
"@nexus/schema": {
"version": "0.16.0",
@ -17923,7 +17940,7 @@
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/@prisma/cli/-/cli-2.9.0.tgz",
"integrity": "sha512-wPk4ehyTtVM7ZarWs16MhOc6kwLV/gZFardMvUeh46rlBwrklMdKtNChzzPa3wurrUPQ5KTbuRBz5Mgf7AdD/w==",
"dev": true
"devOptional": true
},
"@prisma/client": {
"version": "2.9.0",
@ -18108,7 +18125,8 @@
"@react-types/shared": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/@react-types/shared/-/shared-3.2.1.tgz",
"integrity": "sha512-Yi+zB+wvIGrxomjG7JZWsOPm8/tKPBtEsJI4cS2QbSho/bQWsw6xufJ6YlXxmx4BiBcktkp5VeP43E5nWqMQ5w=="
"integrity": "sha512-Yi+zB+wvIGrxomjG7JZWsOPm8/tKPBtEsJI4cS2QbSho/bQWsw6xufJ6YlXxmx4BiBcktkp5VeP43E5nWqMQ5w==",
"requires": {}
},
"@samverschueren/stream-to-observable": {
"version": "0.3.1",
@ -18713,12 +18731,14 @@
"ajv-errors": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/ajv-errors/-/ajv-errors-1.0.1.tgz",
"integrity": "sha512-DCRfO/4nQ+89p/RK43i8Ezd41EqdGIU4ld7nGF8OQ14oc/we5rEntLCUa7+jrn3nn83BosfwZA0wb4pon2o8iQ=="
"integrity": "sha512-DCRfO/4nQ+89p/RK43i8Ezd41EqdGIU4ld7nGF8OQ14oc/we5rEntLCUa7+jrn3nn83BosfwZA0wb4pon2o8iQ==",
"requires": {}
},
"ajv-keywords": {
"version": "3.5.2",
"resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz",
"integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ=="
"integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==",
"requires": {}
},
"ally.js": {
"version": "1.4.1",
@ -18882,7 +18902,8 @@
"apollo-server-errors": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/apollo-server-errors/-/apollo-server-errors-2.4.2.tgz",
"integrity": "sha512-FeGxW3Batn6sUtX3OVVUm7o56EgjxDlmgpTLNyWcLb0j6P8mw9oLNyAm3B+deHA4KNdNHO5BmHS2g1SJYjqPCQ=="
"integrity": "sha512-FeGxW3Batn6sUtX3OVVUm7o56EgjxDlmgpTLNyWcLb0j6P8mw9oLNyAm3B+deHA4KNdNHO5BmHS2g1SJYjqPCQ==",
"requires": {}
},
"apollo-server-micro": {
"version": "2.18.2",
@ -21470,7 +21491,8 @@
"graphql-tag": {
"version": "2.11.0",
"resolved": "https://registry.npmjs.org/graphql-tag/-/graphql-tag-2.11.0.tgz",
"integrity": "sha512-VmsD5pJqWJnQZMUeRwrDhfgoyqcfwEkvtpANqcoUG8/tOLkwNgU9mzub/Mc78OJMhHjx7gfAMTxzdG43VGg3bA=="
"integrity": "sha512-VmsD5pJqWJnQZMUeRwrDhfgoyqcfwEkvtpANqcoUG8/tOLkwNgU9mzub/Mc78OJMhHjx7gfAMTxzdG43VGg3bA==",
"requires": {}
},
"graphql-tools": {
"version": "4.0.8",
@ -24321,6 +24343,12 @@
"integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=",
"dev": true
},
"prettier": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.1.2.tgz",
"integrity": "sha512-16c7K+x4qVlJg9rEbXl7HEGmQyZlG4R9AgP+oHKRMsMsuk8s+ATStlf1NpDqyBI1HpVyfjLOeMhH2LvuNvV5Vg==",
"dev": true
},
"process": {
"version": "0.11.10",
"resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
@ -25769,7 +25797,8 @@
"stylis-rule-sheet": {
"version": "0.0.10",
"resolved": "https://registry.npmjs.org/stylis-rule-sheet/-/stylis-rule-sheet-0.0.10.tgz",
"integrity": "sha512-nTbZoaqoBnmK+ptANthb10ZRZOGC+EmTLLUxeYIuHNkEKcmKgXX1XWKkUBT2Ac4es3NybooPe0SmvKdhKJZAuw=="
"integrity": "sha512-nTbZoaqoBnmK+ptANthb10ZRZOGC+EmTLLUxeYIuHNkEKcmKgXX1XWKkUBT2Ac4es3NybooPe0SmvKdhKJZAuw==",
"requires": {}
},
"subscriptions-transport-ws": {
"version": "0.9.18",
@ -26534,7 +26563,8 @@
"use-callback-ref": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/use-callback-ref/-/use-callback-ref-1.2.4.tgz",
"integrity": "sha512-rXpsyvOnqdScyied4Uglsp14qzag1JIemLeTWGKbwpotWht57hbP78aNT+Q4wdFKQfQibbUX4fb6Qb4y11aVOQ=="
"integrity": "sha512-rXpsyvOnqdScyied4Uglsp14qzag1JIemLeTWGKbwpotWht57hbP78aNT+Q4wdFKQfQibbUX4fb6Qb4y11aVOQ==",
"requires": {}
},
"use-sidecar": {
"version": "1.0.3",

View File

@ -11,7 +11,8 @@
"studio": "npx prisma studio",
"generate:prisma": "npx prisma generate",
"seed": "ts-node prisma/seed.ts",
"gen": "graphql-codegen --config codegen.yml"
"gen": "graphql-codegen --config codegen.yml",
"prettier": "prettier --write ."
},
"dependencies": {
"@apollo/client": "^3.2.4",
@ -34,6 +35,7 @@
"@graphql-codegen/typescript-react-apollo": "2.0.7",
"@prisma/cli": "^2.8.0",
"@types/react": "^16.9.49",
"prettier": "^2.1.2",
"ts-node": "^9.0.0",
"typescript": "^4.0.3"
}

View File

@ -12,4 +12,4 @@ export default new ApolloServer({
schema,
context: createContext,
tracing: process.env.NODE_ENV === "development",
}).createHandler({ path: "/api/graphql" });
}).createHandler({ path: "/api/graphql" });

View File

@ -24,7 +24,7 @@ CREATE TABLE "public"."Profile" (
"bio" text ,
"weaponPool" text [] ,
"customUrlPath" text ,
"userId" integer NOT NULL
"userId" integer NOT NULL
)
CREATE UNIQUE INDEX "User.discordId_unique" ON "public"."User"("discordId")
@ -75,5 +75,3 @@ migration ..20201013141255-init
+ userId Int @unique
+}
```

View File

@ -252,4 +252,4 @@
}
}
]
}
}

View File

@ -1,6 +1,6 @@
import { PrismaClient } from "@prisma/client"
import { PrismaClient } from "@prisma/client";
const prisma = new PrismaClient()
const prisma = new PrismaClient();
const main = async () => {
await prisma.user.create({
@ -16,21 +16,26 @@ const main = async () => {
customUrlPath: "tester",
sensMotion: 45,
sensStick: -20,
weaponPool: ["Tenta Brella", "Range Blaster", "Luna Blaster", "N-ZAP '89"],
weaponPool: [
"Tenta Brella",
"Range Blaster",
"Luna Blaster",
"N-ZAP '89",
],
twitchName: "nintendo",
youtubeId: "UCAtobAxsQcACwDZCSH9uJfA"
}
}
}
})
youtubeId: "UCAtobAxsQcACwDZCSH9uJfA",
},
},
},
});
console.log("User created")
}
console.log("User created");
};
main()
.catch(e => console.error(e))
.catch((e) => console.error(e))
.finally(async () => {
await prisma.$disconnect()
})
await prisma.$disconnect();
});
export { }
export {};

View File

@ -1,7 +1,6 @@
### This file was generated by Nexus Schema
### Do not make changes to this file directly
type Profile {
bio: String
country: String

View File

@ -1,11 +1,7 @@
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": false,
"skipLibCheck": true,
"strict": true,
@ -24,12 +20,6 @@
"module": "commonjs"
}
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx"
],
"exclude": [
"node_modules"
]
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}