Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
saa00123 committed Sep 4, 2023
1 parent 7c0883a commit 4784848
Show file tree
Hide file tree
Showing 6 changed files with 272 additions and 123 deletions.
11 changes: 9 additions & 2 deletions front/src/components/graph/AnalysisContribute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,17 @@ import {
PolarAngleAxis,
ResponsiveContainer,
} from "recharts";
import { useUser } from "../frames/token/UserContext";
import refresh from "../../images/refresh.png";
import mainData from "./GraphData/mainData";
import subData1 from "./GraphData/subData1";

function AnaylsisContribute() {
const [user] = useUser();
const currentNickname = user ? user.nickname : "Guest";

const activeData = currentNickname === "최정훈" ? mainData : subData1;

return (
<div className='flex flex-col bg-white w-[1000px] h-[400px] border'>
<div className='flex justify-between items-center p-5 h-[50px] bg-[#6A6A6A]'>
Expand All @@ -23,7 +30,7 @@ function AnaylsisContribute() {
<div className='flex m-auto w-[1000px] h-[500px]'>
<div className='m-auto w-[500px] h-[300px]'>
<ResponsiveContainer width='100%' height='100%'>
<RadarChart cx='50%' cy='50%' outerRadius='80%' data={mainData}>
<RadarChart cx='50%' cy='50%' outerRadius='80%' data={activeData}>
<PolarGrid />
<PolarAngleAxis dataKey='subject' />
<Radar
Expand All @@ -37,7 +44,7 @@ function AnaylsisContribute() {
</ResponsiveContainer>
</div>
<div className='flex flex-col justify-center items-start space-y-2 w-[400px] p-2 m-auto'>
{mainData.map((item) => (
{activeData.map((item) => (
<p key={item.subject}>
{item.subject} : {item.A}P
</p>
Expand Down
17 changes: 11 additions & 6 deletions front/src/components/graph/CompareGraph.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* eslint-disable no-unsafe-optional-chaining */
/* eslint-disable no-nested-ternary */
/* eslint-disable no-plusplus */
/* eslint-disable no-restricted-syntax */
/* eslint-disable no-unsafe-optional-chaining */
import React, { useState, useEffect } from "react";
import {
Radar,
Expand All @@ -10,6 +9,7 @@ import {
PolarAngleAxis,
ResponsiveContainer,
} from "recharts";
import { useUser } from "../frames/token/UserContext";
import refresh from "../../images/refresh.png";
import mainData from "./GraphData/mainData";
import subData1 from "./GraphData/subData1";
Expand Down Expand Up @@ -48,28 +48,33 @@ function CompareGraph() {
const [averages, setAverages] = useState<AverageData>({});
const [chartData, setChartData] = useState<any[]>([]);

const [user] = useUser();
const currentNickname = user ? user.nickname : "Guest";

useEffect(() => {
const activeData = currentNickname === "최정훈" ? mainData : subData1;

const newAverages: AverageData = {};
for (const item of mainData) {
for (const item of activeData) {
const average = calculateSubjectAverage(
[mainData, subData1, subData2],
item.subject
);
newAverages[item.subject] = {
main: calculateSubjectAverage([mainData], item.subject),
main: calculateSubjectAverage([activeData], item.subject),
sub1: calculateSubjectAverage([subData1], item.subject),
sub2: calculateSubjectAverage([subData2], item.subject),
average,
};
}
setAverages(newAverages);

const calculatedChartData = mainData.map((data) => ({
const calculatedChartData = activeData.map((data) => ({
...data,
average: newAverages[data.subject]?.average || 0,
}));
setChartData(calculatedChartData);
}, []);
}, [currentNickname]);

const getWarningMessage = () => {
const subjectsBelowAverage = Object.keys(averages).filter(
Expand Down
20 changes: 10 additions & 10 deletions front/src/components/main/CheckListBox.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import { NavLink } from 'react-router-dom';
import refresh from '../../images/refresh.png';
import taskImg from '../../images/rightarrow.png';
import progressImg from '../../images/minichart.png';
import React from "react";
import { NavLink } from "react-router-dom";
import refresh from "../../images/refresh.png";
import taskImg from "../../images/rightarrow.png";
import progressImg from "../../images/minichart.png";

function CheckListBox() {
return (
Expand Down Expand Up @@ -32,27 +32,27 @@ function CheckListBox() {
</NavLink>
</div>
<div className='flex justify-start items-center space-x-6 mb-2'>
<div className='text-lg'>스프린트12</div>
<div className='text-lg'>예시 스프린트</div>
<div className='flex text-[15px]'>
<img
className='w-[24px] h-[24px] mr-2'
alt='progressImg'
src={progressImg}
/>
67%
50%
</div>
</div>
<div className='flex flex-col justify-start items-start bg-white rounded-[10px] w-[350px] h-[200px] mb-2'>
<div className='flex justify-between items-center border p-3 w-full text-sm rounded-t-[10px]'>
<p>최종 데모</p>
<p>5차 발표</p>
<p>30P</p>
</div>
<div className='flex justify-between items-center border p-3 w-full text-sm'>
<p>sample</p>
<p>최정훈</p>
<p>개발, 커뮤니케이션</p>
</div>
<div className='flex justify-between items-start border p-3 w-full h-full text-sm rounded-b-[10px]'>
<p>최종 데모 체크</p>
<p>5차 발표 데모 준비</p>
</div>
</div>
</li>
Expand Down
2 changes: 1 addition & 1 deletion front/src/components/main/DailyCalendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ const eventStyleGetter = (

const DailyCalendar: React.FC = () => {
const [currentMonth, setCurrentMonth] = useState<Date>(
moment().subtract(1, "months").toDate() // 이전 달로 설정
moment().subtract(0, "months").toDate()
);

const handleNavigate = (date: Date) => {
Expand Down
30 changes: 15 additions & 15 deletions front/src/pages/sprint/Sprint.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { useState, useEffect } from 'react';
import axios from 'axios';
import { NavLink } from 'react-router-dom';
import moveImg from '../../images/login.png';
import Menu from '../../components/frames/Side/Sidebar';
import MiniChart from '../../images/minichart.png';
import React, { useState, useEffect } from "react";
import axios from "axios";
import { NavLink } from "react-router-dom";
import moveImg from "../../images/login.png";
import Menu from "../../components/frames/Side/Sidebar";
import MiniChart from "../../images/minichart.png";

interface Leader {
id: number;
Expand Down Expand Up @@ -34,7 +34,7 @@ function Sprint() {
useEffect(() => {
async function fetchData(): Promise<void> {
try {
const response = await axios.get<SprintData[]>('sprints?project-id=3');
const response = await axios.get<SprintData[]>("sprints?project-id=3");
setSprintData(response.data);
console.log(response.data, response.status);
} catch (error) {
Expand All @@ -45,7 +45,7 @@ function Sprint() {
}, []);

const activeStyle = {
background: '#D8F1FF',
background: "#D8F1FF",
};

return (
Expand All @@ -63,16 +63,16 @@ function Sprint() {
key={sprintData.id}
>
<div className='mr-5'>스프린트{sprintData.round}(10days)</div>
|{' '}
|{" "}
<div className='mr-5 ml-5'>
{sprintData.startDate}~{sprintData.endDate}
</div>{' '}
</div>{" "}
|
<img
className='w-[15px] h-[15px] mr-5'
alt='MiniChart'
src={MiniChart}
/>{' '}
/>{" "}
100%
<NavLink
className='flex justify-center items-center ml-auto w-[60px] h-[40px] rounded-[10px] bg-[#4A4A4A] text-white'
Expand All @@ -89,14 +89,14 @@ function Sprint() {
))
: null}
<li className='flex justify-start pl-4 items-center m-auto w-[850px] h-[50px] bg-white border p-2'>
<div className='mr-5'>스프린트12(10days)</div> |
<div className='mr-5 ml-5'>2023-06-19~2023-06-28 </div>|
<div className='mr-5'>예시 스프린트(10days)</div> |
<div className='mr-5 ml-5'>2023-09-01~2023-09-07 </div>|
<img
className='w-[15px] h-[15px] ml-5'
alt='MiniChart'
src={MiniChart}
/>{' '}
67%
/>{" "}
50%
<NavLink
className='flex justify-center items-center ml-auto w-[60px] h-[40px] rounded-[10px] bg-[#4A4A4A] text-white'
style={({ isActive }) => (isActive ? activeStyle : {})}
Expand Down
Loading

0 comments on commit 4784848

Please sign in to comment.