Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FE] 브랜치 병합 #229

Merged
merged 31 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
0fc4cfe
🔧 fix: 이동 평균 관련 오류 수정 #192
dannysir Nov 27, 2024
16e5ce9
💄 design: 메인 페이지 상위 5개 종목 관련 부호 표시
dannysir Nov 27, 2024
8cc0b9e
✨ feat: 주식 즐겨찾기 등록/취소 버튼 레이아웃 구현 #212 #214
dongree Nov 27, 2024
3d18875
✨ feat: bookmark API 연동 #213 #215
dongree Nov 27, 2024
e31c7dd
➕ add: 로그인 아닐 시 bookmark 버튼 누를 경우 예외처리 & toastify 추가
dongree Nov 27, 2024
856de51
✨ feat: 마이페이지 즐겨찾기 레이아웃 구현 #216
dongree Nov 27, 2024
2e3c6ae
✨ feat: 마이페이지 즐겨찾기 주식 API 연동 #217
dongree Nov 27, 2024
93b5a24
⚙️ chore: console.log 제거
dongree Nov 27, 2024
69f5756
➕ add: 검색 안내 문구 추가
dongree Nov 27, 2024
6c1ae58
🔧 fix: 즐겨찾기 로직 수정
dongree Nov 27, 2024
4ca6cbb
Merge pull request #222 from boostcampwm-2024/feature/bookmark
dannysir Nov 28, 2024
3593d63
➕ add: 등락률 +인 경우 '+' 마크 추가
dongree Nov 28, 2024
e062752
🔧 fix: getStockByCode 즐겨찾기 여부 확인을 위해 credential 옵션 설정
dongree Nov 28, 2024
d92bed6
♻️ refactor: X축 라벨의 갯수를 데이터 갯수에 맞게 출력하도록 수정. #192
dannysir Nov 28, 2024
4ac4ff9
✨ feat: 이동평균선 on/off 기능 추가 #192
dannysir Nov 28, 2024
a7e29bc
♻️ refactor: 로고 이미지 포멧 추가 & favicon 설정.
dannysir Nov 28, 2024
a782b2c
➕ add: 내 정보 수정 레이아웃 구현
dongree Nov 28, 2024
60702e4
✨ feat: 유저 닉네임 수정 API 연동
dongree Nov 28, 2024
902a706
💄 design: 내 정보 반응형 디자인 추가
dongree Nov 28, 2024
934ee66
➕ add: 같은 닉네임으로 수정했을 때 예외처리
dongree Nov 28, 2024
0865ee7
➕ add: 닉네임 변경 취소 버튼 추가
dongree Nov 28, 2024
db5a2d7
♻️ refactor: user 정보 api customhooks로 관리
dongree Nov 28, 2024
307df08
✨ 차트 값 표시 화면 추가 #192
dannysir Nov 28, 2024
6f2c7d4
🔧 fix: 불필요한 log 제거
dannysir Nov 28, 2024
e7e2a43
🔧 fix: 다른 종목간 주식 디테일 페이지 이동시 매수, 매도 가격 입력란 변경안되는 문제 해결
dongree Nov 28, 2024
4a48853
💄 design: 검색창 기본 크기 수정
dannysir Nov 28, 2024
ab7f9a5
💄 design: 최근 검색 부분을 위한 높이 설정 수정
dannysir Nov 28, 2024
19ca1aa
🔧 fix: 차트 데이터 요청 body 수정. #192
dannysir Nov 28, 2024
99b4903
Merge pull request #225 from boostcampwm-2024/feature/mypage/myInfo
dannysir Nov 28, 2024
576c292
Merge pull request #228 from boostcampwm-2024/feature/layout/detail/c…
dongree Nov 28, 2024
5710b6a
Merge branch 'dev' into front/main
dannysir Nov 28, 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
2 changes: 1 addition & 1 deletion FE/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<link rel="icon" href="src/assets/favicon.ico" type="image/x-icon" />
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css"
Expand Down
21 changes: 21 additions & 0 deletions FE/package-lock.json

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

1 change: 1 addition & 0 deletions FE/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"react-dom": "^18.3.1",
"react-error-boundary": "^4.1.2",
"react-router-dom": "^6.27.0",
"react-toastify": "^10.0.6",
"socket.io-client": "^4.8.1",
"vite-tsconfig-paths": "^5.0.1",
"zustand": "^5.0.1"
Expand Down
3 changes: 3 additions & 0 deletions FE/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import Login from 'components/Login';
import SearchModal from './components/Search';
import MyPage from 'page/MyPage';
import Rank from 'page/Rank.tsx';
import { ToastContainer } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';

function App() {
return (
Expand Down Expand Up @@ -39,6 +41,7 @@ function Layout() {
</main>
<Login />
<SearchModal />
<ToastContainer />
</>
);
}
Binary file added FE/src/assets/favicon.ico
Binary file not shown.
File renamed without changes
Binary file added FE/src/assets/logo.webp
Binary file not shown.
12 changes: 10 additions & 2 deletions FE/src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import useAuthStore from 'store/authStore';
import useLoginModalStore from 'store/useLoginModalStore';
import useSearchModalStore from '../store/useSearchModalStore.ts';
import useSearchInputStore from '../store/useSearchInputStore.ts';
import logo from 'assets/Logo.png';
import logoPng from 'assets/logo.png';
import logoWebp from 'assets/logo.webp';
import { checkAuth, logout } from 'service/auth.ts';
import { useEffect } from 'react';

Expand Down Expand Up @@ -42,7 +43,14 @@ export default function Header() {
<header className='fixed left-0 top-0 h-[60px] w-full bg-white'>
<div className='mx-auto flex h-full max-w-[1280px] items-center justify-between px-8'>
<Link to={'/'} className='flex items-center gap-2'>
<img src={logo} className={'h-[32px]'} />
<picture>
<source
srcSet={logoWebp}
type='image/webp'
className={'h-[32px]'}
/>
<img src={logoPng} className={'h-[32px]'} />
</picture>
<h1 className='text-xl font-bold text-juga-grayscale-black'>JuGa</h1>
</Link>

Expand Down
2 changes: 0 additions & 2 deletions FE/src/components/Mypage/Account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ export default function Account() {

const { asset, stocks } = data;

console.log(asset, stocks);

return (
<div className='flex min-h-[500px] flex-col gap-3'>
<AccountCondition asset={asset} />
Expand Down
61 changes: 61 additions & 0 deletions FE/src/components/Mypage/BookMark.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import { useQuery } from '@tanstack/react-query';
import { useNavigate } from 'react-router-dom';
import { getBookmarkedStocks } from 'service/bookmark';

export default function BookMark() {
const navigation = useNavigate();

const handleClick = (code: string) => {
navigation(`/stocks/${code}`);
};

const { data, isLoading, isError } = useQuery(
['bookmark', 'stock'],
() => getBookmarkedStocks(),
{
staleTime: 1000,
},
);

if (isLoading) return <div>loading</div>;
if (!data) return <div>No data</div>;
if (isError) return <div>error</div>;

return (
<div className='mx-auto flex min-h-[500px] w-full flex-1 flex-col rounded-md bg-white p-4 shadow-md'>
<div className='flex pb-2 text-sm font-bold border-b'>
<p className='w-1/2 text-left truncate'>종목</p>
<p className='w-1/4 text-center'>현재가</p>
<p className='w-1/4 text-right'>등락률</p>
</div>

<ul className='flex flex-col text-sm divide-y'>
{data.map((stock) => {
const { code, name, stck_prpr, prdy_ctrt, prdy_vrss_sign } = stock;

return (
<li
className='flex py-2 transition-colors hover:cursor-pointer hover:bg-gray-50'
key={code}
onClick={() => handleClick(code)}
>
<div className='flex w-1/2 gap-2 text-left truncate'>
<p className='font-semibold'>{name}</p>
<p className='text-gray-500'>{code}</p>
</div>
<p className='w-1/4 text-center truncate'>
{(+stck_prpr).toLocaleString()}원
</p>
<p
className={`w-1/4 truncate text-right ${+prdy_vrss_sign > 3 ? 'text-juga-blue-50' : 'text-juga-red-60'}`}
>
{+prdy_vrss_sign < 3 && '+'}
{prdy_ctrt}%
</p>
</li>
);
})}
</ul>
</div>
);
}
88 changes: 71 additions & 17 deletions FE/src/components/Mypage/MyInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,34 +1,88 @@
import { PencilSquareIcon } from '@heroicons/react/16/solid';
import { useQuery } from '@tanstack/react-query';
import { getMyProfile } from 'service/user';
import Toast from 'components/Toast';

import useUser from 'hooks/useUser';
import { useEffect, useState } from 'react';

export default function MyInfo() {
const { data, isLoading, isError } = useQuery(
['myInfo', 'profile'],
() => getMyProfile(),
{ staleTime: 1000 },
);
const [isEditMode, setIsEditMode] = useState(false);
const { userQuery, updateNickame } = useUser();

const { data, isLoading, isError } = userQuery;

const [nickname, setNickname] = useState('');

useEffect(() => {
if (!data) return;
setNickname(data.name);
}, [data]);

if (isLoading) return <div>loading</div>;
if (!data) return <div>No data</div>;
if (isError) return <div>error</div>;

const { name } = data;
const handeleEditBtnClick = () => {
if (nickname === data.name) {
setIsEditMode(false);
return;
}

updateNickame.mutate(nickname, {
onSuccess: (res) => {
if (res.statusCode === 400) {
Toast({ message: res.message, type: 'error' });
return;
}
setIsEditMode(false);
},
});
};

return (
<div className='flex flex-col items-center p-6 text-lg'>
<div className='flex w-[50%] items-center gap-2 py-2'>
<div className='flex w-full max-w-[600px] items-center gap-2 py-2 sm:w-[80%] lg:w-[50%]'>
<div className='flex items-center justify-between w-full'>
<p className='w-28 min-w-[100px] truncate font-medium text-juga-grayscale-black'>
username
<p className='w-28 min-w-[80px] truncate font-medium text-juga-grayscale-black sm:min-w-[100px]'>
닉네임
</p>
<div className='flex items-center gap-2'>
<p className='min-w-[50px] truncate font-semibold text-juga-grayscale-500'>
{name}
</p>
<button>
<PencilSquareIcon className='w-5 h-5' />
</button>
{isEditMode ? (
<>
<input
type='text'
value={nickname}
onChange={(e) => setNickname(e.target.value)}
className='w-24 min-w-[60px] flex-1 text-right font-semibold text-juga-grayscale-500 sm:w-auto sm:min-w-[80px]'
autoFocus
/>
<button
onClick={handeleEditBtnClick}
className='w-10 p-1 text-sm font-semibold text-white rounded-lg bg-juga-blue-40'
>
수정
</button>
<button
onClick={() => {
setNickname(data.name);
setIsEditMode(false);
}}
className='w-10 p-1 text-sm font-semibold text-white rounded-lg bg-juga-grayscale-500'
>
취소
</button>
</>
) : (
<>
<p className='min-w-[60px] truncate font-semibold text-juga-grayscale-500 sm:min-w-[80px]'>
{nickname}
</p>
<div className='flex items-center justify-end w-9'>
<button onClick={() => setIsEditMode(true)}>
<PencilSquareIcon className='w-5 h-5' />
</button>
</div>
</>
)}
</div>
</div>
</div>
Expand Down
3 changes: 2 additions & 1 deletion FE/src/components/Mypage/Nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import { MypageSectionType } from 'types';
const mapping = {
account: '보유 자산 현황',
order: '주문 요청 현황',
bookmark: '즐겨찾기',
info: '내 정보',
};
const sections: MypageSectionType[] = ['account', 'order', 'info'];
const sections: MypageSectionType[] = ['account', 'order', 'bookmark', 'info'];

export default function Nav() {
const [searchParams, setSearchParams] = useSearchParams();
Expand Down
16 changes: 13 additions & 3 deletions FE/src/components/Search/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
if (data && data.length > 0 && debounceValue && !isLoading) {
addSearchHistory(formatNoSpecialChar(debounceValue));
}
}, [data, debounceValue]);

Check warning on line 39 in FE/src/components/Search/index.tsx

View workflow job for this annotation

GitHub Actions / FE-test-and-build

React Hook useEffect has missing dependencies: 'addSearchHistory' and 'isLoading'. Either include them or remove the dependency array

Check warning on line 39 in FE/src/components/Search/index.tsx

View workflow job for this annotation

GitHub Actions / build-and-deploy (fe, FE, 5173, juga-docker-fe, ENV_FE)

React Hook useEffect has missing dependencies: 'addSearchHistory' and 'isLoading'. Either include them or remove the dependency array

if (!isOpen) return null;

Expand All @@ -47,7 +47,7 @@
<>
<Overlay onClick={() => toggleSearchModal()} />
<section
className={`${searchInput.length ? 'h-[520px]' : 'h-[160px]'} fixed left-1/2 top-3 z-20 w-[640px] -translate-x-1/2 rounded-2xl bg-white shadow-xl`}
className={`${searchInput.length ? 'h-[520px]' : ''} fixed left-1/2 top-3 z-20 w-[640px] -translate-x-1/2 rounded-2xl bg-white shadow-xl`}
>
<div
className={'absolute left-0 right-0 top-0 rounded-t-2xl bg-white p-3'}
Expand All @@ -70,8 +70,18 @@

<div className={'h-[400px] overflow-y-auto'}>
{isSearching ? (
<div className={'flex h-full items-center justify-center'}>
<Lottie animationData={searchAnimation} />
<div
className={
'flex h-[320px] flex-col items-center justify-center'
}
>
<Lottie
animationData={searchAnimation}
className='h-[200px]'
/>
<p className='font-bold text-juga-grayscale-black'>
두 글자 이상의 검색어를 입력해주세요.
</p>
</div>
) : (
showSearchResults && <SearchList searchData={data} />
Expand Down
Loading
Loading