Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/Strong-Potato/TripVote-FE in…
Browse files Browse the repository at this point in the history
…to 153-design-change-a-map-pin-in-vote-page
  • Loading branch information
SKY-PEY committed Jan 26, 2024
2 parents 8adb1be + 77ff4e3 commit a067a51
Show file tree
Hide file tree
Showing 85 changed files with 2,122 additions and 1,054 deletions.
9 changes: 9 additions & 0 deletions 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 package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"react-helmet-async": "^2.0.4",
"react-hook-form": "^7.49.2",
"react-icons": "^4.12.0",
"react-intersection-observer": "^9.5.3",
"react-kakao-maps-sdk": "^1.1.24",
"react-mobile-datepicker": "^4.0.2",
"react-router-dom": "^6.21.1",
Expand Down
1 change: 0 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import MainRouter from './routes/MainRouter/MainRouter';
window.Kakao.init(import.meta.env.VITE_KAKAO_KEY);

const queryClient = new QueryClient();

queryClient.setDefaultOptions({
queries: {
refetchOnWindowFocus: false,
Expand Down
12 changes: 12 additions & 0 deletions src/api/auth.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import axios from 'axios';

export const authRequest = {
withdrawal: async (password?: string) =>
await axios.post(
'/api/members/sign-out',
{
password,
},
{withCredentials: true},
),
};
8 changes: 3 additions & 5 deletions src/api/detail.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {MySpaces, PlacesNearby, PostReview, Reviews, ReviewsRating, Wishes, placeInfoData} from '@/types/detail';
import axios from 'axios';

import {MySpaces, placeInfoData, PlacesNearby, PostReview, Reviews, ReviewsRating, Wishes} from '@/types/detail';

// --------------------------- GET ---------------------------

export const getPlaceInfo = async (id: number, typeId: number): Promise<placeInfoData> => {
Expand All @@ -27,13 +28,10 @@ export const getReviews = async (id: number, typeId: number, title: string): Pro
return response.data;
};

export const getIsWish = async (id: number, setIsWish: React.Dispatch<React.SetStateAction<boolean>>) => {
export const getIsWish = async (id: number) => {
const response = await axios.get(`/api/wishes/${id}`, {
withCredentials: true,
});

setIsWish(response.data.data);

console.log(response.data);

return response.data;
Expand Down
20 changes: 20 additions & 0 deletions src/api/review.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import axios from 'axios';

export const reviewRequest = {
getMyReview: async ({pageParam}: {pageParam: number}) => {
try {
const res = await axios.get('/api/members/my-reviews', {
params: {
size: 5,
page: pageParam,
},
withCredentials: true,
});
console.log(res);

return res.data;
} catch (error) {
console.log(error);
}
},
};
4 changes: 2 additions & 2 deletions src/api/s3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ export const s3Request = {
}
},

uploadImages: async (images: FileList[]) => {
uploadImages: async (images: File[]) => {
try {
// 이미지 당 presigned url 발급
const res = await axios.post(
'/api/s3/presigned',
images.map((image) => image[0].name),
images.map((image) => image.name),
);
const presignedUrls = await res.data.data.elements.map((element: PresignedUrlElement) => element.preSignedUrl);
console.log('api/s3/presigned response', res);
Expand Down
98 changes: 90 additions & 8 deletions src/api/spaces.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import axios from 'axios';

import {Region} from '@/types/regionSearch';
import {SpaceDateParams, SpaceRegionParams, SpaceResponse} from '@/types/route';
import {ExitSpaceParams, journeyParams, PlaceParams, SpaceDateParams, SpaceRegionParams} from '@/types/route';

export const spacesRequest = {
getUpcoming: async () => {
Expand All @@ -13,6 +12,21 @@ export const spacesRequest = {
}
},

getOutdated: async ({pageParam}: {pageParam: number}) => {
try {
const res = await axios.get('/api/members/my-spaces/outdated', {
params: {
size: 5,
page: pageParam,
},
withCredentials: true,
});
return res.data;
} catch (error) {
console.log(error);
}
},

post: async () => {
try {
const res = await axios.post('/api/spaces', {withCredentials: true});
Expand All @@ -23,16 +37,62 @@ export const spacesRequest = {
},
};

// [GET] 지역 리스트
export const getRegions = async (): Promise<Region[]> => {
// [GET] 지역 리스트 조회
export const getRegions = async () => {
const response = await axios.get(`/api/spaces/city`);
return response.data.data.cities;
};

// [GET] 단일 여행 스페이스
export const getSpace = async (spaceId: number): Promise<SpaceResponse> => {
const response = await axios.get(`/api/spaces/${spaceId}`, {withCredentials: true});
return response.data;
// [GET] 단일 여행 스페이스 조회
export const getSpace = async (spaceId: number) => {
try {
const response = await axios.get(`/api/spaces/${spaceId}`, {withCredentials: true});
return response.data;
} catch (error) {
console.log(error);
}
};

// [GET] 최근 여행 스페이스 조회
export const getRecentSpace = async () => {
try {
const response = await axios.get(`/api/spaces/recent`, {withCredentials: true});
return response.data;
} catch (error) {
console.log(error);
}
};

// [GET] 여행 일정 조회
export const getJourneys = async (spaceId: number) => {
try {
const response = await axios.get(`/api/spaces/${spaceId}/journey`, {withCredentials: true});
return response.data;
} catch (error) {
console.log(error);
}
};

// [POST] 일정 추가
export const postPlaces = async ({spaceId, journeyId, placeIds}: PlaceParams) => {
try {
const response = await axios.post(`/api/spaces/${spaceId}/places`, {journeyId: journeyId, placeIds: placeIds});
console.log('[SUCCESS]', response);
return response;
} catch (error) {
console.error(error);
}
};

// [PUT] 일정 수정
export const putPlaces = async ({spaceId, places}: journeyParams) => {
try {
const response = await axios.put(`/api/spaces/${spaceId}/places`, {places: places});
console.log('[SUCCESS]', response);
return response;
} catch (error) {
console.error(error);
}
};

// [PUT] 지역 선택
Expand All @@ -56,3 +116,25 @@ export const putDates = async ({spaceId, startDate, endDate}: SpaceDateParams) =
console.error(error);
}
};

// [PUT] 여행 나가기
export const putExitSpace = async ({spaceId}: ExitSpaceParams) => {
try {
const response = await axios.put(`/api/spaces/${spaceId}/exit`);
console.log('[SUCCESS]', response);
return response;
} catch (error) {
console.error(error);
}
};

// [DELETE] 일정 삭제
export const deletePlaces = async ({spaceId, places}: journeyParams) => {
try {
const response = await axios.delete(`/api/spaces/${spaceId}/places`, {params: {places: places}});
console.log('[SUCCESS]', response);
return response;
} catch (error) {
console.error(error);
}
};
15 changes: 15 additions & 0 deletions src/api/wishes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import axios from 'axios';
import {Dispatch} from 'react';

import {DataType} from '@/types/home';
import {Wishes} from '@/types/wish';

export async function getUserWishes(set: Dispatch<Wishes | undefined>) {
try {
const fetchData = await axios.get('/api/members/my-places');
const data: DataType<Wishes> = fetchData.data;
set(data.data);
} catch (error) {
console.log(error);
}
}
6 changes: 6 additions & 0 deletions src/assets/icons/city_default.svg
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/spinner.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 22 additions & 17 deletions src/chakra/avatarCustom.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,34 @@
import { avatarAnatomy } from "@chakra-ui/anatomy";
import { createMultiStyleConfigHelpers } from "@chakra-ui/react";
import {avatarAnatomy} from '@chakra-ui/anatomy';
import {createMultiStyleConfigHelpers} from '@chakra-ui/react';

const { definePartsStyle, defineMultiStyleConfig } =
createMultiStyleConfigHelpers(avatarAnatomy.keys);
const {definePartsStyle, defineMultiStyleConfig} = createMultiStyleConfigHelpers(avatarAnatomy.keys);

const tabsVoteCard = definePartsStyle({
container: {
w: "24px",
h: "24px",
border: "1px solid #fff",
w: '24px',
h: '24px',
border: '1px solid #fff',
},
excessLabel: {
w: "39px",
h: "24px",
borderRadius: "75px",
border: "1px solid #2388FF",
color: "#2388FF",
bg: "#fff",
w: '39px',
h: '24px',
borderRadius: '75px',
border: '1px solid #2388FF',
color: '#2388FF',
bg: '#fff',

fontSize: "captionSmall",
fontWeight: "captionSmall",
lineHeight: "captionSmall",
fontSize: 'captionSmall',
fontWeight: 'captionSmall',
lineHeight: 'captionSmall',
},
});

const spaceAvatar = definePartsStyle({
excessLabel: {
display: 'none !important',
},
});

export const avatarTheme = defineMultiStyleConfig({
variants: { tabsVoteCard },
variants: {tabsVoteCard, spaceAvatar},
});
3 changes: 2 additions & 1 deletion src/components/Auth/Input/Input.module.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@use "@/sass" as *;
@use '@/sass' as *;

.email,
.sertCode,
Expand Down Expand Up @@ -124,6 +124,7 @@
height: 7.2rem;
padding: 8px;
border-radius: 50%;
border: 1px solid $neutral200;

&__camera {
background-color: $neutral100;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ const SelectButton = ({data}: Propstype) => {
e.preventDefault();
setIsClicked((prev) => !prev);
toggleItemInNewArray(data);
console.log(data);
};

useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@use "@/sass" as *;
@use '@/sass' as *;

.container {
margin-top: 32px;
Expand All @@ -20,8 +20,13 @@
position: relative;
display: flex;
gap: 8px;
padding: 10px 0;

overflow-x: auto;
overflow-y: visible;

&__addBox {
flex: 0 0 7.6rem;
width: 7.6rem;
height: 7.6rem;
background-color: $neutral100;
Expand All @@ -36,9 +41,7 @@
}

&__box {
width: 7.6rem;
height: 7.6rem;

flex: 0 0 7.6rem;
display: flex;
justify-content: center;
align-items: center;
Expand All @@ -62,4 +65,8 @@
}
}
}

&__imageInput {
display: none;
}
}
Loading

0 comments on commit a067a51

Please sign in to comment.