Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@
"@vitest/coverage-v8": "3.2.4",
"@vitest/ui": "^3.2.4",
"cypress": "^15.12.0",
"dotenv": "^17.2.3",
"eslint": "^9.39.1",
Comment on lines 113 to 114
"eslint-config-next": "16.0.8",
"istanbul-badges-readme": "^1.9.0",
Expand Down
9 changes: 0 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion src/app/problems/[slug]/problem-layout-client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ type ProblemLayoutClientProps = {
problem: Problem;
};

export default function ProblemLayoutClient({ problem }: ProblemLayoutClientProps) {
export default function ProblemLayoutClient({
problem,
}: ProblemLayoutClientProps) {
const account = accountStore((state) => state.account);

return <ProblemLayout problem={problem} isAuthenticated={!!account} />;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
"use client";

import { Badge } from "@/components/ui/badge";

type ProblemDifficultyBadgeProps = {
difficulty: number;
};

const EASY_THRESHOLD = 1000;
const MEDIUM_THRESHOLD = 2000;

function getDifficultyLabel(difficulty: number): {
label: string;
className: string;
} {
if (difficulty < 1000) {
if (difficulty < EASY_THRESHOLD) {
return {
label: "Easy",
className:
"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400",
};
}
if (difficulty < 2000) {
if (difficulty < MEDIUM_THRESHOLD) {
return {
label: "Medium",
className:
Expand Down
2 changes: 1 addition & 1 deletion src/features/problem/problem-question/problem-question.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import {
AccordionItem,
AccordionTrigger,
} from "@/components/ui/accordion";
import { ProblemDifficultyBadge } from "@/components/problem-difficulty-badge";
import { Separator } from "@/components/ui/separator";
import { Problem } from "@/features/problems/models/problem";
import { ProblemDifficultyBadge } from "@/features/problem/problem-difficulty-badge/problem-difficulty-badge";
import { Tag } from "lucide-react";
import React from "react";
import ProblemEditorTags from "./problem-editor-tags";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ColumnDef } from "@tanstack/react-table";
import { ProblemDifficultyBadge } from "@/components/problem-difficulty-badge";
import { Problem } from "../models/problem";
Comment on lines 1 to 3

export const problemColumnsV2: ColumnDef<Problem>[] = [
Expand All @@ -9,6 +10,9 @@ export const problemColumnsV2: ColumnDef<Problem>[] = [
{
accessorKey: "difficulty",
header: "Difficulty",
cell: ({ row }) => (
<ProblemDifficultyBadge difficulty={row.original.difficulty} />
),
},
{
accessorKey: "tags",
Expand Down
14 changes: 12 additions & 2 deletions vitest.setup.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
import "@testing-library/jest-dom";
import { config } from "dotenv";
import { vi } from "vitest";

config({ path: ".env.test" });
vi.mock("@/env", () => ({
env: {
AUTH0_DOMAIN: "test-auth0-domain",
AUTH0_CLIENT_ID: "test-auth0-client-id",
AUTH0_SECRET: "test-auth0-secret",
AUTH0_CLIENT_SECRET: "test-auth0-client-secret",
AUTH0_CALLBACK_URL: "http://localhost:3000/account/callback",
AUTH0_AUDIENCE: "test-auth0-audience",
NEXT_PUBLIC_API_SERVER_URL: "http://localhost:5035",
},
}));