Skip to content

Commit eef9484

Browse files
authored
Merge pull request #102 from Leets-Official/100-fix/판매-상태-오류-수정
[Fix] 판매 상태 오류 수정
2 parents 1d11a2b + 0cbc7c7 commit eef9484

7 files changed

Lines changed: 24 additions & 5 deletions

File tree

src/pages/chat/ui/ChatConversation.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export const ChatConversation = ({
104104
})}
105105
</div>
106106

107-
<div className="mt-xs xl:mt-xl w-full max-w-[647px]">
107+
<div className="mt-xs xl:mt-xl w-full max-w-[647px] xl:sticky xl:bottom-4">
108108
<ChatInput placeholder="메시지를 입력하세요." onSend={onSend} />
109109
</div>
110110
</>

src/pages/chat/ui/ChatPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const ChatPage = () => {
2424

2525
return (
2626
<div className="w-full bg-white">
27-
<div className="mx-auto flex min-h-screen w-full max-w-[1440px] flex-col bg-white xl:min-h-[1024px]">
27+
<div className="mx-auto flex w-full max-w-[1440px] flex-col bg-white">
2828
<main className="md:px-xxxl flex flex-col px-(--margin-l) xl:flex-1 xl:px-0">
2929
<section className="mx-auto flex w-full max-w-[1200px] flex-col gap-8 xl:flex-1 xl:flex-row xl:gap-0">
3030
<div className={hasSelection ? 'hidden xl:block' : 'block h-fit'}>

src/pages/chat/ui/ChatThreadList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export const ChatThreadList = ({ rooms, selectedRoomId, onSelect }: ChatThreadLi
3030
type="button"
3131
onClick={() => onSelect(room.roomId)}
3232
className={cn(
33-
'gap-xxs rounded-m px-l py-l flex h-[130px] w-full items-center text-left transition-colors',
33+
'gap-xxs rounded-m px-l py-l flex h-[130px] w-full cursor-pointer items-center text-left transition-colors',
3434
isActive ? 'bg-gray-50' : 'hover:bg-gray-50'
3535
)}
3636
aria-pressed={isActive}

src/shared/apis/chat/queries.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { useAuthStore } from '@shared/stores';
22
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
3+
import { useEffect } from 'react';
34
import { checkUnreadMessages, createOrGetRoom, getChatMessages, getChatRooms, getRoomByPostId } from './api';
45
import { chatKeys } from './keys';
56

@@ -12,11 +13,21 @@ export const useChatRoomsQuery = () => {
1213
};
1314

1415
export const useChatMessagesQuery = (roomId: number | null) => {
15-
return useQuery({
16+
const queryClient = useQueryClient();
17+
18+
const query = useQuery({
1619
queryKey: chatKeys.messages(roomId!),
1720
queryFn: () => getChatMessages(roomId!),
1821
enabled: roomId !== null,
1922
});
23+
24+
useEffect(() => {
25+
if (roomId !== null && query.isSuccess) {
26+
queryClient.invalidateQueries({ queryKey: chatKeys.unread() });
27+
}
28+
}, [roomId, query.isSuccess, queryClient]);
29+
30+
return query;
2031
};
2132

2233
export const useCreateRoomMutation = () => {

src/shared/apis/sell/queries.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { buyKeys } from '@shared/apis/buy/keys';
2+
import { chatKeys } from '@shared/apis/chat/keys';
23
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
34
import {
45
activePost,
@@ -66,7 +67,9 @@ export const useReservePostMutation = () => {
6667
return useMutation({
6768
mutationFn: (request: ReservePostRequest) => reservePost(request),
6869
onSuccess: (_, variables) => {
70+
queryClient.removeQueries({ queryKey: buyKeys.lists() });
6971
queryClient.invalidateQueries({ queryKey: buyKeys.detail(variables.postId) });
72+
queryClient.invalidateQueries({ queryKey: chatKeys.roomByPost(variables.postId) });
7073
},
7174
});
7275
};
@@ -76,7 +79,9 @@ export const useCompletePostMutation = () => {
7679
return useMutation({
7780
mutationFn: (request: CompletePostRequest) => completePost(request),
7881
onSuccess: (_, variables) => {
82+
queryClient.removeQueries({ queryKey: buyKeys.lists() });
7983
queryClient.invalidateQueries({ queryKey: buyKeys.detail(variables.postId) });
84+
queryClient.invalidateQueries({ queryKey: chatKeys.roomByPost(variables.postId) });
8085
},
8186
});
8287
};
@@ -86,7 +91,9 @@ export const useActivePostMutation = () => {
8691
return useMutation({
8792
mutationFn: (request: ActivePostRequest) => activePost(request),
8893
onSuccess: (_, variables) => {
94+
queryClient.removeQueries({ queryKey: buyKeys.lists() });
8995
queryClient.invalidateQueries({ queryKey: buyKeys.detail(variables.postId) });
96+
queryClient.invalidateQueries({ queryKey: chatKeys.roomByPost(variables.postId) });
9097
},
9198
});
9299
};

src/shared/ui/ChatInput/ChatInput.variants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export const chatInputVariants = tv({
3535
icon: ['[&_.send-circle]:fill-white', '[&_.send-circle]:stroke-gray-400', '[&_.send-arrow]:stroke-gray-400'],
3636
},
3737
active: {
38+
button: ['cursor-pointer'],
3839
icon: ['[&_.send-circle]:fill-brand-primary', '[&_.send-circle]:stroke-black', '[&_.send-arrow]:stroke-black'],
3940
},
4041
},

src/shared/ui/Header/Header.variants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export const headerVariants = tv({
3131
'xl:pl-[120px]',
3232
'xl:pr-[120px]',
3333
],
34-
logo: ['w-[192px]', 'h-[36px]', 'shrink-0'],
34+
logo: ['w-[160px]', 'xl:w-[192px]', 'h-[36px]', 'shrink-0'],
3535

3636
// Desktop Navigation
3737
desktopNav: ['hidden', 'xl:flex', 'items-center', 'gap-[93px]'],

0 commit comments

Comments
 (0)