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

[Release/0.4.0] 마이페이지 및 마무리 #33

Merged
merged 26 commits into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
1ee63f7
Merge pull request #26 from tomato-market/main
Hyunuk17 Nov 8, 2023
5fe7a93
[tomato-market/plan#14] 버그 수정
Hyunuk17 Nov 9, 2023
12cf6a2
[tomato-market/plan#14] 관심 등록
Hyunuk17 Nov 9, 2023
e713965
[tomato-market/plan#14] 디자인 수정
Hyunuk17 Nov 9, 2023
7afe5ad
Merge pull request #27 from tomato-market/feature/14_favorite
Hyunuk17 Nov 10, 2023
30776aa
[tomato-market/plan#22] 브랜치 생성
Hyunuk17 Nov 10, 2023
e5c8fa6
[tomato-market/plan#22] 데이터 호출 및 출력 구현
Hyunuk17 Nov 10, 2023
0413115
Merge pull request #28 from tomato-market/feature/22_favorite_list
Hyunuk17 Nov 11, 2023
e5f2837
[tomato-market/plan#27] 기본 디자인
Hyunuk17 Nov 11, 2023
d84ec50
[tomato-market/plan#27] 게시글 수정
Hyunuk17 Nov 11, 2023
ee140c2
[tomato-market/plan#27] 게시글 Status 수정 구현
Hyunuk17 Nov 11, 2023
b428f81
Merge pull request #29 from tomato-market/feature/27_post_update
Hyunuk17 Nov 13, 2023
d7126ab
[tomato-market/plan#19] 브랜치 생성 및 기본 구성
Hyunuk17 Nov 13, 2023
b3d7146
[tomato-market/plan#19] 판매 목록 출력
Hyunuk17 Nov 13, 2023
444aa71
Merge pull request #30 from tomato-market/feature/19_sell_list
Hyunuk17 Nov 14, 2023
778f46f
[tomato-market/plan#30] 브랜치 생성
Hyunuk17 Nov 14, 2023
bba23e8
[tomato-market/plan#30] Category 구현
Hyunuk17 Nov 15, 2023
6ce884c
[tomato-market/plan#30] 디자인 수정
Hyunuk17 Nov 15, 2023
fc9176e
[tomato-market/plan#30] Prettier 적용
Hyunuk17 Nov 15, 2023
4cdf0f0
Merge pull request #31 from tomato-market/feature/30_category
Hyunuk17 Nov 16, 2023
64be671
[tomato-market/plan#11] 브랜치 생성 및 화면 구성
Hyunuk17 Nov 16, 2023
c76b53d
[tomato-market/plan#11] 전체적인 수정
Hyunuk17 Nov 23, 2023
4990919
[tomato-market/plan#11] 마이페이지 수정
Hyunuk17 Nov 23, 2023
d860f2c
Merge pull request #32 from tomato-market/feature/11_user_update
Hyunuk17 Nov 24, 2023
972d83b
[tomato-market/plan#0.4.0] 브랜치 생성
Hyunuk17 Nov 24, 2023
e7ba6f2
[tomato-market/plan#0.4.0] 불필요 이미지 삭제
Hyunuk17 Nov 24, 2023
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
12 changes: 12 additions & 0 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ import Post from 'pages/Post';
import PostDetail from 'pages/PostDetail';
import Chatting from 'pages/Chatting';
import ChatList from 'pages/ChatList';
import MyPage from 'pages/MyPage';
import Favorite from 'pages/Favorite';
import PostUpdate from 'pages/PostUpdate';
import SellList from 'pages/SellList';
import Category from 'pages/Category';
import UpdateUser from 'pages/UpdateUser';

function App() {
return (
Expand All @@ -22,6 +28,12 @@ function App() {
<Route path="/postDetail" element={<PostDetail />} />
<Route path="/chatting" element={<Chatting />} />
<Route path="/chatList" element={<ChatList />} />
<Route path="/myPage" element={<MyPage />} />
<Route path="/favorite" element={<Favorite />} />
<Route path="/postUpdate" element={<PostUpdate />} />
<Route path="/sellList" element={<SellList />} />
<Route path="/category" element={<Category />} />
<Route path="updateUser" element={<UpdateUser />} />
</Routes>
</BrowserRouter>
);
Expand Down
Binary file added src/assets/tomato_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/tomato_main_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 10 additions & 2 deletions src/components/BottomNav.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,26 @@ export default function SimpleBottomNavigation() {
navigate('/board');
};

const category = () => {
navigate('/category');
};

const chatList = () => {
navigate('/chatList');
};

const myPage = () => {
navigate('/myPage');
};

return (
<Box>
<BottomNavigation showLabels>
{/* 내용 수정 필요 */}
<BottomNavigationAction label="홈" value="board" icon={<DashboardIcon />} onClick={board} />
<BottomNavigationAction label="카테고리" value="category" icon={<CategoryIcon />} />
<BottomNavigationAction label="카테고리" value="category" icon={<CategoryIcon />} onClick={category} />
<BottomNavigationAction label="채팅" value="chatList" icon={<ChatIcon />} onClick={chatList} />
<BottomNavigationAction label="마이페이지" value="mypage" icon={<ContactPageIcon />} />
<BottomNavigationAction label="마이페이지" value="mypage" icon={<ContactPageIcon />} onClick={myPage} />
</BottomNavigation>
</Box>
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/Logo.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import 'styles/Logo.css';
import logo from '../logo.svg';
import logo from 'assets/tomato_logo.png';

export default function Logo() {
return (
Expand Down
28 changes: 21 additions & 7 deletions src/components/Navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ import Button from '@mui/material/Button';
import DialogActions from '@mui/material/DialogActions';
import Session from 'utils/Session';
import { useState } from 'react';
import Grid from '@mui/material/Grid';
import Logout from 'components/Logout';
import { useNavigate } from 'react-router-dom';
import logo from 'assets/tomato_logo.png';

export default function Navbar(props) {
const navigate = useNavigate();
const style = {
position: 'absolute',
top: '20%',
Expand All @@ -38,18 +42,28 @@ export default function Navbar(props) {
}, [isSessionValid, props]);

// const logoutSession = logout();
const home = () => {
navigate('/board');
};

return (
<>
<AppBar position="static" color="error">
<Toolbar>
<Typography variant="h6" component="div" sx={{ flexGrow: 1 }}>
Text
{/* 로고 넣기 */}
</Typography>
<IconButton size="large" edge="start" color="inherit" aria-label="menu" onClick={openMenu}>
<MenuIcon />
</IconButton>
<Grid container>
<Grid item xs={1}>
<div></div>
</Grid>
<Grid item xs textAlign={'center'}>
{/* Logo */}
<img src={logo} style={{ height: '46px', marginTop: '6px', bottom: '0' }} onClick={home} />
</Grid>
<Grid item xs={1} display={'flex'} justifyContent={'end'}>
<IconButton size="large" edge="end" color="inherit" aria-label="menu" onClick={openMenu} style={{ margin: 0, padding: 0 }}>
<MenuIcon />
</IconButton>
</Grid>
</Grid>
</Toolbar>
</AppBar>
<Modal open={open} onClose={closeMenu} aria-labelledby="modal-modal-title" aria-describedby="modal-modal-description">
Expand Down
101 changes: 71 additions & 30 deletions src/pages/Board.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useEffect } from 'react';
import { useState } from 'react';
import { Link } from 'react-router-dom';
import { Link, useLocation } from 'react-router-dom';
import Background from 'components/Background';
import Navbar from 'components/Navbar';
import BottomNav from 'components/BottomNav';
Expand All @@ -19,14 +19,12 @@ import createdAt from 'utils/Time';
import SpeedDial from '@mui/material/SpeedDial';
import SpeedDialIcon from '@mui/material/SpeedDialIcon';
import SpeedDialAction from '@mui/material/SpeedDialAction';
import SaveIcon from '@mui/icons-material/Save';
import PrintIcon from '@mui/icons-material/Print';
import ShareIcon from '@mui/icons-material/Share';
import CreateIcon from '@mui/icons-material/Create';
import LocationOnIcon from '@mui/icons-material/LocationOn';
import Grid from '@mui/material/Grid';

export default function Board() {
const navigate = useNavigate();
const { state } = useLocation();
const [userId, setUserId] = useState('');
const getUserId = (id) => {
setUserId(id);
Expand All @@ -37,7 +35,10 @@ export default function Board() {
setSearchInput(e.target.value);
console.log(searchInput);
};
const [keyword, setKeyword] = useState();

// 일단 기본값, 카테고리 검색 시 state를 받음 // useLocation? or null
const [type, setType] = useState(state ? state.type : null);
const [keyword, setKeyword] = useState(state ? state.keyword : null);

const [postList, setPostList] = useState([]);
const [isLoading, setIsLoading] = useState(true);
Expand All @@ -52,11 +53,13 @@ export default function Board() {
useEffect(() => {
if (userId !== '') {
console.log('axios 호출');
console.log(type + ': ' + keyword);
axios({
url: '/api/board/getPostList',
method: 'get',
params: {
page: pageNumber,
type: type,
keyword: keyword,
},
})
Expand Down Expand Up @@ -96,6 +99,47 @@ export default function Board() {
navigate('/postDetail', { state: postNumber });
};

// const [location, setLocation] = useState('');
const searchByLocation = () => {
console.log('현재 위치로 검색');
axios({
url: '/api/user/location',
method: 'get',
params: {
userId: userId,
},
})
.then((response) => {
console.log(response.data);
if (response.status === 200) {
if (response.data.message === '위치 조회 성공') {
// setLocation(response.data.data);
// console.log(location);
// setLocation이 아니라
setType('L');
setKeyword(response.data.data);
} else {
alert(response.data.message);
}
} else {
throw new Error('정의되지 않은 에러');
}
})
.catch((error) => alert(error));
};

const actions = [
{
icon: (
<Link to={'/post'} style={{ textDecoration: 'none', color: '#5f5f5f', display: 'flex' }}>
<EditIcon />
</Link>
),
name: '글쓰기',
},
{ icon: <LocationOnIcon onClick={searchByLocation} />, name: '위치 검색' },
];

return (
<Background>
<Navbar getUserId={getUserId} userId={userId} />
Expand All @@ -109,6 +153,13 @@ export default function Board() {
placeholder="검색어를 입력하세요."
style={{ margin: '10px 0 10px 0' }}
onChange={handleSearchInput}
onKeyDown={(ev) => {
if (ev.key === 'Enter') {
setPageNumber(0);
setKeyword(searchInput);
setType('T');
}
}}
InputProps={{
endAdornment: (
<InputAdornment
Expand All @@ -117,6 +168,7 @@ export default function Board() {
onClick={() => {
setPageNumber(0);
setKeyword(searchInput);
setType('T');
}}
>
<SearchIcon />
Expand All @@ -125,13 +177,14 @@ export default function Board() {
}}
></TextField>

{/* 이미지 접근 예시 */}
{/* nginx proxy로 접근 */}
{/* <img src='/image/default.png' style={{width: '120px', marginBottom: '10px'}}/> */}

{/* Image nginx proxy로 접근 */}
{/* 반복 Card 구조*/}
{isLoading ? (
<p>Loading...</p>
<div style={{ display: 'flex', alignItems: 'center', height: '100%', justifyContent: 'center' }}>
<Typography variant="body1" textAlign={'center'}>
Loading...
</Typography>
</div>
) : postList.length > 0 ? (
<div style={{ flex: '1' }}>
{postList.map((post, index) => {
Expand All @@ -150,7 +203,7 @@ export default function Board() {
<CardContent sx={{ flex: '1 0 auto', p: 1 }} style={{ paddingBottom: '8px' }}>
<Grid container item xs direction="row" p={0} m={0}>
<Grid item pr={1} xs>
<Typography component="h4" variant="subtitle1" style={{ maxWidth: '160px', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>
<Typography component="h4" variant="subtitle1" style={{ maxWidth: '110px', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>
{post.title}
</Typography>
</Grid>
Expand All @@ -160,7 +213,7 @@ export default function Board() {
</Typography>
</Grid>
</Grid>
<Typography variant="caption" color="text.secondary" component="div" style={{ height: '40px', maxWidth: '200px', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>
<Typography variant="caption" color="text.secondary" component="div" style={{ height: '40px', width: '100%', maxWidth: '160px', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>
{post.location}
</Typography>

Expand All @@ -184,7 +237,11 @@ export default function Board() {
})}
</div>
) : (
<p>No Data</p>
<div style={{ display: 'flex', alignItems: 'center', height: '100%', justifyContent: 'center' }}>
<Typography variant="body1" textAlign={'center'}>
등록된 아이템이 없습니다.
</Typography>
</div>
)}

<div style={{ width: '100%', textAlign: 'center', padding: '10px 0 20px 0' }}>
Expand Down Expand Up @@ -213,19 +270,3 @@ export default function Board() {
</Background>
);
}

const actions = [
{
icon: (
<Link to={'/post'} style={{ textDecoration: 'none', color: '#5f5f5f', display: 'flex' }}>
<EditIcon />
</Link>
),
name: '글쓰기',
},
// 추후 목록 수정
{ icon: <CreateIcon />, name: 'ds' },
{ icon: <SaveIcon />, name: 'Save' },
{ icon: <PrintIcon />, name: 'Print' },
{ icon: <ShareIcon />, name: 'Share' },
];
Loading