Skip to content

Commit

Permalink
fix: small bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoEscaleira committed Apr 30, 2024
1 parent 21dedc8 commit 81b0bc0
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/components/AttemptRating/AttemptRating.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function AttemptRating({ attemptId, rating }: QuizRatingProps) {
readonly={Boolean(rating)}
onChange={value => {
if (!rating) {
submitRating({ variables: { attemptId, rating: value } });
submitRating({ variables: { attemptId, rating: value }, refetchQueries: [GET_QUIZ_RATING] });
}
}}
/>
Expand Down
1 change: 1 addition & 0 deletions src/global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

* {
box-sizing: border-box;
outline: none;
}

html {
Expand Down
5 changes: 4 additions & 1 deletion src/pages/Game/CountryQuizList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ export const CountryQuizList = ({ quizList, isLoadingCountryQuizList }: CountryQ
const goToQuizForm = () => navigate(`/game/quiz/add?country=${countryDetails.name}`);

const headerContent = (
<div className="mb-4 mt-20 flex w-full items-center justify-between gap-3 border-b-2 pb-4 sm:justify-center sm:gap-14 md:mt-10 md:px-0 md:pb-6">
<div
className="mb-4 mt-20 flex w-full items-center justify-between gap-3 border-b-2 pb-4 sm:justify-center sm:gap-14 md:mt-10 md:px-0 md:pb-6"
id="country-container"
>
<Typography variant="h2" className="flex items-center gap-2 text-2xl">
<img src={countryDetails.flags.svg} alt={countryDetails.name} className="h-5 w-5 rounded-full object-cover" />

Expand Down
6 changes: 6 additions & 0 deletions src/pages/Game/MapChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ export const MapChart: FC = () => {
setSearchParams({
country,
});

window &&
window.scrollTo({
top: 200,
behavior: "smooth",
});
}
};

Expand Down
15 changes: 13 additions & 2 deletions src/pages/Quizzes/ApproveQuiz.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import {
} from "@material-tailwind/react";
import { Check } from "lucide-react";
import { toast } from "react-toastify";
import { GET_COUNTRY_QUIZZES, GET_QUIZ_ATTEMPTS, GET_QUIZ_RATING } from "@utils/queries";
import { APPROVE_QUIZ } from "@utils/queries/ApproveQuiz.ts";
import { GET_QUIZ_COMMENTS } from "@utils/queries/QuizComments.ts";
import { GET_QUIZZES } from "@utils/queries/Quizzes.ts";

export function ApproveQuiz({ quizId }: { quizId: string }) {
Expand All @@ -24,7 +26,6 @@ export function ApproveQuiz({ quizId }: { quizId: string }) {
toggleDialog();
toast.success("Quiz approved successfully!");
},
refetchQueries: [GET_QUIZZES],
});

return (
Expand All @@ -47,7 +48,17 @@ export function ApproveQuiz({ quizId }: { quizId: string }) {
color="green"
loading={isLoadingQuizApproval}
disabled={isLoadingQuizApproval}
onClick={() => quizApprovalMutation()}
onClick={() =>
quizApprovalMutation({
refetchQueries: [
GET_QUIZZES,
GET_COUNTRY_QUIZZES,
GET_QUIZ_ATTEMPTS,
GET_QUIZ_RATING,
GET_QUIZ_COMMENTS,
],
})
}
>
Approve
</Button>
Expand Down
2 changes: 1 addition & 1 deletion src/utils/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const BREAKPOINTS = { mobile: 0, tablet: 768, desktop: 1280 };

export const DATE_TIME = "yyyy-MM-dd hh:mm";
export const DATE_TIME_READ = "dd MMM yyyy hh:mm";
export const DATE_TIME_READ = "dd MMM yyyy HH:mm";

0 comments on commit 81b0bc0

Please sign in to comment.