diff --git a/app/src/__generated__/gql.ts b/app/src/__generated__/gql.ts index 209f35fe..6322666e 100644 --- a/app/src/__generated__/gql.ts +++ b/app/src/__generated__/gql.ts @@ -24,7 +24,7 @@ const documents = { "\n query GetEvalCountByDateTemplate($dateTemplate: DateTemplate!) {\n getHomeEval {\n evalCountByDateTemplate(dateTemplate: $dateTemplate) {\n data\n start\n end\n }\n }\n }\n": types.GetEvalCountByDateTemplateDocument, "\n query GetAverageEvalCountByDateTemplate($dateTemplate: DateTemplate!) {\n getHomeEval {\n averageEvalCountByDateTemplate(dateTemplate: $dateTemplate) {\n data\n start\n end\n }\n }\n }\n": types.GetAverageEvalCountByDateTemplateDocument, "\n query GetCurrRegisteredCountRanking {\n getHomeTeam {\n currRegisteredCountRanking(limit: 5) {\n projectPreview {\n id\n name\n url\n }\n rank\n value\n }\n }\n }\n": types.GetCurrRegisteredCountRankingDocument, - "\n query GetLastExamResult {\n getHomeTeam {\n lastExamResult {\n data {\n rank\n passCount\n totalCount\n }\n start\n end\n }\n }\n }\n": types.GetLastExamResultDocument, + "\n query GetRecentExamResult($after: Int!) {\n getHomeTeam {\n recentExamResult(after: $after) {\n start\n end\n data {\n resultPerRank {\n rank\n rate {\n total\n fields {\n key\n value\n }\n }\n }\n beginAt\n endAt\n location\n maxPeople\n name\n nbrSubscribers\n }\n }\n }\n }\n": types.GetRecentExamResultDocument, "\n query GetAliveUserCountRecords {\n getHomeUser {\n aliveUserCountRecords {\n at\n value\n }\n }\n }\n": types.GetAliveUserCountRecordsDocument, "\n query getAverageDurationPerCircle {\n getHomeUser {\n averageDurationPerCircle {\n circle\n value\n }\n }\n }\n": types.GetAverageDurationPerCircleDocument, "\n query getBlackholedCountPerCircle {\n getHomeUser {\n blackholedCountPerCircle {\n circle\n value\n }\n }\n }\n": types.GetBlackholedCountPerCircleDocument, @@ -59,7 +59,7 @@ const documents = { "\n query getLogtimeByDateTemplate(\n $login: String!\n $currDateTemplate: DateTemplate!\n $lastDateTemplate: DateTemplate!\n ) {\n getPersonalGeneral(login: $login) {\n currData: logtimeByDateTemplate(dateTemplate: $currDateTemplate) {\n data\n start\n end\n }\n lastData: logtimeByDateTemplate(dateTemplate: $lastDateTemplate) {\n data\n start\n end\n }\n }\n }\n": types.GetLogtimeByDateTemplateDocument, "\n query GetPreferredClusterByDateTemplate(\n $login: String!\n $dateTemplate: DateTemplate!\n ) {\n getPersonalGeneral(login: $login) {\n preferredClusterByDateTemplate(dateTemplate: $dateTemplate) {\n data {\n name\n }\n start\n end\n }\n }\n }\n": types.GetPreferredClusterByDateTemplateDocument, "\n query getPrefferedTime($login: String!, $dateTemplate: DateTemplate!) {\n getPersonalGeneral(login: $login) {\n preferredTimeByDateTemplate(dateTemplate: $dateTemplate) {\n data {\n total\n morning\n daytime\n evening\n night\n }\n start\n end\n }\n }\n }\n": types.GetPrefferedTimeDocument, - "\n query getCoalition($login: String!) {\n getPersonalGeneral(login: $login) {\n userProfile {\n coalition {\n name\n }\n }\n }\n }\n": types.GetCoalitionDocument, + "\n query GetCharacter {\n getPersonalGeneral {\n character {\n effort {\n logtimeRank {\n rank\n value\n userPreview {\n id\n }\n }\n evalCountRank {\n rank\n value\n }\n examTryCount\n projectTryCount\n }\n talent {\n levelRank {\n rank\n value\n }\n examOneshotRate {\n total\n fields {\n key\n value\n }\n }\n projectOneshotRate {\n total\n fields {\n key\n value\n }\n }\n outstandingRate {\n total\n fields {\n key\n value\n }\n }\n }\n }\n }\n }\n": types.GetCharacterDocument, "\n query getTeamInfo($login: String!) {\n getPersonalGeneral(login: $login) {\n teamInfo {\n lastRegistered\n lastPassed\n teams {\n id\n name\n occurrence\n projectPreview {\n id\n name\n url\n }\n status\n lastEventTime\n isValidated\n finalMark\n }\n }\n }\n }\n": types.GetTeamInfoDocument, "\n query GetWallet($login: String!) {\n getPersonalGeneral(login: $login) {\n wallet\n }\n }\n": types.GetWalletDocument, "\n query GetUserProfile($login: String!) {\n getPersonalGeneral(login: $login) {\n userProfile {\n id\n login\n imgUrl\n grade\n displayname\n coalition {\n id\n name\n slug\n imageUrl\n coverUrl\n color\n score\n userId\n }\n titles {\n titleId\n name\n selected\n createdAt\n updatedAt\n }\n level\n }\n }\n }\n": types.GetUserProfileDocument, @@ -127,7 +127,7 @@ export function gql(source: "\n query GetCurrRegisteredCountRanking {\n getH /** * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function gql(source: "\n query GetLastExamResult {\n getHomeTeam {\n lastExamResult {\n data {\n rank\n passCount\n totalCount\n }\n start\n end\n }\n }\n }\n"): (typeof documents)["\n query GetLastExamResult {\n getHomeTeam {\n lastExamResult {\n data {\n rank\n passCount\n totalCount\n }\n start\n end\n }\n }\n }\n"]; +export function gql(source: "\n query GetRecentExamResult($after: Int!) {\n getHomeTeam {\n recentExamResult(after: $after) {\n start\n end\n data {\n resultPerRank {\n rank\n rate {\n total\n fields {\n key\n value\n }\n }\n }\n beginAt\n endAt\n location\n maxPeople\n name\n nbrSubscribers\n }\n }\n }\n }\n"): (typeof documents)["\n query GetRecentExamResult($after: Int!) {\n getHomeTeam {\n recentExamResult(after: $after) {\n start\n end\n data {\n resultPerRank {\n rank\n rate {\n total\n fields {\n key\n value\n }\n }\n }\n beginAt\n endAt\n location\n maxPeople\n name\n nbrSubscribers\n }\n }\n }\n }\n"]; /** * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ @@ -267,7 +267,7 @@ export function gql(source: "\n query getPrefferedTime($login: String!, $dateTe /** * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function gql(source: "\n query getCoalition($login: String!) {\n getPersonalGeneral(login: $login) {\n userProfile {\n coalition {\n name\n }\n }\n }\n }\n"): (typeof documents)["\n query getCoalition($login: String!) {\n getPersonalGeneral(login: $login) {\n userProfile {\n coalition {\n name\n }\n }\n }\n }\n"]; +export function gql(source: "\n query GetCharacter {\n getPersonalGeneral {\n character {\n effort {\n logtimeRank {\n rank\n value\n userPreview {\n id\n }\n }\n evalCountRank {\n rank\n value\n }\n examTryCount\n projectTryCount\n }\n talent {\n levelRank {\n rank\n value\n }\n examOneshotRate {\n total\n fields {\n key\n value\n }\n }\n projectOneshotRate {\n total\n fields {\n key\n value\n }\n }\n outstandingRate {\n total\n fields {\n key\n value\n }\n }\n }\n }\n }\n }\n"): (typeof documents)["\n query GetCharacter {\n getPersonalGeneral {\n character {\n effort {\n logtimeRank {\n rank\n value\n userPreview {\n id\n }\n }\n evalCountRank {\n rank\n value\n }\n examTryCount\n projectTryCount\n }\n talent {\n levelRank {\n rank\n value\n }\n examOneshotRate {\n total\n fields {\n key\n value\n }\n }\n projectOneshotRate {\n total\n fields {\n key\n value\n }\n }\n outstandingRate {\n total\n fields {\n key\n value\n }\n }\n }\n }\n }\n }\n"]; /** * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ diff --git a/app/src/__generated__/graphql.ts b/app/src/__generated__/graphql.ts index 87abc397..e5d795b9 100644 --- a/app/src/__generated__/graphql.ts +++ b/app/src/__generated__/graphql.ts @@ -18,6 +18,28 @@ export type Scalars = { URL: string; }; +export type Character = { + __typename?: 'Character'; + effort: CharacterEffort; + talent: CharacterTalent; +}; + +export type CharacterEffort = { + __typename?: 'CharacterEffort'; + evalCountRank: UserRank; + examTryCount: Scalars['Int']; + logtimeRank: UserRank; + projectTryCount: Scalars['Int']; +}; + +export type CharacterTalent = { + __typename?: 'CharacterTalent'; + examOneshotRate: Rate; + levelRank: UserRank; + outstandingRate: Rate; + projectOneshotRate: Rate; +}; + export type Coalition = { __typename?: 'Coalition'; color?: Maybe; @@ -89,14 +111,18 @@ export type EvalReview = { export type ExamResult = { __typename?: 'ExamResult'; - passCount: Scalars['Int']; - rank: Scalars['Int']; - totalCount: Scalars['Int']; + beginAt: Scalars['DateTime']; + endAt: Scalars['DateTime']; + location: Scalars['String']; + maxPeople: Scalars['Int']; + name: Scalars['String']; + nbrSubscribers: Scalars['Int']; + resultPerRank: Array; }; export type ExamResultDateRanged = { __typename?: 'ExamResultDateRanged'; - data: Array; + data: ExamResult; end: Scalars['DateTime']; start: Scalars['DateTime']; }; @@ -148,8 +174,7 @@ export type HomeEvalEvalCountByDateTemplateArgs = { export type HomeTeam = { __typename?: 'HomeTeam'; currRegisteredCountRanking: Array; - /** HOME 직전 회차 시험 Rank별 통과율 */ - lastExamResult: ExamResultDateRanged; + recentExamResult: ExamResultDateRanged; }; @@ -157,6 +182,11 @@ export type HomeTeamCurrRegisteredCountRankingArgs = { limit?: Scalars['Int']; }; + +export type HomeTeamRecentExamResultArgs = { + after?: Scalars['Int']; +}; + export type HomeUser = { __typename?: 'HomeUser'; aliveUserCountRecords: Array; @@ -341,6 +371,7 @@ export type PersonalGeneral = { __typename?: 'PersonalGeneral'; beginAt: Scalars['DateTime']; blackholedAt?: Maybe; + character?: Maybe; logtimeByDateTemplate: IntDateRanged; memberLevelRecords: Array; preferredClusterByDateTemplate: PreferredClusterDateRanged; @@ -406,7 +437,7 @@ export type ProjectInfo = { closedTeamCount: Scalars['Int']; currRegisteredTeamCount: Scalars['Int']; description: Scalars['String']; - difficulty: Scalars['Int']; + difficulty?: Maybe; estimateTime?: Maybe; id: Scalars['Int']; maxUserCount: Scalars['Int']; @@ -496,6 +527,12 @@ export type Rate = { total: Scalars['Int']; }; +export type ResultPerRank = { + __typename?: 'ResultPerRank'; + rank: Scalars['Int']; + rate: Rate; +}; + export type ScoreRecordPerCoalition = { __typename?: 'ScoreRecordPerCoalition'; coalition: Coalition; @@ -664,10 +701,12 @@ export type GetCurrRegisteredCountRankingQueryVariables = Exact<{ [key: string]: export type GetCurrRegisteredCountRankingQuery = { __typename?: 'Query', getHomeTeam: { __typename?: 'HomeTeam', currRegisteredCountRanking: Array<{ __typename?: 'ProjectRank', rank: number, value: number, projectPreview: { __typename?: 'ProjectPreview', id: number, name: string, url: string } }> } }; -export type GetLastExamResultQueryVariables = Exact<{ [key: string]: never; }>; +export type GetRecentExamResultQueryVariables = Exact<{ + after: Scalars['Int']; +}>; -export type GetLastExamResultQuery = { __typename?: 'Query', getHomeTeam: { __typename?: 'HomeTeam', lastExamResult: { __typename?: 'ExamResultDateRanged', start: string, end: string, data: Array<{ __typename?: 'ExamResult', rank: number, passCount: number, totalCount: number }> } } }; +export type GetRecentExamResultQuery = { __typename?: 'Query', getHomeTeam: { __typename?: 'HomeTeam', recentExamResult: { __typename?: 'ExamResultDateRanged', start: string, end: string, data: { __typename?: 'ExamResult', beginAt: string, endAt: string, location: string, maxPeople: number, name: string, nbrSubscribers: number, resultPerRank: Array<{ __typename?: 'ResultPerRank', rank: number, rate: { __typename?: 'Rate', total: number, fields: Array<{ __typename?: 'Pair', key: string, value: number }> } }> } } } }; export type GetAliveUserCountRecordsQueryVariables = Exact<{ [key: string]: never; }>; @@ -905,12 +944,10 @@ export type GetPrefferedTimeQueryVariables = Exact<{ export type GetPrefferedTimeQuery = { __typename?: 'Query', getPersonalGeneral: { __typename?: 'PersonalGeneral', preferredTimeByDateTemplate: { __typename?: 'PreferredTimeDateRanged', start: string, end: string, data: { __typename?: 'PreferredTime', total: number, morning: number, daytime: number, evening: number, night: number } } } }; -export type GetCoalitionQueryVariables = Exact<{ - login: Scalars['String']; -}>; +export type GetCharacterQueryVariables = Exact<{ [key: string]: never; }>; -export type GetCoalitionQuery = { __typename?: 'Query', getPersonalGeneral: { __typename?: 'PersonalGeneral', userProfile: { __typename?: 'UserProfile', coalition: { __typename?: 'Coalition', name: string } } } }; +export type GetCharacterQuery = { __typename?: 'Query', getPersonalGeneral: { __typename?: 'PersonalGeneral', character?: { __typename?: 'Character', effort: { __typename?: 'CharacterEffort', examTryCount: number, projectTryCount: number, logtimeRank: { __typename?: 'UserRank', rank: number, value: number, userPreview: { __typename?: 'UserPreview', id: number } }, evalCountRank: { __typename?: 'UserRank', rank: number, value: number } }, talent: { __typename?: 'CharacterTalent', levelRank: { __typename?: 'UserRank', rank: number, value: number }, examOneshotRate: { __typename?: 'Rate', total: number, fields: Array<{ __typename?: 'Pair', key: string, value: number }> }, projectOneshotRate: { __typename?: 'Rate', total: number, fields: Array<{ __typename?: 'Pair', key: string, value: number }> }, outstandingRate: { __typename?: 'Rate', total: number, fields: Array<{ __typename?: 'Pair', key: string, value: number }> } } } | null } }; export type GetTeamInfoQueryVariables = Exact<{ login: Scalars['String']; @@ -938,7 +975,7 @@ export type GetProjectInfoQueryVariables = Exact<{ }>; -export type GetProjectInfoQuery = { __typename?: 'Query', getProjectInfo: { __typename?: 'ProjectInfo', id: number, name: string, objectives: Array, skills: Array, description: string, minUserCount: number, maxUserCount: number, estimateTime?: string | null, difficulty: number, currRegisteredTeamCount: number, closedTeamCount: number, averagePassFinalMark: number, validatedRate: { __typename?: 'Rate', total: number, fields: Array<{ __typename?: 'Pair', key: string, value: number }> } } }; +export type GetProjectInfoQuery = { __typename?: 'Query', getProjectInfo: { __typename?: 'ProjectInfo', id: number, name: string, objectives: Array, skills: Array, description: string, minUserCount: number, maxUserCount: number, estimateTime?: string | null, difficulty?: number | null, currRegisteredTeamCount: number, closedTeamCount: number, averagePassFinalMark: number, validatedRate: { __typename?: 'Rate', total: number, fields: Array<{ __typename?: 'Pair', key: string, value: number }> } } }; export const FindUserPreviewDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"FindUserPreview"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"login"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"findUserPreview"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"login"},"value":{"kind":"Variable","name":{"kind":"Name","value":"login"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"login"}},{"kind":"Field","name":{"kind":"Name","value":"imgUrl"}}]}}]}}]} as unknown as DocumentNode; @@ -952,7 +989,7 @@ export const GetAverageFeedbackLengthDocument = {"kind":"Document","definitions" export const GetEvalCountByDateTemplateDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetEvalCountByDateTemplate"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"dateTemplate"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTemplate"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"getHomeEval"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"evalCountByDateTemplate"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"dateTemplate"},"value":{"kind":"Variable","name":{"kind":"Name","value":"dateTemplate"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"}},{"kind":"Field","name":{"kind":"Name","value":"start"}},{"kind":"Field","name":{"kind":"Name","value":"end"}}]}}]}}]}}]} as unknown as DocumentNode; export const GetAverageEvalCountByDateTemplateDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetAverageEvalCountByDateTemplate"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"dateTemplate"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTemplate"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"getHomeEval"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"averageEvalCountByDateTemplate"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"dateTemplate"},"value":{"kind":"Variable","name":{"kind":"Name","value":"dateTemplate"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"}},{"kind":"Field","name":{"kind":"Name","value":"start"}},{"kind":"Field","name":{"kind":"Name","value":"end"}}]}}]}}]}}]} as unknown as DocumentNode; export const GetCurrRegisteredCountRankingDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCurrRegisteredCountRanking"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"getHomeTeam"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"currRegisteredCountRanking"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"IntValue","value":"5"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"projectPreview"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"url"}}]}},{"kind":"Field","name":{"kind":"Name","value":"rank"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}}]}}]}}]} as unknown as DocumentNode; -export const GetLastExamResultDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetLastExamResult"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"getHomeTeam"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"lastExamResult"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"rank"}},{"kind":"Field","name":{"kind":"Name","value":"passCount"}},{"kind":"Field","name":{"kind":"Name","value":"totalCount"}}]}},{"kind":"Field","name":{"kind":"Name","value":"start"}},{"kind":"Field","name":{"kind":"Name","value":"end"}}]}}]}}]}}]} as unknown as DocumentNode; +export const GetRecentExamResultDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetRecentExamResult"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"after"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"getHomeTeam"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"recentExamResult"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"after"},"value":{"kind":"Variable","name":{"kind":"Name","value":"after"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"start"}},{"kind":"Field","name":{"kind":"Name","value":"end"}},{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"resultPerRank"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"rank"}},{"kind":"Field","name":{"kind":"Name","value":"rate"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"fields"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"beginAt"}},{"kind":"Field","name":{"kind":"Name","value":"endAt"}},{"kind":"Field","name":{"kind":"Name","value":"location"}},{"kind":"Field","name":{"kind":"Name","value":"maxPeople"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"nbrSubscribers"}}]}}]}}]}}]}}]} as unknown as DocumentNode; export const GetAliveUserCountRecordsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetAliveUserCountRecords"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"getHomeUser"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"aliveUserCountRecords"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"at"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}}]}}]}}]} as unknown as DocumentNode; export const GetAverageDurationPerCircleDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"getAverageDurationPerCircle"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"getHomeUser"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"averageDurationPerCircle"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"circle"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}}]}}]}}]} as unknown as DocumentNode; export const GetBlackholedCountPerCircleDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"getBlackholedCountPerCircle"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"getHomeUser"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"blackholedCountPerCircle"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"circle"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}}]}}]}}]} as unknown as DocumentNode; @@ -987,7 +1024,7 @@ export const GetUserLevelRecordsDocument = {"kind":"Document","definitions":[{"k export const GetLogtimeByDateTemplateDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"getLogtimeByDateTemplate"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"login"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"currDateTemplate"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTemplate"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"lastDateTemplate"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTemplate"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"getPersonalGeneral"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"login"},"value":{"kind":"Variable","name":{"kind":"Name","value":"login"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"currData"},"name":{"kind":"Name","value":"logtimeByDateTemplate"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"dateTemplate"},"value":{"kind":"Variable","name":{"kind":"Name","value":"currDateTemplate"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"}},{"kind":"Field","name":{"kind":"Name","value":"start"}},{"kind":"Field","name":{"kind":"Name","value":"end"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"lastData"},"name":{"kind":"Name","value":"logtimeByDateTemplate"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"dateTemplate"},"value":{"kind":"Variable","name":{"kind":"Name","value":"lastDateTemplate"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"}},{"kind":"Field","name":{"kind":"Name","value":"start"}},{"kind":"Field","name":{"kind":"Name","value":"end"}}]}}]}}]}}]} as unknown as DocumentNode; export const GetPreferredClusterByDateTemplateDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetPreferredClusterByDateTemplate"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"login"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"dateTemplate"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTemplate"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"getPersonalGeneral"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"login"},"value":{"kind":"Variable","name":{"kind":"Name","value":"login"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"preferredClusterByDateTemplate"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"dateTemplate"},"value":{"kind":"Variable","name":{"kind":"Name","value":"dateTemplate"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"start"}},{"kind":"Field","name":{"kind":"Name","value":"end"}}]}}]}}]}}]} as unknown as DocumentNode; export const GetPrefferedTimeDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"getPrefferedTime"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"login"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"dateTemplate"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"DateTemplate"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"getPersonalGeneral"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"login"},"value":{"kind":"Variable","name":{"kind":"Name","value":"login"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"preferredTimeByDateTemplate"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"dateTemplate"},"value":{"kind":"Variable","name":{"kind":"Name","value":"dateTemplate"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"morning"}},{"kind":"Field","name":{"kind":"Name","value":"daytime"}},{"kind":"Field","name":{"kind":"Name","value":"evening"}},{"kind":"Field","name":{"kind":"Name","value":"night"}}]}},{"kind":"Field","name":{"kind":"Name","value":"start"}},{"kind":"Field","name":{"kind":"Name","value":"end"}}]}}]}}]}}]} as unknown as DocumentNode; -export const GetCoalitionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"getCoalition"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"login"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"getPersonalGeneral"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"login"},"value":{"kind":"Variable","name":{"kind":"Name","value":"login"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"userProfile"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"coalition"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]}}]} as unknown as DocumentNode; +export const GetCharacterDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCharacter"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"getPersonalGeneral"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"character"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"effort"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"logtimeRank"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"rank"}},{"kind":"Field","name":{"kind":"Name","value":"value"}},{"kind":"Field","name":{"kind":"Name","value":"userPreview"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"evalCountRank"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"rank"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","name":{"kind":"Name","value":"examTryCount"}},{"kind":"Field","name":{"kind":"Name","value":"projectTryCount"}}]}},{"kind":"Field","name":{"kind":"Name","value":"talent"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"levelRank"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"rank"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","name":{"kind":"Name","value":"examOneshotRate"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"fields"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"projectOneshotRate"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"fields"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"outstandingRate"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"fields"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode; export const GetTeamInfoDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"getTeamInfo"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"login"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"getPersonalGeneral"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"login"},"value":{"kind":"Variable","name":{"kind":"Name","value":"login"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"teamInfo"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"lastRegistered"}},{"kind":"Field","name":{"kind":"Name","value":"lastPassed"}},{"kind":"Field","name":{"kind":"Name","value":"teams"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"occurrence"}},{"kind":"Field","name":{"kind":"Name","value":"projectPreview"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"url"}}]}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"lastEventTime"}},{"kind":"Field","name":{"kind":"Name","value":"isValidated"}},{"kind":"Field","name":{"kind":"Name","value":"finalMark"}}]}}]}}]}}]}}]} as unknown as DocumentNode; export const GetWalletDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetWallet"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"login"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"getPersonalGeneral"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"login"},"value":{"kind":"Variable","name":{"kind":"Name","value":"login"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"wallet"}}]}}]}}]} as unknown as DocumentNode; export const GetUserProfileDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetUserProfile"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"login"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"getPersonalGeneral"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"login"},"value":{"kind":"Variable","name":{"kind":"Name","value":"login"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"userProfile"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"login"}},{"kind":"Field","name":{"kind":"Name","value":"imgUrl"}},{"kind":"Field","name":{"kind":"Name","value":"grade"}},{"kind":"Field","name":{"kind":"Name","value":"displayname"}},{"kind":"Field","name":{"kind":"Name","value":"coalition"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"imageUrl"}},{"kind":"Field","name":{"kind":"Name","value":"coverUrl"}},{"kind":"Field","name":{"kind":"Name","value":"color"}},{"kind":"Field","name":{"kind":"Name","value":"score"}},{"kind":"Field","name":{"kind":"Name","value":"userId"}}]}},{"kind":"Field","name":{"kind":"Name","value":"titles"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"titleId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"selected"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"level"}}]}}]}}]}}]} as unknown as DocumentNode; diff --git a/app/src/pages/HomePage/contents/Team/LastExamResult.tsx b/app/src/pages/HomePage/contents/Team/LastExamResult.tsx deleted file mode 100644 index de459dc4..00000000 --- a/app/src/pages/HomePage/contents/Team/LastExamResult.tsx +++ /dev/null @@ -1,105 +0,0 @@ -import { gql } from '@/__generated__'; -import { useQuery } from '@apollo/client'; -import { Loader } from '@components/common'; -import { BarChart } from '@components/elements/Chart'; -import { - ApolloBadRequest, - ApolloNotFound, -} from '@components/elements/DashboardContentView/Error'; -import { DashboardContent } from '@components/templates/DashboardContent'; -import dayjs from 'dayjs'; - -const GET_LAST_EXAM_RESULT = gql(/* GraphQL */ ` - query GetLastExamResult { - getHomeTeam { - lastExamResult { - data { - rank - passCount - totalCount - } - start - end - } - } - } -`); - -export const LastExamResult = () => { - const title = '직전 회차 시험 Rank 별 통과율'; - const { loading, error, data } = useQuery(GET_LAST_EXAM_RESULT); - if (loading) - return ( - - - - ); - if (error) - return ( - - - - ); - if (!data) - return ( - - - - ); - - const { lastExamResult } = data.getHomeTeam; - const { start, end } = lastExamResult; - - const description = `${dayjs(start).format('YYYY년 M월 D일 H시 m분')}`; - - const categories = lastExamResult.data.map(({ rank }) => rank); - const seriesData = lastExamResult.data.map( - ({ passCount, totalCount }) => passCount / totalCount, - ); - const series: ApexAxisChartSeries = [ - { - name: 'Exam 통과율', - data: seriesData, - }, - ]; - - return ( - - - - ); -}; - -type LastExamResultChartProps = { - categories: number[]; - series: ApexAxisChartSeries; -}; - -const LastExamResultChart = ({ - categories, - series, -}: LastExamResultChartProps) => { - const options: ApexCharts.ApexOptions = { - xaxis: { - categories, - labels: { - formatter: (value) => `Rank ${String(value).padStart(2, '0')}`, - }, - }, - yaxis: { - labels: { - formatter: (value) => `${(value * 100).toFixed(0)}%`, - }, - }, - tooltip: { - y: { - formatter: (value) => `${(value * 100).toFixed(1)}%`, - }, - }, - dataLabels: { - enabled: false, - }, - }; - - return ; -}; diff --git a/app/src/pages/HomePage/contents/Team/RecentExamResult.tsx b/app/src/pages/HomePage/contents/Team/RecentExamResult.tsx new file mode 100644 index 00000000..e1ee3ece --- /dev/null +++ b/app/src/pages/HomePage/contents/Team/RecentExamResult.tsx @@ -0,0 +1,145 @@ +import { gql } from '@/__generated__'; +import { useQuery } from '@apollo/client'; +import { Loader } from '@components/common'; +import { BarChart } from '@components/elements/Chart'; +import { + ApolloBadRequest, + ApolloNotFound, +} from '@components/elements/DashboardContentView/Error'; +import { DashboardContent } from '@components/templates/DashboardContent'; +import dayjs from 'dayjs'; + +const GET_RECENT_EXAM_RESULT = gql(/* GraphQL */ ` + query GetRecentExamResult($after: Int!) { + getHomeTeam { + recentExamResult(after: $after) { + start + end + data { + resultPerRank { + rank + rate { + total + fields { + key + value + } + } + } + beginAt + endAt + location + maxPeople + name + nbrSubscribers + } + } + } + } +`); + +export const RecentExamResult = () => { + const title = '직전 회차 시험 Rank 별 통과율'; + const { loading, error, data } = useQuery(GET_RECENT_EXAM_RESULT, { + variables: { + after: 1, + }, + }); + if (loading) + return ( + + + + ); + if (error) + return ( + + + + ); + if (!data) + return ( + + + + ); + + const { recentExamResult } = data.getHomeTeam; + const { beginAt, location, resultPerRank } = recentExamResult.data; + + const description = `${dayjs(beginAt).format( + 'YYYY년 M월 D일 H시 m분', + )} / ${location}`; + + const categories = resultPerRank.map(({ rank }) => rank); + const totalSeriesData = resultPerRank.map(({ rate: { total } }) => total); + const passSeriesData = resultPerRank.map(({ rate: { fields } }) => { + const pass = fields.find(({ key }) => key === 'pass'); + return pass ? pass.value : 0; + }); + const seriesLabel = totalSeriesData.map((total, index) => { + const pass = passSeriesData[index]; + return { pass, total }; + }); + const seriesData = totalSeriesData.map((total, index) => { + const pass = passSeriesData[index]; + return total === 0 ? 0 : pass / total; + }); + + const series: ApexAxisChartSeries = [ + { + name: '통과율', + data: seriesData, + }, + ]; + + return ( + + + + ); +}; + +type LastExamResultChartProps = { + categories: number[]; + series: ApexAxisChartSeries; + seriesLabel: { pass: number; total: number }[]; +}; + +const LastExamResultChart = ({ + categories, + series, + seriesLabel, +}: LastExamResultChartProps) => { + const options: ApexCharts.ApexOptions = { + xaxis: { + categories, + labels: { + formatter: (value) => `Rank ${String(value).padStart(2, '0')}`, + }, + }, + yaxis: { + max: 1, + labels: { + formatter: (value) => `${(value * 100).toFixed(0)}%`, + }, + }, + tooltip: { + y: { + formatter: (value, { dataPointIndex }) => + `${(value * 100).toFixed(1)}% (${seriesLabel[dataPointIndex].pass}/${ + seriesLabel[dataPointIndex].total + })`, + }, + }, + dataLabels: { + enabled: false, + }, + }; + + return ; +}; diff --git a/app/src/pages/HomePage/contents/Team/index.ts b/app/src/pages/HomePage/contents/Team/index.ts index 98bc1a5e..79581ba7 100644 --- a/app/src/pages/HomePage/contents/Team/index.ts +++ b/app/src/pages/HomePage/contents/Team/index.ts @@ -1,2 +1,2 @@ export * from './CurrRegisteredCountRanking'; -export * from './LastExamResult'; +export * from './RecentExamResult'; diff --git a/app/src/pages/HomePage/hooks/homePageDashboardContents.ts b/app/src/pages/HomePage/hooks/homePageDashboardContents.ts index 75b3182d..ee4843dd 100644 --- a/app/src/pages/HomePage/hooks/homePageDashboardContents.ts +++ b/app/src/pages/HomePage/hooks/homePageDashboardContents.ts @@ -10,7 +10,7 @@ import { TotalEvalCount, WeeklyAverageEvalCount, } from '../contents/Eval'; -import { CurrRegisteredCountRanking, LastExamResult } from '../contents/Team'; +import { CurrRegisteredCountRanking, RecentExamResult } from '../contents/Team'; import { AliveUserCountRecords, AverageDurationPerCircle, @@ -92,7 +92,7 @@ export const homePageDashboardContents: DashboardItemProps[] = [ }, { id: 16, - content: LastExamResult, + content: RecentExamResult, }, { id: 17, diff --git a/app/src/pages/ProfileGeneralTab/contents/Character/POKEMON.ts b/app/src/pages/ProfileGeneralTab/contents/Character/POKEMON.ts new file mode 100644 index 00000000..ba4119e6 --- /dev/null +++ b/app/src/pages/ProfileGeneralTab/contents/Character/POKEMON.ts @@ -0,0 +1,41 @@ +export const POKEMON = [ + ['starting', 'Togepi', 'abra', 'Espeon', 'Lugia', 'Mew', 'Mewtwo'], + ['Geodude', 'Eevee', 'Marill', 'Raichu', 'Jolteon', 'Ampharos', 'Zapdos'], + ['Onix', 'Dratini', 'Lapras', 'Haunter', 'Gengar', 'Mimikyu', 'Darkrai'], + [ + 'Steelix', + 'Lucario', + 'Happiny', + 'Lapras', + 'Dragonair', + 'Gyarados', + 'Kyogre', + ], + [ + 'Golem', + 'Snorlax', + 'Arcanine', + 'Leafeon', + 'Togekiss', + 'Greninja', + 'Articuno', + ], + [ + 'Tyranitar', + 'Lucario', + 'Charizard', + 'Sylveon', + 'Dragonite', + 'Salamence', + 'Solgaleo', + ], + [ + 'Regigigas', + 'Zacian', + 'Moltres', + 'Shaymin', + 'Jirachi', + 'Rayquaza', + 'Arceus', + ], +]; diff --git a/app/src/pages/ProfileGeneralTab/contents/Character/index.tsx b/app/src/pages/ProfileGeneralTab/contents/Character/index.tsx new file mode 100644 index 00000000..29369c28 --- /dev/null +++ b/app/src/pages/ProfileGeneralTab/contents/Character/index.tsx @@ -0,0 +1,174 @@ +import { gql } from '@/__generated__'; +import marvin from '@/assets/marvin-depressed.gif'; +import { H3Text, Image, Loader, VStack } from '@/components/common'; +import { DashboardContent } from '@/components/templates/DashboardContent'; +import { useQuery } from '@apollo/client'; +import { + ApolloBadRequest, + ApolloNotFound, +} from '@components/elements/DashboardContentView/Error'; +import { useState } from 'react'; +import { useParams } from 'react-router-dom'; + +const GET_CHARACTER = gql(/* GraphQL */ ` + query GetCharacter { + getPersonalGeneral { + character { + effort { + logtimeRank { + rank + value + userPreview { + id + } + } + evalCountRank { + rank + value + } + examTryCount + projectTryCount + } + talent { + levelRank { + rank + value + } + examOneshotRate { + total + fields { + key + value + } + } + projectOneshotRate { + total + fields { + key + value + } + } + outstandingRate { + total + fields { + key + value + } + } + } + } + } + } +`); + +export const Character = () => { + const { username } = useParams() as { username: string }; + + const title = '이 유저를 캐릭터로 표현한다면?'; + const description = '과제 점수, 레벨 증가, 접속 시간, 평가 횟수 기준'; + const [character, setCharacter] = useState('마빈'); + + const { loading, error, data } = useQuery(GET_CHARACTER); + + // const [pokeImg, setPokeImg] = useState( + // 'https://data1.pokemonkorea.co.kr/newdata/pokedex/full/006601.png', + // ); + // const [pokeName, setPokeName] = useState('unown'); + + // /** + // *재능값을 구하는 구하는 로직 + // * @returns 0~6 사이의 재능 값 + // */ + // const getX = () => { + // return 1; + // }; + + // /** + // *노력값을 구하는 로직 + // * @returns 0~6 사이의 노력 값 + // */ + // const getY = () => { + // return 2; + // }; + + // useEffect(() => { + // // 인덱싱을 위해 반올림 처리 + // const y = Math.round(getY()); + // const x = Math.round(getX()); + // let queryName = pokemonArray[y][x].toLowerCase(); + + // // 스타팅 일 경우 건곤감리에 따라 다른 포켓몬 설정 + // if (data) { + // const { name: coalition } = data.getPersonalGeneral.userProfile.coalition; + // if (queryName === 'starting') { + // switch (coalition) { + // case 'Gun': + // queryName = 'Pikachu'; + // break; + // case 'Gon': + // queryName = 'Bulbasaur'; + // break; + // case 'Gam': + // queryName = 'Squirtle'; + // break; + // case 'Lee': + // queryName = 'Charmander'; + // break; + // default: + // queryName = 'unown'; + // } + // } + // } + + // const fetchURL = 'https://pokeapi.co/api/v2/pokemon/' + queryName; + + // fetch(fetchURL) + // .then((response) => response.json()) + // .then((data) => { + // const tmp = data.sprites.other['official-artwork']; + // const name = data.name; + // const { front_default, front_shiny } = tmp; + // /** + // * username 첫글자가 포켓몬 이름에 포함되어있으면 이로치 + // */ + // if (pokeName.includes(username[0])) { + // setPokeImg(front_shiny); + // setPokeName('✨' + name + '✨'); + // } else { + // setPokeImg(front_default); + // setPokeName(name); + // } + // }) + // .catch((error) => { + // console.log('데이터를 가져오는 중에 오류가 발생했습니다:', error); + // }); + // }, [pokeName, username, data]); + + if (loading) + return ( + + + + ); + if (error) + return ( + + + + ); + if (!data) + return ( + + + + ); + + return ( + + + + {character} + + + ); +}; diff --git a/app/src/pages/ProfileGeneralTab/contents/SimilarCharacter.tsx b/app/src/pages/ProfileGeneralTab/contents/SimilarCharacter.tsx deleted file mode 100644 index 10bdb5cf..00000000 --- a/app/src/pages/ProfileGeneralTab/contents/SimilarCharacter.tsx +++ /dev/null @@ -1,188 +0,0 @@ -import { gql } from '@/__generated__'; -import { H3Text, Image, Loader, VStack } from '@/components/common'; -import { DashboardContent } from '@/components/templates/DashboardContent'; -import { useQuery } from '@apollo/client'; -import { - ApolloBadRequest, - ApolloNotFound, -} from '@components/elements/DashboardContentView/Error'; -import { useEffect, useState } from 'react'; -import { useParams } from 'react-router-dom'; - -/** - * 포켓몬 배열 - * @description - * 현재 7x7 - * Y x X 형태의 배열 - * 인덱스 값에 변경이 생길경우 getX getY값의 출력범위를 조정해야함 - */ -const pokemonArray = [ - ['starting', 'Togepi', 'abra', 'Espeon', 'Lugia', 'Mew', 'Mewtwo'], - ['Geodude', 'Eevee', 'Marill', 'Raichu', 'Jolteon', 'Ampharos', 'Zapdos'], - ['Onix', 'Dratini', 'Lapras', 'Haunter', 'Gengar', 'Mimikyu', 'Darkrai'], - [ - 'Steelix', - 'Lucario', - 'Happiny', - 'Lapras', - 'Dragonair', - 'Gyarados', - 'Kyogre', - ], - [ - 'Golem', - 'Snorlax', - 'Arcanine', - 'Leafeon', - 'Togekiss', - 'Greninja', - 'Articuno', - ], - [ - 'Tyranitar', - 'Lucario', - 'Charizard', - 'Sylveon', - 'Dragonite', - 'Salamence', - 'Solgaleo', - ], - [ - 'Regigigas', - 'Zacian', - 'Moltres', - 'Shaymin', - 'Jirachi', - 'Rayquaza', - 'Arceus', - ], -]; - -const GET_COALITION = gql(/* GraphQL */ ` - query getCoalition($login: String!) { - getPersonalGeneral(login: $login) { - userProfile { - coalition { - name - } - } - } - } -`); - -export const SimilarCharacter = () => { - const { username } = useParams() as { username: string }; - - const title = '이 유저를 캐릭터로 표현한다면?'; - const description = '과제 점수, 레벨 증가, 접속 시간, 평가 횟수 기준'; - - const [pokeImg, setPokeImg] = useState( - 'https://data1.pokemonkorea.co.kr/newdata/pokedex/full/006601.png', - ); - const [pokeName, setPokeName] = useState('unown'); - - const { loading, error, data } = useQuery(GET_COALITION, { - variables: { login: username }, - }); - - /** - *재능값을 구하는 구하는 로직 - * @returns 0~6 사이의 재능 값 - */ - const getX = () => { - return 1; - }; - - /** - *노력값을 구하는 로직 - * @returns 0~6 사이의 노력 값 - */ - const getY = () => { - return 2; - }; - - useEffect(() => { - // 인덱싱을 위해 반올림 처리 - const y = Math.round(getY()); - const x = Math.round(getX()); - let queryName = pokemonArray[y][x].toLowerCase(); - - // 스타팅 일 경우 건곤감리에 따라 다른 포켓몬 설정 - if (data) { - const { name: coalition } = data.getPersonalGeneral.userProfile.coalition; - if (queryName === 'starting') { - switch (coalition) { - case 'Gun': - queryName = 'Pikachu'; - break; - case 'Gon': - queryName = 'Bulbasaur'; - break; - case 'Gam': - queryName = 'Squirtle'; - break; - case 'Lee': - queryName = 'Charmander'; - break; - default: - queryName = 'unown'; - } - } - } - - const fetchURL = 'https://pokeapi.co/api/v2/pokemon/' + queryName; - - fetch(fetchURL) - .then((response) => response.json()) - .then((data) => { - const tmp = data.sprites.other['official-artwork']; - const name = data.name; - const { front_default, front_shiny } = tmp; - /** - * username 첫글자가 포켓몬 이름에 포함되어있으면 이로치 - */ - if (pokeName.includes(username[0])) { - setPokeImg(front_shiny); - setPokeName('✨' + name + '✨'); - } else { - setPokeImg(front_default); - setPokeName(name); - } - }) - .catch((error) => { - console.log('데이터를 가져오는 중에 오류가 발생했습니다:', error); - }); - }, [pokeName, username, data]); - - if (loading) - return ( - - - - ); - if (error) - return ( - - - - ); - if (!data) - return ( - - - - ); - - return ( - - - 이 유저와 성향이 비슷한 포켓몬 - {pokeName} - - - ); -}; diff --git a/app/src/pages/ProfileGeneralTab/contents/index.ts b/app/src/pages/ProfileGeneralTab/contents/index.ts index 96ac65a9..9784eae7 100644 --- a/app/src/pages/ProfileGeneralTab/contents/index.ts +++ b/app/src/pages/ProfileGeneralTab/contents/index.ts @@ -8,5 +8,5 @@ export * from './LevelRecords'; export * from './LogTime'; export * from './PreferredCluster'; export * from './PreferredTime'; -export * from './SimilarCharacter'; +export * from './Character'; export * from './TeamInfo'; diff --git a/app/src/pages/ProfileGeneralTab/hooks/profileGeneralTabDashboardContents.ts b/app/src/pages/ProfileGeneralTab/hooks/profileGeneralTabDashboardContents.ts index 801eff0f..22f2221a 100644 --- a/app/src/pages/ProfileGeneralTab/hooks/profileGeneralTabDashboardContents.ts +++ b/app/src/pages/ProfileGeneralTab/hooks/profileGeneralTabDashboardContents.ts @@ -2,16 +2,16 @@ import type { DashboardItemProps } from '@utils/types/Dashboard'; import { BeginAt, BlackholedAt, + Character, CoalitionScore, - Wallet, LastPass, LastRegistered, LevelRecords, LogTime, PreferredCluster, PreferredTime, - SimilarCharacter, TeamInfo, + Wallet, } from '../contents'; export const profileGeneralTabDashboardContents: DashboardItemProps[] = [ @@ -53,7 +53,7 @@ export const profileGeneralTabDashboardContents: DashboardItemProps[] = [ }, { id: 9, - content: SimilarCharacter, + content: Character, }, { id: 10, diff --git a/app/src/pages/ProjectDetailPage/index.tsx b/app/src/pages/ProjectDetailPage/index.tsx index 2595ac0e..e5f93a1e 100644 --- a/app/src/pages/ProjectDetailPage/index.tsx +++ b/app/src/pages/ProjectDetailPage/index.tsx @@ -86,9 +86,9 @@ const ProjectPage = () => { const getPeopleRange = (from: number, to: number) => { if (from === to) { if (from === 1) return 'Solo'; - return `${from} Students`; + return `${from} students`; } - return `${from} ~ ${to} Students`; + return `${from} ~ ${to} students`; }; return ( @@ -104,7 +104,9 @@ const ProjectPage = () => { {`${getPeopleRange( minUserCount, maxUserCount, - )} / ${estimateTime} hrs. / ${difficulty} XP`} + )} / ${estimateTime} / ${ + difficulty?.toLocaleString() ?? '0' + } XP`}