Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "๐ŸŽ‰ ๊ฑฐ๋ž˜์„ฑ์‚ฌ์š”์ฒญ ๊ธฐ๋Šฅ ๊ตฌํ˜„ ์™„๋ฃŒ" #107

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions public/images/check-circle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions public/images/quit-circle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

This file was deleted.

This file was deleted.

This file was deleted.

53 changes: 3 additions & 50 deletions src/app/(root)/(routes)/chatrooms/[chatRoomId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import ApiEndPoint from '@/config/apiEndPoint'
import apiClient from '@/services/apiClient'
import { getServerCookie } from '@/utils/getServerCookie'
import ChatRoomTemplate from './components/ChatRoomTemplate'
import CompleteRequestButton from './components/CompleteRequestButton'
import CompleteReqeustTemplate from './components/CompleteRequestTemplate'

type ChatPageProps = {
params: {
Expand Down Expand Up @@ -34,64 +32,19 @@ const getInitialChatRoom = async (chatRoomId: string) => {
Authorization: `${token}`,
},
)
return res.data.chatRoomInfo
}

const getCompleteRequestInfo = async (completeRequestId: number) => {
const token = getServerCookie()
const res = await apiClient.get(
ApiEndPoint.getCompleteRequest(completeRequestId),
{},
{
Authorization: `${token}`,
},
)
return res.data.completeRequestInfo
return res.data.chatRoomInfo.fireStoreChatRoomId
}

const ChatPage = async ({ params }: ChatPageProps) => {
const initialUserInfo = await getInitialUser()
const initialChatRoom = await getInitialChatRoom(params.chatRoomId)

//NOTE - ๋‘˜ ์ค‘ ์•„๋ฌด๋ผ๋„ ๊ฑฐ๋ž˜์„ฑ์‚ฌ ์š”์ฒญ์„ ํ–ˆ์„ ๊ฒฝ์šฐ
const isCompleteRequested = initialChatRoom.completeRequestId !== -1
const completeRequestInfo = isCompleteRequested
? await getCompleteRequestInfo(initialChatRoom.completeRequestId)
: null

const suggestionDataArray = [
initialChatRoom.fromCardInfo,
initialChatRoom.toCardInfo,
]
console.log(suggestionDataArray)
const myCardId = suggestionDataArray.find(
(obj) => obj.userInfo.userId === initialUserInfo.userId,
).cardInfo.cardId

const otherCardId = suggestionDataArray.find(
(obj) => obj.userInfo.userId !== initialUserInfo.userId,
).cardInfo.cardId

return (
<main className="relative flex flex-col items-center w-full gap-10 h-page pb-chat_input">
<header className="w-full flex flex-row items-center px-4">
<PageTitle title="์ฑ„ํŒ…๋ฐฉ" />
{!isCompleteRequested && (
<CompleteRequestButton
myCardId={myCardId}
otherCardId={otherCardId}
/>
)}
</header>
{isCompleteRequested && (
<CompleteReqeustTemplate
currentUser={initialUserInfo}
completeRequestData={completeRequestInfo}
/>
)}
<PageTitle title="์ฑ„ํŒ…๋ฐฉ" />
<ChatRoomTemplate
currentUser={initialUserInfo}
fireStoreId={initialChatRoom.fireStoreChatRoomId}
fireStoreId={initialChatRoom}
/>
<div className="w-full h-0 border border-t-background-secondary-color" />
</main>
Expand Down
4 changes: 0 additions & 4 deletions src/config/apiEndPoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,6 @@ const ApiEndPoint = {
putCardStatus: (cardId: number) => `/cards/status/${cardId}`,
getPopularCardList: () => '/cards/popular',
putMySuggestionStatus: () => `/suggestions/decision`,
getCompleteRequest: (completeRequestId: number) =>
`/complete-requests/${completeRequestId}`,
postCompleteRequest: () => '/complete-requests',
putCompleteRequest: () => '/complete-requests/confirm',
getNotificationList: ({ isRead, cursorId }: GetNotificationListReq) => {
return `/notifications/?${getQueryParams({
'is-read': String(isRead),
Expand Down
7 changes: 0 additions & 7 deletions src/constants/card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,6 @@ const CATEGORY_BUTTON_LIST = [
{ key: 'ALL_CARD', value: '์ „์ฒด๋ณด๊ธฐ', image: Assets.allCardIcon },
] as const

const COMPLETE_REQUEST_TYPE_OBJS = [
{ key: 'WAITING', value: '๊ฑฐ๋ž˜์„ฑ์‚ฌ ๋Œ€๊ธฐ์ค‘' },
{ key: 'ACCEPTED', value: '๊ฑฐ๋ž˜์„ฑ์‚ฌ ํ™•์ •' },
{ key: 'REFUSED', value: '๊ฑฐ๋ž˜์„ฑ์‚ฌ ๊ฑฐ์ ˆ๋จ' },
]

export {
PRICE_RANGE,
CATEGORY,
Expand All @@ -115,5 +109,4 @@ export {
CATEGORY_OBJS,
TRADE_TYPE_OBJS,
TRADE_STATUS_OBJS,
COMPLETE_REQUEST_TYPE_OBJS,
}
32 changes: 0 additions & 32 deletions src/services/complete-request/completeRequest.ts

This file was deleted.

3 changes: 0 additions & 3 deletions src/types/card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
PRICE_RANGE_OBJS,
TRADE_STATUS_OBJS,
TRADE_TYPE_OBJS,
COMPLETE_REQUEST_TYPE_OBJS,
} from '@/constants/card'

interface Card {
Expand Down Expand Up @@ -52,7 +51,6 @@ type CategoryObjs = (typeof CATEGORY_OBJS)[number]
type PriceRangeObjs = (typeof PRICE_RANGE_OBJS)[number]
type TradeStatusObjs = (typeof TRADE_STATUS_OBJS)[number]
type TradeTypeObjs = (typeof TRADE_TYPE_OBJS)[number]
type CompleteRequestTypeObjs = (typeof COMPLETE_REQUEST_TYPE_OBJS)[number]

export type {
Category,
Expand All @@ -66,5 +64,4 @@ export type {
PriceRangeObjs,
TradeStatusObjs,
TradeTypeObjs,
CompleteRequestTypeObjs,
}