Skip to content

Commit

Permalink
Hotfix/#71/jaeguk (#81)
Browse files Browse the repository at this point in the history
* fix: refresh토큰 만료시간 6시간으로 조정

* feat: 마일리지 관련 팁 데이터 변경

* fix: 회원가입 완료시 confirm이 아닌 alert로 알림

* fix: 내 글 목록에서 글쓰기 버튼시 Not Found로 가는 버그 해결

* style: MapCard 컴포넌트 스타일링 변경

* feat: 기업회원 회원가입 추가

* feat: 사업자 등록번호 key registNum으로 통일

* chore: 불필요한 import 제거

* feat: 헤더 NavBar 클릭 시 대표 페이지로 이동

* chore: D-day 표시에 D- 빠진 것 추가

* chore: confrim 메시지 출력 후 취소시 뒤로가기

* style: 게시물 목록 컴포넌트 width 고정

* style: 게시물 Item 레이아웃 조정

* style: 게시물 Item 등록날짜 태그 width 변경

* fix: 게시물 상세 페이지에서 데이터 로드되지 않으면 레이아웃 보이지 않게

* fix: 관리자는 좋아요 버튼 비활성화

* fix: 401에러 반환시 처리하는 로직 변경

* fix: 좋아요 버튼 클릭시 관리자인지 확인

* fix: 관리자 좋아요 버튼 비활성화

* fix: 페이지바 끝페이지 이동 버튼 활성화

* feat: 지도에 검색 기능 추가
  • Loading branch information
jk6722 authored Nov 23, 2023
1 parent 0eda3e4 commit 659d54c
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 16 deletions.
3 changes: 2 additions & 1 deletion src/apis/map/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import Axios from '..';

export const fetchMapMarker = () => () =>
export const fetchMapMarker = (searchFilter: string) => () =>
Axios.get('/programs/filters', {
params: {
orderCriteria: '최신순',
location: searchFilter,
size: 100,
},
});
14 changes: 12 additions & 2 deletions src/components/PageBar/PageBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ const PageBar: React.FC<Props> = ({ page, setPage, maxPage }) => {
<>
{maxPage > 0 && (
<Container>
<HiOutlineChevronDoubleLeft className="icon" />
<HiOutlineChevronDoubleLeft
className="icon"
onClick={() => {
setPage(1);
}}
/>
<HiOutlineChevronLeft
className="icon"
onClick={() => movePage('prev')}
Expand All @@ -73,7 +78,12 @@ const PageBar: React.FC<Props> = ({ page, setPage, maxPage }) => {
className="icon"
onClick={() => movePage('next')}
/>
<HiOutlineChevronDoubleRight className="icon" />
<HiOutlineChevronDoubleRight
className="icon"
onClick={() => {
setPage(maxPage);
}}
/>
</Container>
)}
</>
Expand Down
11 changes: 11 additions & 0 deletions src/functions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,14 @@ export const handleClickSearchProgram = (
navigate(`/search?keyword=${searchInput}`);
setSearchInput('');
};

export const handleClickSearchMap = (
searchInput: string,
setSearchInput: React.Dispatch<React.SetStateAction<string>>,
setSearhFilter: React.Dispatch<React.SetStateAction<string>>,
) => {
// 검색 후 페이지 이동
console.log(searchInput);
setSearhFilter(searchInput);
setSearchInput('');
};
2 changes: 1 addition & 1 deletion src/pages/board/Board.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ const Container = styled.div`
width: 1400px;
margin: 0 auto 128px;
body:not(&) {
background-color: white;
}
Expand Down
25 changes: 13 additions & 12 deletions src/pages/map/Map.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import { Map, MarkerClusterer } from 'react-kakao-maps-sdk';
import CustomMarker from './components/CustomMarker';
import { useEffect, useRef, useState } from 'react';
import { useCallback, useEffect, useRef, useState } from 'react';
import MapCard from './components/MapCard';
import styled from 'styled-components';
import SearchBar from '@/components/SearchBar/SearchBar';
import useOnClickOutside from '@/hooks/useOnClickOutside';
import { useQuery } from 'react-query';
import { fetchMapMarker } from '@/apis/map';
import Loading from '@/components/Loading/Loading';
import { handleClickSearchProgram } from '@/functions';
import { useNavigate } from 'react-router-dom';
import { handleClickSearchMap } from '@/functions';

interface markerDataType {
id: number;
Expand All @@ -24,20 +23,24 @@ interface markerDataType {
const MapPage = () => {
const [selected, setSelected] = useState<number>(-1);
const [isModalOpen, setIsModalOpen] = useState<boolean>(false);
const [searchInput, setSearchInput] = useState('');
const [searchInput, setSearchInput] = useState<string>('');
const [searchFilter, setSearchFilter] = useState<string>('');

const { isLoading, data, refetch } = useQuery(
['marker', selected],
fetchMapMarker(),
['marker', selected, searchFilter],
fetchMapMarker(searchFilter),
{
cacheTime: 500005,
staleTime: 500000,
},
);
const navigate = useNavigate();

const cardRef = useRef(null);

const handleClickSearch = useCallback(() => {
handleClickSearchMap(searchInput, setSearchInput, setSearchFilter);
}, [searchInput, searchFilter]);

useOnClickOutside(cardRef, () => {
setIsModalOpen(false);
setSelected(-1);
Expand Down Expand Up @@ -74,16 +77,14 @@ const MapPage = () => {
searchInput={searchInput}
setSearchInput={setSearchInput}
placeHolder="관심있는 여행지가 있으신가요?"
handleSubmit={() =>
handleClickSearchProgram(searchInput, setSearchInput, navigate)
}
handleSubmit={handleClickSearch}
/>
</SearchBarWrapper>

<Map
center={{ lat: 37.566566, lng: 126.979192 }}
center={{ lat: 36.58775, lng: 127.968238 }}
style={{ width: '100%', height: '133.3333vh', zoom: '1.33333' }}
level={11}
level={12}
>
<MarkerClusterer>
{markerData?.map(({ latitude: lat, longitude: lng, id }, idx) => (
Expand Down

0 comments on commit 659d54c

Please sign in to comment.