Skip to content

Commit

Permalink
Merge pull request #52 from plezanje-net/fix-gs-usage
Browse files Browse the repository at this point in the history
Fix usages of gradingSystems object
  • Loading branch information
demshy authored Nov 2, 2024
2 parents 198acdf + 0695084 commit f52697d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/app/[lang]/crags/components/crags-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ const getSlugToNameMap = <T extends Area | Country>(entities: T[]) => {

const getMinMaxDifficulty = () => {
// For now we can only filter by french grades. Should add other grading systems in a future task?
const frenchGrades = gradingSystems.find((gs) => gs.id === "french")?.grades!;
const frenchGrades = gradingSystems["french"].grades;

return {
minDifficulty: frenchGrades[0].difficulty,
Expand All @@ -624,7 +624,7 @@ const getMinMaxDifficulty = () => {
};

const getDifficultyGradeMap = () => {
const frenchGrades = gradingSystems.find((gs) => gs.id === "french")?.grades!;
const frenchGrades = gradingSystems["french"].grades;

return frenchGrades.reduce((prev: Record<string, string>, cur) => {
prev[cur.difficulty] = cur.name;
Expand Down
2 changes: 1 addition & 1 deletion src/app/[lang]/crags/components/filters-pane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function FiltersPane({ open, filtersData, onResetAll }: TFiltersPane) {
<div className="mt-5 border-t border-neutral-200 px-8 pb-5 pt-4">
<Button variant="tertiary" onClick={onResetAll}>
<span className="flex gap-2">
<IconReset size={IconSize.regular} />
<IconReset />
Ponastavi vse
</span>
</Button>
Expand Down
5 changes: 2 additions & 3 deletions src/components/grade-selector.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Select, Option } from "./ui/select";
import { gradingSystems } from "@/utils/grading-systems";
import { TGradingSystemId, gradingSystems } from "@/utils/grading-systems";
import IconPlus from "./ui/icons/plus";
import Button from "./ui/button";
import IconMinus from "./ui/icons/minus";
Expand Down Expand Up @@ -93,8 +93,7 @@ export default GradeSelector;
// Helpers

const getGrades = (gradingSystemId: string, halfGrades: boolean = false) => {
const fullGrades =
gradingSystems.find((gs) => gs.id === gradingSystemId)?.grades || [];
const fullGrades = gradingSystems[gradingSystemId as TGradingSystemId].grades;

let grades = [];

Expand Down

0 comments on commit f52697d

Please sign in to comment.