-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #72 from sayyyho/dev
Fix: 각종수정
- Loading branch information
Showing
2 changed files
with
80 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,71 @@ | ||
import React from "react"; | ||
import {useLocation, useNavigate} from "react-router-dom"; | ||
import { useLocation } from "react-router-dom"; | ||
import * as style from "./styled/EvaluationPage.style.js"; | ||
import { Header } from "../../components/Header/Header.jsx"; | ||
import { DoughnutChartComponent } from "./DoughnutChart.jsx"; | ||
import { ProgressBar } from "./BarChart.jsx"; | ||
|
||
export const EvaluationPage = () => { | ||
const location = useLocation(); | ||
const navigate = useNavigate(); | ||
const handleNavigate = (path) => { | ||
navigate(path); | ||
}; | ||
const location = useLocation(); | ||
|
||
const mockData = [ | ||
{ | ||
person: '홍창기', | ||
date: '2024.09.07', | ||
pieData: { '응': 10, '그래': 9, '가보자고': 8, '싫어': 7 ,'먹자': 4}, | ||
score: { positive: 50, neutral: 20, negative: 30 }, | ||
result: { message: "이번 채팅은 누가 고집이 더 셌어요 그만 좀 부리세요." } | ||
}, | ||
{ | ||
person: '문보경', | ||
date: '2024.09.07', | ||
pieData: { '좋다': 7, '사랑해': 10, '잘자': 6, '안녕': 9, '할것이다': 8 }, | ||
score: { positive: 60, neutral: 25, negative: 15 }, | ||
result: { message: "긍정적인 대화가 많았습니다!" } | ||
}, | ||
{ | ||
person: '김현수', | ||
date: '2024.09.07', | ||
pieData: { '꺼져': 9, '새끼': 8, '싫어': 7, '그만해': 6 ,'개':2}, | ||
score: { positive: 40, neutral: 30, negative: 30 }, | ||
result: { message: "대화가 약간 부정적이었습니다." } | ||
} | ||
]; | ||
const mockData = [ | ||
{ | ||
person: "홍창기", | ||
date: "2024.09.07", | ||
pieData: { 응: 10, 그래: 9, 가보자고: 8, 싫어: 7, 먹자: 4 }, | ||
score: { positive: 50, neutral: 20, negative: 30 }, | ||
result: { | ||
message: "이번 채팅은 누가 고집이 더 셌어요 그만 좀 부리세요.", | ||
}, | ||
}, | ||
{ | ||
person: "문보경", | ||
date: "2024.09.07", | ||
pieData: { 좋다: 7, 사랑해: 10, 잘자: 6, 안녕: 9, 할것이다: 8 }, | ||
score: { positive: 60, neutral: 25, negative: 15 }, | ||
result: { message: "긍정적인 대화가 많았습니다!" }, | ||
}, | ||
{ | ||
person: "김현수", | ||
date: "2024.09.07", | ||
pieData: { 꺼져: 9, 새끼: 8, 싫어: 7, 그만해: 6, 개: 2 }, | ||
score: { positive: 40, neutral: 30, negative: 30 }, | ||
result: { message: "대화가 약간 부정적이었습니다." }, | ||
}, | ||
]; | ||
|
||
const { person = "익명" } = location.state || {}; | ||
const selectedData = mockData.find((data) => data.person === person) || {}; | ||
const { person = "익명" } = location.state || {}; | ||
const selectedData = mockData.find((data) => data.person === person) || {}; | ||
|
||
const { pieData = {}, score = { positive: 0, neutral: 0, negative: 0 }, result = { message: "" }, date = "알 수 없음" } = selectedData; | ||
console.log('전달할',mockData); | ||
return ( | ||
<style.Frame> | ||
<style.Wrapper> | ||
<Header color={"#1B536B"}> | ||
<h3>{`${person}`} 님과의 대화 평가</h3> | ||
const { | ||
pieData = {}, | ||
score = { positive: 0, neutral: 0, negative: 0 }, | ||
result = { message: "" }, | ||
date = "알 수 없음", | ||
} = selectedData; | ||
console.log("전달할", mockData); | ||
return ( | ||
<style.Frame> | ||
<style.Wrapper> | ||
<Header color={"#1B536B"} isBack={true}> | ||
<h2>{`${person}`} 님과의 대화 평가</h2> | ||
</Header> | ||
|
||
<style.HomeButton onClick={() => handleNavigate("/home")}>홈으로 이동</style.HomeButton> | ||
</Header> | ||
<style.ScrollWrapper> | ||
<style.ContentWrapper> | ||
<h3>{`${date} 대화 분석`}</h3> | ||
<style.ContentWrapper> | ||
<h3>{`${date} 대화 분석`}</h3> | ||
|
||
<DoughnutChartComponent pieData={pieData} /> | ||
<style.SecondWrapper> | ||
<ProgressBar | ||
positive={score.positive} | ||
neutral={score.neutral} | ||
negative={score.negative} | ||
/> | ||
</style.SecondWrapper> | ||
|
||
<DoughnutChartComponent pieData={pieData}/> | ||
<style.SecondWrapper> | ||
<ProgressBar positive={score.positive} neutral={score.neutral} negative={score.negative}/> | ||
</style.SecondWrapper> | ||
|
||
|
||
<style.ThirdWrapper> | ||
{result.message} | ||
</style.ThirdWrapper> | ||
</style.ContentWrapper> | ||
</style.ScrollWrapper> | ||
|
||
|
||
</style.Wrapper> | ||
</style.Frame> | ||
); | ||
<style.ThirdWrapper>{result.message}</style.ThirdWrapper> | ||
</style.ContentWrapper> | ||
</style.Wrapper> | ||
</style.Frame> | ||
); | ||
}; |