Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
6c52357
#83 feat: 리밸런싱 리포트 라우터 경로 추가
rlafl7942 Jun 24, 2024
390fab7
#83 feat: 리밸런싱 펀드 리스트 컴포넌트 구현
rlafl7942 Jun 24, 2024
3ea6a57
#83 feat: 뉴스 기사 조회 컴포넌트 구현
rlafl7942 Jun 24, 2024
af03caa
#83 feat: 리밸런싱 정보 조회 모달 구현
rlafl7942 Jun 24, 2024
8f281db
#83 feat: 리밸런싱 리포트 페이지 구현
rlafl7942 Jun 24, 2024
62224db
#83 feat: 주식 로고 불러오기 구현
rlafl7942 Jun 24, 2024
92bbcba
chore: localhost에서 public ip로 변경
youhyeoneee Jun 25, 2024
b62c0e0
Merge branch 'develop' into chore/93-deploy
youhyeoneee Jun 25, 2024
82462aa
#93 fix: 투자성향 테스트 api url 수정
youhyeoneee Jun 25, 2024
6f4e1fc
Merge branch 'develop' into chore/93-deploy
youhyeoneee Jun 25, 2024
db8fafe
#93 fix: 변경된 uri 반영
youhyeoneee Jun 25, 2024
4dc637a
Merge branch 'develop' into chore/93-deploy
youhyeoneee Jun 25, 2024
9f85c92
Merge branch 'develop' into chore/93-deploy
youhyeoneee Jun 25, 2024
6b78a83
Merge branch 'develop' into chore/93-deploy
youhyeoneee Jun 25, 2024
ef02193
fix: url 위치 변경
youhyeoneee Jun 25, 2024
27d15b3
Merge branch 'develop' into chore/93-deploy
youhyeoneee Jun 25, 2024
e7f189a
#93 fix: 개인화 요청 수정
youhyeoneee Jun 25, 2024
bc41fe6
#83 design: cursor pointer 제거
rlafl7942 Jun 25, 2024
be50d61
Merge branch 'develop' into chore/93-deploy
youhyeoneee Jun 25, 2024
b6f518a
Merge branch 'develop' into chore/93-deploy
youhyeoneee Jun 26, 2024
89fdbf1
Merge branch 'develop' into chore/93-deploy
youhyeoneee Jun 26, 2024
9558849
#83 feat: 리밸런싱 리포트 구현
rlafl7942 Jun 26, 2024
465034d
Merge branch 'develop' into 83-리밸런싱-리포트-구현
rlafl7942 Jun 26, 2024
7a253b2
Merge branch 'develop' into 83-리밸런싱-리포트-구현
rlafl7942 Jun 26, 2024
aec705c
#83 feat: 리밸런싱 리포트 경로 이동
rlafl7942 Jun 26, 2024
3c26322
#83 fix: 수익률 정보 없을 때 버그 수정
rlafl7942 Jun 26, 2024
28aa2d0
Merge branch 'develop' into chore/93-deploy
youhyeoneee Jun 26, 2024
93ec19d
Merge branch '83-리밸런싱-리포트-구현' into chore/93-deploy
youhyeoneee Jun 26, 2024
e74e074
#83 fix: 수익률 차트 버그 수정
rlafl7942 Jun 26, 2024
f5e2197
Merge branch '83-리밸런싱-리포트-구현' into chore/93-deploy
youhyeoneee Jun 26, 2024
bd61526
Merge branch 'develop' into chore/93-deploy
youhyeoneee Jun 26, 2024
740fb4d
Merge branch 'develop' into 83-리밸런싱-리포트-구현
rlafl7942 Jun 26, 2024
778c280
Merge branch 'develop' into chore/93-deploy
youhyeoneee Jun 26, 2024
491ed45
#83 feat: 리밸런싱 리포트 api 연결
rlafl7942 Jun 26, 2024
ba8e295
Merge branch 'develop' into 83-리밸런싱-리포트-구현
rlafl7942 Jun 26, 2024
b2d2d1d
Merge branch '83-리밸런싱-리포트-구현' into chore/93-deploy
youhyeoneee Jun 26, 2024
dc8b381
fix: 노후 준비 종합 진단 결과 없을 때 이전 기록 보기 버그 수정
rlafl7942 Jun 26, 2024
68e34ca
Merge branch '83-리밸런싱-리포트-구현' into chore/93-deploy
youhyeoneee Jun 26, 2024
d576e88
fix: 수익률 그래프 NaN 오류 수정
rlafl7942 Jun 26, 2024
f285b8b
Merge branch '83-리밸런싱-리포트-구현' into chore/93-deploy
youhyeoneee Jun 26, 2024
689b5b8
Merge branch 'develop' into chore/93-deploy
youhyeoneee Jun 26, 2024
0e6e777
Merge branch 'develop' into chore/93-deploy
youhyeoneee Jun 26, 2024
b0d26ea
Merge branch 'develop' into chore/93-deploy
youhyeoneee Jun 26, 2024
a56ff2c
Merge branch 'develop' into chore/93-deploy
youhyeoneee Jun 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/assets/icons/rightArrow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 0 additions & 13 deletions src/components/common/chart/FundChartComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -43,7 +31,6 @@ export default function FundChartComponent({ type, ratio, className }) {
const backgroundColors = ratio.map(
(_, index) => defaultColors[index % defaultColors.length]
);

const data = {
labels: ["주식", "채권"],
datasets: [
Expand Down
34 changes: 34 additions & 0 deletions src/components/common/rebalnacing/FundListComponent.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import React from "react";

// icons
import arrow from "../../../assets/icons/cheveron-right.svg";

export default function FundListComponent({
index,
weight,
data,
setOpen,
setIsSelected,
}) {
return (
<div
className={`flex justify-between w-[90vw] rounded-[25px] px-5 py-5 shadow-lg`}
style={{ backgroundColor: `#E5E9FF` }}
onClick={() => {
setOpen(true);
setIsSelected(data);
}}
>
<div className="flex flex-col flex-1 mr-2 truncate">
<div className="w-full truncate">
<span className="text-[17px] font-bold">{data?.fund_name}</span>
</div>
<span className="text-[13px]">{data?.company_name}</span>
</div>
<div className="flex items-center">
<span className="text-[20px] font-bold">{weight[index]}%</span>
<img src={arrow} className="w-[20px]" />
</div>
</div>
);
}
26 changes: 26 additions & 0 deletions src/components/common/rebalnacing/NewsInfo.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from "react";

// icons
import arrow from "../../../assets/icons/cheveron-right.svg";

export default function NewsInfo({ data }) {
return (
<div className="flex w-full py-3 bg-white">
<div className="flex flex-col flex-1 truncate">
<div className="flex items-center">
<img
src={`https://file.alphasquare.co.kr/media/images/stock_logo/kr/${data.stock_code}.png`}
className="rounded-full w-[22px]"
/>
<span className="text-[16px] font-bold mx-1">{data.stock_name}</span>
</div>
<span className="w-full text-[13px] truncate">
{data.bad_news_title}
</span>
</div>
<a href={data.bad_news_url} target="_blank">
<img src={arrow} className="w-fit" />
</a>
</div>
);
}
76 changes: 76 additions & 0 deletions src/components/common/rebalnacing/ReportModal.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import React from "react";
import { useEffect } from "react";
import { useState } from "react";

// modal
import { Sheet } from "react-modal-sheet";

// components
import NewsInfo from "./NewsInfo";

export default function ReportModal({ isOpen, setOpen, data }) {
// bad_news가 null이 아닌 항목들만 필터링
const filteredStocks =
data.stocks?.filter((stock) => stock.bad_news_title !== "None") || [];

return (
<Sheet
isOpen={isOpen}
onClose={() => setOpen(false)}
detent={"content-height"}
>
<Sheet.Container>
<Sheet.Header />
<Sheet.Content>
<div className="flex flex-col items-center w-full my-[2vh]">
<div className="flex flex-col w-[90vw] px-5 py-3 border-b mb-[2vh]">
<span className="text-[20px] font-bold self-center mb-3">
{data.fund_name}
</span>
<div className="flex flex-col justify-center w-full gap-1">
<div className="flex justify-between w-full">
<span className="text-[15px]">운용사</span>
<span className="text-[17px]">{data.company_name}</span>
</div>
<div className="flex justify-between w-full">
<span className="text-[15px]">수익률</span>
<div className="flex items-baseline">
<span className="text-[13px] mr-2 text-[#4E4E4E]">
3개월
</span>
<span className="text-[18px] font-bold text-[#ff0000]">
{data.return3m?.toFixed(2)}%
</span>
</div>
</div>
</div>
</div>
<div className="w-[90vw] mb-[2vh]">
<p className="text-[15px]">
✔︎{" "}
<span className="font-bold">
총 {filteredStocks.length}개의 위험 판단 주식
</span>
을 찾았어요.
</p>
</div>
{/** 뉴스 기사 */}
<div className="flex flex-col w-[90vw] mb-[2vh]">
{filteredStocks.map((elem, index) => (
<NewsInfo data={elem} key={index} />
))}
</div>
<div className="flex justify-center w-full">
<button
className="my-2 px-10 py-2 rounded-[25px] bg-[#375AFF] text-white font-bold"
onClick={() => setOpen(false)}
>
확인
</button>
</div>
</div>
</Sheet.Content>
</Sheet.Container>
</Sheet>
);
}
14 changes: 7 additions & 7 deletions src/components/common/topBar/TopBarComponents.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ export const LogoWithNotification = () => {
<div className="p-3 flex flex-row items-center justify-between h-[7vh] bg-white">
<img
src={logo}
className="w-[10vw] max-w-10 hover:cursor-pointer"
className="w-[10vw] max-w-10"
onClick={() => navigate("/")}
/>
<img
src={noti}
className="w-[10vw] max-w-10 hover:cursor-pointer"
className="w-[10vw] max-w-10"
onClick={() => navigate("/notification")}
/>
</div>
Expand All @@ -31,12 +31,12 @@ export const BackArrowWithNotification = () => {
<div className="p-3 flex flex-row items-center justify-between h-[7vh] bg-white">
<img
src={backArrow}
className="w-[10vw] max-w-10 hover:cursor-pointer"
className="w-[10vw] max-w-10"
onClick={() => navigate(-1)}
/>
<img
src={noti}
className="w-[10vw] max-w-10 hover:cursor-pointer"
className="w-[10vw] max-w-10"
onClick={() => navigate("/notification")}
/>
</div>
Expand All @@ -49,12 +49,12 @@ export const NotificationWithSetting = () => {
<div className="p-3 flex flex-row items-center justify-end h-[7vh] bg-white gap-2">
<img
src={noti}
className="w-[10vw] max-w-10 hover:cursor-pointer"
className="w-[10vw] max-w-10"
onClick={() => navigate("/notification")}
/>
<img
src={setting}
className="w-[10vw] max-w-10 hover:cursor-pointer"
className="w-[10vw] max-w-10"
onClick={() => navigate("/setting")}
/>
</div>
Expand All @@ -67,7 +67,7 @@ export const BackArrow = () => {
<div className="p-3 flex items-center h-7[vh] bg-white">
<img
src={backArrow}
className="w-[9vw] max-w-9 hover:cursor-pointer"
className="w-[9vw] max-w-9"
onClick={() => navigate(-1)}
/>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/home/RecommendComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const PortfolioRecommendComponent = ({
</div>
) : null}
<div
className="bg-main text-white font-bold w-5/12 py-1.5 rounded-[20px] text-[12px] flex justify-center items-center hover:cursor-pointer"
className="bg-main text-white font-bold w-5/12 py-1.5 rounded-[20px] text-[12px] flex justify-center items-center"
onClick={() => {
data.funds
? navigate(`/detail/${data.name}`, { state: data.funds })
Expand Down
2 changes: 1 addition & 1 deletion src/components/home/TabComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const TabComponent = ({ type, isSelected, setSelected }) => {
return (
<div className="flex items-center justify-center flex-1 h-full">
<div
className={`h-full w-10/12 flex justify-center items-center hover:cursor-pointer ${
className={`h-full w-10/12 flex justify-center items-center ${
isSelected ? "border-b border-main font-bold" : null
}`}
onClick={() => setSelected(type)}
Expand Down
2 changes: 1 addition & 1 deletion src/components/manage/MoreServiceComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default function MoreServiceComponent({ title, detail }) {
</div>
<img
src={rightCircleArrow}
className="w-[50px] hover:cursor-pointer"
className="w-[50px]"
onClick={() =>
navigate(
`${title === "노후 준비 종합 진단" ? "diagnosis" : "pension"}`
Expand Down
7 changes: 6 additions & 1 deletion src/components/notification/NotificationListComponent.jsx
Original file line number Diff line number Diff line change
@@ -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({
Expand All @@ -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);
Expand All @@ -24,11 +26,14 @@ export default function NotificationListComponent({
onClick={() => {
setIsRead(true);
fetchPatchNotification(id);
navigate("/rebalancing-report");
}}
>
<p className="text-[15px]">리밸런싱 리포트</p>
<div className="flex flex-col items-end">
<span className="flex justify-center flex-1 text-[12px]">{content}</span>
<span className="flex justify-center flex-1 text-[12px]">
{content}
</span>
<span className="text-[11px]">{date}</span>
</div>
</div>
Expand Down
30 changes: 21 additions & 9 deletions src/lib/apis/base.jsx
Original file line number Diff line number Diff line change
@@ -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");
Expand All @@ -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;
Expand Down
32 changes: 17 additions & 15 deletions src/lib/apis/diagnosisApi.jsx
Original file line number Diff line number Diff line change
@@ -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;
}
}
Loading