mirror of
https://github.com/UiO-Gaming/name-100-uio-gamers.git
synced 2026-11-05 13:56:53 +01:00
add support for setting a custom correct guess limit
This commit is contained in:
6 files changed
+14
-10
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import { GOAL_AMOUNT } from "@/consts";
|
||||
import { useLanguage } from "@/LanguageContext";
|
||||
import { translations } from "@/translations";
|
||||
|
||||
@@ -7,7 +8,7 @@ const Header = () => {
|
||||
return (
|
||||
<header>
|
||||
<h1 className="mb-12 text-center text-4xl font-bold">
|
||||
{t.appTitle.split(" ")[0]} 100 <span className="border-norway border-b-2">{t.norwegians}</span>
|
||||
{t.appTitle.split(" ")[0]} {GOAL_AMOUNT} <span className="border-norway border-b-2">{t.norwegians}</span>
|
||||
</h1>
|
||||
</header>
|
||||
);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { GOAL_AMOUNT } from "@/consts";
|
||||
import React from "react";
|
||||
|
||||
interface ScoreProps {
|
||||
@@ -7,7 +8,7 @@ interface ScoreProps {
|
||||
const Score: React.FC<ScoreProps> = ({ matchesCount }) => {
|
||||
return (
|
||||
<p className="text-xl">
|
||||
<span className="font-bold">{matchesCount}</span> / 100
|
||||
<span className="font-bold">{matchesCount}</span> / {GOAL_AMOUNT}
|
||||
</p>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export const GOAL_AMOUNT = 2;
|
||||
+2
-2
@@ -2,8 +2,8 @@ import "@/globals.css";
|
||||
import type { Metadata } from "next";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Name 100 Norwegians",
|
||||
description: "How fast can you name 100 Norwegian people?",
|
||||
title: "Name 2 Norwegians",
|
||||
description: "How fast can you name 2 Norwegian people?",
|
||||
};
|
||||
|
||||
export default function RootLayout({
|
||||
|
||||
+3
-2
@@ -1,5 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { GOAL_AMOUNT } from "@/consts";
|
||||
import { LanguageProvider, useLanguage } from "@/LanguageContext";
|
||||
import { translations } from "@/translations";
|
||||
import React, { useMemo, useRef, useState } from "react";
|
||||
@@ -58,7 +59,7 @@ function Home() {
|
||||
|
||||
// Stop timer when 100 correct guesses are made
|
||||
React.useEffect(() => {
|
||||
if (correctMatchesCount === 100) {
|
||||
if (correctMatchesCount === GOAL_AMOUNT) {
|
||||
stopTimer();
|
||||
}
|
||||
}, [correctMatchesCount]);
|
||||
@@ -122,7 +123,7 @@ function Home() {
|
||||
setRepeatMessage("");
|
||||
}}
|
||||
onSubmit={handleSubmit}
|
||||
disabled={correctMatchesCount === 100}
|
||||
disabled={correctMatchesCount === GOAL_AMOUNT}
|
||||
/>
|
||||
<Score matchesCount={correctMatchesCount} />
|
||||
{repeatMessage && <div className="mb-2 font-semibold text-red-500">{repeatMessage}</div>}
|
||||
|
||||
@@ -8,8 +8,8 @@ export const translations = {
|
||||
howToPlay1: "Any real Norwegian person listed on Store Norske Leksikon should be accepted.",
|
||||
howToPlay2: "No repeats allowed.",
|
||||
howToPlay3: "The timer starts once you make your first correct guess.",
|
||||
appTitle: "Name 100 Norwegians",
|
||||
appDescription: "How fast can you name 100 Norwegian people?",
|
||||
appTitle: "Name Norwegians",
|
||||
appDescription: "How fast can you name 2 Norwegian people?",
|
||||
madeBy: "Made by",
|
||||
sourceCode: "Source code",
|
||||
norwegians: "Norwegians",
|
||||
@@ -23,8 +23,8 @@ export const translations = {
|
||||
howToPlay1: "Alle ekte norske personer som har en side om seg på Store Norske Leksikon bør godtas.",
|
||||
howToPlay2: "Du kan ikke gjenta navn.",
|
||||
howToPlay3: "Tiden starter første gang du skriver et godkjent navn.",
|
||||
appTitle: "Navngi 100 nordmenn",
|
||||
appDescription: "Hvor raskt kan du navngi 100 nordmenn?",
|
||||
appTitle: "Navngi nordmenn",
|
||||
appDescription: "Hvor raskt kan du navngi 2 nordmenn?",
|
||||
madeBy: "Laget av",
|
||||
sourceCode: "Kildekode",
|
||||
norwegians: "Nordmenn",
|
||||
|
||||
Reference in new issue
Block a user