Skip to content

Commit

Permalink
Merge pull request #19 from wecode-bootcamp-korea/fix/modifyEnv
Browse files Browse the repository at this point in the history
[50기 황수현]Modify:코드일부 수정
  • Loading branch information
Hsoohyeon authored Nov 24, 2023
2 parents d2127c7 + 5af7b8e commit 64e622c
Show file tree
Hide file tree
Showing 28 changed files with 425 additions and 825 deletions.
49 changes: 0 additions & 49 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion public/images/caret-down-solid.svg

This file was deleted.

32 changes: 0 additions & 32 deletions public/images/close.svg

This file was deleted.

Binary file added public/images/closeMark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 17 additions & 14 deletions src/components/MenuBar/MenuBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ const MenuBar = () => {

// 로고 클릭시 메인페이지로 이동
const goToMain = () => {
navigate('/');
navigate('/main');
};

const TOKEN = localStorage.getItem('TOKEN');
const TOKEN = localStorage.getItem('TOKEN') || '';

// 로그아웃
const logout = () => {
Expand All @@ -28,7 +28,7 @@ const MenuBar = () => {

// 버튼 데이터
const BUTTONS = [
{ text: 'Home', onClick: () => navigate('/') },
{ text: 'Home', onClick: () => navigate('/main') },
{ text: '가계부 조회', onClick: () => navigate('/table') },
{ text: '가계부 설정', onClick: () => navigate('/setting') },
{ text: '금융상품 안내', onClick: () => {} },
Expand All @@ -37,7 +37,7 @@ const MenuBar = () => {
];
// 사용자 정보(이름, 권한)
useEffect(() => {
fetch(`${API.UserInfo}`, {
fetch(API.UserInfo, {
method: 'GET',
headers: {
'Content-Type': 'application/json;charset=utf-8',
Expand Down Expand Up @@ -70,16 +70,19 @@ const MenuBar = () => {
</div>
<div className="menuBarButtonFrame">
<ul>
{BUTTONS.map((button, index) => (
<li key={index} className="buttonList">
<button
className={`menuBarButton${button.isRed ? ' red' : ''}`}
onClick={button.onClick}
>
{button.text}
</button>
</li>
))}
{BUTTONS.map(
(button, index) =>
!(setUserRole === 0 && button.text === '가계부 설정') && ( //userRole이 0이면서, button.text가 가계부 설정이면 렌더링하지않음
<li key={index} className="buttonList">
<button
className={`menuBarButton${button.isRed ? ' red' : ''}`}
onClick={button.onClick}
>
{button.text}
</button>
</li>
),
)}
</ul>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/components/MenuBar/MenuBar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@

&:focus {
background-color: #3dd980;
outline: none;
}

&.red {
Expand Down
8 changes: 7 additions & 1 deletion src/components/MenuWrapper/MenuWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ import { useLocation } from 'react-router-dom';
import MenuBar from '../MenuBar/MenuBar';
import './MenuWrapper.scss';

const EXCEPTIONAL_PATH = ['/login', '/users/auth', '/Setting', '/'];
const EXCEPTIONAL_PATH = [
'/login',
'/users/auth',
'/Setting',
'/',
'/user-signup',
];

const MenuWrapper = ({ children }) => {
const { pathname } = useLocation();
Expand Down
6 changes: 0 additions & 6 deletions src/components/MenuWrapper/MenuWrapper.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,3 @@
max-width: 90%;
}
}

@media screen and (min-width: 570px) {
.mainContent {
max-width: 82%;
}
}
11 changes: 7 additions & 4 deletions src/config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
const BASE_URL = 'http://43.202.56.239:8000/';
const BASE_URL = 'http://10.58.52.81:8000';

const API = {
Login: `${BASE_URL}/Login`,
UserSignUp: `${BASE_URL}/users/update'`,
UserAuth: `${BASE_URL}/users/auth'`,
UserInfo: `${BASE_URL}/users/info'`,
UserSignUp: `${BASE_URL}/users/update`,
UserAuth: `${BASE_URL}/users/auth`,
UserInfo: `${BASE_URL}/users/info`,
MainJoin: `${BASE_URL}/family/join`,
MainCreate: `${BASE_URL}/family/book`,
MainFlow: `${BASE_URL}/flow`,
Expand All @@ -15,6 +15,9 @@ const API = {
SettingCategory: `${BASE_URL}/category`,
SettingAuthCode: `${BASE_URL}/family/auth-code`,
TableFlow: `${BASE_URL}/flow`,
Allowance: `${BASE_URL}/allowance`,
FamilyUser: `${BASE_URL}/family/user`,
Budget: `${BASE_URL}/budget`,
};

export default API;
9 changes: 3 additions & 6 deletions src/pages/Auth/Auth.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import React from 'react';
import { useNavigate, useParams, useLocation } from 'react-router-dom';
import { useNavigate, useSearchParams } from 'react-router-dom';
import API from '../../config';

const Auth = () => {
const navigate = useNavigate();
const location = useLocation();
const { code } = useParams();
const [searchParams] = useSearchParams();

const searchParams = new URLSearchParams(location.search);
const codeKakao = searchParams.get('code');

fetch(`${API.UserAuth}`, {
fetch(API.UserAuth, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Expand Down
19 changes: 16 additions & 3 deletions src/pages/Main/GraphBarChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ const GraphBarChart = ({ data }) => {
transformedData.push(newData);
}

const tickFormatY = (tickItem) => tickItem.toLocaleString();

return (
<BarChart
width={580}
Expand All @@ -40,11 +42,22 @@ const GraphBarChart = ({ data }) => {
>
<CartesianGrid strokeDasharray="3 3" />
<XAxis dataKey="name" />
<YAxis />
<YAxis tickFormatter={tickFormatY} />
<Tooltip />
<Legend />
<Bar dataKey="수입" fill="#8884d8" />
<Bar dataKey="지출" fill="#82ca9d" />
<Bar
dataKey="수입"
fill="#8884d8"
position="top"
formatter={(value) => new Intl.NumberFormat('ko-KR').format(value)}
/>

<Bar
dataKey="지출"
fill="#82ca9d"
position="top"
formatter={(value) => new Intl.NumberFormat('ko-KR').format(value)}
/>
</BarChart>
);
};
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Main/GraphCircularChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const GraphCircularChart = ({ data }) => {
});
});

const total = data.reduce((acc, entry) => acc + entry.value, 0);
// const total = data.reduce((acc, entry) => acc + entry.value, 0);

return (
<PieChart width={900} height={500}>
Expand Down
Loading

0 comments on commit 64e622c

Please sign in to comment.