diff --git a/src/App.js b/src/App.js
index 997016a..9d0efbb 100644
--- a/src/App.js
+++ b/src/App.js
@@ -36,51 +36,51 @@ export const FormHandlingContext = React.createContext();
export const AuthContext = React.createContext();
function App() {
- return (
-
-
-
-
-
-
-
- }>
- } />
- } />
- }>
- } />
- } />
- } />
- } />
-
- } />
- } />
- } />
- } />
- } />
- } />
- } />
- } />
- } />
- } />
- } />
-
-
-
-
-
-
-
- );
+ return (
+
+
+
+
+
+
+
+ }>
+ } />
+ } />
+ }>
+ } />
+ } />
+ } />
+ } />
+
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+
+
+
+
+
+
+
+ );
}
export default App;
diff --git a/src/components/SurveyList/SurveyListItem.js b/src/components/SurveyList/SurveyListItem.js
index fc8db7b..5a17bd6 100644
--- a/src/components/SurveyList/SurveyListItem.js
+++ b/src/components/SurveyList/SurveyListItem.js
@@ -7,82 +7,82 @@ import { SurveyContext } from "../../services/survey/survey.context";
import { AuthenticationContext } from "../../services/authentication/authentication.context";
export const SurveyListItem = (props) => {
- const navigate = useNavigate();
- // console.log(props);
- const { GetMyAnswer } = useContext(SurveyContext);
- const { userData, userToken } = useContext(AuthenticationContext);
+ const navigate = useNavigate();
+ // console.log(props);
+ const { GetMyAnswer } = useContext(SurveyContext);
+ const { userData, userToken } = useContext(AuthenticationContext);
- const handleClick = async () => {
- if (props.surveyType === "AB" && (props.type === "post" || props.type === "allpost")) {
- navigate(`/post/${props.id}`, { state: { id: props.id } });
- } else if (props.surveyType === "AB") {
- navigate(`/createAvsB/`, { state: { id: props.id } });
- } else if (props.type === "answered") {
- const myAnswer = await GetMyAnswer(props.id, userToken);
- console.log("my answer: ", myAnswer);
- navigate(`/survey/${props.id}`, { state: { forCheck: true, myAnswer: myAnswer } });
- } else if (props.type === "popular") {
- navigate(`/survey/${props.id}`, { state: { id: props.id } });
- } else if (props.type === "post" || props.type === "allpost") {
- navigate(`/post/${props.id}`);
- console.log(props);
- } else {
- navigate(`/create/`, { state: { id: props.id } });
- }
- };
+ const handleClick = async () => {
+ if (props.surveyType === "AB" && (props.type === "post" || props.type === "allpost")) {
+ navigate(`/post/${props.id}`, { state: { id: props.id } });
+ } else if (props.surveyType === "AB") {
+ navigate(`/createAvsB/`, { state: { id: props.id } });
+ } else if (props.type === "answered") {
+ const myAnswer = await GetMyAnswer(props.id, userToken);
+ console.log("my answer: ", myAnswer);
+ navigate(`/survey/${props.id}`, { state: { forCheck: true, myAnswer: myAnswer } });
+ } else if (props.type === "popular") {
+ navigate(`/post/${props.id}`, { state: { id: props.id } });
+ } else if (props.type === "post" || props.type === "allpost") {
+ navigate(`/post/${props.id}`);
+ console.log(props);
+ } else {
+ navigate(`/create/`, { state: { id: props.id } });
+ }
+ };
- return (
-
-
-
-
- {props.surveyType === "AB" ? "AvsB" : props.surveyType === "NORMAL" ? "Normal" : null}
-
-
-
{props.title}
-
-
- {props.type === "post" ?
작성자 : {props.author} :
작성자 : {props.author}}
-
- {props.type === "post" && (
-
-
- 시작날짜
-
- {props.postStartDate[0]}년 {props.postStartDate[1]}월 {props.postStartDate[2]}일
-
-
- {props.postStartDate[3]}시 {props.postStartDate[4]}분
-
-
-
- 마감날짜
-
- {props.postDueDate[0]}년 {props.postDueDate[1]}월 {props.postDueDate[2]}일
-
-
- {props.postDueDate[3]}시 {props.postDueDate[4]}분
-
-
-
- )}
-
+ return (
+
+
+
+
+ {props.surveyType === "AB" ? "AvsB" : props.surveyType === "NORMAL" ? "Normal" : null}
+
- );
+
{props.title}
+
+
+ {props.type === "post" ?
작성자 : {props.author} :
작성자 : {props.author}}
+
+ {props.type === "post" && (
+
+
+ 시작날짜
+
+ {props.postStartDate[0]}년 {props.postStartDate[1]}월 {props.postStartDate[2]}일
+
+
+ {props.postStartDate[3]}시 {props.postStartDate[4]}분
+
+
+
+ 마감날짜
+
+ {props.postDueDate[0]}년 {props.postDueDate[1]}월 {props.postDueDate[2]}일
+
+
+ {props.postDueDate[3]}시 {props.postDueDate[4]}분
+
+
+
+ )}
+
+
+ );
};
export const HotCategory = (props) => {
- return (
-
- {props.category == "" ? "빈칸" : props.category}
-
- );
+ return (
+
+ {props.category == "" ? "빈칸" : props.category}
+
+ );
};
SurveyListItem.defaultProps = {
- title: "제목",
- author: "작성자",
+ title: "제목",
+ author: "작성자",
};
HotCategory.defaultProps = {
- category: "분야 예시 1",
+ category: "분야 예시 1",
};
diff --git a/src/pages/Post/Statistics/Statistics.js b/src/pages/Post/Statistics/Statistics.js
index 0b43ceb..d07e980 100644
--- a/src/pages/Post/Statistics/Statistics.js
+++ b/src/pages/Post/Statistics/Statistics.js
@@ -8,100 +8,105 @@ import StatList from "./StatList";
import { Button, Spinner } from "react-bootstrap";
import { SiProbot } from "react-icons/si";
import { Firework } from "../../../animation/Firework";
+import FadeIn from "../../../animation/FadeIn";
export const Statistics = () => {
- const { postPk } = useParams();
- const [postTitle, setPostTitle] = useState("");
- const { GetPost } = useContext(PostContext);
- const { GetStats, GetSurveyById } = useContext(SurveyContext);
- const { GetAiAnalyse } = useContext(AIContext);
- const [statistics, setStatistics] = useState(null);
- const [stats, setStats] = useState(null);
- const [postId, setPostId] = useState("");
+ const { postPk } = useParams();
+ const [postTitle, setPostTitle] = useState("");
+ const { GetPost } = useContext(PostContext);
+ const { GetStats, GetSurveyById } = useContext(SurveyContext);
+ const { GetAiAnalyse } = useContext(AIContext);
+ const [statistics, setStatistics] = useState(null);
+ const [stats, setStats] = useState(null);
+ const [postId, setPostId] = useState("");
- const [surveyData, setSurveyData] = useState(null);
- const [aiIsLoading, setAiIsLoading] = useState(false);
- const [showAIRes, setShowAIRes] = useState(false);
- const [AIAnalyse, setAIAnalyse] = useState(null);
+ const [surveyData, setSurveyData] = useState(null);
+ const [aiIsLoading, setAiIsLoading] = useState(false);
+ const [showAIRes, setShowAIRes] = useState(false);
+ const [AIAnalyse, setAIAnalyse] = useState(null);
- const fetchPostData = async () => {
- const post = await GetPost(postPk);
- console.log("post : ", post);
- setPostTitle(post.postTitle);
- setPostId(post.postSurvey);
+ const fetchPostData = async () => {
+ const post = await GetPost(postPk);
+ console.log("post : ", post);
+ setPostTitle(post.postTitle);
+ setPostId(post.postSurvey);
- const survey = await GetSurveyById(post.postSurvey);
- setSurveyData(survey.data);
- };
+ const survey = await GetSurveyById(post.postSurvey);
+ setSurveyData(survey.data);
+ };
- useEffect(() => {
- console.log("surveyData : ", surveyData);
- }, [surveyData]);
+ useEffect(() => {
+ console.log("surveyData : ", surveyData);
+ }, [surveyData]);
- useEffect(() => {
- fetchPostData();
- }, [postPk]); // 포스트 이름 불러오기
+ useEffect(() => {
+ fetchPostData();
+ }, [postPk]); // 포스트 이름 불러오기
- const fetchData = async () => {
- const result = await GetStats(postId);
- result.statistics.sort((a, b) => (a.index > b.index ? 1 : -1));
- setStatistics(result);
+ const fetchData = async () => {
+ const result = await GetStats(postId);
+ result.statistics.sort((a, b) => (a.index > b.index ? 1 : -1));
+ setStatistics(result);
- console.log("stat: ", result);
- };
+ console.log("stat: ", result);
+ };
- useEffect(() => {
- if (postId !== "") fetchData();
- }, [postId]);
+ useEffect(() => {
+ if (postId !== "") fetchData();
+ }, [postId]);
- const onAIAnalyse = async () => {
- setAiIsLoading(true);
- setShowAIRes(true);
- console.log(await GetAiAnalyse(JSON.stringify(surveyData), JSON.stringify(statistics)));
- setAIAnalyse(await GetAiAnalyse(JSON.stringify(surveyData), JSON.stringify(statistics)));
- };
- useEffect(() => {
- if (AIAnalyse !== null) {
- setAiIsLoading(false);
- Firework();
- }
- }, [AIAnalyse]);
+ const onAIAnalyse = async () => {
+ setAiIsLoading(true);
+ setShowAIRes(true);
+ console.log(await GetAiAnalyse(JSON.stringify(surveyData), JSON.stringify(statistics)));
+ setAIAnalyse(await GetAiAnalyse(JSON.stringify(surveyData), JSON.stringify(statistics)));
+ };
+ useEffect(() => {
+ if (AIAnalyse !== null) {
+ setAiIsLoading(false);
+ Firework();
+ }
+ }, [AIAnalyse]);
- return (
-
-
-
-
{postTitle}
-
통계
-
-
-
-
-
+ return (
+
+
+
+
{postTitle}
+
통계
+
+
+
+
+
- {showAIRes ? (
-
-
AI 결과 분석
- {aiIsLoading ? (
-
- ) : (
-
- )}
-
- ) : null}
-
-
-
-
+ {showAIRes ? (
+
+
AI 결과 분석
+ {aiIsLoading ? (
+
+ ) : (
+
+ )}
+ ) : null}
+
+
+
- );
+
+
+ );
};
export default Statistics;