mhpark / Edu_Tech star
박민혁 박민혁 05-27
240527 박민혁 금오공대 최종본
@79ca85ebd25e8f2dc0cc11e7bfc8cc669b9be498
README.md
--- README.md
+++ README.md
@@ -1,1 +1,70 @@
-Test
+# Getting Started with Create React App
+
+This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
+
+## Available Scripts
+
+In the project directory, you can run:
+
+### `npm start`
+
+Runs the app in the development mode.\
+Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
+
+The page will reload when you make changes.\
+You may also see any lint errors in the console.
+
+### `npm test`
+
+Launches the test runner in the interactive watch mode.\
+See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
+
+### `npm run build`
+
+Builds the app for production to the `build` folder.\
+It correctly bundles React in production mode and optimizes the build for the best performance.
+
+The build is minified and the filenames include the hashes.\
+Your app is ready to be deployed!
+
+See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
+
+### `npm run eject`
+
+**Note: this is a one-way operation. Once you `eject`, you can't go back!**
+
+If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
+
+Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
+
+You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
+
+## Learn More
+
+You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
+
+To learn React, check out the [React documentation](https://reactjs.org/).
+
+### Code Splitting
+
+This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
+
+### Analyzing the Bundle Size
+
+This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
+
+### Making a Progressive Web App
+
+This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
+
+### Advanced Configuration
+
+This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
+
+### Deployment
+
+This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
+
+### `npm run build` fails to minify
+
+This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
src/App.js
--- src/App.js
+++ src/App.js
@@ -18,6 +18,10 @@
 import StudyMainFairyWorld from "./pages/studyMainFairyWorld/StudyMainFairyWorld";
 import StudyMainFairyTravel from "./pages/studyMainFairyTravel/StudyMainFairyTravel";
 import MainStudent from "./pages/main/MainStudent";
+import MainTeacher from "./pages/main/MainTeacher";
+import MainTeacher2 from "./pages/main/MainTeacher2";
+import MainParent from "./pages/main/MainParent";
+import MainSelect from "./pages/main/MainSelect";
 
 function App() {
   return (
@@ -77,6 +81,10 @@
           />
           <Route path="/oneMainUnit" element={<OneMainUnit />} />
           <Route path="/mainStudent" element={<MainStudent />} />
+          <Route path="/mainTeacher" element={<MainTeacher />} />
+          <Route path="/mainTeacher2" element={<MainTeacher2 />} />
+          <Route path="/mainParent" element={<MainParent />} />
+          <Route path="/mainSelect" element={<MainSelect />} />
         </Routes>
       </BrowserRouter>
     </div>
 
src/components/chart/AllBarChart.jsx (added)
+++ src/components/chart/AllBarChart.jsx
@@ -0,0 +1,57 @@
+import React, { useEffect, useRef } from "react";
+import { Chart } from "chart.js/auto";
+
+const AllBarChart = ({ labels, datasets }) => {
+  const chartRef = useRef(null);
+
+  useEffect(() => {
+    const ctx = chartRef.current.getContext("2d");
+    const chartInstance = new Chart(ctx, {
+      type: "bar",
+      data: {
+        labels: labels,
+        datasets: datasets,
+      },
+      options: {
+        responsive: true,
+        plugins: {
+          legend: {
+            position: "top",
+          },
+        },
+        scales: {
+          x: {
+            title: {
+              display: true,
+              text: "날짜",
+            },
+            ticks: {
+              font: {
+                family: "JalnanGothic, sans-serif",
+              },
+            },
+          },
+          y: {
+            title: {
+              display: true,
+              text: "점수",
+            },
+            ticks: {
+              font: {
+                family: "JalnanGothic, sans-serif",
+              },
+            },
+          },
+        },
+      },
+    });
+
+    return () => {
+      chartInstance.destroy();
+    };
+  }, [labels, datasets]);
+
+  return <canvas ref={chartRef} />;
+};
+
+export default AllBarChart;
src/components/chart/AllLineChart.jsx
--- src/components/chart/AllLineChart.jsx
+++ src/components/chart/AllLineChart.jsx
@@ -1,7 +1,7 @@
 import React, { useEffect, useRef } from "react";
 import { Chart } from "chart.js/auto";
 
-const AllLineChart = ({ datasets }) => {
+const AllLineChart = ({ labels, datasets }) => {
   const chartRef = useRef(null);
 
   useEffect(() => {
@@ -9,8 +9,12 @@
     const chartInstance = new Chart(ctx, {
       type: "line",
       data: {
-        labels: ["월", "화", "수", "목", "금", "토", "일"],
-        datasets: datasets,
+        labels: labels,
+        datasets: datasets.map((dataset) => ({
+          ...dataset,
+          xAxisID: "x-axis-0", // Add xAxisID
+          yAxisID: "y-axis-0", // Add yAxisID
+        })),
       },
       options: {
         responsive: true,
@@ -20,18 +24,30 @@
           },
         },
         scales: {
-          x: {
-            display: true,
+          "x-axis-0": {
+            type: "category",
+            position: "bottom",
             title: {
               display: true,
-              text: "요일",
+              text: "날짜",
+            },
+            ticks: {
+              font: {
+                family: "JalnanGothic, sans-serif",
+              },
             },
           },
-          y: {
-            display: true,
+          "y-axis-0": {
+            type: "linear",
+            position: "left",
             title: {
               display: true,
               text: "점수",
+            },
+            ticks: {
+              font: {
+                family: "JalnanGothic, sans-serif",
+              },
             },
           },
         },
@@ -41,7 +57,7 @@
     return () => {
       chartInstance.destroy();
     };
-  }, [datasets]);
+  }, [labels, datasets]);
 
   return <canvas ref={chartRef} />;
 };
src/components/header/Header.jsx
--- src/components/header/Header.jsx
+++ src/components/header/Header.jsx
@@ -44,7 +44,7 @@
       <div
         className="icon"
         onClick={() => {
-          navigate("/");
+          navigate("/mainSelect");
         }}
       >
         <img src="/images/logo/logo3.png" />
@@ -53,6 +53,8 @@
       <div className="nav">
         {cookies.loggedIn ? (
           <>
+            <span className="nav-item">{cookies.username}님</span>
+
             <div className="nav-item" onClick={goMypage}>
               마이페이지
             </div>
src/pages/login/LoginPage.jsx
--- src/pages/login/LoginPage.jsx
+++ src/pages/login/LoginPage.jsx
@@ -40,7 +40,7 @@
           path: "/",
           expires: new Date(Date.now() + 30 * 60 * 1000),
         });
-        navigate("/");
+        navigate("/mainSelect");
         console.log(response.data);
       })
       .catch((error) => {
 
src/pages/main/MainParent.css (added)
+++ src/pages/main/MainParent.css
@@ -0,0 +1,50 @@
+.mainstudent-student-information {
+  width: 50%;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+}
+
+.mainparent-recommend-keys {
+  width: 100%;
+  height: 50%;
+  display: flex;
+  justify-content: space-around;
+  align-items: center;
+  flex-wrap: wrap;
+}
+
+.mainstudent-parent-information {
+  width: 50%;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  font-size: 20px;
+  margin: 3% 0;
+}
+.health-good {
+  color: green;
+}
+
+.health-excellent {
+  color: blue;
+}
+
+.health-warning {
+  color: yellow;
+}
+
+.health-danger {
+  color: red;
+}
+.mainparent-recommend-question {
+  text-align: center;
+  height: 10%;
+  padding-bottom: 0;
+  box-sizing: border-box;
+  display: flex;
+  justify-content: space-around;
+  align-items: center;
+  margin-top: -5%;
+  margin-bottom: 2%;
+}
 
src/pages/main/MainParent.jsx (added)
+++ src/pages/main/MainParent.jsx
@@ -0,0 +1,406 @@
+import React, { useEffect, useState } from "react";
+import { useActionData, useNavigate } from "react-router-dom";
+import axios from "axios";
+import "./MainParent.css";
+import AllLineChart from "../../components/chart/AllLineChart";
+import AllBarChart from "../../components/chart/AllBarChart";
+
+const MainParent = () => {
+  const navigate = useNavigate();
+  const [solved, setSolved] = useState([]);
+  const [topTwoKeys, setTopTwoKeys] = useState([]);
+  const [student, setStudent] = useState();
+  const [allDatasets, setAllDatasets] = useState([]);
+  const [datasets, setDatasets] = useState([]);
+  const [labels, setLabels] = useState([]);
+  const [progress, setProgress] = useState(0);
+  const [health, setHealth] = useState();
+  const [wordDataset, setWordDataset] = useState([]);
+  const [focusDataset, setFocusDataset] = useState([]);
+  const [grammarDataset, setGrammarDataset] = useState([]);
+  const [sentenceDataset, setSentenceDataset] = useState([]);
+  const [understandDataset, setUnderstandDataset] = useState([]);
+  const [expressionDataset, setExpressionDataset] = useState([]);
+  const [sumDataset, setSumDataset] = useState([]);
+  const [sumAverage, setSumAverage] = useState();
+  const [images, setImages] = useState({
+    동화여행: "fairytravel.png",
+    동화세계: "fairyworld.png",
+    문법요정: "grammerfariy.png",
+    문법랜드: "grammerland.png",
+    문장쑥쑥: "sentenceabsorb.png",
+    문장일기: "sentencediary.png",
+    동요여행: "songtravel.png",
+    동요나라: "songcountry.png",
+    어휘력쑥쑥: "wordabsorb.png",
+    단어뭉치: "wordbundle.png",
+  });
+
+  const expressionAndUnderstandDatasets = [
+    {
+      label: "이해",
+      data: understandDataset.length ? understandDataset[0].data : [],
+      backgroundColor: "rgba(54, 162, 235, 0.5)",
+    },
+    {
+      label: "표현",
+      data: expressionDataset.length ? expressionDataset[0].data : [],
+      backgroundColor: "rgba(255, 206, 86, 0.5)",
+    },
+  ];
+
+  const formatDate = (dateString) => {
+    const date = new Date(dateString);
+    const month = String(date.getMonth() + 1).padStart(2, "0");
+    const day = String(date.getDate()).padStart(2, "0");
+    return `${month}-${day}`;
+  };
+
+  const fetchStudent = async () => {
+    try {
+      const response = await axios.get(
+        `http://localhost:8080/member/student?userId=sangbabo`,
+        {
+          withCredentials: true,
+        }
+      );
+      console.log(response.data.data.sum);
+      setStudent(response.data.data);
+    } catch (error) {
+      console.error("Error fetching data: ", error);
+    }
+  };
+
+  const fetchSolved = async () => {
+    try {
+      const response = await axios.get(
+        `http://localhost:8080/parents/solved?userId=sangbabo`,
+        {
+          withCredentials: true,
+        }
+      );
+      console.log(response);
+      if (response.data && response.data.result) {
+        setSolved(response.data.data.length);
+      }
+    } catch (error) {
+      console.error("Error fetching data: ", error);
+    }
+  };
+
+  const fetchSolvedCount = async () => {
+    try {
+      const response = await axios.get(`http://localhost:8080/solved/count`, {
+        withCredentials: true,
+      });
+      const data = response.data;
+
+      // 객체의 키와 값을 배열로 변환
+      const solvedCounts = Object.entries(data);
+
+      // 값이 큰 순서대로 정렬
+      solvedCounts.sort((a, b) => b[1] - a[1]);
+
+      // 가장 큰 값 두 개의 키 가져오기
+      const [first, second, three] = solvedCounts
+        .slice(0, 3)
+        .map(([key, value]) => key);
+
+      // 상태로 설정
+      setTopTwoKeys([first, second, three]);
+
+      console.log("가장 큰 값 두 개의 키:", first, second, three);
+
+      // 이후에 필요한 로직을 수행하면 됩니다.
+    } catch (error) {
+      console.error("Error fetching data: ", error);
+    }
+  };
+
+  const fetchData = async () => {
+    try {
+      const response = await axios.get(
+        "http://localhost:8080/scorelog/parents/latest?userId=sangbabo",
+        {
+          withCredentials: true,
+        }
+      );
+      console.log(response);
+      const data = response.data;
+
+      const labels = data.map((entry) => formatDate(entry.createdAt));
+      const focusData = data.map((entry) => entry.focus);
+      const understandData = data.map((entry) => entry.understand);
+      const wordData = data.map((entry) => entry.word);
+      const grammarData = data.map((entry) => entry.grammar);
+      const sentenceData = data.map((entry) => entry.sentence);
+      const expressionData = data.map((entry) => entry.expression);
+
+      setLabels(labels);
+      setFocusDataset([
+        {
+          label: "집중",
+          data: focusData,
+          borderColor: "rgba(75, 192, 192, 0.7)",
+          fill: false,
+        },
+      ]);
+      setUnderstandDataset([
+        {
+          label: "이해",
+          data: understandData,
+          borderColor: "rgba(54, 162, 235, 1)",
+          fill: false,
+        },
+      ]);
+      setWordDataset([
+        {
+          label: "어휘",
+          data: wordData,
+          borderColor: "rgba(75, 192, 192, 1)",
+          fill: false,
+        },
+      ]);
+      setGrammarDataset([
+        {
+          label: "문법",
+          data: grammarData,
+          borderColor: "rgba(153, 102, 255, 1)",
+          fill: false,
+        },
+      ]);
+      setSentenceDataset([
+        {
+          label: "문장",
+          data: sentenceData,
+
+          borderColor: "rgba(255, 159, 64, 1)",
+          fill: false,
+        },
+      ]);
+      setExpressionDataset([
+        {
+          label: "표현",
+          data: expressionData,
+          borderColor: "rgba(255, 206, 86, 1)",
+          fill: false,
+        },
+      ]);
+
+      const totalProgress = data.reduce(
+        (acc, cur) =>
+          acc +
+          cur.focus +
+          cur.expression +
+          cur.understand +
+          cur.word +
+          cur.sentence +
+          cur.grammar,
+        0
+      );
+      setProgress(totalProgress / (6 * data.length));
+    } catch (error) {
+      console.error("Error fetching data:", error);
+    }
+  };
+
+  const fetchSumData = async () => {
+    try {
+      const response = await axios.get(
+        "http://localhost:8080/scorelog/parents/sum?userId=sangbabo",
+        {
+          withCredentials: true,
+        }
+      );
+      console.log(response.data);
+      const data = response.data;
+      const labels = data.map((entry) => formatDate(entry.createdAt));
+      const sumData = data.map((entry) => entry.sum);
+
+      setLabels(labels);
+      setSumDataset([
+        {
+          label: "체급",
+          data: sumData,
+          borderColor: "rgba(255, 99, 132, 1)",
+          fill: false,
+        },
+      ]);
+    } catch (error) {
+      console.error("Error fetching data:", error);
+    }
+  };
+  const fetchSumAverage = async () => {
+    try {
+      const response = await axios.get(
+        "http://localhost:8080/average-total-score",
+        {
+          withCredentials: true,
+        }
+      );
+      console.log(response.data.averageTotalScore);
+      setSumAverage(response.data.averageTotalScore);
+    } catch (error) {
+      console.error("Error fetching data:", error);
+    }
+  };
+
+  useEffect(() => {
+    fetchSolvedCount();
+    fetchSolved();
+    fetchStudent();
+    fetchData();
+    fetchSumData(); // 새로운 데이터를 가져온 후에 호출되도록 변경
+    fetchSumAverage();
+  }, []);
+
+  const getProgressBarColor = (progress) => {
+    if (progress < 30) {
+      return "red";
+    } else if (progress >= 30 && progress < 70) {
+      return "orange";
+    } else {
+      return "green";
+    }
+  };
+  const determineHealthStatus = (studentSum, average) => {
+    const difference = studentSum - average;
+    if (difference >= -50 && difference <= 50) {
+      return "양호";
+    } else if (difference > 50) {
+      return "우수";
+    } else if (difference >= -150) {
+      return "주의";
+    } else {
+      return "경고";
+    }
+  };
+  const getHealthClassName = (status) => {
+    switch (status) {
+      case "양호":
+        return "health-good";
+      case "우수":
+        return "health-excellent";
+      case "주의":
+        return "health-warning";
+      case "경고":
+        return "health-danger";
+      default:
+        return "";
+    }
+  };
+  useEffect(() => {
+    // 체급을 결정할 때 사용될 함수
+    if (student && sumAverage) {
+      const healthStatus = determineHealthStatus(student.sum, sumAverage);
+      setHealth(healthStatus);
+    }
+  }, [student, sumAverage]);
+  return (
+    <>
+      <div className="mainstudent-container">
+        <div className="mainstudent-chart">
+          <div className="mainstudent-chart-container">
+            <div className="mainstudent-chart-box">
+              <div className="mainstudent-chart-box-container">
+                <h2>집중</h2>
+                <div className="chart-wrapper">
+                  <AllLineChart labels={labels} datasets={focusDataset} />
+                </div>
+              </div>
+            </div>
+            <div className="mainstudent-chart-box">
+              <div className="mainstudent-chart-box-container">
+                <h2>어휘</h2>
+                <div className="chart-wrapper">
+                  <AllLineChart labels={labels} datasets={wordDataset} />
+                </div>
+              </div>
+            </div>
+            <div className="mainstudent-chart-box">
+              <div className="mainstudent-chart-box-container">
+                <h2>문법</h2>
+                <div className="chart-wrapper">
+                  <AllLineChart labels={labels} datasets={grammarDataset} />
+                </div>
+              </div>
+            </div>
+            <div className="mainstudent-chart-box">
+              <div className="mainstudent-chart-box-container">
+                <h2>문장</h2>
+                <div className="chart-wrapper">
+                  <AllLineChart labels={labels} datasets={sentenceDataset} />
+                </div>
+              </div>
+            </div>
+            <div className="mainstudent-chart-box">
+              <div className="mainstudent-chart-box-container">
+                <h2>이해와 표현</h2>
+                <div className="chart-wrapper">
+                  <AllBarChart
+                    labels={labels}
+                    datasets={expressionAndUnderstandDatasets}
+                  />
+                </div>
+              </div>
+            </div>
+            <div className="mainstudent-chart-box">
+              <div className="mainstudent-chart-box-container">
+                <h2>자녀 종합 점수</h2>
+                <div className="chart-wrapper">
+                  <AllLineChart labels={labels} datasets={sumDataset} />
+                </div>
+              </div>
+            </div>
+          </div>
+        </div>
+        <div className="mainstudent-progress-recommend">
+          <div className="mainstudent-progress-left-container">
+            <div className="mainstudent-progress-bar-container">
+              <div className="progress-bar-container">
+                <div
+                  className="progress-bar"
+                  style={{
+                    width: `${solved * 1.25}%`,
+                    backgroundColor: getProgressBarColor(solved * 1.25),
+                  }}
+                ></div>
+              </div>
+              <div className="mainstudent-progress">
+                진행률 : {solved * 1.25}%
+              </div>
+            </div>
+          </div>
+          <div className="mainstudent-recommend-right-container">
+            <div className="mainstudent-recommend-container">
+              <div className="mainparent-recommend-question">
+                <h2>자녀 정보</h2>
+              </div>
+              <div className="mainparent-recommend-keys">
+                <div className="mainstudent-parent-information">
+                  {student && <span>이름: {student.name}</span>}
+                </div>
+
+                <div className="mainstudent-parent-information">
+                  {student && <span>학년: {student.grade}</span>}
+                </div>
+                <div
+                  className={`mainstudent-parent-information ${getHealthClassName(
+                    health
+                  )}`}
+                >
+                  {student && <span>상태: {health}</span>}
+                </div>
+                <div className="mainstudent-parent-information">
+                  {student && <span>성별: {student.gender}</span>}
+                </div>
+              </div>
+            </div>
+          </div>
+        </div>
+      </div>
+    </>
+  );
+};
+
+export default MainParent;
 
src/pages/main/MainSelect.css (added)
+++ src/pages/main/MainSelect.css
@@ -0,0 +1,0 @@
 
src/pages/main/MainSelect.jsx (added)
+++ src/pages/main/MainSelect.jsx
@@ -0,0 +1,35 @@
+import React, { useEffect } from "react";
+import "./MainParent.css";
+import { useNavigate } from "react-router-dom";
+import axios from "axios";
+
+const MainSelect = () => {
+  const navigate = useNavigate();
+  const fetchData = async () => {
+    try {
+      const response = await axios.get(`http://localhost:8080/rating`, {
+        withCredentials: true,
+      });
+      const responseData = response.data.data; // response.data는 이미 JavaScript 객체로 사용 가능합니다.
+      const role = responseData.role;
+      if (role == "parent") {
+        navigate("/mainParent");
+      } else if (role == "teacher") {
+        navigate("/mainTeacher");
+      } else {
+        navigate("/mainStudent");
+      }
+
+      console.log(response.data);
+    } catch (error) {
+      console.error("Error fetching data: ", error);
+    }
+  };
+  useEffect(() => {
+    fetchData();
+  }, []);
+
+  return <div>loading...</div>;
+};
+
+export default MainSelect;
src/pages/main/MainStudent.css
--- src/pages/main/MainStudent.css
+++ src/pages/main/MainStudent.css
@@ -1,6 +1,34 @@
 .mainstudent-container {
-  width: 100vw;
+  width: 100%;
   height: calc(100vh - 60px);
+  overflow: hidden;
+}
+
+.mainstudent-container1 {
+  width: 100%;
+  height: calc(170vh - 60px);
+  background-size: cover; /* 배경 이미지가 컨테이너를 모두 채우도록 설정합니다. */
+  /* 다른 스타일링 속성을 필요에 따라 추가할 수 있습니다. */
+  overflow: hidden;
+}
+
+.mainstudent-container-one {
+  width: 100%;
+  height: calc(70vh - 30px);
+  overflow: hidden;
+}
+.mainstudent-container-two {
+  width: 100%;
+  height: calc(100vh - 30px);
+  overflow: hidden;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+}
+
+.mainstudent-container2 {
+  width: 90%;
+  margin: auto;
   overflow: hidden;
 }
 
@@ -21,10 +49,12 @@
 .mainstudent-chart-all {
   width: 90%;
   height: 90%;
-  border: 1px solid;
   display: flex;
   justify-content: center;
   align-items: center;
+  background-color: #ffffff;
+  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* Add this line for shadow */
+  border-radius: 20px;
 }
 
 .mainstudent-chart-right-container {
@@ -38,8 +68,7 @@
 
 .mainstudent-chart-three-box {
   width: 100%;
-  height: 33.33%;
-  border: 1px solid;
+  height: 32%;
   display: flex;
   justify-content: center;
   align-items: center;
@@ -51,8 +80,13 @@
   display: flex;
   justify-content: center;
   align-items: center;
-  background-color: #f0f0f0;
+  background-color: #ffffff;
+  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* Add this line for shadow */
   border-radius: 10px;
+}
+
+.goContent {
+  cursor: pointer;
 }
 
 .mainstudent-chart-three-box-chart h1 {
@@ -67,25 +101,55 @@
 
 .mainstudent-progress-left-container {
   display: flex;
+  flex-direction: column;
   justify-content: center;
   align-items: center;
   width: 50%;
   height: 100%;
-  border: 1px solid;
 }
 
 .mainstudent-recommend-right-container {
   width: 50%;
   height: 100%;
-  border: 1px solid;
+  display: flex;
+  justify-content: center;
+  align-self: center;
+  flex-direction: column;
+}
+
+.mainstudent-progress-bar-container {
+  width: 88.3%;
+  height: 70%;
+  padding: 2.5%;
+  border-radius: 20px;
+  display: flex;
+  justify-content: center;
+  align-self: center;
+  flex-direction: column;
+  background-color: #ffffff;
+  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* Add this line for shadow */
 }
 
 .progress-bar-container {
   width: 80%;
-  height: 20px;
+  height: 50px;
   background-color: #f0f0f0;
   border-radius: 10px;
   overflow: hidden;
+  margin: auto;
+}
+
+.mainstudent-recommend-container {
+  width: 88%;
+  height: 70%;
+  border-radius: 20px;
+  padding: 2.5%;
+  background-color: #ffffff;
+  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* Add this line for shadow */
+  display: flex;
+  justify-content: center;
+  align-self: center;
+  flex-direction: column;
 }
 
 .progress-bar {
@@ -93,3 +157,92 @@
   background-color: #4caf50;
   transition: width 0.3s ease;
 }
+
+.mainstudent-progress {
+  margin-top: 5%;
+  text-align: center;
+}
+
+.mainstudent-recommend-keys {
+  display: flex;
+  justify-content: space-around;
+  align-items: center;
+  flex-wrap: wrap;
+}
+
+.mainstudent-recommend-key {
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  flex-direction: column;
+}
+
+.mainstudent-recommend-key span {
+  margin-top: 10%;
+}
+
+.mainstudent-recommend-question {
+  text-align: center;
+  height: 25%;
+  display: flex;
+  justify-content: space-around;
+  align-items: center;
+}
+
+/* 추가된 스타일 */
+
+.mainstudent-chart-container {
+  display: flex;
+  flex-wrap: wrap;
+}
+
+.mainstudent-chart-box-container {
+  width: 90%;
+  height: 90%;
+  background-color: white;
+  display: flex;
+  flex-direction: column;
+  justify-content: center;
+  align-items: center;
+  border-radius: 20px;
+  background-color: #ffffff;
+  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* Add this line for shadow */
+}
+
+.mainstudent-gocontent-box-container {
+  width: 90%;
+  height: 90%;
+  display: flex;
+  flex-direction: column;
+  justify-content: center;
+  align-items: center;
+  border-radius: 20px;
+  font-size: 50px;
+  background-color: #ffffff;
+  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* Add this line for shadow */
+}
+
+.mainstudent-chart-box-container h2 {
+  height: 0;
+}
+
+.mainstudent-chart-box {
+  width: 33.3%;
+  height: 50%;
+  display: flex;
+  flex-direction: column;
+  justify-content: center;
+  align-items: center;
+}
+
+.mainstudent-chart-box h2 {
+  text-align: center;
+}
+
+.chart-wrapper {
+  width: 90%;
+  height: 90%;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+}
src/pages/main/MainStudent.jsx
--- src/pages/main/MainStudent.jsx
+++ src/pages/main/MainStudent.jsx
@@ -1,69 +1,181 @@
-import React from "react";
+import React, { useEffect, useState } from "react";
 import { useNavigate } from "react-router-dom";
+import axios from "axios";
 import "./MainStudent.css";
 import AllLineChart from "../../components/chart/AllLineChart";
+import AllBarChart from "../../components/chart/AllBarChart";
 
 const MainStudent = () => {
   const navigate = useNavigate();
+  const [solved, setSolved] = useState([]);
+  const [topTwoKeys, setTopTwoKeys] = useState([]);
+  const [labels, setLabels] = useState([]);
+  const [focusDataset, setFocusDataset] = useState([]);
+  const [understandDataset, setUnderstandDataset] = useState([]);
+  const [wordDataset, setWordDataset] = useState([]);
+  const [grammarDataset, setGrammarDataset] = useState([]);
+  const [sentenceDataset, setSentenceDataset] = useState([]);
+  const [expressionDataset, setExpressionDataset] = useState([]);
+  const [progress, setProgress] = useState(0);
+  const [images, setImages] = useState({
+    동화여행: "fairytravel.png",
+    동화세계: "fairyworld.png",
+    문법요정: "grammerfariy.png",
+    문법랜드: "grammerland.png",
+    문장쑥쑥: "sentenceabsorb.png",
+    문장일기: "sentencediary.png",
+    동요여행: "songtravel.png",
+    동요나라: "songcountry.png",
+    어휘력쑥쑥: "wordabsorb.png",
+    단어뭉치: "wordbundle.png",
+  });
 
-  const datasets = [
-    {
-      label: "어휘",
-      data: [12, 19, 3, 5, 2, 3, 7],
-      borderColor: "rgba(75, 192, 192, 1)",
-      fill: false,
-    },
-    {
-      label: "문법",
-      data: [2, 3, 20, 5, 1, 4, 9],
-      borderColor: "rgba(153, 102, 255, 1)",
-      fill: false,
-    },
-    {
-      label: "문장",
-      data: [3, 10, 13, 15, 22, 30, 25],
-      borderColor: "rgba(255, 159, 64, 1)",
-      fill: false,
-    },
-    {
-      label: "이해",
-      data: [5, 15, 10, 20, 8, 7, 18],
-      borderColor: "rgba(54, 162, 235, 1)",
-      fill: false,
-    },
-    {
-      label: "표현",
-      data: [1, 4, 6, 8, 10, 12, 14],
-      borderColor: "rgba(255, 206, 86, 1)",
-      fill: false,
-    },
-    {
-      label: "집중",
-      data: [9, 7, 6, 4, 3, 2, 1],
-      borderColor: "rgba(75, 192, 192, 0.7)",
-      fill: false,
-    },
-  ];
+  const goContent = () => {
+    navigate("/");
+  };
 
-  const expressionDataset = [
-    {
-      label: "표현",
-      data: [3, 10, 13, 15, 22, 30, 25],
-      borderColor: "rgba(255, 159, 64, 1)",
-      fill: false,
-    },
-  ];
+  const formatDate = (dateString) => {
+    const date = new Date(dateString);
+    const month = String(date.getMonth() + 1).padStart(2, "0");
+    const day = String(date.getDate()).padStart(2, "0");
+    return `${month}-${day}`;
+  };
 
-  const comprehensionDataset = [
-    {
-      label: "이해",
-      data: [5, 15, 10, 20, 8, 7, 18],
-      borderColor: "rgba(54, 162, 235, 1)",
-      fill: false,
-    },
-  ];
+  const fetchSolved = async () => {
+    try {
+      const response = await axios.get(`http://localhost:8080/member/solved`, {
+        withCredentials: true,
+      });
+      console.log(response);
+      if (response.data && response.data.result) {
+        setSolved(response.data.data.length);
+      }
+    } catch (error) {
+      console.error("Error fetching data: ", error);
+    }
+  };
 
-  const progress = 60;
+  const fetchSolvedCount = async () => {
+    try {
+      const response = await axios.get(`http://localhost:8080/solved/count`, {
+        withCredentials: true,
+      });
+      const data = response.data;
+
+      // 객체의 키와 값을 배열로 변환
+      const solvedCounts = Object.entries(data);
+
+      // 값이 큰 순서대로 정렬
+      solvedCounts.sort((a, b) => b[1] - a[1]);
+
+      // 가장 큰 값 세 개의 키 가져오기
+      const [first, second, three] = solvedCounts
+        .slice(0, 3)
+        .map(([key, value]) => key);
+
+      // 상태로 설정
+      setTopTwoKeys([first, second, three]);
+
+      console.log("가장 큰 값 세 개의 키:", first, second, three);
+
+      // 이후에 필요한 로직을 수행하면 됩니다.
+    } catch (error) {
+      console.error("Error fetching data: ", error);
+    }
+  };
+
+  const fetchData = async () => {
+    try {
+      const response = await axios.get(
+        "http://localhost:8080/scorelog/latest",
+        {
+          withCredentials: true,
+        }
+      );
+      console.log(response);
+      const data = response.data;
+
+      const labels = data.map((entry) => formatDate(entry.createdAt));
+      const focusData = data.map((entry) => entry.focus);
+      const understandData = data.map((entry) => entry.understand);
+      const wordData = data.map((entry) => entry.word);
+      const grammarData = data.map((entry) => entry.grammar);
+      const sentenceData = data.map((entry) => entry.sentence);
+      const expressionData = data.map((entry) => entry.expression);
+
+      setLabels(labels);
+      setFocusDataset([
+        {
+          label: "집중",
+          data: focusData,
+          borderColor: "rgba(75, 192, 192, 0.7)",
+          fill: false,
+        },
+      ]);
+      setUnderstandDataset([
+        {
+          label: "이해",
+          data: understandData,
+          borderColor: "rgba(54, 162, 235, 1)",
+          fill: false,
+        },
+      ]);
+      setWordDataset([
+        {
+          label: "어휘",
+          data: wordData,
+          borderColor: "rgba(75, 192, 192, 1)",
+          fill: false,
+        },
+      ]);
+      setGrammarDataset([
+        {
+          label: "문법",
+          data: grammarData,
+          borderColor: "rgba(153, 102, 255, 1)",
+          fill: false,
+        },
+      ]);
+      setSentenceDataset([
+        {
+          label: "문장",
+          data: sentenceData,
+
+          borderColor: "rgba(255, 159, 64, 1)",
+          fill: false,
+        },
+      ]);
+      setExpressionDataset([
+        {
+          label: "표현",
+          data: expressionData,
+          borderColor: "rgba(255, 206, 86, 1)",
+          fill: false,
+        },
+      ]);
+
+      const totalProgress = data.reduce(
+        (acc, cur) =>
+          acc +
+          cur.focus +
+          cur.expression +
+          cur.understand +
+          cur.word +
+          cur.sentence +
+          cur.grammar,
+        0
+      );
+      setProgress(totalProgress / (6 * data.length));
+    } catch (error) {
+      console.error("Error fetching data:", error);
+    }
+  };
+
+  useEffect(() => {
+    fetchSolvedCount();
+    fetchSolved();
+    fetchData();
+  }, []);
 
   const getProgressBarColor = (progress) => {
     if (progress < 30) {
@@ -75,47 +187,111 @@
     }
   };
 
+  const expressionAndUnderstandDatasets = [
+    {
+      label: "이해",
+      data: understandDataset.length ? understandDataset[0].data : [],
+      backgroundColor: "rgba(54, 162, 235, 0.5)",
+    },
+    {
+      label: "표현",
+      data: expressionDataset.length ? expressionDataset[0].data : [],
+      backgroundColor: "rgba(255, 206, 86, 0.5)",
+    },
+  ];
+
   return (
     <>
       <div className="mainstudent-container">
         <div className="mainstudent-chart">
-          <div className="mainstudent-chart-left-container">
-            <div className="mainstudent-chart-all">
-              <AllLineChart datasets={datasets} />
-            </div>
-          </div>
-          <div className="mainstudent-chart-right-container">
-            <div className="mainstudent-chart-three-box">
-              <div className="mainstudent-chart-three-box-chart">
-                <h1 onClick={() => navigate("/")}>학습컨텐츠 가기</h1>
+          <div className="mainstudent-chart-container">
+            <div className="mainstudent-chart-box">
+              <div className="mainstudent-chart-box-container">
+                <h2>집중</h2>
+                <div className="chart-wrapper">
+                  <AllLineChart labels={labels} datasets={focusDataset} />
+                </div>
               </div>
             </div>
-            <div className="mainstudent-chart-three-box">
-              <div className="mainstudent-chart-three-box-chart">
-                <AllLineChart datasets={expressionDataset} />
+            <div className="mainstudent-chart-box">
+              <div className="mainstudent-chart-box-container">
+                <h2>어휘</h2>
+                <div className="chart-wrapper">
+                  <AllLineChart labels={labels} datasets={wordDataset} />
+                </div>
               </div>
             </div>
-            <div className="mainstudent-chart-three-box">
-              <div className="mainstudent-chart-three-box-chart">
-                <AllLineChart datasets={comprehensionDataset} />
+            <div className="mainstudent-chart-box">
+              <div className="mainstudent-chart-box-container">
+                <h2>문법</h2>
+                <div className="chart-wrapper">
+                  <AllLineChart labels={labels} datasets={grammarDataset} />
+                </div>
+              </div>
+            </div>
+            <div className="mainstudent-chart-box">
+              <div className="mainstudent-chart-box-container">
+                <h2>문장</h2>
+                <div className="chart-wrapper">
+                  <AllLineChart labels={labels} datasets={sentenceDataset} />
+                </div>
+              </div>
+            </div>
+            <div className="mainstudent-chart-box">
+              <div className="mainstudent-chart-box-container">
+                <h2>이해와 표현</h2>
+                <div className="chart-wrapper">
+                  <AllBarChart
+                    labels={labels}
+                    datasets={expressionAndUnderstandDatasets}
+                  />
+                </div>
+              </div>
+            </div>
+            <div className="mainstudent-chart-box">
+              <div
+                className="mainstudent-gocontent-box-container"
+                onClick={goContent}
+                style={{ cursor: "pointer" }}
+              >
+                학습 컨텐츠 바로가기
               </div>
             </div>
           </div>
         </div>
+
         <div className="mainstudent-progress-recommend">
           <div className="mainstudent-progress-left-container">
-            진행도
-            <div className="progress-bar-container">
-              <div
-                className="progress-bar"
-                style={{
-                  width: `${progress}%`,
-                  backgroundColor: getProgressBarColor(progress),
-                }}
-              ></div>
+            <div className="mainstudent-progress-bar-container">
+              <div className="progress-bar-container">
+                <div
+                  className="progress-bar"
+                  style={{
+                    width: `${solved * 1.25}%`,
+                    backgroundColor: getProgressBarColor(solved * 1.25),
+                  }}
+                ></div>
+              </div>
+              <div className="mainstudent-progress">
+                진행률 : {solved * 1.25}%
+              </div>
             </div>
           </div>
-          <div className="mainstudent-recommend-right-container">차트세개</div>
+          <div className="mainstudent-recommend-right-container">
+            <div className="mainstudent-recommend-container">
+              <div className="mainstudent-recommend-question">
+                <h2>가장 인기 많은 학습 컨텐츠</h2>
+              </div>
+              <div className="mainstudent-recommend-keys">
+                {topTwoKeys.map((key) => (
+                  <div key={key} className="mainstudent-recommend-key">
+                    <img src={`/images/${images[key]}`} alt={key} />
+                    <span>{key}</span>
+                  </div>
+                ))}
+              </div>
+            </div>
+          </div>
         </div>
       </div>
     </>
 
src/pages/main/MainTeacher.css (added)
+++ src/pages/main/MainTeacher.css
@@ -0,0 +1,230 @@
+.main-teacher-container {
+  width: 80vw;
+  margin: 0 auto;
+  padding: 20px;
+}
+
+.main-teacher-top-container {
+  display: flex;
+  height: 500px;
+  margin-bottom: 20px;
+}
+
+.mainteacher-chart {
+  width: 100%;
+  height: 95%;
+  display: flex;
+  overflow: hidden;
+}
+
+.main-teacher-top-chart {
+  flex: 9;
+  border-radius: 10px;
+  background-color: #ffffff;
+  margin-right: 20px;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+}
+
+.main-teacher-top-buttons {
+  flex: 1;
+  border-radius: 10px;
+}
+
+.main-teacher-top-button {
+  width: 150px;
+  height: 150px;
+  background-color: #ffffff;
+  margin-bottom: 20px;
+  font-size: 24px;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  border-radius: 15px;
+}
+
+.main-teacher-top-button:hover {
+  cursor: pointer;
+}
+
+.main-teacher-next-button {
+  width: 150px;
+  height: 50px;
+  background-color: #ffffff;
+  font-size: 16px;
+  border: none;
+  border-radius: 10px;
+  cursor: pointer;
+}
+
+.mainteacher-left-container {
+  width: 70%;
+  height: 100%;
+  display: flex;
+  justify-content: center;
+  flex-direction: column;
+  align-items: center;
+}
+
+.mainteacher-detail-container {
+  width: 90%;
+  height: 90%;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  flex-direction: column;
+}
+
+.mainteacher-detail-name-container {
+  width: 100%;
+  height: 25%;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+}
+
+.mainteacher-detail-name {
+  width: 100%;
+  height: 80%;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  border-radius: 20px;
+  background-color: #ffffff;
+  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* Add this line for shadow */
+}
+
+.mainteacher-detail-graph-container {
+  width: 100%;
+  height: 50%;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+}
+
+.mainteacher-detail-graph {
+  width: 80%;
+  height: 90%;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* Add this line for shadow */
+  border-radius: 20px;
+  background-color: #ffffff;
+}
+
+.mainteacher-detail-threebutton {
+  width: 20%;
+  height: 90%;
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  flex-direction: column;
+}
+
+.mainteahcer-detail-button {
+  width: 90%;
+  height: 30%;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* Add this line for shadow */
+  border-radius: 20px;
+  background-color: #ffffff;
+}
+
+.mainteacher-detail-comment-container {
+  width: 100%;
+  height: 25%;
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+}
+
+.mainteacher-detail-comment {
+  width: 47%;
+  height: 90%;
+  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* Add this line for shadow */
+  padding: 1% 3%;
+  box-sizing: border-box;
+  border-radius: 20px;
+  background-color: #ffffff;
+}
+
+.mainteacher-detail-comment-input {
+  width: 50%;
+  height: 90%;
+  padding: 1% 3%;
+  box-sizing: border-box;
+  border-radius: 20px;
+  background-color: #ffffff;
+  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* Add this line for shadow */
+}
+
+.mainteacher-detail-comment-input-button {
+  width: 100%;
+  height: 50%;
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+
+  div {
+    width: 25%;
+    height: 80%;
+    box-sizing: border-box;
+    text-align: center;
+    font-size: 20px;
+    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* Add this line for shadow */
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    border-radius: 10px;
+    border: 1px solid;
+  }
+  input {
+    width: 70%;
+    height: 80%;
+    font-size: 20px;
+    box-sizing: border-box;
+    padding: 0 2%;
+    border: none;
+    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* Add this line for shadow */
+    border-radius: 10px;
+    border: 1px solid;
+  }
+}
+
+.mainteacher-right-container {
+  width: 30%;
+  height: 100%;
+  display: flex;
+  flex-direction: column;
+  justify-content: center;
+  align-items: center;
+}
+
+.mainteacher-list-container {
+  width: 90%;
+  height: 90%;
+  display: flex;
+  flex-direction: column;
+  justify-content: flex-start;
+  align-items: center;
+  overflow: auto;
+  scrollbar-width: thin; /* For Firefox */
+  scrollbar-color: #888 #f0f0f0; /* For Firefox */
+}
+
+.mainteacher-list-student {
+  width: 90%;
+  padding: 40px 0px;
+  background-color: #ffffff;
+  border: none;
+  border-radius: 20px;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  margin-top: 4%;
+  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* Add this line for shadow */
+}
 
src/pages/main/MainTeacher.jsx (added)
+++ src/pages/main/MainTeacher.jsx
@@ -0,0 +1,544 @@
+import React, { useEffect, useState } from "react";
+import { useNavigate } from "react-router-dom";
+import axios from "axios";
+import "./MainTeacher.css";
+import AllLineChart from "../../components/chart/AllLineChart";
+import mainBodyImage from "../../assets/mainbody.png";
+
+const MainTeacher = () => {
+  const [sumAverage, setSumAverage] = useState();
+  const [health, setHealth] = useState();
+  const [clickComment, setClickComment] = useState();
+  const [clickStudent, setClickStudent] = useState("이름을 누르세요");
+  const navigate = useNavigate();
+  const [selectedDataset, setSelectedDataset] = useState([]);
+  const [solved, setSolved] = useState([]);
+  const [topTwoKeys, setTopTwoKeys] = useState([]);
+  const [student, setStudent] = useState();
+  const [allDatasets, setAllDatasets] = useState([]);
+  const [datasets, setDatasets] = useState([]);
+  const [labels, setLabels] = useState([]);
+  const [progress, setProgress] = useState(0);
+  const [allDatasets2, setAllDatasets2] = useState([]);
+  const [datasets2, setDatasets2] = useState();
+  const [labels2, setLabels2] = useState([]);
+  const [comment, setComment] = useState();
+  const [onlyStudent, setOnlyStudent] = useState();
+
+  const saveComment = (e) => {
+    setComment(e.target.value);
+    console.log(comment);
+  };
+
+  const sendComment = async () => {
+    console.log(onlyStudent, comment);
+    try {
+      const response = await axios.put(
+        `http://localhost:8080/updateComment`,
+        { id: onlyStudent, comment: comment },
+        {
+          withCredentials: true,
+        }
+      );
+      setClickComment(comment);
+    } catch (error) {
+      console.error("Error fetching data: ", error);
+    }
+  };
+
+  const determineHealthStatus = (studentSum, average) => {
+    const difference = studentSum - average;
+    if (difference >= -50 && difference <= 50) {
+      return "양호";
+    } else if (difference > 50) {
+      return "우수";
+    } else if (difference >= -150) {
+      return "주의";
+    } else {
+      return "경고";
+    }
+  };
+  const getHealthClassName = (status) => {
+    switch (status) {
+      case "양호":
+        return "health-good";
+      case "우수":
+        return "health-excellent";
+      case "주의":
+        return "health-warning";
+      case "경고":
+        return "health-danger";
+      default:
+        return "";
+    }
+  };
+
+  const formatDate = (dateString) => {
+    const date = new Date(dateString);
+    const month = String(date.getMonth() + 1).padStart(2, "0");
+    const day = String(date.getDate()).padStart(2, "0");
+    return `${month}-${day}`;
+  };
+
+  const fetchStudents = async () => {
+    try {
+      const response = await axios.get(`http://localhost:8080/studentAll`, {
+        withCredentials: true,
+      });
+      console.log(response.data);
+      setStudent(response.data);
+    } catch (error) {
+      console.error("Error fetching data: ", error);
+    }
+  };
+
+  const fetchSolvedCount = async () => {
+    try {
+      const response = await axios.get(`http://localhost:8080/solved/count`, {
+        withCredentials: true,
+      });
+      const data = response.data;
+
+      // 객체의 키와 값을 배열로 변환
+      const solvedCounts = Object.entries(data);
+
+      // 값이 큰 순서대로 정렬
+      solvedCounts.sort((a, b) => b[1] - a[1]);
+
+      // 가장 큰 값 두 개의 키 가져오기
+      const [first, second, three] = solvedCounts
+        .slice(0, 3)
+        .map(([key, value]) => key);
+
+      // 상태로 설정
+      setTopTwoKeys([first, second, three]);
+
+      console.log("가장 큰 값 두 개의 키:", first, second, three);
+
+      // 이후에 필요한 로직을 수행하면 됩니다.
+    } catch (error) {
+      console.error("Error fetching data: ", error);
+    }
+  };
+
+  const fetchClickStudent = async (studentId, studentName, studentComment) => {
+    try {
+      setClickStudent(studentName);
+      setClickComment(studentComment);
+      setOnlyStudent(studentId);
+      const response = await axios.get(
+        `http://localhost:8080/scorelog/parents/latest?userId=${studentId}`,
+        {
+          withCredentials: true,
+        }
+      );
+      console.log(response.data);
+
+      let data = response.data;
+
+      // Sort the data by date
+      data.sort((a, b) => new Date(a.createdAt) - new Date(b.createdAt));
+
+      // Format dates and prepare datasets
+      const newLabels = data.map((entry) => formatDate(entry.createdAt));
+      const avgFocusData = data.map((entry) => entry.focus || 0);
+      const avgUnderstandData = data.map((entry) => entry.understand || 0);
+      const avgWordData = data.map((entry) => entry.word || 0);
+      const avgGrammarData = data.map((entry) => entry.grammar || 0);
+      const avgSentenceData = data.map((entry) => entry.sentence || 0);
+      const avgExpressionData = data.map((entry) => entry.expression || 0);
+
+      const newDatasets = [
+        {
+          label: "집중",
+          data: avgFocusData,
+          borderColor: "rgba(75, 192, 192, 0.7)",
+          fill: false,
+        },
+        {
+          label: "이해",
+          data: avgUnderstandData,
+          borderColor: "rgba(54, 162, 235, 1)",
+          fill: false,
+        },
+        {
+          label: "어휘",
+          data: avgWordData,
+          borderColor: "rgba(75, 192, 192, 1)",
+          fill: false,
+        },
+        {
+          label: "문법",
+          data: avgGrammarData,
+          borderColor: "rgba(153, 102, 255, 1)",
+          fill: false,
+        },
+        {
+          label: "문장",
+          data: avgSentenceData,
+          borderColor: "rgba(255, 159, 64, 1)",
+          fill: false,
+        },
+        {
+          label: "표현",
+          data: avgExpressionData,
+          borderColor: "rgba(255, 206, 86, 1)",
+          fill: false,
+        },
+      ];
+
+      setLabels2(newLabels);
+      setAllDatasets2(newDatasets);
+      setDatasets2(newDatasets); // Initially display all datasets
+    } catch (error) {
+      console.error("Error fetching data:", error);
+    }
+  };
+
+  // -----------------------------------------------------------------------------------------------------------------
+  const fetchData = async () => {
+    try {
+      const response = await axios.get(
+        "http://localhost:8080/scorelog/averages/all",
+        {
+          withCredentials: true,
+        }
+      );
+      console.log(response.data);
+      const data = response.data;
+
+      const newLabels = data.map((entry) => formatDate(entry.date));
+      const avgFocusData = data.map((entry) => entry.avgFocus);
+      const avgUnderstandData = data.map((entry) => entry.avgUnderstand);
+      const avgWordData = data.map((entry) => entry.avgWord);
+      const avgGrammarData = data.map((entry) => entry.avgGrammar);
+      const avgSentenceData = data.map((entry) => entry.avgSentence);
+      const avgExpressionData = data.map((entry) => entry.avgExpression);
+
+      const newDatasets = [
+        {
+          label: "집중",
+          data: avgFocusData,
+          borderColor: "rgba(75, 192, 192, 0.7)",
+          fill: false,
+        },
+        {
+          label: "이해",
+          data: avgUnderstandData,
+          borderColor: "rgba(54, 162, 235, 1)",
+          fill: false,
+        },
+        {
+          label: "어휘",
+          data: avgWordData,
+          borderColor: "rgba(75, 192, 192, 1)",
+          fill: false,
+        },
+        {
+          label: "문법",
+          data: avgGrammarData,
+          borderColor: "rgba(153, 102, 255, 1)",
+          fill: false,
+        },
+        {
+          label: "문장",
+          data: avgSentenceData,
+          borderColor: "rgba(255, 159, 64, 1)",
+          fill: false,
+        },
+        {
+          label: "표현",
+          data: avgExpressionData,
+          borderColor: "rgba(255, 206, 86, 1)",
+          fill: false,
+        },
+      ];
+
+      setLabels(newLabels);
+      setAllDatasets(newDatasets);
+      setDatasets(newDatasets); // Initially display all datasets
+      const totalProgress = data.reduce(
+        (acc, cur) =>
+          acc +
+          cur.avgFocus +
+          cur.avgExpression +
+          cur.avgUnderstand +
+          cur.avgWord +
+          cur.avgSentence +
+          cur.avgGrammar,
+        0
+      );
+      setProgress(totalProgress);
+    } catch (error) {
+      console.error("Error fetching data:", error);
+    }
+  };
+
+  useEffect(() => {
+    fetchSolvedCount();
+    fetchData();
+    fetchStudents();
+    fetchSumAverage();
+  }, []);
+
+  const getProgressBarColor = (progress) => {
+    if (progress < 30) {
+      return "red";
+    } else if (progress < 70) {
+      return "orange";
+    } else {
+      return "green";
+    }
+  };
+
+  const showAllDatasets = () => {
+    setDatasets(allDatasets);
+  };
+
+  const showAllDatasets2 = () => {
+    setDatasets2(allDatasets2);
+  };
+
+  const showExpressionAndUnderstanding = () => {
+    setDatasets(
+      allDatasets.filter(
+        (dataset) => dataset.label === "표현" || dataset.label === "이해"
+      )
+    );
+  };
+
+  const showExpressionAndUnderstanding2 = () => {
+    setDatasets2(
+      allDatasets2.filter(
+        (dataset) => dataset.label === "표현" || dataset.label === "이해"
+      )
+    );
+  };
+
+  const showAllStudents = () => {
+    const combinedData = allDatasets[0].data.map((_, index) => {
+      return (
+        allDatasets[0].data[index] +
+        allDatasets[1].data[index] +
+        allDatasets[2].data[index] +
+        allDatasets[3].data[index] +
+        allDatasets[4].data[index] +
+        allDatasets[5].data[index]
+      );
+    });
+
+    const combinedDataset = [
+      {
+        label: "학생 체급 합계",
+        data: combinedData,
+        borderColor: "rgba(255, 99, 132, 1)",
+        fill: false,
+      },
+    ];
+
+    setDatasets(combinedDataset);
+  };
+
+  const showAllStudents2 = () => {
+    const combinedData = allDatasets2[0].data.map((_, index) => {
+      return (
+        allDatasets2[0].data[index] +
+        allDatasets2[1].data[index] +
+        allDatasets2[2].data[index] +
+        allDatasets2[3].data[index] +
+        allDatasets2[4].data[index] +
+        allDatasets2[5].data[index]
+      );
+    });
+
+    const combinedDataset = [
+      {
+        label: "학생 체급 합계",
+        data: combinedData,
+        borderColor: "rgba(255, 99, 132, 1)",
+        fill: false,
+      },
+    ];
+
+    setDatasets2(combinedDataset);
+  };
+  const fetchSumAverage = async () => {
+    try {
+      const response = await axios.get(
+        "http://localhost:8080/average-total-score",
+        {
+          withCredentials: true,
+        }
+      );
+      console.log(response.data.averageTotalScore);
+      setSumAverage(response.data.averageTotalScore);
+    } catch (error) {
+      console.error("Error fetching data:", error);
+    }
+  };
+  useEffect(() => {
+    // 체급을 결정할 때 사용될 함수
+    if (student && sumAverage) {
+      const healthStatus = determineHealthStatus(student.sum, sumAverage);
+      setHealth(healthStatus);
+    }
+  }, [student, sumAverage]);
+  return (
+    <>
+      <div
+        className="mainstudent-container1"
+        style={{
+          backgroundImage: `url(${mainBodyImage})`,
+          backgroundSize: "cover",
+          backgroundPosition: "center",
+          backgroundRepeat: "no-repeat",
+        }}
+      >
+        <div className="mainstudent-container-one">
+          <h2 style={{ textAlign: "center", marginBottom: "0" }}>
+            담당하는 학생들의 평균 역량
+          </h2>
+          <div className="mainteacher-chart">
+            <div className="mainstudent-chart-left-container">
+              <div className="mainstudent-chart-all">
+                <AllLineChart labels={labels} datasets={datasets} />
+              </div>
+            </div>
+            <div className="mainstudent-chart-right-container">
+              <div className="mainstudent-chart-three-box">
+                <div
+                  className="mainstudent-chart-three-box-chart"
+                  onClick={showAllStudents}
+                >
+                  <h1>우리반 체급 보기</h1>
+                </div>
+              </div>
+              <div className="mainstudent-chart-three-box">
+                <div
+                  className="mainstudent-chart-three-box-chart"
+                  onClick={showAllDatasets}
+                >
+                  <h1>우리반 전체 요소</h1>
+                </div>
+              </div>
+              <div className="mainstudent-chart-three-box">
+                <div
+                  className="mainstudent-chart-three-box-chart"
+                  onClick={showExpressionAndUnderstanding}
+                >
+                  <h1>표현과 이해</h1>
+                </div>
+              </div>
+            </div>
+          </div>
+        </div>
+        <div className="mainstudent-container-two">
+          <div className="mainteacher-left-container">
+            <h2 style={{ margin: "0px" }}>학생 정보</h2>
+            <div className="mainteacher-detail-container">
+              <div className="mainteacher-detail-name-container">
+                <div className="mainteacher-detail-name">
+                  <h1>{clickStudent}</h1>
+                </div>
+              </div>
+              <div className="mainteacher-detail-graph-container">
+                <div className="mainteacher-detail-graph">
+                  {datasets2 && (
+                    <AllLineChart labels={labels2} datasets={datasets2} />
+                  )}
+                </div>
+                <div className="mainteacher-detail-threebutton">
+                  {onlyStudent ? (
+                    <>
+                      <div
+                        className="mainteahcer-detail-button"
+                        onClick={showAllStudents2}
+                      >
+                        체급보기
+                      </div>
+                      <div
+                        className="mainteahcer-detail-button"
+                        onClick={showAllDatasets2}
+                      >
+                        전체요소
+                      </div>
+                      <div
+                        className="mainteahcer-detail-button"
+                        onClick={showExpressionAndUnderstanding2}
+                      >
+                        표현과이해
+                      </div>
+                    </>
+                  ) : (
+                    <>
+                      <div className="mainteahcer-detail-button">체급보기</div>
+                      <div className="mainteahcer-detail-button">전체요소</div>
+                      <div className="mainteahcer-detail-button">
+                        표현과이해
+                      </div>
+                    </>
+                  )}
+                </div>
+              </div>
+              <div className="mainteacher-detail-comment-container">
+                <div className="mainteacher-detail-comment">
+                  {clickComment && (
+                    <>
+                      <h3>선생님의 한말씀</h3>
+                      {clickComment}
+                    </>
+                  )}
+                </div>
+                <div className="mainteacher-detail-comment-input">
+                  {clickComment ? (
+                    <h3>{clickStudent}에게 코멘트</h3>
+                  ) : (
+                    <h3>코멘트</h3>
+                  )}
+                  <div className="mainteacher-detail-comment-input-button">
+                    <input type="text" onChange={saveComment} />
+                    <div onClick={sendComment}>코멘트달기</div>
+                  </div>
+                </div>
+              </div>
+            </div>
+          </div>
+          <div className="mainteacher-right-container">
+            <h2 style={{ margin: "0px" }}>학생 리스트</h2>
+            <div className="mainteacher-list-container">
+              {student &&
+                student.map((student, index) => {
+                  return (
+                    <>
+                      <div
+                        className="mainteacher-list-student"
+                        onClick={() =>
+                          fetchClickStudent(
+                            student.id,
+                            student.name,
+                            student.comment
+                          )
+                        }
+                      >
+                        <h2>{student.name}</h2>
+
+                        <div
+                          className={`mainstudent-student-information ${getHealthClassName(
+                            determineHealthStatus(student.sum, sumAverage)
+                          )}`}
+                        >
+                          {determineHealthStatus(student.sum, sumAverage)}
+                        </div>
+                      </div>
+                    </>
+                  );
+                })}
+            </div>
+          </div>
+        </div>
+      </div>
+    </>
+  );
+};
+
+export default MainTeacher;
 
src/pages/main/MainTeacher2.css (added)
+++ src/pages/main/MainTeacher2.css
@@ -0,0 +1,94 @@
+.main-teacher-container-2 {
+  width: 80vw;
+  margin: 0 auto;
+  padding: 20px;
+}
+
+.main-teacher-top-container-2 {
+  display: flex;
+  height: 700px;
+  margin-bottom: 20px;
+}
+
+.main-student-top-chart-2 {
+  border-radius: 10px;
+  background-color: #ffffff;
+  margin-right: 20px;
+  display: flex;
+  flex-direction: column;
+  justify-content: center;
+  align-items: center;
+}
+
+.main-student-comment-container {
+  display: flex;
+  margin-top: 20px;
+  height: 100px;
+  width: 100%;
+}
+
+.main-student-comment {
+  width: 80%;
+  background-color: #ffffff;
+  margin: 0 10px;
+  border-radius: 10px;
+  padding: 10px;
+  font-size: large;
+}
+
+.main-student-comment-button {
+  width: 20%;
+  background-color: #ffffff;
+  margin: 0 10px;
+  border-radius: 10px;
+  padding: 10px;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  font-size: 20px;
+}
+
+.main-student-comment-button:hover {
+  cursor: pointer;
+}
+
+.main-student-top-buttons-2 {
+  flex: 1;
+}
+
+.main-student-top-button {
+  width: 150px;
+  height: 150px;
+  background-color: #ffffff;
+  margin-bottom: 20px;
+  font-size: 24px;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  border-radius: 15px;
+}
+
+.main-student-top-button:hover {
+  cursor: pointer;
+}
+
+.main-student-list {
+  flex: 3;
+  margin-left: 20px;
+  border-radius: 20px;
+  background-color: #ffffff;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+}
+
+.main-student-name {
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  background-color: #e6daff;
+  width: 90%;
+  height: 50px;
+  margin: 10px 0;
+  border-radius: 20px;
+}
 
src/pages/main/MainTeacher2.jsx (added)
+++ src/pages/main/MainTeacher2.jsx
@@ -0,0 +1,124 @@
+import React, { useState } from "react";
+import "./MainTeacher2.css";
+import AllLineChart from "../../components/chart/AllLineChart";
+
+const MainTeacher2 = () => {
+  const datasets = [
+    {
+      label: "어휘",
+      data: [12, 19, 3, 5, 2, 3, 7],
+      borderColor: "rgba(75, 192, 192, 1)",
+      fill: false,
+    },
+    {
+      label: "문법",
+      data: [2, 3, 20, 5, 1, 4, 9],
+      borderColor: "rgba(153, 102, 255, 1)",
+      fill: false,
+    },
+    {
+      label: "문장",
+      data: [3, 10, 13, 15, 22, 30, 25],
+      borderColor: "rgba(255, 159, 64, 1)",
+      fill: false,
+    },
+    {
+      label: "이해",
+      data: [5, 15, 10, 20, 8, 7, 18],
+      borderColor: "rgba(54, 162, 235, 1)",
+      fill: false,
+    },
+    {
+      label: "표현",
+      data: [1, 4, 6, 8, 10, 12, 14],
+      borderColor: "rgba(255, 206, 86, 1)",
+      fill: false,
+    },
+    {
+      label: "집중",
+      data: [9, 7, 6, 4, 3, 2, 1],
+      borderColor: "rgba(75, 192, 192, 0.7)",
+      fill: false,
+    },
+  ];
+
+  const expressionDataset = [
+    {
+      label: "표현",
+      data: [3, 10, 13, 15, 22, 30, 25],
+      borderColor: "rgba(255, 159, 64, 1)",
+      fill: false,
+    },
+  ];
+
+  const comprehensionDataset = [
+    {
+      label: "이해",
+      data: [5, 15, 10, 20, 8, 7, 18],
+      borderColor: "rgba(54, 162, 235, 1)",
+      fill: false,
+    },
+  ];
+
+  const [selectedDataset, setSelectedDataset] = useState(datasets);
+  const handleButtonClick = (dataset) => {
+    switch (dataset) {
+      case "전체성적":
+        setSelectedDataset(datasets);
+        break;
+      case "이해성적":
+        setSelectedDataset(comprehensionDataset);
+        break;
+      case "표현성적":
+        setSelectedDataset(expressionDataset);
+        break;
+      default:
+        setSelectedDataset(datasets);
+        break;
+    }
+  };
+
+  return (
+    <div className="main-teacher-container-2">
+      <h2>교사 전용 페이지</h2>
+      <div className="main-teacher-top-container-2">
+        <div className="main-student-top-chart-2">
+          <h2>이기창 학생</h2>
+          <AllLineChart datasets={selectedDataset} />
+          <div className="main-student-comment-container">
+            <input className="main-student-comment"></input>
+            <button className="main-student-comment-button">댓글달기</button>
+          </div>
+        </div>
+        <div className="main-teacher-top-buttons-2">
+          <div
+            className="main-teacher-top-button"
+            onClick={() => handleButtonClick("전체성적")}
+          >
+            전체성적
+          </div>
+          <div
+            className="main-teacher-top-button"
+            onClick={() => handleButtonClick("이해성적")}
+          >
+            이해성적
+          </div>
+          <div
+            className="main-teacher-top-button"
+            onClick={() => handleButtonClick("표현성적")}
+          >
+            표현성적
+          </div>
+        </div>
+        <div className="main-student-list">
+          <div className="main-student-name">이기창</div>
+          <div className="main-student-name">전승기</div>
+          <div className="main-student-name">정채연</div>
+          <div className="main-student-name">권상웅</div>
+        </div>
+      </div>
+    </div>
+  );
+};
+
+export default MainTeacher2;
 
src/pages/main/MainTeacher3.css (added)
+++ src/pages/main/MainTeacher3.css
@@ -0,0 +1,95 @@
+.main-teacher-container-2 {
+  width: 80vw;
+  margin: 0 auto;
+  padding: 20px;
+}
+
+.main-teacher-top-container-2 {
+  display: flex;
+  height: 700px;
+  margin-bottom: 20px;
+}
+
+.main-student-top-chart-2 {
+  flex: 7;
+  border-radius: 10px;
+  background-color: #ffffff;
+  margin-right: 20px;
+  display: flex;
+  flex-direction: column;
+  justify-content: center;
+  align-items: center;
+}
+
+.main-student-comment-container {
+  display: flex;
+  margin-top: 20px;
+  height: 100px;
+  width: 100%;
+}
+
+.main-student-comment {
+  width: 80%;
+  background-color: #ffffff;
+  margin: 0 10px;
+  border-radius: 10px;
+  padding: 10px;
+  font-size: large;
+}
+
+.main-student-comment-button {
+  width: 20%;
+  background-color: #ffffff;
+  margin: 0 10px;
+  border-radius: 10px;
+  padding: 10px;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  font-size: 20px;
+}
+
+.main-student-comment-button:hover {
+  cursor: pointer;
+}
+
+.main-student-top-buttons-2 {
+  flex: 1;
+}
+
+.main-student-top-button {
+  width: 150px;
+  height: 150px;
+  background-color: #ffffff;
+  margin-bottom: 20px;
+  font-size: 24px;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  border-radius: 15px;
+}
+
+.main-student-top-button:hover {
+  cursor: pointer;
+}
+
+.main-student-list {
+  flex: 3;
+  margin-left: 20px;
+  border-radius: 20px;
+  background-color: #ffffff;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+}
+
+.main-student-name {
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  background-color: #e6daff;
+  width: 90%;
+  height: 50px;
+  margin: 10px 0;
+  border-radius: 20px;
+}
 
src/pages/main/MainTeacher3.jsx (added)
+++ src/pages/main/MainTeacher3.jsx
@@ -0,0 +1,125 @@
+import React, { useState } from "react";
+import "./MainTeacher.css";
+import AllLineChart from "../../components/chart/AllLineChart";
+import { useNavigate } from "react-router-dom";
+
+const MainTeacher3 = () => {
+  const navigate = useNavigate();
+  const datasets = [
+    {
+      label: "어휘",
+      data: [12, 19, 3, 5, 2, 3, 7],
+      borderColor: "rgba(75, 192, 192, 1)",
+      fill: false,
+    },
+    {
+      label: "문법",
+      data: [2, 3, 20, 5, 1, 4, 9],
+      borderColor: "rgba(153, 102, 255, 1)",
+      fill: false,
+    },
+    {
+      label: "문장",
+      data: [3, 10, 13, 15, 22, 30, 25],
+      borderColor: "rgba(255, 159, 64, 1)",
+      fill: false,
+    },
+    {
+      label: "이해",
+      data: [5, 15, 10, 20, 8, 7, 18],
+      borderColor: "rgba(54, 162, 235, 1)",
+      fill: false,
+    },
+    {
+      label: "표현",
+      data: [1, 4, 6, 8, 10, 12, 14],
+      borderColor: "rgba(255, 206, 86, 1)",
+      fill: false,
+    },
+    {
+      label: "집중",
+      data: [9, 7, 6, 4, 3, 2, 1],
+      borderColor: "rgba(75, 192, 192, 0.7)",
+      fill: false,
+    },
+  ];
+
+  const expressionDataset = [
+    {
+      label: "표현",
+      data: [3, 10, 13, 15, 22, 30, 25],
+      borderColor: "rgba(255, 159, 64, 1)",
+      fill: false,
+    },
+  ];
+
+  const comprehensionDataset = [
+    {
+      label: "이해",
+      data: [5, 15, 10, 20, 8, 7, 18],
+      borderColor: "rgba(54, 162, 235, 1)",
+      fill: false,
+    },
+  ];
+
+  const [selectedDataset, setSelectedDataset] = useState(datasets);
+  const handleButtonClick = (dataset) => {
+    switch (dataset) {
+      case "전체성적":
+        setSelectedDataset(datasets);
+        break;
+      case "이해성적":
+        setSelectedDataset(comprehensionDataset);
+        break;
+      case "표현성적":
+        setSelectedDataset(expressionDataset);
+        break;
+      default:
+        setSelectedDataset(datasets);
+        break;
+    }
+  };
+
+  const handleNextPageClick = () => {
+    navigate("/mainTeacher2");
+  };
+
+  return (
+    <div className="main-teacher-container">
+      <h2>교사 전용 페이지</h2>
+      <div className="main-teacher-top-container">
+        <div className="main-teacher-top-chart">
+          <AllLineChart datasets={selectedDataset} />
+        </div>
+        <div className="main-teacher-top-buttons">
+          <div
+            className="main-teacher-top-button"
+            onClick={() => handleButtonClick("전체성적")}
+          >
+            전체성적
+          </div>
+          <div
+            className="main-teacher-top-button"
+            onClick={() => handleButtonClick("이해성적")}
+          >
+            이해성적
+          </div>
+          <div
+            className="main-teacher-top-button"
+            onClick={() => handleButtonClick("표현성적")}
+          >
+            표현성적
+          </div>
+          <button
+            className="main-teacher-next-button"
+            onClick={handleNextPageClick}
+          >
+            다음 페이지로
+          </button>
+        </div>
+      </div>
+    </div>
+  );
+};
+
+export default MainTeacher3;
src/pages/main/mainp.jsx
--- src/pages/main/mainp.jsx
+++ src/pages/main/mainp.jsx
@@ -5,8 +5,10 @@
 import AbilitiesChart from "../../components/chart/AbilitiesChart";
 import axios from "axios";
 import { useCookies } from "react-cookie";
+import { useNavigate } from "react-router-dom";
 const MainP = () => {
   const [cookies, setCookie, removeCookie] = useCookies(["loggedIn"]);
+  const navigate = useNavigate();
   const [currentStep, setCurrentStep] = useState(1);
   const [abilities, setAbilities] = useState([
     { name: "어휘", level: 50 },
@@ -41,6 +43,13 @@
       const response = await axios.get(`http://localhost:8080/rating`, {
         withCredentials: true,
       });
+      const responseData = response.data.data; // response.data는 이미 JavaScript 객체로 사용 가능합니다.
+      const role = responseData.role;
+      if (role == "parent") {
+        navigate("/mainParent");
+      } else {
+        navigate("/");
+      }
       if (response.data && response.data.result) {
         setAbilities(transformData(response.data.data));
       }
@@ -49,7 +58,27 @@
       console.error("Error fetching data: ", error);
     }
   };
+
   useEffect(() => {
+    fetchData();
+  }, []);
+  // 사용자 입력을 저장할 state 초기화
+  const [comment, setComment] = useState(
+    "어서와~ 꿈 속 우주공간은 처음이지? 여행하고 싶은 행성을 골라봐~"
+  );
+
+  useEffect(() => {
+    const fetchData = async () => {
+      try {
+        const response = await axios.get("http://localhost:8080/member", {
+          withCredentials: true,
+        });
+        console.log(response);
+        setComment(response.data.data.comment);
+      } catch (error) {
+        console.error("Error fetching data:", error);
+      }
+    };
     fetchData();
   }, []);
   return (
@@ -58,7 +87,7 @@
         <div className="mainp-left-top">
           <img src="/images/good.png" className="mainp-left-img" />
           <div className="mainp-left-top-div">
-            어서와~ 꿈 속 우주공간은 처음이지? 여행하고 싶은 행성을 골라봐~
+            {comment}
             <div className="bubble-tail"></div>
           </div>
         </div>
Add a comment
List