Skip to content

Commit

Permalink
๐Ÿ› Fix: ๋นŒ๋“œ ์˜ค๋ฅ˜ ํ•ด๊ฒฐ
Browse files Browse the repository at this point in the history
  • Loading branch information
SNXWXH committed Jul 23, 2024
1 parent 0dc73ea commit 2e9a8bb
Show file tree
Hide file tree
Showing 38 changed files with 345 additions and 247 deletions.
6 changes: 3 additions & 3 deletions src/app/(main)/@modal/(.)testModal/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Button from "@/components/test/Button";
import Image from "next/image";
import Button from '@/components/test/Button';
import Image from 'next/image';

export default function Modal() {
return (
Expand Down Expand Up @@ -44,4 +44,4 @@ export default function Modal() {
</div>
</div>
);
}
}
49 changes: 26 additions & 23 deletions src/app/(main)/@modal/default.tsx
Original file line number Diff line number Diff line change
@@ -1,39 +1,42 @@
'use client'
'use client';

import Button from "@/components/test/Button";
import Button from '@/components/test/Button';
import Image from 'next/image';
import { IoIosClose } from "react-icons/io";
import { IoIosClose } from 'react-icons/io';

export default function Default() {

return (
<>
<div className="w-[500px] h-[500px] rounded-md fixed top-1/2 left-1/2 p-5 bg-white shadow -translate-x-1/2 -translate-y-1/2" >
<IoIosClose className="absolute text-3xl right-2 top-2 text-slate-400 hover:text-black"/>
<div className="w-[500px] h-[500px] rounded-md fixed top-1/2 left-1/2 p-5 bg-white shadow -translate-x-1/2 -translate-y-1/2">
<IoIosClose className="absolute text-3xl right-2 top-2 text-slate-400 hover:text-black" />
<div onClick={(e) => e.stopPropagation()}>
<div className="flex justify-center flex-col items-center gap-2 mt-4">
<h1 className="text-2xl font-bold">AI๊ฐ€ ์•Œ๋ ค์ฃผ๋Š” ๋‚˜์™€ ์ž˜ ๋งž๋Š” ์•ผ๊ตฌ์„ ์ˆ˜๋Š”?</h1>
<p className="text-xl">โค๏ธํฌํ† ์นด๋“œ๊ฐ€ ๋‚˜์˜ค๋Š” ์•ผ๊ตฌ ์„ฑํ–ฅ ํ…Œ์ŠคํŠธ!!โค๏ธ</p>
</div>
<div className="flex justify-center flex-col items-center mt-14">
<div className="flex justify-center flex-col items-center gap-2 mt-4">
<h1 className="text-2xl font-bold">
AI๊ฐ€ ์•Œ๋ ค์ฃผ๋Š” ๋‚˜์™€ ์ž˜ ๋งž๋Š” ์•ผ๊ตฌ์„ ์ˆ˜๋Š”?
</h1>
<p className="text-xl">โค๏ธํฌํ† ์นด๋“œ๊ฐ€ ๋‚˜์˜ค๋Š” ์•ผ๊ตฌ ์„ฑํ–ฅ ํ…Œ์ŠคํŠธ!!โค๏ธ</p>
</div>
<div className="flex justify-center flex-col items-center mt-14">
<Image
src="/svgs/test/modal.svg"
alt="emblem"
width={500}
height={120}
className="w-72 -mb-4 mr-11"
/>
<Button width={52} text="xl" href="/testModal">
๐Ÿ‘‰๐ŸปAI ์•ผ๊ตฌ ์„ฑํ–ฅ ํ…Œ์ŠคํŠธํ•˜๋Ÿฌ ๊ฐ€๊ธฐ๐Ÿ‘ˆ๐Ÿป
</Button>
</div>
<Image
src="/svgs/test/modal.svg"
src="/svgs/test/result/resultBackground.svg"
alt="emblem"
width={500}
height={120}
className="w-72 -mb-4 mr-11"
className="absolute rounded-b-md -bottom-px left-0 w-full"
/>
<Button width={52} text="xl" href="/testModal">๐Ÿ‘‰๐ŸปAI ์•ผ๊ตฌ ์„ฑํ–ฅ ํ…Œ์ŠคํŠธํ•˜๋Ÿฌ ๊ฐ€๊ธฐ๐Ÿ‘ˆ๐Ÿป</Button>
</div>
<Image
src="/svgs/test/result/resultBackground.svg"
alt="emblem"
width={500}
height={120}
className="absolute rounded-b-md -bottom-px left-0 w-full"
/>
</div>
</div>
</>
);
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
'use client';

import ModalWrapper from "@/components/test/ModalWrapper";
import ModalWrapper from '@/components/test/ModalWrapper';
import { useEffect, useState } from 'react';
import { useRouter } from 'next/navigation';
import ProgressBar from '@/components/test/ProgressBar';
import TestAnswer from '@/components/test/TestAnswer';
import { IoIosArrowBack } from 'react-icons/io';
import { TQuestionHandlerProps } from '@/types';
import Loading from "@/app/(test)/test/loading";

import Loading from '@/app/(test)/test/loading';

type TQuestionsProps = {
params: {
Expand Down Expand Up @@ -86,7 +85,8 @@ export default function Questions({ params }: TQuestionsProps) {
const errorText = await response.text();
console.error('Failed to fetch test result:', errorText);
}
} catch (error) {2
} catch (error) {
2;
console.error('Failed to fetch test result:', error);
}
sessionStorage.removeItem('questions');
Expand All @@ -104,23 +104,36 @@ export default function Questions({ params }: TQuestionsProps) {
<div className="mt-7 mb-28">
<ProgressBar progress={progress} />
</div>
<h1 className="text-5xl font-bold text-[#333333]">Q{questionIndex + 1}</h1>
<h1 className="text-5xl font-bold text-[#333333]">
Q{questionIndex + 1}
</h1>
<h2 className="mt-4 text-center w-72 text-2xl font-semibold text-[#333333]">
{question.Q}
</h2>
</div>
<div className="w-full h-1/2 bg-slate-50 flex flex-col justify-center items-center text-center">
<div className="my-12">
<TestAnswer onClick={() => handleAnswer(question.P1)}>{question.A1}</TestAnswer>
<TestAnswer onClick={() => handleAnswer(question.P2)}>{question.A2}</TestAnswer>
<TestAnswer onClick={() => handleAnswer(question.P1)}>
{question.A1}
</TestAnswer>
<TestAnswer onClick={() => handleAnswer(question.P2)}>
{question.A2}
</TestAnswer>
</div>
<div className="px-4 w-full flex justify-between text-[#444444] font-semibold text-base">
<button className="flex flex-row justify-center items-center" onClick={() => router.back()}><IoIosArrowBack /> ๋’ค๋กœ</button>
<div>{questionIndex + 1} / {totalQuestions}</div>
<button
className="flex flex-row justify-center items-center"
onClick={() => router.back()}
>
<IoIosArrowBack /> ๋’ค๋กœ
</button>
<div>
{questionIndex + 1} / {totalQuestions}
</div>
</div>
</div>
</div>
</ModalWrapper>
</>
);
}
}
2 changes: 1 addition & 1 deletion src/app/(main)/@questions/default.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export default function Default() {
return null;
}
}
6 changes: 3 additions & 3 deletions src/app/(main)/@result/(.)testModal/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export default function page () {
export default function page() {
return (
<>
<div>hihihi</div>
</>
)
}
);
}
2 changes: 1 addition & 1 deletion src/app/(main)/@result/default.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export default function Default() {
return null;
}
}
2 changes: 1 addition & 1 deletion src/app/(main)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ export default function MainLayout({
{questions}
</>
);
}
}
2 changes: 1 addition & 1 deletion src/app/(main)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ export default function Main() {
/>
</>
);
}
}
4 changes: 2 additions & 2 deletions src/app/(main)/player/batter/catcher/[catcherId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ async function getPlayerData(
}
}
export default async function CatcherDetail({ params }: CatcherPageProps) {
console.log('catcher page');
// console.log('catcher page');
const player = await getPlayerData(params.catcherId);
if (!player) {
return <div>Player not found</div>;
Expand All @@ -87,7 +87,7 @@ export default async function CatcherDetail({ params }: CatcherPageProps) {
);
if (!predictionRes.ok) {
console.error('Error-Failed to fetch prediction data');
console.log(predictionRes.statusText);
// console.log(predictionRes.statusText);
return <div>Failed to fetch prediction data</div>;
}
const playerMetric: TCatcherMetric = await predictionRes.json();
Expand Down
8 changes: 4 additions & 4 deletions src/app/(main)/player/batter/infielder/[infielderId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ async function getPlayerData(
'public/data/playerFront',
'infielder_data.json',
);
console.log(infielderDataPath);
// console.log(infielderDataPath);
const infielderData = JSON.parse(fs.readFileSync(infielderDataPath, 'utf8'));
const playerMeta = infielderData.data.list.find(
(player: IPlayerFront) => player.backNum === backNum,
);
console.log(`playerMeta:${playerMeta}`);
// console.log(`playerMeta:${playerMeta}`);

if (!playerMeta) {
return null;
Expand All @@ -53,7 +53,7 @@ async function getPlayerData(
'playerDetail/batter/infielder',
`${playerMeta.korName}.json`,
);
console.log(`filePath: ${filePath}`);
// console.log(`filePath: ${filePath}`);

try {
const fileContents = fs.readFileSync(filePath, 'utf8');
Expand Down Expand Up @@ -86,7 +86,7 @@ export default async function InfielderDetail({ params }: InfielderPageProps) {
);
if (!predictionRes.ok) {
console.error('Error-Failed to fetch prediction data');
console.log(predictionRes.statusText);
// console.log(predictionRes.statusText);
return <div>Failed to fetch prediction data</div>;
}
const playerMetric: TInfielderMetric = await predictionRes.json();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ async function getPlayerData(
'public/data/playerFront',
'outfielder_data.json',
);
console.log(outfielderDataPath);
// console.log(outfielderDataPath);
const outfielderData = JSON.parse(
fs.readFileSync(outfielderDataPath, 'utf8'),
);
const playerMeta = outfielderData.data.list.find(
(player: IPlayerFront) => player.backNum === backNum,
);
console.log(`playerMeta:${playerMeta}`);
// console.log(`playerMeta:${playerMeta}`);

if (!playerMeta) {
return null;
Expand All @@ -55,7 +55,7 @@ async function getPlayerData(
'playerDetail/batter/outfielder',
`${playerMeta.korName}.json`,
);
console.log(`filePath: ${filePath}`);
// console.log(`filePath: ${filePath}`);

try {
const fileContents = fs.readFileSync(filePath, 'utf8');
Expand Down Expand Up @@ -90,7 +90,7 @@ export default async function OutfielderDetail({
);
if (!predictionRes.ok) {
console.error('Error-Failed to fetch prediction data');
console.log(predictionRes.statusText);
// console.log(predictionRes.statusText);
return <div>Failed to fetch prediction data</div>;
}
const playerMetric: TInfielderMetric = await predictionRes.json();
Expand Down
4 changes: 2 additions & 2 deletions src/app/(main)/player/pitcher/[pitcherId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ async function getPlayerData(
const playerMeta = pitcherData.data.list.find(
(player: IPlayerFront) => player.backNum === backNum,
);
console.log(`playerMeta:${playerMeta}`);
// console.log(`playerMeta:${playerMeta}`);

if (!playerMeta) {
return null;
Expand Down Expand Up @@ -86,7 +86,7 @@ export default async function PitcherDetail({ params }: PitcherPageProps) {
);
if (!predictionRes.ok) {
console.error('Error-Failed to fetch prediction data');
console.log(predictionRes.statusText);
// console.log(predictionRes.statusText);
return <div>Failed to fetch prediction data</div>;
}
const playerMetric: TPitcherMetric = await predictionRes.json();
Expand Down
6 changes: 2 additions & 4 deletions src/app/(test)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { ReactNode } from "react";
import { ReactNode } from 'react';

export default function TestLayout({ children }: { children: ReactNode }) {
return (
<>
<div className="bg-slate-100">
{children}
</div>
<div className="bg-slate-100">{children}</div>
</>
);
}
38 changes: 20 additions & 18 deletions src/app/(test)/test/loading.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
"use client";
'use client';

import { useEffect, useState } from "react";
import { useEffect, useState } from 'react';

const images = [
"/svgs/test/loading/0.svg",
"/svgs/test/loading/1.svg",
"/svgs/test/loading/2.svg",
"/svgs/test/loading/3.svg",
"/svgs/test/loading/4.svg",
"/svgs/test/loading/5.svg",
"/svgs/test/loading/6.svg",
"/svgs/test/loading/7.svg",
'/svgs/test/loading/0.svg',
'/svgs/test/loading/1.svg',
'/svgs/test/loading/2.svg',
'/svgs/test/loading/3.svg',
'/svgs/test/loading/4.svg',
'/svgs/test/loading/5.svg',
'/svgs/test/loading/6.svg',
'/svgs/test/loading/7.svg',
];

export default function Loading() {
const [currentImageIndex, setCurrentImageIndex] = useState(0);
const [dots, setDots] = useState("");
const [dots, setDots] = useState('');

useEffect(() => {
useEffect(() => {
const imageInterval = setInterval(() => {
setCurrentImageIndex((prevIndex) => (prevIndex + 1) % images.length);
}, 300);
Expand All @@ -26,9 +26,9 @@ export default function Loading() {
}, []);

useEffect(() => {
const textInterval = setInterval(() => {
setDots((prevDots) => (prevDots.length === 6 ? "" : prevDots + "."));
}, 500);
const textInterval = setInterval(() => {
setDots((prevDots) => (prevDots.length === 6 ? '' : prevDots + '.'));
}, 500);

return () => clearInterval(textInterval);
}, []);
Expand All @@ -42,12 +42,14 @@ export default function Loading() {
src={image}
alt={`์Šฌ๋ผ์ด๋“œ ์ด๋ฏธ์ง€ ${index}`}
className={`absolute w-60 h-60 object-cover transition-opacity duration-0 ease-in-out ${
index === currentImageIndex ? "opacity-100" : "opacity-0"
index === currentImageIndex ? 'opacity-100' : 'opacity-0'
}`}
/>
))}
</div>
<div className="mt-4 font-bold text-3xl text-[#444444]">๊ณต ๊ฐ€์ง€๋Ÿฌ ๊ฐ€๋Š” ์ค‘{dots}</div>
<div className="mt-4 font-bold text-3xl text-[#444444]">
๊ณต ๊ฐ€์ง€๋Ÿฌ ๊ฐ€๋Š” ์ค‘{dots}
</div>
</div>
);
}
}
6 changes: 4 additions & 2 deletions src/app/(test)/test/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ export default function Test() {
height={180}
className="w-40 md:w-[200px] mb-4"
/>
<Button width={80} text="2xl" href="/test/questions/1">ํ…Œ์ŠคํŠธ START</Button>
<Button width={80} text="2xl" href="/test/questions/1">
ํ…Œ์ŠคํŠธ START
</Button>
</div>
<div className="w-full h-2/6 bg-[#FFFFFF] flex flex-col justify-center items-center text-center">
<div className="w-74 h-[95px] text-sm mt-1 text-[#333333]">
Expand All @@ -44,4 +46,4 @@ export default function Test() {
</div>
</>
);
}
}
Loading

0 comments on commit 2e9a8bb

Please sign in to comment.