From 6c5235711f6a0de68ce8b486859e8f884a4e3998 Mon Sep 17 00:00:00 2001 From: yeri Date: Mon, 24 Jun 2024 16:49:47 +0900 Subject: [PATCH 01/19] =?UTF-8?q?#83=20feat:=20=EB=A6=AC=EB=B0=B8=EB=9F=B0?= =?UTF-8?q?=EC=8B=B1=20=EB=A6=AC=ED=8F=AC=ED=8A=B8=20=EB=9D=BC=EC=9A=B0?= =?UTF-8?q?=ED=84=B0=20=EA=B2=BD=EB=A1=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/routers/mainRouter.jsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/routers/mainRouter.jsx b/src/routers/mainRouter.jsx index 827ca163..ca460dbb 100644 --- a/src/routers/mainRouter.jsx +++ b/src/routers/mainRouter.jsx @@ -33,6 +33,7 @@ import KaKaoLoginPage from "../routes/login/KaKaoLoginPage"; import FundDetailPage from "../routes/home/FundDetailPage"; import InvestTestUserResultPage from "../routes/investTest/InvestTestUserResultPage"; import ManageDiagnosisPage from "../routes/manage/diagnosis/ManageDiagnosisPage"; +import RebalancingReportPage from "../routes/rebalancing/RebalancingReportPage"; // layouts import HomeLayout from "../routes/home/HomeLayout"; @@ -239,6 +240,11 @@ export const mainRouter = [ element: , index: true, }, + { + path: "rebalancing-report", + element: , + index: true, + }, { path: "account-create", children: [ From 390fab7cba4e62f51505a7c33fca5a1d9a3a4d4d Mon Sep 17 00:00:00 2001 From: yeri Date: Mon, 24 Jun 2024 17:36:12 +0900 Subject: [PATCH 02/19] =?UTF-8?q?#83=20feat:=20=EB=A6=AC=EB=B0=B8=EB=9F=B0?= =?UTF-8?q?=EC=8B=B1=20=ED=8E=80=EB=93=9C=20=EB=A6=AC=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/rebalnacing/FundListComponent.jsx | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/components/common/rebalnacing/FundListComponent.jsx diff --git a/src/components/common/rebalnacing/FundListComponent.jsx b/src/components/common/rebalnacing/FundListComponent.jsx new file mode 100644 index 00000000..04570631 --- /dev/null +++ b/src/components/common/rebalnacing/FundListComponent.jsx @@ -0,0 +1,25 @@ +import React from "react"; + +// icons +import arrow from "../../../assets/icons/cheveron-right.svg"; + +export default function FundListComponent({ setOpen }) { + return ( +
setOpen(true)} + > +
+
+ 어쩌구저쩌구펀드 +
+ 해외선진 +
+
+ 30% + +
+
+ ); +} From 3ea6a57760cee611e84279dfa20ea4a41d0f800d Mon Sep 17 00:00:00 2001 From: yeri Date: Mon, 24 Jun 2024 17:37:06 +0900 Subject: [PATCH 03/19] =?UTF-8?q?#83=20feat:=20=EB=89=B4=EC=8A=A4=20?= =?UTF-8?q?=EA=B8=B0=EC=82=AC=20=EC=A1=B0=ED=9A=8C=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/rebalnacing/NewsInfo.jsx | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/components/common/rebalnacing/NewsInfo.jsx diff --git a/src/components/common/rebalnacing/NewsInfo.jsx b/src/components/common/rebalnacing/NewsInfo.jsx new file mode 100644 index 00000000..1455e85d --- /dev/null +++ b/src/components/common/rebalnacing/NewsInfo.jsx @@ -0,0 +1,20 @@ +import React from "react"; + +// icons +import arrow from "../../../assets/icons/cheveron-right.svg"; + +export default function NewsInfo() { + return ( +
+
+ 삼성전자 + + “삼성 없으면 큰일날 판”…생각보다 심각한 상황이라는데“삼성 없으면 + 큰일날 판”…생각보다 심각한 상황이라는데“삼성 없으면 큰일날 + 판”…생각보다 심각한 상황이라는데 + +
+ +
+ ); +} From af03caaa422437ee0f91d7a736fb090f25020075 Mon Sep 17 00:00:00 2001 From: yeri Date: Mon, 24 Jun 2024 17:37:35 +0900 Subject: [PATCH 04/19] =?UTF-8?q?#83=20feat:=20=EB=A6=AC=EB=B0=B8=EB=9F=B0?= =?UTF-8?q?=EC=8B=B1=20=EC=A0=95=EB=B3=B4=20=EC=A1=B0=ED=9A=8C=20=EB=AA=A8?= =?UTF-8?q?=EB=8B=AC=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/rebalnacing/ReportModal.jsx | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 src/components/common/rebalnacing/ReportModal.jsx diff --git a/src/components/common/rebalnacing/ReportModal.jsx b/src/components/common/rebalnacing/ReportModal.jsx new file mode 100644 index 00000000..57fd618b --- /dev/null +++ b/src/components/common/rebalnacing/ReportModal.jsx @@ -0,0 +1,74 @@ +import React from "react"; + +// modal +import { Sheet } from "react-modal-sheet"; + +// components +import NewsInfo from "./NewsInfo"; + +export default function ReportModal({ isOpen, setOpen }) { + return ( + setOpen(false)} + detent={"content-height"} + > + + + +
+
+ + 신한BNPP글로벌밸런스EMP + +
+
+ 운용사 + 신한자산운용 +
+
+ 수익률 +
+ + 3개월 + + + 21.7% + +
+
+
+
+
+

+ ✔︎ 해당 펀드의 비중은{" "} + 20%에서 30%로 변경되었어요. +

+

+ ✔︎ 총 6개의 위험 판단 주식을 + 찾았어요. +

+
+ {/** 뉴스 기사 */} +
+ + + + + + +
+
+ +
+
+
+
+
+ ); +} From 8f281db4195d955fdfdbb790c77de17d56945bb8 Mon Sep 17 00:00:00 2001 From: yeri Date: Mon, 24 Jun 2024 17:37:45 +0900 Subject: [PATCH 05/19] =?UTF-8?q?#83=20feat:=20=EB=A6=AC=EB=B0=B8=EB=9F=B0?= =?UTF-8?q?=EC=8B=B1=20=EB=A6=AC=ED=8F=AC=ED=8A=B8=20=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/icons/rightArrow.svg | 3 + .../rebalancing/RebalancingReportPage.jsx | 64 +++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 src/assets/icons/rightArrow.svg create mode 100644 src/routes/rebalancing/RebalancingReportPage.jsx diff --git a/src/assets/icons/rightArrow.svg b/src/assets/icons/rightArrow.svg new file mode 100644 index 00000000..9256f8d1 --- /dev/null +++ b/src/assets/icons/rightArrow.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/routes/rebalancing/RebalancingReportPage.jsx b/src/routes/rebalancing/RebalancingReportPage.jsx new file mode 100644 index 00000000..7193c66a --- /dev/null +++ b/src/routes/rebalancing/RebalancingReportPage.jsx @@ -0,0 +1,64 @@ +import React, { useState } from "react"; + +// components +import FundChartComponent from "../../components/common/chart/FundChartComponent"; +import TopBar from "../../components/common/topBar/TopBar"; +import FundListComponent from "../../components/common/rebalnacing/FundListComponent"; +import ReportModal from "../../components/common/rebalnacing/ReportModal"; + +// icons +import rightArrow from "../../assets/icons/rightArrow.svg"; + +export default function RebalancingReportPage() { + const [isOpen, setOpen] = useState(false); + return ( +
+ + +
+
+ 리밸런싱 리포트 +
+
+ {/** 한 눈에 보기 */} +
+ 📌 한 눈에 보기 +

+ {`네이버 뉴스를 기준으로 감정 분석을 진행하고 + 분석 결과를 기반으로 펀드 비율을 조정했어요!`} +

+
+ + 화살표 + +
+
+ {/** 자세히 보기 */} +
+
+ 📌 자세히 보기 + + ※ 2024.05.30 기준 + +
+

+ {`감정 분석을 통해 위험 주식이라고 판단된 주식들과 + 감정 분석에 사용된 네이버 뉴스 기사를 볼 수 있어요!`} +

+
+ +
+
+
+
+
+ ); +} From 62224db2e4cd4ce9a102a0f9e1e56627fe4b5876 Mon Sep 17 00:00:00 2001 From: yeri Date: Mon, 24 Jun 2024 19:38:40 +0900 Subject: [PATCH 06/19] =?UTF-8?q?#83=20feat:=20=EC=A3=BC=EC=8B=9D=20?= =?UTF-8?q?=EB=A1=9C=EA=B3=A0=20=EB=B6=88=EB=9F=AC=EC=98=A4=EA=B8=B0=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/rebalnacing/NewsInfo.jsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/components/common/rebalnacing/NewsInfo.jsx b/src/components/common/rebalnacing/NewsInfo.jsx index 1455e85d..55daa0e4 100644 --- a/src/components/common/rebalnacing/NewsInfo.jsx +++ b/src/components/common/rebalnacing/NewsInfo.jsx @@ -7,7 +7,18 @@ export default function NewsInfo() { return (
- 삼성전자 +
+ + 삼성전자 + + 매출: -197억, 영업이익: 1321억 + +
“삼성 없으면 큰일날 판”…생각보다 심각한 상황이라는데“삼성 없으면 큰일날 판”…생각보다 심각한 상황이라는데“삼성 없으면 큰일날 From 92bbcba7a9a5cac3594dcda59ee6133aa0ba5ef9 Mon Sep 17 00:00:00 2001 From: youhyeoneee Date: Tue, 25 Jun 2024 23:09:00 +0900 Subject: [PATCH 07/19] =?UTF-8?q?chore:=20localhost=EC=97=90=EC=84=9C=20pu?= =?UTF-8?q?blic=20ip=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #93 --- src/lib/apis/base.jsx | 30 +++++-- src/lib/apis/portfolioApi.jsx | 158 +++++++++++++++++----------------- vite.config.js | 29 ++++--- 3 files changed, 117 insertions(+), 100 deletions(-) diff --git a/src/lib/apis/base.jsx b/src/lib/apis/base.jsx index c4a09382..95c862fd 100644 --- a/src/lib/apis/base.jsx +++ b/src/lib/apis/base.jsx @@ -1,7 +1,12 @@ import axios from "axios"; +const portfolioUrl = import.meta.env.VITE_PORTFOLIO_BASE_URI; +const assetUrl = import.meta.env.VITE_ASSET_BASE_URI; +const userUrl = import.meta.env.VITE_USER_BASE_URI; +const mydataUrl = import.meta.env.VITE_MYDATA_BASE_URI; + const instance = axios.create({ - baseURL: "http://localhost:8081/api", + baseURL: `${userUrl}:8081/api`, }); // const persistedString = localStorage.getItem("persist:user"); @@ -10,14 +15,21 @@ const instance = axios.create({ // : ""; const authInstance = (port) => { - const token = localStorage.getItem("accessToken"); - return axios.create({ - baseURL: import.meta.env.VITE_BASE_URL || `http://localhost:${port}/api`, - headers: { - "Content-Type": "application/json", - Authorization: token ? `Bearer ${token}` : "", - }, - }); + const token = localStorage.getItem("accessToken"); + let url = ""; + if (port == 8081) url = userUrl; + else if (port == 8082) url = mydataUrl; + else if (port == 8083) url = assetUrl; + else if (port == 8084) url = portfolioUrl; + else console.log("port is " + port); + + return axios.create({ + baseURL: import.meta.env.VITE_BASE_URL || `${url}:${port}/api`, + headers: { + "Content-Type": "application/json", + Authorization: token ? `Bearer ${token}` : "", + }, + }); }; export default instance; diff --git a/src/lib/apis/portfolioApi.jsx b/src/lib/apis/portfolioApi.jsx index dd1ab622..5ebc6516 100644 --- a/src/lib/apis/portfolioApi.jsx +++ b/src/lib/apis/portfolioApi.jsx @@ -2,106 +2,106 @@ import instance, { authInstance } from "./base"; import axios from "axios"; export async function getAllPortfolio() { - try { - // const response = await authInstance(8084).get("/portfolios/hitit"); - const response = await axios.get( - "http://localhost:8084/api/portfolios/hitit" - ); - return response.data; - } catch (error) { - return error.response; - } + const baseUrl = import.meta.env.VITE_PORTFOLIO_BASE_URI; + const port = 8084; + const url = `${baseUrl}:${port}`; + + try { + // const response = await authInstance(8084).get("/portfolios/hitit"); + const response = await axios.get(`${url}/api/portfolios/hitit`); + return response.data; + } catch (error) { + return error.response; + } } export async function getFundList(id) { - try { - const response = await axios.get( - `http://localhost:8084/api/portfolios/hitit/${id}` - ); - return response.data; - } catch (error) { - return error.response; - } + try { + const response = await axios.get(`${url}/api/portfolios/hitit/${id}`); + return response.data; + } catch (error) { + return error.response; + } } export async function getFundDetail(portfolioId, fundId) { - try { - const response = await axios.get( - `http://localhost:8084/api/portfolios/hitit/${portfolioId}/${fundId}` - ); - return response.data; - } catch (error) { - return error.response; - } + try { + const response = await axios.get( + `${url}/api/portfolios/hitit/${portfolioId}/${fundId}` + ); + return response.data; + } catch (error) { + return error.response; + } } export async function getMyDataPortfolio(body) { - const token = localStorage.getItem("accessToken"); - try { - const response = await axios.post( - `http://3.39.217.69:8084/api/portfolios/mydata/leveltest`, - body - // { - // headers: { - // Authorization: `Bearer ${token}`, - // }, - // } - ); - return response.data; - } catch (error) { - return error.response; - } + const token = localStorage.getItem("accessToken"); + try { + const response = await axios.post( + `${url}/api/portfolios/mydata/leveltest`, + body + // { + // headers: { + // Authorization: `Bearer ${token}`, + // }, + // } + ); + return response.data; + } catch (error) { + return error.response; + } } export async function changePortfolio(id) { - try { - const response = await authInstance(8084).post(`/portfolios/change/${id}`); - return response.data; - } catch (error) { - return error.response; - } + try { + const response = await authInstance(8084).post(`/portfolios/change/${id}`); + return response.data; + } catch (error) { + return error.response; + } } export async function getUserPortfolio() { - try { - const response = await authInstance(8084).get(`/portfolios/user`); - return response.data; - } catch (error) { - console.log(error); - return error.response; - } + try { + const response = await authInstance(8084).get(`/portfolios/user`); + return response.data; + } catch (error) { + console.log(error); + return error.response; + } } export async function changeMyDataPortfolio(body) { - try { - const response = await authInstance(8084).post( - `/portfolios/mydata/change`, - body - ); - return response.data; - } catch (error) { - return error.response; - } + try { + const response = await authInstance(8084).post( + `/portfolios/mydata/change`, + body + ); + return response.data; + } catch (error) { + return error.response; + } } export async function getUserPortfolioDetail() { - try { - const response = await authInstance(8084).get(`/portfolios/userfunds`); - return response.data; - } catch (error) { - console.log(error); - return error.response; - } + try { + const response = await authInstance(8084).get(`/portfolios/userfunds`); + return response.data; + } catch (error) { + console.log(error); + return error.response; + } } - + export async function getUserFundDetail(fundId) { - try { - const response = await authInstance(8084).get( - `/portfolios/userfunds/detail/${fundId}` - ); - return response.data; - } catch (error) { - console.log(error); - return error.response; - } + try { + const response = await authInstance(8084).get( + `/portfolios/userfunds/detail/${fundId}` + ); + return response.data; + } catch (error) { + console.log(error); + return error.response; + } } diff --git a/vite.config.js b/vite.config.js index a17c3030..20d89dab 100644 --- a/vite.config.js +++ b/vite.config.js @@ -1,16 +1,21 @@ -import { defineConfig } from "vite"; +import { defineConfig, loadEnv } from "vite"; import react from "@vitejs/plugin-react"; // https://vitejs.dev/config/ -export default defineConfig({ - plugins: [react()], - server: { - proxy: { - "/api": { - target: "http://localhost:8081", - changeOrigin: true, - rewrite: (path) => path.replace(/^\/api/, ""), - }, - }, - }, +export default defineConfig(({ mode }) => { + // Load environment variables based on the current mode + const env = loadEnv(mode, process.cwd()); + + return { + plugins: [react()], + server: { + proxy: { + "/api": { + target: env.VITE_USER_BASE_URI + ":8081", + changeOrigin: true, + rewrite: (path) => path.replace(/^\/api/, ""), + }, + }, + }, + }; }); From 82462aa3fa5832a74891ac32b224f5e230e8611f Mon Sep 17 00:00:00 2001 From: youhyeoneee Date: Wed, 26 Jun 2024 00:04:07 +0900 Subject: [PATCH 08/19] =?UTF-8?q?#93=20fix:=20=ED=88=AC=EC=9E=90=EC=84=B1?= =?UTF-8?q?=ED=96=A5=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20api=20url=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib/apis/testApi.jsx | 50 ++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/src/lib/apis/testApi.jsx b/src/lib/apis/testApi.jsx index ed035ee0..6e0f0981 100644 --- a/src/lib/apis/testApi.jsx +++ b/src/lib/apis/testApi.jsx @@ -1,36 +1,40 @@ import instance, { authInstance } from "./base"; async function getQuestion(num) { - try { - const response = await instance.get(`/investment_tests/questions/${num}`); - return response; - } catch (error) { - console.log(error); - return error.response; - } + try { + const response = await instance.get( + `/users/investment_tests/questions/${num}` + ); + return response; + } catch (error) { + console.log(error); + return error.response; + } } const token = localStorage.getItem("accessToken"); async function postTestResult(result) { - try { - const response = await authInstance(8081).post( - `/investment_tests/results`, - result - ); - return response; - } catch (error) { - console.log(error); - return error.response; - } + try { + const response = await authInstance(8081).post( + `/users/investment_tests/results`, + result + ); + return response; + } catch (error) { + console.log(error); + return error.response; + } } async function getTestResult() { - try { - const response = await authInstance(8081).get(`/investment_tests/results`); - return response; - } catch (error) { - return error.response; - } + try { + const response = await authInstance(8081).get( + `/users/investment_tests/results` + ); + return response; + } catch (error) { + return error.response; + } } export { getQuestion, postTestResult, getTestResult }; From db8fafeb723843024f9345993042471bb9fd33df Mon Sep 17 00:00:00 2001 From: youhyeoneee Date: Wed, 26 Jun 2024 00:49:59 +0900 Subject: [PATCH 09/19] =?UTF-8?q?#93=20fix:=20=EB=B3=80=EA=B2=BD=EB=90=9C?= =?UTF-8?q?=20uri=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib/apis/diagnosisApi.jsx | 32 ++++++++++++----------- src/lib/apis/notificationApi.jsx | 45 +++++++++++++++++--------------- 2 files changed, 41 insertions(+), 36 deletions(-) diff --git a/src/lib/apis/diagnosisApi.jsx b/src/lib/apis/diagnosisApi.jsx index 8019930a..137bbec3 100644 --- a/src/lib/apis/diagnosisApi.jsx +++ b/src/lib/apis/diagnosisApi.jsx @@ -1,22 +1,24 @@ import { authInstance } from "./base"; export async function getDiagnosisResult(survey) { - try { - const response = await authInstance(8081).post( - `/retirements/test/results`, - survey - ); - return response.data; - } catch (error) { - return error.response; - } + try { + const response = await authInstance(8081).post( + `/users/retirements/test/results`, + survey + ); + return response.data; + } catch (error) { + return error.response; + } } export async function getPreviousDiagnosisResult() { - try { - const response = await authInstance(8081).get(`/retirements/test/results`); - return response.data; - } catch (error) { - return error.response; - } + try { + const response = await authInstance(8081).get( + `/users/retirements/test/results` + ); + return response.data; + } catch (error) { + return error.response; + } } diff --git a/src/lib/apis/notificationApi.jsx b/src/lib/apis/notificationApi.jsx index 3a63be7a..b08e31af 100644 --- a/src/lib/apis/notificationApi.jsx +++ b/src/lib/apis/notificationApi.jsx @@ -1,32 +1,35 @@ import { authInstance } from "./base"; const getNotification = async () => { - try { - const response = await authInstance(8081).get(`/notifications`); - return response.data; - } catch (error) { - return error.response; - } + try { + const response = await authInstance(8081).get(`/users/notifications`); + return response.data; + } catch (error) { + return error.response; + } }; const postNotification = async (reqBody) => { - try { - const response = await authInstance(8084).post(`/send/message`, reqBody); - return response.data; - } catch (error) { - return error.response; - } + try { + const response = await authInstance(8084).post( + `/portfolios/send/message`, + reqBody + ); + return response.data; + } catch (error) { + return error.response; + } }; const patchNotification = async (notificationId) => { - try { - console.log(notificationId); - const response = await authInstance(8081).patch( - `/notifications/${notificationId}` - ); - return response.data; - } catch (error) { - return error.response; - } + try { + console.log(notificationId); + const response = await authInstance(8081).patch( + `/users/notifications/${notificationId}` + ); + return response.data; + } catch (error) { + return error.response; + } }; export { getNotification, postNotification, patchNotification }; From ef021939becec7f7613ef05991763d6973ae8c78 Mon Sep 17 00:00:00 2001 From: youhyeoneee Date: Wed, 26 Jun 2024 03:00:28 +0900 Subject: [PATCH 10/19] =?UTF-8?q?fix:=20url=20=EC=9C=84=EC=B9=98=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #93 --- src/lib/apis/portfolioApi.jsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/lib/apis/portfolioApi.jsx b/src/lib/apis/portfolioApi.jsx index 5ebc6516..d449c99a 100644 --- a/src/lib/apis/portfolioApi.jsx +++ b/src/lib/apis/portfolioApi.jsx @@ -1,11 +1,11 @@ import instance, { authInstance } from "./base"; import axios from "axios"; -export async function getAllPortfolio() { - const baseUrl = import.meta.env.VITE_PORTFOLIO_BASE_URI; - const port = 8084; - const url = `${baseUrl}:${port}`; +const baseUrl = import.meta.env.VITE_PORTFOLIO_BASE_URI; +const port = 8084; +const url = `${baseUrl}:${port}`; +export async function getAllPortfolio() { try { // const response = await authInstance(8084).get("/portfolios/hitit"); const response = await axios.get(`${url}/api/portfolios/hitit`); @@ -37,6 +37,7 @@ export async function getFundDetail(portfolioId, fundId) { export async function getMyDataPortfolio(body) { const token = localStorage.getItem("accessToken"); + console.log(`${url}/api/portfolios/mydata/leveltest`); try { const response = await axios.post( `${url}/api/portfolios/mydata/leveltest`, From e7f189a46738c57c747d2e4a84510a6a329c1bfd Mon Sep 17 00:00:00 2001 From: youhyeoneee Date: Wed, 26 Jun 2024 03:43:21 +0900 Subject: [PATCH 11/19] =?UTF-8?q?#93=20fix:=20=EA=B0=9C=EC=9D=B8=ED=99=94?= =?UTF-8?q?=20=EC=9A=94=EC=B2=AD=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib/apis/portfolioApi.jsx | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/lib/apis/portfolioApi.jsx b/src/lib/apis/portfolioApi.jsx index d449c99a..d63dbbd5 100644 --- a/src/lib/apis/portfolioApi.jsx +++ b/src/lib/apis/portfolioApi.jsx @@ -37,17 +37,12 @@ export async function getFundDetail(portfolioId, fundId) { export async function getMyDataPortfolio(body) { const token = localStorage.getItem("accessToken"); - console.log(`${url}/api/portfolios/mydata/leveltest`); try { - const response = await axios.post( - `${url}/api/portfolios/mydata/leveltest`, - body - // { - // headers: { - // Authorization: `Bearer ${token}`, - // }, - // } - ); + const response = await authInstance(8084).get(`/portfolios/mydata`, { + headers: { + Authorization: `Bearer ${token}`, + }, + }); return response.data; } catch (error) { return error.response; From bc41fe638a9b00f74383535b5b6ec133ef974501 Mon Sep 17 00:00:00 2001 From: yeri Date: Wed, 26 Jun 2024 04:08:45 +0900 Subject: [PATCH 12/19] =?UTF-8?q?#83=20design:=20cursor=20pointer=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/bottomTab/BottomTab.jsx | 2 +- .../common/rebalnacing/FundListComponent.jsx | 2 +- .../common/topBar/TopBarComponents.jsx | 14 +++---- src/components/home/RecommendComponent.jsx | 5 +-- src/components/home/TabComponent.jsx | 2 +- .../manage/MoreServiceComponent.jsx | 2 +- .../NotificationListComponent.jsx | 2 +- src/routes/home/PortfolioDetailPage.jsx | 2 +- .../PensionAccountListPage.jsx | 42 +++++++++---------- 9 files changed, 36 insertions(+), 37 deletions(-) diff --git a/src/components/common/bottomTab/BottomTab.jsx b/src/components/common/bottomTab/BottomTab.jsx index fa110ed4..e43b0e97 100644 --- a/src/components/common/bottomTab/BottomTab.jsx +++ b/src/components/common/bottomTab/BottomTab.jsx @@ -74,7 +74,7 @@ const Tab = ({ img, imgSelected, title, setSelected, isSelected }) => { }; return (
onClickFn()} > diff --git a/src/components/common/rebalnacing/FundListComponent.jsx b/src/components/common/rebalnacing/FundListComponent.jsx index 04570631..944280d1 100644 --- a/src/components/common/rebalnacing/FundListComponent.jsx +++ b/src/components/common/rebalnacing/FundListComponent.jsx @@ -6,7 +6,7 @@ import arrow from "../../../assets/icons/cheveron-right.svg"; export default function FundListComponent({ setOpen }) { return (
setOpen(true)} > diff --git a/src/components/common/topBar/TopBarComponents.jsx b/src/components/common/topBar/TopBarComponents.jsx index 49b964ce..9da3f8a9 100644 --- a/src/components/common/topBar/TopBarComponents.jsx +++ b/src/components/common/topBar/TopBarComponents.jsx @@ -13,12 +13,12 @@ export const LogoWithNotification = () => {
navigate("/")} /> navigate("/notification")} />
@@ -31,12 +31,12 @@ export const BackArrowWithNotification = () => {
navigate(-1)} /> navigate("/notification")} />
@@ -49,12 +49,12 @@ export const NotificationWithSetting = () => {
navigate("/notification")} /> navigate("/setting")} />
@@ -67,7 +67,7 @@ export const BackArrow = () => {
navigate(-1)} />
diff --git a/src/components/home/RecommendComponent.jsx b/src/components/home/RecommendComponent.jsx index cf154c60..161a54f0 100644 --- a/src/components/home/RecommendComponent.jsx +++ b/src/components/home/RecommendComponent.jsx @@ -45,7 +45,6 @@ const PortfolioRecommendComponent = ({ type, data }) => { {data.minimumSubscriptionFee}만원
)} -
수익률
@@ -64,11 +63,11 @@ const PortfolioRecommendComponent = ({ type, data }) => {
{type ? null : (
-
+
선택하기
{ data.funds ? navigate(`/detail/${data.name}`, { state: data.funds }) diff --git a/src/components/home/TabComponent.jsx b/src/components/home/TabComponent.jsx index 4045c5c1..f735e9b1 100644 --- a/src/components/home/TabComponent.jsx +++ b/src/components/home/TabComponent.jsx @@ -4,7 +4,7 @@ const TabComponent = ({ type, isSelected, setSelected }) => { return (
setSelected(type)} diff --git a/src/components/manage/MoreServiceComponent.jsx b/src/components/manage/MoreServiceComponent.jsx index 1e536670..8163a61b 100644 --- a/src/components/manage/MoreServiceComponent.jsx +++ b/src/components/manage/MoreServiceComponent.jsx @@ -16,7 +16,7 @@ export default function MoreServiceComponent({ title, detail }) {
navigate(`${title === "노후준비종합진단" ? "diagnosis" : "pension"}`) } diff --git a/src/components/notification/NotificationListComponent.jsx b/src/components/notification/NotificationListComponent.jsx index 3f8ab9a6..4f6b2480 100644 --- a/src/components/notification/NotificationListComponent.jsx +++ b/src/components/notification/NotificationListComponent.jsx @@ -6,7 +6,7 @@ export default function NotificationListComponent({ date, content }) {
setIsRead(true)} > {date} diff --git a/src/routes/home/PortfolioDetailPage.jsx b/src/routes/home/PortfolioDetailPage.jsx index 03858d3d..19ac4eb5 100644 --- a/src/routes/home/PortfolioDetailPage.jsx +++ b/src/routes/home/PortfolioDetailPage.jsx @@ -90,7 +90,7 @@ const FundListComponent = ({ index, data, type }) => { } return (
{ type === "all" ? navigate(`${index}`) diff --git a/src/routes/manage/unclaimedPension/PensionAccountListPage.jsx b/src/routes/manage/unclaimedPension/PensionAccountListPage.jsx index 73d13ede..2cf8abd5 100644 --- a/src/routes/manage/unclaimedPension/PensionAccountListPage.jsx +++ b/src/routes/manage/unclaimedPension/PensionAccountListPage.jsx @@ -29,7 +29,7 @@ export default function PensionAccountListPage() {
navigate("../apply-info")} > @@ -38,7 +38,7 @@ export default function PensionAccountListPage() {
-
+
@@ -78,50 +78,50 @@ const DetailModal = ({ isOpen, setOpen }) => { 미청구 퇴직연금 조회 -
+
신한은행
073-021-038-01-014 9,000,000원
-
+
-
제도 유형
-
DC
+
제도 유형
+
DC
-
산정 기준일
-
2024-06-17
+
산정 기준일
+
2024-06-17
-
관리점명
-
강남역점
+
관리점명
+
강남역점
-
+
단체명(사용자명)
-
테라주식회사
+
테라주식회사
-
성명
-
홍길동
+
성명
+
홍길동
-
사업장 상태
-
폐업확인
+
사업장 상태
+
폐업확인
-
복수사업자 여부
-
개인
+
복수사업자 여부
+
개인
-
담당자 연락처
-
1588-5000
+
담당자 연락처
+
1588-5000
-
+
{/** 뉴스 기사 */}
- - - - -
From aec705c06ab8223d2a38695fe273496d9650ec99 Mon Sep 17 00:00:00 2001 From: yeri Date: Wed, 26 Jun 2024 09:54:10 +0900 Subject: [PATCH 14/19] =?UTF-8?q?#83=20feat:=20=EB=A6=AC=EB=B0=B8=EB=9F=B0?= =?UTF-8?q?=EC=8B=B1=20=EB=A6=AC=ED=8F=AC=ED=8A=B8=20=EA=B2=BD=EB=A1=9C=20?= =?UTF-8?q?=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/notification/NotificationListComponent.jsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/notification/NotificationListComponent.jsx b/src/components/notification/NotificationListComponent.jsx index 6a370b16..3aff0533 100644 --- a/src/components/notification/NotificationListComponent.jsx +++ b/src/components/notification/NotificationListComponent.jsx @@ -1,4 +1,5 @@ import React, { useEffect, useState } from "react"; +import { useNavigate } from "react-router-dom"; import { patchNotification } from "../../lib/apis/notificationApi"; export default function NotificationListComponent({ @@ -8,6 +9,7 @@ export default function NotificationListComponent({ check, }) { const [isRead, setIsRead] = useState(check); + const navigate = useNavigate(); const fetchPatchNotification = async (notificationId) => { try { const response = await patchNotification(notificationId); @@ -24,6 +26,7 @@ export default function NotificationListComponent({ onClick={() => { setIsRead(true); fetchPatchNotification(id); + navigate("/rebalancing-report"); }} >

리밸런싱 리포트

From 3c26322f52da3047fcc06f3b5ca22bd2c4e9751a Mon Sep 17 00:00:00 2001 From: yeri Date: Wed, 26 Jun 2024 10:14:59 +0900 Subject: [PATCH 15/19] =?UTF-8?q?#83=20fix:=20=EC=88=98=EC=9D=B5=EB=A5=A0?= =?UTF-8?q?=20=EC=A0=95=EB=B3=B4=20=EC=97=86=EC=9D=84=20=EB=95=8C=20?= =?UTF-8?q?=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/routes/manage/ManagePage.jsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/routes/manage/ManagePage.jsx b/src/routes/manage/ManagePage.jsx index ec68e846..18ec2d0b 100644 --- a/src/routes/manage/ManagePage.jsx +++ b/src/routes/manage/ManagePage.jsx @@ -18,9 +18,11 @@ export default function ManagePage() { const user = useUserStore((store) => store.user); const [dates, setDates] = useState([]); const [values, setValues] = useState([]); + const [rates, setRates] = useState([]); const getData = async () => { const data = await getRates(); + setRates(rates); const newDates = []; const newValues = []; data.response.forEach((item) => { @@ -77,7 +79,7 @@ export default function ManagePage() { />
- ) : ( + ) : rates?.length > 0 ? ( <> + ) : rates?.length === 0 ? ( +
+ 아직 수익률 정보가 없어요! +
+ ) : ( +
+ 포트폴리오가 없어요! +
)}
From e74e07432fd22d64a6b438a94ffc66525b569c37 Mon Sep 17 00:00:00 2001 From: yeri Date: Wed, 26 Jun 2024 11:08:20 +0900 Subject: [PATCH 16/19] =?UTF-8?q?#83=20fix:=20=EC=88=98=EC=9D=B5=EB=A5=A0?= =?UTF-8?q?=20=EC=B0=A8=ED=8A=B8=20=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/routes/manage/ManagePage.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/manage/ManagePage.jsx b/src/routes/manage/ManagePage.jsx index 18ec2d0b..1f574ba7 100644 --- a/src/routes/manage/ManagePage.jsx +++ b/src/routes/manage/ManagePage.jsx @@ -22,7 +22,7 @@ export default function ManagePage() { const getData = async () => { const data = await getRates(); - setRates(rates); + setRates(data.response); const newDates = []; const newValues = []; data.response.forEach((item) => { From 491ed455c37f28aa58ecb63ed1b3da28da3220d5 Mon Sep 17 00:00:00 2001 From: yeri Date: Wed, 26 Jun 2024 12:28:57 +0900 Subject: [PATCH 17/19] =?UTF-8?q?#83=20feat:=20=EB=A6=AC=EB=B0=B8=EB=9F=B0?= =?UTF-8?q?=EC=8B=B1=20=EB=A6=AC=ED=8F=AC=ED=8A=B8=20api=20=EC=97=B0?= =?UTF-8?q?=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/chart/FundChartComponent.jsx | 13 -- .../common/rebalnacing/FundListComponent.jsx | 19 ++- .../common/rebalnacing/NewsInfo.jsx | 17 +-- .../common/rebalnacing/ReportModal.jsx | 29 ++-- src/lib/apis/rebalancingApi.jsx | 11 ++ .../rebalancing/RebalancingReportPage.jsx | 135 ++++++++++++------ 6 files changed, 137 insertions(+), 87 deletions(-) diff --git a/src/components/common/chart/FundChartComponent.jsx b/src/components/common/chart/FundChartComponent.jsx index 3b003378..162be035 100644 --- a/src/components/common/chart/FundChartComponent.jsx +++ b/src/components/common/chart/FundChartComponent.jsx @@ -5,18 +5,6 @@ import { Doughnut } from "react-chartjs-2"; ChartJS.register(ArcElement, Legend); export default function FundChartComponent({ type, ratio, className }) { - // const defaultColors = [ - // "#F0F4FF", - // "#E4ECFF", - // "#CCD8FF", - // "#B3C5FF", - // "#98B1FF", - // "#6A8CFF", - // "#375AFF", - // "#B3C5FF", - // "#B3C5FF", - // "#B3C5FF", - // ]; // 기본 색상 배열 const defaultColors = [ "#EBEEFF", "#D8DDFF", @@ -43,7 +31,6 @@ export default function FundChartComponent({ type, ratio, className }) { const backgroundColors = ratio.map( (_, index) => defaultColors[index % defaultColors.length] ); - const data = { labels: ["주식", "채권"], datasets: [ diff --git a/src/components/common/rebalnacing/FundListComponent.jsx b/src/components/common/rebalnacing/FundListComponent.jsx index c6c44d49..585d1af2 100644 --- a/src/components/common/rebalnacing/FundListComponent.jsx +++ b/src/components/common/rebalnacing/FundListComponent.jsx @@ -3,21 +3,30 @@ import React from "react"; // icons import arrow from "../../../assets/icons/cheveron-right.svg"; -export default function FundListComponent({ title, setOpen }) { +export default function FundListComponent({ + index, + weight, + data, + setOpen, + setIsSelected, +}) { return (
setOpen(true)} + onClick={() => { + setOpen(true); + setIsSelected(data); + }} >
- {title} + {data?.fund_name}
- 해외주식형 + {data?.company_name}
- 30% + {weight[index]}%
diff --git a/src/components/common/rebalnacing/NewsInfo.jsx b/src/components/common/rebalnacing/NewsInfo.jsx index e5c36a19..432ffc1d 100644 --- a/src/components/common/rebalnacing/NewsInfo.jsx +++ b/src/components/common/rebalnacing/NewsInfo.jsx @@ -3,29 +3,22 @@ import React from "react"; // icons import arrow from "../../../assets/icons/cheveron-right.svg"; -export default function NewsInfo() { +export default function NewsInfo({ data }) { return (
- 삼성전자 - - 매출: -197억, 영업이익: 1321억 - + {data.stock_name}
- “삼성 없으면 큰일날 판”…생각보다 심각한 상황이라는데“삼성 없으면 - 큰일날 판”…생각보다 심각한 상황이라는데“삼성 없으면 큰일날 - 판”…생각보다 심각한 상황이라는데 + {data.bad_news_title}
- +
diff --git a/src/components/common/rebalnacing/ReportModal.jsx b/src/components/common/rebalnacing/ReportModal.jsx index 78306e68..858d23e0 100644 --- a/src/components/common/rebalnacing/ReportModal.jsx +++ b/src/components/common/rebalnacing/ReportModal.jsx @@ -1,4 +1,6 @@ import React from "react"; +import { useEffect } from "react"; +import { useState } from "react"; // modal import { Sheet } from "react-modal-sheet"; @@ -6,7 +8,11 @@ import { Sheet } from "react-modal-sheet"; // components import NewsInfo from "./NewsInfo"; -export default function ReportModal({ isOpen, setOpen }) { +export default function ReportModal({ isOpen, setOpen, data }) { + // bad_news가 null이 아닌 항목들만 필터링 + const filteredStocks = + data.stocks?.filter((stock) => stock.bad_news_title !== "None") || []; + return (
- 신한BNPP글로벌밸런스EMP + {data.fund_name}
운용사 - 신한자산운용 + {data.company_name}
수익률 @@ -33,7 +39,7 @@ export default function ReportModal({ isOpen, setOpen }) { 3개월 - 21.7% + {data.return3m?.toFixed(2)}%
@@ -41,17 +47,18 @@ export default function ReportModal({ isOpen, setOpen }) {

- ✔︎ 해당 펀드의 비중은{" "} - 20%에서 30%로 변경되었어요. -

-

- ✔︎ 총 1개의 위험 판단 주식을 - 찾았어요. + ✔︎{" "} + + 총 {filteredStocks.length}개의 위험 판단 주식 + + 을 찾았어요.

{/** 뉴스 기사 */}
- + {filteredStocks.map((elem, index) => ( + + ))}