From b5dfae5bb3eb363b5c13946ed37d75677c2d8700 Mon Sep 17 00:00:00 2001 From: Marco Escaleira Date: Wed, 6 Mar 2024 23:06:52 +0000 Subject: [PATCH] fix: small fixes --- package.json | 4 +++- src/__generated__/graphql.ts | 10 +++++++--- src/components/Footer/Footer.tsx | 4 +++- src/components/Layout/Layout.tsx | 5 +++-- src/components/Quiz/QuizForm.tsx | 4 ++-- src/pages/Game/CountryQuizList.tsx | 2 +- src/pages/Game/index.tsx | 2 +- src/pages/Quiz/index.tsx | 2 +- src/pages/QuizResult/index.tsx | 4 ++-- 9 files changed, 23 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index e1b98f2..df30f16 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,9 @@ "scripts": { "dev": "vite", "build": "tsc && vite build", - "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0 --fix", + "lint": "yarn lint:eslint && yarn lint:ts", + "lint:eslint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0 --fix", + "lint:ts": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0 --fix", "preview": "vite preview", "compile:gql": "graphql-codegen" }, diff --git a/src/__generated__/graphql.ts b/src/__generated__/graphql.ts index 34cdd85..07e43a4 100644 --- a/src/__generated__/graphql.ts +++ b/src/__generated__/graphql.ts @@ -82,8 +82,9 @@ export type LoginResponse = { export type Mutation = { __typename?: 'Mutation'; addAttempt: AttemptData; + /** Approve a quiz */ approveQuiz: Scalars['Boolean']['output']; - /** Cancel a quiz. All attempts will be removed. */ + /** Cancel a quiz. All attempts will be removed alongside. */ cancelQuiz: Scalars['Boolean']['output']; createQuiz: QuizData; deleteAttempt: Scalars['Boolean']['output']; @@ -91,6 +92,7 @@ export type Mutation = { deleteUser: Scalars['Boolean']['output']; loginUser: LoginResponse; signupUser: UserData; + /** Update a quiz */ updateQuiz: QuizData; updateUser: UserData; }; @@ -171,9 +173,11 @@ export type Query = { attempts: Array; getCurrentlyLoggedInUser: UserData; logoutUser: Scalars['Boolean']['output']; - quizById: Array; + /** Get a quiz by its ID */ + quizById: QuizData; /** Get the list of all quizzes based on any filter. Admin only. */ quizList: Array; + /** Get the list of all quizzes based on the country */ quizzesByCountry: Array; refreshAccessToken: LoginResponse; }; @@ -417,7 +421,7 @@ export type QuizByIdQueryVariables = Exact<{ }>; -export type QuizByIdQuery = { __typename?: 'Query', quizById: Array<{ __typename?: 'QuizData', id: string, title: string, description: string, difficulty?: Difficulty | null, timeLimit?: number | null, image: string, tags?: Array | null, country: string, createdAt: any, updatedAt: any, questions: Array<{ __typename?: 'QuestionData', question: string, type: QuestionType, options: Array<{ __typename?: 'OptionData', correct: boolean, text: string, chosen?: boolean | null }> }>, creator: { __typename?: 'UserData', lastName?: string | null }, lastEditor?: { __typename?: 'UserData', lastName?: string | null } | null }> }; +export type QuizByIdQuery = { __typename?: 'Query', quizById: { __typename?: 'QuizData', id: string, title: string, description: string, difficulty?: Difficulty | null, timeLimit?: number | null, image: string, tags?: Array | null, country: string, createdAt: any, updatedAt: any, questions: Array<{ __typename?: 'QuestionData', question: string, type: QuestionType, options: Array<{ __typename?: 'OptionData', correct: boolean, text: string, chosen?: boolean | null }> }>, creator: { __typename?: 'UserData', lastName?: string | null }, lastEditor?: { __typename?: 'UserData', lastName?: string | null } | null } }; export type QuizzesQueryVariables = Exact<{ country?: InputMaybe; diff --git a/src/components/Footer/Footer.tsx b/src/components/Footer/Footer.tsx index 5a6baa5..ec8e4cc 100644 --- a/src/components/Footer/Footer.tsx +++ b/src/components/Footer/Footer.tsx @@ -5,7 +5,9 @@ export function Footer() { return (
Planet Earth - © {format(new Date(), "yyyy")} Meet The Countries + + © {format(new Date(), "yyyy")} Meet The Countries +
); } diff --git a/src/components/Layout/Layout.tsx b/src/components/Layout/Layout.tsx index ef0a488..27c123f 100644 --- a/src/components/Layout/Layout.tsx +++ b/src/components/Layout/Layout.tsx @@ -1,10 +1,11 @@ import { useEffect } from "react"; import Modal from "react-modal"; -import { Outlet } from "react-router-dom"; +import { Outlet, useLocation } from "react-router-dom"; import { Footer } from "@components/Footer/Footer.tsx"; import { Header } from "@components/Header/Header.tsx"; export function Layout() { + const location = useLocation(); useEffect(() => { Modal.setAppElement("#root"); }, []); @@ -15,7 +16,7 @@ export function Layout() {
-