-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ๐ ์ ์ ๋ ์ ์ ์์ฒญ, ์ ์ ์๋ฝ/๊ฑฐ์ , ๊ฑฐ๋ ์ฑ์ฌ ์์ฒญ์ ๋ํ ์๋ฆผ์ ์กฐํ ํ ์ ์๋ค. (#97) * ๐ ์๋ฆผ ์นด๋ ์ ์ ๋ฐ ํ์ด์ง ์ด๋ ๊ธฐ๋ฅ ๊ตฌํ * ๐ ์๋ฆผ ๋ฆฌ์คํธ ์ ์ ๋ฐ ์๋ฆผ ์กฐํ ๊ธฐ๋ฅ ๊ตฌํ * ๐ ์๋ฆผ ํญ ์ ์ ๋ฐ ์๋ฆผ ์ข ๋ฅ๋ณ ์กฐํ ๊ธฐ๋ฅ ๊ตฌํ * ๐ ์ฝ์ ์ฒ๋ฆฌ ๋ฒํผ ์ ์ ๋ฐ ์ฝ์ ์ฒ๋ฆฌ ๊ธฐ๋ฅ ๊ตฌํ * โจ ์ฑํ ๋ฐฉ ๋ ์ด์์ ๋ฐ ํ์ ์กฐ์ * ๐ ์ฐ ๋ชฉ๋ก ์ฐ๊ฒฐ ์๋๋ ์ค๋ฅ ํด๊ฒฐ * ๐ ์ฑํ ๋ฐฉ api ์ฐ๊ฒฐ * ๐ ์ ์ ๋ ์๋ฝ๋ ์ ์์ผ๋ก ์ธํด ์์ฑ๋ ์ฑํ ๋ฐฉ ๋ชฉ๋ก์ ์กฐํ ํ ์ ์๋ค. (#102) * ๐ ์ฑํ ๋ฐฉ ์นด๋ ์ ์ ๋ฐ ๋ฆฌ๋ค์ด๋ ํธ ๊ธฐ๋ฅ ๊ตฌํ * ๐ ์ฑํ ๋ฐฉ ๋ฆฌ์คํธ ์ ์ ๋ฐ ๋ฌดํ์คํฌ๋กค ๊ธฐ๋ฅ ๊ตฌํ * ๐ ์ ์ ๋ ์๋ฝ๋ ์ ์์ผ๋ก ์ธํด ์์ฑ๋ ์ฑํ ๋ฐฉ ๋ชฉ๋ก์ ์กฐํ ํ ์ ์๋ค. (#104) * ๐ ์ฑํ ๋ฐฉ ์นด๋ ์ ์ ๋ฐ ๋ฆฌ๋ค์ด๋ ํธ ๊ธฐ๋ฅ ๊ตฌํ * ๐ ์ฑํ ๋ฐฉ ๋ฆฌ์คํธ ์ ์ ๋ฐ ๋ฌดํ์คํฌ๋กค ๊ธฐ๋ฅ ๊ตฌํ * Merge branch 'develop' into NABI-301 * ๐ ๊ฑฐ๋์ฑ์ฌ์์ฒญ ๊ธฐ๋ฅ ๊ตฌํ ์๋ฃ (#108) * ๐ง complete request ์ํ ํ์ ์ง์ * ๐ง get api ์ถ๊ฐ * ๐ง ๊ฑฐ๋์ฑ์ฌ์์ฒญ ์นด๋ ์ปดํฌ๋ํธ * ๐ ๊ฑฐ๋์ฑ์ฌ์์ฒญ ์ปดํฌ๋ํธ ๊ตฌํ * ๐ง ์ ์์์ฒญ ์๋ฝ/๊ฑฐ์ api ์ฐ๊ฒฐ์ค * ๐ง chatroom ํ ์คํธ์ค * ๐ ๊ฑฐ๋์ฑ์ฌ์์ฒญ ๊ธฐ๋ฅ ๊ตฌํ ์๋ฃ * โจ ์ฝ๋๋ฆฌ๋ทฐ ๋ฐ์ --------- Co-authored-by: Kim Dong Hyun <[email protected]> Co-authored-by: oaoong <[email protected]>
- Loading branch information
1 parent
c902421
commit 185b491
Showing
55 changed files
with
1,770 additions
and
685 deletions.
There are no files selected for viewing
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
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
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
59 changes: 59 additions & 0 deletions
59
src/app/(root)/(routes)/chatrooms/[chatRoomId]/components/CompleteRequestButton.tsx
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,59 @@ | ||
'use client' | ||
|
||
import Image from 'next/image' | ||
import Button from '@/components/ui/button' | ||
import { | ||
DropdownMenu, | ||
DropdownMenuContent, | ||
DropdownMenuGroup, | ||
DropdownMenuItem, | ||
DropdownMenuTrigger, | ||
} from '@/components/ui/dropdown-menu' | ||
import Assets from '@/config/assets' | ||
import { toast } from '@/hooks/useToast' | ||
import { postCompleteRequest } from '@/services/complete-request/completeRequest' | ||
|
||
type CompleteRequestButtonProps = { | ||
myCardId: number | ||
otherCardId: number | ||
} | ||
|
||
const CompleteRequestButton = ({ | ||
myCardId, | ||
otherCardId, | ||
}: CompleteRequestButtonProps) => { | ||
const handleRequestButton = async () => { | ||
try { | ||
await postCompleteRequest(myCardId, otherCardId) | ||
toast({ | ||
title: '๊ฑฐ๋์ฑ์ฌ๋ฅผ ์์ฒญํ์์ต๋๋ค', | ||
variant: 'default', | ||
duration: 2000, | ||
}) | ||
} catch (error) { | ||
toast({ | ||
title: '๊ฑฐ๋์ฑ์ฌ ์์ฒญ์ด ์คํจํ์ต๋๋ค.', | ||
variant: 'destructive', | ||
duration: 2000, | ||
}) | ||
} | ||
} | ||
|
||
return ( | ||
<DropdownMenu> | ||
<DropdownMenuTrigger asChild> | ||
<Button className="ml-auto" size="icon_sm" variant={null}> | ||
<Image src={Assets.vMoreIcon} alt="more" /> | ||
</Button> | ||
</DropdownMenuTrigger> | ||
<DropdownMenuContent className="min-w-[8rem]"> | ||
<DropdownMenuGroup> | ||
<DropdownMenuItem onClick={handleRequestButton}> | ||
๊ฑฐ๋์ฑ์ฌ ์์ฒญ | ||
</DropdownMenuItem> | ||
</DropdownMenuGroup> | ||
</DropdownMenuContent> | ||
</DropdownMenu> | ||
) | ||
} | ||
export default CompleteRequestButton |
103 changes: 103 additions & 0 deletions
103
src/app/(root)/(routes)/chatrooms/[chatRoomId]/components/CompleteRequestCard.tsx
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,103 @@ | ||
import Image from 'next/image' | ||
import Button from '@/components/ui/button' | ||
import { Card, CardFlex, CardImage, CardText } from '@/components/ui/card/Card' | ||
import Assets from '@/config/assets' | ||
import { toast } from '@/hooks/useToast' | ||
import { putCompleteRequest } from '@/services/complete-request/completeRequest' | ||
import { Card as CardType } from '@/types/card' | ||
|
||
const CardItem = ({ | ||
thumbnail, | ||
itemName, | ||
}: Pick<CardType, 'thumbnail' | 'itemName'>) => ( | ||
<CardFlex direction={'col'} justify={'center'} align={'center'} gap={'space'}> | ||
<div className="h-11 w-20 relative"> | ||
<CardImage | ||
alt="card-thumbnail" | ||
src={thumbnail} | ||
layout="fill" | ||
objectFit="cover" | ||
className="rounded" | ||
/> | ||
</div> | ||
<CardText className="font-bold text-[12px] whitespace-nowrap overflow-hidden overflow-ellipsis"> | ||
{itemName} | ||
</CardText> | ||
</CardFlex> | ||
) | ||
|
||
type CompleteRequestCardProps = { | ||
myCardData: CardType | ||
otherCardData: CardType | ||
} | ||
|
||
const CompleteRequestCard = ({ | ||
myCardData, | ||
otherCardData, | ||
}: CompleteRequestCardProps) => { | ||
const handleCompleteRequestUpdate = async (isAccepted: boolean) => { | ||
try { | ||
await putCompleteRequest( | ||
otherCardData.cardId, | ||
myCardData.cardId, | ||
isAccepted, | ||
) | ||
window.location.reload() | ||
toast({ | ||
title: `๊ฑฐ๋์ฑ์ฌ ์์ฒญ์ ${isAccepted ? '์๋ฝ' : '๊ฑฐ์ '}ํ์์ต๋๋ค.`, | ||
variant: 'default', | ||
duration: 2000, | ||
}) | ||
} catch (error) { | ||
toast({ | ||
title: '๊ฑฐ๋์ฑ์ฌ์์ฒญ ์๋ฝ ๋๋ ๊ฑฐ์ ์ด ์คํจํ์ต๋๋ค.', | ||
variant: 'destructive', | ||
duration: 2000, | ||
}) | ||
} | ||
} | ||
return ( | ||
<div> | ||
<Card className="p-2 flex items-center border-0" size={'sm'}> | ||
<CardFlex justify={'between'} className="gap-4"> | ||
<CardItem | ||
thumbnail={myCardData.thumbnail} | ||
itemName={myCardData.itemName} | ||
/> | ||
<CardFlex direction={'col'} align={'center'} justify={'center'}> | ||
<CardText | ||
type={'description'} | ||
className="text-[12px] max-w-[125px] text-center" | ||
> | ||
๊ฑฐ๋์ฑ์ฌ ์์ฒญ์ด ์์ต๋๋ค. ๊ฑฐ๋๋ฅผ ํ์ จ๋์? | ||
</CardText> | ||
<CardFlex direction={'row'} gap={'space'}> | ||
<Button | ||
className="ml-auto" | ||
size="icon_sm" | ||
variant={null} | ||
onClick={() => handleCompleteRequestUpdate(true)} | ||
> | ||
<Image src={Assets.checkCircle} alt="accept" /> | ||
</Button> | ||
<Button | ||
className="ml-auto" | ||
size="icon_sm" | ||
variant={null} | ||
onClick={() => handleCompleteRequestUpdate(false)} | ||
> | ||
<Image src={Assets.quitCircle} alt="refuse" /> | ||
</Button> | ||
</CardFlex> | ||
</CardFlex> | ||
<CardItem | ||
thumbnail={otherCardData.thumbnail} | ||
itemName={otherCardData.itemName} | ||
/> | ||
</CardFlex> | ||
</Card> | ||
</div> | ||
) | ||
} | ||
|
||
export default CompleteRequestCard |
36 changes: 36 additions & 0 deletions
36
src/app/(root)/(routes)/chatrooms/[chatRoomId]/components/CompleteRequestTemplate.tsx
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,36 @@ | ||
import Badge from '@/components/ui/badge' | ||
import { COMPLETE_REQUEST_TYPE_OBJS } from '@/constants/card' | ||
import { Card, CompleteRequestTypeObjs } from '@/types/card' | ||
import { User } from '@/types/user' | ||
import { getValueByKey } from '@/utils/getValueByKey' | ||
import CompleteRequestCard from './CompleteRequestCard' | ||
|
||
type CompleteReqeustTemplateProps = { | ||
currentUser: User | ||
completeRequestData: { | ||
fromCard: { cardInfo: Card; userInfo: User } | ||
toCard: { cardInfo: Card; userInfo: User } | ||
status: CompleteRequestTypeObjs['key'] | ||
} | ||
} | ||
|
||
const CompleteReqeustTemplate = ({ | ||
currentUser, | ||
completeRequestData: { fromCard, toCard, status }, | ||
}: CompleteReqeustTemplateProps) => { | ||
//NOTE - ํ์ฌ ๋ก๊ทธ์ธํ ์ฌ๋์ด ๊ฑฐ๋์ฑ์ฌ ์์ฒญ ๋ฐ์ ์ฌ๋์ธ๊ฒฝ์ฐ + ์์ฒญ ์ํ๊ฐ waiting์ธ ๊ฒฝ์ฐ - ๊ฑฐ๋์ฑ์ฌ์์ฒญ ์นด๋๊ฐ ๋ณด์ธ๋ค. | ||
const isRequestedUser = | ||
toCard.userInfo.userId === currentUser.userId && status === 'WAITING' | ||
return isRequestedUser ? ( | ||
<CompleteRequestCard | ||
myCardData={fromCard.cardInfo} | ||
otherCardData={toCard.cardInfo} | ||
/> | ||
) : ( | ||
<Badge variant={'gradation'} size={'lg'} className="self-end mr-4"> | ||
{getValueByKey(COMPLETE_REQUEST_TYPE_OBJS, status)} | ||
</Badge> | ||
) | ||
} | ||
|
||
export default CompleteReqeustTemplate |
Oops, something went wrong.