Skip to content

Commit

Permalink
run tests on PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
franciscoBSalgueiro committed Feb 15, 2024
1 parent b0f4781 commit ffcd732
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 12 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ on:
push:
branches:
- "*"
pull_request:
branches:
- "*"
workflow_dispatch:

jobs:
Expand Down
10 changes: 8 additions & 2 deletions src/atoms/atoms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,14 @@ function tabValue<T extends object | string | boolean | number>(
}

// Puzzles
export const hidePuzzleRatingAtom = atomWithStorage<boolean>("hide-puzzle-rating", false);
export const progressivePuzzlesAtom = atomWithStorage<boolean>("progressive-puzzles", false);
export const hidePuzzleRatingAtom = atomWithStorage<boolean>(
"hide-puzzle-rating",
false,
);
export const progressivePuzzlesAtom = atomWithStorage<boolean>(
"progressive-puzzles",
false,
);

// Per tab settings

Expand Down
7 changes: 3 additions & 4 deletions src/components/common/ChallengeHistory.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { hidePuzzleRatingAtom } from "@/atoms/atoms";
import { Completion } from "@/utils/puzzles";
import { ActionIcon, Group, Stack, Text } from "@mantine/core";
import { IconCheck, IconDots, IconX } from "@tabler/icons-react";
import { match } from "ts-pattern";
import { hidePuzzleRatingAtom } from "@/atoms/atoms";
import { useAtomValue } from "jotai";
import { match } from "ts-pattern";

type Challenge = {
completion: Completion;
Expand All @@ -19,7 +19,6 @@ function ChallengeHistory({
select: (i: number) => void;
current: number;
}) {

const hideRating = useAtomValue(hidePuzzleRatingAtom);

return (
Expand Down Expand Up @@ -72,7 +71,7 @@ function ChallengeHistory({
<IconDots color="yellow" />
</ActionIcon>
<Text ta="center" fz="xs" c="yellow">
{hideRating ? '?' : p.label}
{hideRating ? "?" : p.label}
</Text>
</Stack>
))
Expand Down
13 changes: 7 additions & 6 deletions src/components/puzzles/Puzzles.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {
activeTabAtom,
currentPuzzleAtom,
selectedPuzzleDbAtom,
tabsAtom,
hidePuzzleRatingAtom,
progressivePuzzlesAtom,
selectedPuzzleDbAtom,
tabsAtom,
} from "@/atoms/atoms";
import { commands } from "@/bindings";
import { unwrap } from "@/utils/invoke";
Expand Down Expand Up @@ -151,10 +151,11 @@ function Puzzles({ id }: { id: string }) {
Puzzle Rating
</Text>
<Text fw={500} size="xl">
{(puzzles[currentPuzzle]?.completion === "incomplete")
? hideRating ? '?' : puzzles[currentPuzzle]?.rating
: puzzles[currentPuzzle]?.rating
}
{puzzles[currentPuzzle]?.completion === "incomplete"
? hideRating
? "?"
: puzzles[currentPuzzle]?.rating
: puzzles[currentPuzzle]?.rating}
</Text>
</div>
{averageWonRating && (
Expand Down

0 comments on commit ffcd732

Please sign in to comment.