-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: merge dev branch to main (#151)
* fix: update likedUser of sliced placeList (#144) * fix: update likedUser of sliced placeList * fix: fix css of image inside link in carousel * chore: update package-lock.json * feat: update ai recommendation page (#147) * feat: add ticket icon * refactor: add props to reuse gpt-intro-modal * feat: implement use-typewriter for typing effect * feat: update ai recommendation page - add api call to get ai recommendations - update logic and design * feat: use test API in dev and real API in prod api.gpt.restaurants.recommend * feat: improve recommendation available count logic * refactor: make ai-recommendation as a file * chore: remove 'AI봇의 추천 이유' temporary * fix: update isFetching and isLoading logic * feat: update ai-recommend asset from img to lottie * feat: update ai-recommend-place-box * fix: fix lint error * feat: handle rounding number and empty data * feat: update ui (#148) * feat: update bottom sheet scroll * feat: add map search button (feature in progress * fix: add async keyword to server actions * fix: prevent component from mount twice * feat: make bottom sheet state change by offsetY considering size as well as direction * feat: update ai recommendation page (#147) * feat: add ticket icon * refactor: add props to reuse gpt-intro-modal * feat: implement use-typewriter for typing effect * feat: update ai recommendation page - add api call to get ai recommendations - update logic and design * feat: use test API in dev and real API in prod api.gpt.restaurants.recommend * feat: improve recommendation available count logic * refactor: make ai-recommendation as a file * chore: remove 'AI봇의 추천 이유' temporary * fix: update isFetching and isLoading logic * feat: update ai-recommend asset from img to lottie * feat: update ai-recommend-place-box * fix: fix lint error * feat: handle rounding number and empty data * feat: make allowUserPosition update properly * feat: improve ai recommendation page (#150) * feat: make linear-gradient css work on footer * fix: make gap visible only if suggestionKeywords * fix: make usageCapReachedChat show suggestionKwrds * feat: add gpt case for unauthorized user * feat: stop lottie loop on recommendation page * fix: limit width of footer on recommendation page * feat: group profile (#146) * feat: set inital design * feat: set profile link * feat: add blue color * feat: set TasteRate * feat: add differ api * fix: fix initial rate * feat: set initial-panel * feat: add place item * chore: change style * feat: set profile * feat: set update map id logic * fix: lint error * feat: set 스켈레톤 * refactor: add mapId * feat: 맵아이디를 적용해보았어용 * feat: 더보기를 추가했어용 * feat: 더보기 버튼 디자인을 쌈@@뽕하게 바꿨어용 * fix: lint error --------- Co-authored-by: Jaeseok <[email protected]>
- Loading branch information
Showing
20 changed files
with
832 additions
and
22 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
import type { PlaceType } from '@/models/api/place' | ||
import type { MapInfo } from '@/models/map' | ||
import type { User } from '@/models/user' | ||
import { api } from '@/utils/api' | ||
import { useEffect, useState } from 'react' | ||
import PlaceItem from './place-item' | ||
import { APIError } from '@/models/api' | ||
import { notify } from '@/components/common/custom-toast' | ||
import EmptyPlaceList from '@/components/place/empty-place-list' | ||
import PlacePopupSkeleton from '@/components/place/place-popup-skeleton' | ||
import Icon from '@/components/common/icon' | ||
import Typography from '@/components/common/typography' | ||
|
||
export const INITIAL_VISIBLE_PLACE_LENGTH = 1 | ||
|
||
const LikedPlacePanel = ({ | ||
userId, | ||
mapId, | ||
}: { | ||
userId: User['id'] | ||
mapId: MapInfo['id'] | ||
}) => { | ||
const [places, setPlaces] = useState<PlaceType[]>() | ||
const [showMorePlace, setShowMorePlace] = useState(false) | ||
|
||
const renderPlaces = () => { | ||
if (typeof places === 'undefined') { | ||
return ( | ||
<div className="flex flex-col gap-2.5 py-[18px]"> | ||
<PlacePopupSkeleton /> | ||
<PlacePopupSkeleton /> | ||
<PlacePopupSkeleton /> | ||
</div> | ||
) | ||
} | ||
if (places.length === 0) { | ||
return ( | ||
<EmptyPlaceList | ||
className="pt-[75px]" | ||
message="등록하거나 좋아요한 맛집이 없어요" | ||
/> | ||
) | ||
} | ||
|
||
return ( | ||
<div className="flex flex-col gap-[30px] py-[18px]"> | ||
<div className="flex flex-col gap-2.5"> | ||
{places | ||
.slice( | ||
0, | ||
showMorePlace ? places.length : INITIAL_VISIBLE_PLACE_LENGTH, | ||
) | ||
.map((place) => ( | ||
<PlaceItem | ||
key={place.place.id} | ||
className="w-full border-[1px] border-neutral-500 bg-neutral-600" | ||
mapId={mapId} | ||
selectedPlace={place} | ||
/> | ||
))} | ||
</div> | ||
{!showMorePlace && places.length > INITIAL_VISIBLE_PLACE_LENGTH && ( | ||
<div className="flex w-full items-center justify-center"> | ||
<button | ||
className="flex items-center justify-center gap-2 rounded-full border-[1px] border-neutral-500 px-6 py-3" | ||
onClick={() => setShowMorePlace(true)} | ||
> | ||
<Icon type="plus" /> | ||
<Typography size="body1">더보기</Typography> | ||
</button> | ||
</div> | ||
)} | ||
</div> | ||
) | ||
} | ||
|
||
useEffect(() => { | ||
if (places) { | ||
setShowMorePlace(places.length <= INITIAL_VISIBLE_PLACE_LENGTH) | ||
} | ||
}, [places]) | ||
|
||
useEffect(() => { | ||
const getLikedPlace = async () => { | ||
try { | ||
const { data } = await api.place.like.mapId.userId.get({ | ||
mapId, | ||
userId, | ||
}) | ||
setPlaces(data) | ||
} catch (error) { | ||
if (error instanceof APIError) { | ||
notify.error(error.message) | ||
} else { | ||
notify.error('에러가 발생했습니다.') | ||
} | ||
} | ||
} | ||
|
||
getLikedPlace() | ||
}, [userId, mapId]) | ||
|
||
return ( | ||
<div role="tabpanel" id="tappanel-liked" aria-labelledby="tap-liked"> | ||
{renderPlaces()} | ||
</div> | ||
) | ||
} | ||
|
||
export default LikedPlacePanel |
Oops, something went wrong.