Skip to content

Commit

Permalink
Merge pull request #92 from BCSDLab/feature/#44
Browse files Browse the repository at this point in the history
[Map] 메인 페이지 지도 구현, 메인 페이지 지도 기능 추가
  • Loading branch information
kimeodml authored Sep 4, 2023
2 parents 92fc538 + 6a86cfa commit 8d4a851
Show file tree
Hide file tree
Showing 35 changed files with 781 additions and 516 deletions.
11 changes: 0 additions & 11 deletions src/api/search/index.ts

This file was deleted.

22 changes: 20 additions & 2 deletions src/api/search/entity.ts → src/api/shop/entity.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
export interface FilterShopsParams {
options_friend: 0 | 1;
options_nearby: 0 | 1;
options_scrap: 0 | 1;
location?: Coords;
}

export interface FilterShopsResponse {
geometry: {
location: Coords;
};
name: string;
photo: null | string[];
placeId: string;
}

export type FilterShopsListResponse = FilterShopsResponse[];

export interface FetchTrendingsResponse {
trendings: string[]
}
Expand Down Expand Up @@ -30,6 +48,6 @@ export interface Shop {
}

export interface Coords {
latitude: number,
longitude: number
lat: number | undefined;
lng: number | undefined;
}
19 changes: 19 additions & 0 deletions src/api/shop/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import {
Coords, FetchShopsResponse, FetchTrendingsResponse, FilterShopsParams,
FilterShopsListResponse, ShopsParams,
} from './entity';
import shopApi from './shopApiClient';

export const fetchTrendings = () => shopApi.get<FetchTrendingsResponse>('/trending');

export const fetchShop = (shopId: string) => shopApi.get(`/shop?place_id=${shopId}`);

export const fetchShops = (params: ShopsParams) => shopApi.post<FetchShopsResponse>(`/shops?keyword=${params.keyword}`, {
lat: params.location?.lat,
lng: params.location?.lng,
});

export const getfilterShops = (params: FilterShopsParams, location: Coords) => shopApi.post<FilterShopsListResponse>(`/shops/maps?options_friend=${params.options_friend}&options_nearby=${params.options_nearby}&options_scrap=${params.options_scrap}`, {
lat: location.lat,
lng: location.lng,
});
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import axios from 'axios';
import { API_PATH } from 'config/constants';

const searchApi = axios.create({
const shopApi = axios.create({
baseURL: `${API_PATH}`,
timeout: 2000,
});

searchApi.interceptors.request.use(
shopApi.interceptors.request.use(
(config) => {
const accessToken = sessionStorage.getItem('accessToken');
// eslint-disable-next-line no-param-reassign
Expand All @@ -15,4 +15,4 @@ searchApi.interceptors.request.use(
},
);

export default searchApi;
export default shopApi;
Binary file modified src/assets/images/home/selected-marker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 0 additions & 3 deletions src/assets/svg/common/home.svg

This file was deleted.

4 changes: 0 additions & 4 deletions src/assets/svg/common/my-page.svg

This file was deleted.

27 changes: 27 additions & 0 deletions src/assets/svg/common/nav-sprite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 0 additions & 4 deletions src/assets/svg/common/setting.svg

This file was deleted.

3 changes: 0 additions & 3 deletions src/assets/svg/common/write.svg

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
left: 0;
width: 100%;
height: 80px;
background-color: #ffffff;
}

.tab {
Expand Down
46 changes: 24 additions & 22 deletions src/components/common/BottomNavigation/index.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
import { ReactComponent as HomeIcon } from 'assets/svg/common/home.svg';
import { ReactComponent as WriteIcon } from 'assets/svg/common/write.svg';
import { ReactComponent as MyPageIcon } from 'assets/svg/common/my-page.svg';
import { Link, useLocation } from 'react-router-dom';
import cn from 'utils/ts/classNames';
import { useAuth } from 'store/auth';
import styles from './BottomNavigation.module.scss';

const NAV_TABS = [
{
pathname: '/',
icon: HomeIcon,
text: '홈',
},
{
pathname: '/search',
icon: WriteIcon,
text: '글쓰기',
},
{
pathname: '/profile',
icon: MyPageIcon,
text: '마이페이지',
},
];
import SpriteSvg from '../SpriteSvg';

export default function BottomNavigation(): JSX.Element {
const { pathname } = useLocation();
const auth = useAuth();

const NAV_TABS = [
{
pathname: '/',
icon: 'home',
text: '홈',
},
{
pathname: '/post',
icon: 'write',
text: '글쓰기',
},
{
pathname: auth ? '/profile' : '/login',
icon: 'my-page',
text: '마이페이지',
},
];

return (
<nav className={styles['bottom-navigation']}>
Expand All @@ -38,7 +38,9 @@ export default function BottomNavigation(): JSX.Element {
})}
>
<Link className={styles.tab__link} to={tab.pathname}>
<tab.icon className={styles.tab__icon} aria-hidden />
<div className={styles.tab__icon}>
<SpriteSvg id={`${tab.icon}`} />
</div>
<div className={styles.tab__text}>{tab.text}</div>
</Link>
</li>
Expand Down
Loading

0 comments on commit 8d4a851

Please sign in to comment.