괄호 안의 항을 2, 3, 4 항으로 설정하는 기능 추가
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
import VariablePlayClient from "./VariablePlayClient";
|
||||
import type { VariableProblemCount } from "@/store/variableGameStore";
|
||||
import type {
|
||||
VariableMaxTermCount,
|
||||
VariableProblemCount,
|
||||
} from "@/store/variableGameStore";
|
||||
|
||||
interface VariablePlayPageProps {
|
||||
searchParams?: {
|
||||
count?: string | string[];
|
||||
terms?: string | string[];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -15,10 +19,24 @@ function parseProblemCount(count?: string | string[]): VariableProblemCount {
|
||||
return count === "5" ? 5 : 10;
|
||||
}
|
||||
|
||||
function parseMaxTermCount(terms?: string | string[]): VariableMaxTermCount {
|
||||
if (Array.isArray(terms)) {
|
||||
return parseMaxTermCount(terms[0]);
|
||||
}
|
||||
|
||||
if (terms === "3") return 3;
|
||||
if (terms === "4") return 4;
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
export default function VariablePlayPage({
|
||||
searchParams,
|
||||
}: VariablePlayPageProps) {
|
||||
return (
|
||||
<VariablePlayClient problemCount={parseProblemCount(searchParams?.count)} />
|
||||
<VariablePlayClient
|
||||
problemCount={parseProblemCount(searchParams?.count)}
|
||||
maxTermCount={parseMaxTermCount(searchParams?.terms)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user