Skip to content

Commit

Permalink
chore: merge dev branch to main (#151)
Browse files Browse the repository at this point in the history
* 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
hee-suh and Pridesd authored Oct 3, 2024
1 parent 53a4c3b commit 813e9c9
Show file tree
Hide file tree
Showing 20 changed files with 832 additions and 22 deletions.
120 changes: 120 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 9 additions & 4 deletions src/app/my-map/[mapId]/crew-info-editable-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import BottomModal from '@/components/common/bottom-modal'
import { api } from '@/utils/api'
import { notify } from '@/components/common/custom-toast'
import useFetch from '@/hooks/use-fetch'
import Link from 'next/link'

const RoleButton = ({
role,
Expand Down Expand Up @@ -128,7 +129,10 @@ const CrewInfoEditableItem = ({

return (
<>
<li className="flex h-[52px] items-center justify-between">
<Link
href={`/profile/${mapId}/${member.id}`}
className="flex h-[52px] items-center justify-between"
>
<div className="flex items-center gap-2">
<Avatar
value={member.nickname}
Expand All @@ -153,8 +157,9 @@ const CrewInfoEditableItem = ({
) : (
<button
type="button"
className="flex items-center gap-[2px]"
onClick={() => {
className="flex h-full items-center gap-[2px]"
onClick={(e) => {
e.preventDefault()
setIsOpenRoleModal(true)
}}
>
Expand All @@ -164,7 +169,7 @@ const CrewInfoEditableItem = ({
<Icon type="caretDown" size="md" stroke="neutral-200" />
</button>
)}
</li>
</Link>

<BottomModal
layout="none"
Expand Down
2 changes: 1 addition & 1 deletion src/app/my-map/[mapId]/crew-info-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import type { User } from '@/models/user'
import cn from '@/utils/cn'
import CrewInfoReadOnlyItem from './crew-info-read-only-item'
import CrewInfoEditableItem from './crew-info-editable-item'

interface CrewInfoListProps extends ClassName {
user: User
mapInfo: MapInfo
Expand Down Expand Up @@ -71,6 +70,7 @@ const CrewInfoList = ({
<CrewInfoReadOnlyItem
key={member.id}
member={member}
mapId={mapInfo.id}
avatarColor={getColorForName(member.nickname)}
isMe={member.id === user.id}
/>
Expand Down
13 changes: 10 additions & 3 deletions src/app/my-map/[mapId]/crew-info-read-only-item.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
import Avatar from '@/components/common/avatar'
import Chip from '@/components/common/chip'
import Typography from '@/components/common/typography'
import type { MapMemberData } from '@/models/map'
import type { MapInfo, MapMemberData } from '@/models/map'
import { korRole } from './constant'
import Link from 'next/link'

const CrewInfoReadOnlyItem = ({
member,
isMe,
avatarColor,
mapId,
}: {
mapId: MapInfo['id']
member: MapMemberData
avatarColor: Parameters<typeof Avatar>[0]['colorScheme']
isMe: boolean
}) => {
return (
<li className="flex h-[52px] items-center justify-between">
<Link
role="listitem"
href={`/profile/${mapId}/${member.id}`}
className="flex h-[52px] items-center justify-between"
>
<div className="flex items-center gap-2">
<Avatar
value={member.nickname}
Expand All @@ -35,7 +42,7 @@ const CrewInfoReadOnlyItem = ({
<Typography size="body3" color="neutral-200">
{korRole[member.role]}
</Typography>
</li>
</Link>
)
}

Expand Down
16 changes: 15 additions & 1 deletion src/app/place/[placeId]/place-liked-users.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,32 @@ import Typography from '@/components/common/typography'
import type { LikeUser } from '@/components/place/types'
import type { ClassName } from '@/models/common'
import type { User } from '@/models/user'
import { getMapId } from '@/services/map-id'
import cn from '@/utils/cn'
import { useRouter } from 'next/navigation'

interface PlaceLikedUserProps extends ClassName {
me: User | null
likedUser: LikeUser[]
}

const PlaceLikedUser = ({ likedUser, className, me }: PlaceLikedUserProps) => {
const router = useRouter()

const handleMoveProfile = async (userId: User['id']) => {
const mapId = await getMapId()
if (!mapId) return
router.push(`/profile/${mapId}/${userId}`)
}

return (
<ul className={cn('flex flex-col pb-6', className)}>
{likedUser.map((user) => (
<li key={user.id} className="flex items-center gap-2 pt-2">
<li
key={user.id}
className="flex items-center gap-2 pt-2"
onClick={() => handleMoveProfile(user.id)}
>
<Avatar
value={user.nickname}
imageUrl={user.profileImage}
Expand Down
110 changes: 110 additions & 0 deletions src/app/profile/[mapId]/[id]/liked-place-panel.tsx
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
Loading

0 comments on commit 813e9c9

Please sign in to comment.