Skip to content

Commit 3d002cf

Browse files
Merge pull request #206 from RealMatchTeam/fix/205-chat
fix: 채팅 로고 나오는 문제 해결
2 parents 5c451bc + 0874951 commit 3d002cf

6 files changed

Lines changed: 32 additions & 32 deletions

File tree

app/routes/chat/components/CampaignListBottomSheet.tsx renamed to app/routes/chat/components/CampaignProposalBottomSheet.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ interface Props {
1111
isOpen: boolean;
1212
onClose: () => void;
1313
onSelect: (detail: ProposalDetail) => void;
14+
brandId?: number;
1415
}
1516

16-
export default function CampaignListBottomSheet({ isOpen, onClose, onSelect }: Props) {
17+
export default function CampaignProposalBottomSheet({ isOpen, onClose, onSelect, brandId }: Props) {
1718
const [campaigns, setCampaigns] = useState<CampaignCollaboration[]>([]);
1819
const [loading, setLoading] = useState(false);
1920
const [loadingDetail, setLoadingDetail] = useState(false);
@@ -29,7 +30,10 @@ export default function CampaignListBottomSheet({ isOpen, onClose, onSelect }: P
2930
status: "REVIEWING",
3031
endDate: today,
3132
});
32-
setCampaigns(data || []);
33+
const filtered = brandId
34+
? (data || []).filter((c) => c.brandId === brandId)
35+
: (data || []);
36+
setCampaigns(filtered);
3337
} catch (error) {
3438
console.error("Failed to fetch campaigns:", error);
3539
} finally {
@@ -38,7 +42,7 @@ export default function CampaignListBottomSheet({ isOpen, onClose, onSelect }: P
3842
};
3943
fetchCampaigns();
4044
}
41-
}, [isOpen]);
45+
}, [isOpen, brandId]);
4246

4347
const options = campaigns
4448
.filter((c) => c.proposalId)
@@ -56,10 +60,8 @@ export default function CampaignListBottomSheet({ isOpen, onClose, onSelect }: P
5660

5761
setLoadingDetail(true);
5862
try {
59-
// Revert back to using proposal API
6063
const detail = await getProposalDetail(proposalId);
6164

62-
// Pass campaignId from collaboration list
6365
const result: ProposalDetail = {
6466
...detail,
6567
campaignId: originalCampaign.campaignId

app/routes/chat/resuggest/resuggest-content.tsx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ export default function ReSuggestContent() {
157157
setIsConfirmDialogOpen(true);
158158
};
159159

160-
const handleConfirmSubmit = () => {
160+
const handleConfirmSubmit = async () => {
161161
const formData = formValues;
162162
const userId = tokenStorage.getUserId();
163163

@@ -166,6 +166,11 @@ export default function ReSuggestContent() {
166166
return;
167167
}
168168

169+
if (!proposalData?.proposalId) {
170+
toast.error("제안 정보가 없습니다. 다시 시도해주세요.");
171+
return;
172+
}
173+
169174
const requestData = {
170175
brandId: proposalData?.brandId || 1,
171176
creatorId: Number(userId),
@@ -183,13 +188,14 @@ export default function ReSuggestContent() {
183188
endDate: formData.endDate || "",
184189
};
185190

186-
setIsConfirmDialogOpen(false);
187-
setIsSuccessModalOpen(true);
188-
189-
reRequestCampaignProposal(proposalData!.proposalId!, requestData).catch((error: unknown) => {
191+
try {
192+
await reRequestCampaignProposal(proposalData.proposalId, requestData);
193+
setIsConfirmDialogOpen(false);
194+
setIsSuccessModalOpen(true);
195+
} catch (error: unknown) {
190196
console.error("캠페인 재제안 실패:", error);
191197
toast.error("캠페인 재제안에 실패했습니다. 다시 시도해주세요.");
192-
});
198+
}
193199
};
194200
return (
195201
<div className="flex flex-col h-full bg-white">

app/routes/room/components/Bubbles/AttachmentMessage.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,20 +101,16 @@ export default function AttachmentMessage({
101101
<div className="w-fit flex items-start gap-[10px] ">
102102
{/* avatar */}
103103
<div
104-
className="shrink-0 rounded-[10px] bg-white overflow-hidden"
104+
className="shrink-0 rounded-[10px] overflow-hidden"
105105
style={{ width: 38, height: 38 }}
106106
>
107-
{avatarSrc ? (
107+
{avatarSrc && (
108108
<img
109109
src={avatarSrc}
110110
alt="avatar"
111111
className="w-full h-full object-cover"
112112
draggable={false}
113113
/>
114-
) : (
115-
<div className="w-full h-full grid place-items-center text-[12px] text-[#5B5D6B]">
116-
logo
117-
</div>
118114
)}
119115
</div>
120116

app/routes/room/components/Bubbles/ProposalMessage.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -282,20 +282,16 @@ export default function ProposalMessage(props: Props) {
282282
<div className="w-fit flex items-start gap-[10px] max-w-full">
283283
{/* avatar */}
284284
<div
285-
className="shrink-0 rounded-[10px] bg-white overflow-hidden"
285+
className="shrink-0 rounded-[10px] overflow-hidden"
286286
style={{ width: 38, height: 38 }}
287287
>
288-
{avatarSrc ? (
288+
{avatarSrc && (
289289
<img
290290
src={avatarSrc}
291291
alt="avatar"
292292
className="w-full h-full object-cover"
293293
draggable={false}
294294
/>
295-
) : (
296-
<div className="w-full h-full grid place-items-center text-[12px] text-[#5B5D6B]">
297-
logo
298-
</div>
299295
)}
300296
</div>
301297

app/routes/room/components/Bubbles/TextMessage.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,20 +55,16 @@ export default function TextMessage ({
5555
<div className="flex items-start gap-[10px] max-w-[80%]">
5656
{/* avatar */}
5757
<div
58-
className="shrink-0 rounded-[10px] bg-white overflow-hidden"
58+
className="shrink-0 rounded-[10px] overflow-hidden"
5959
style={{ width: 38, height: 38 }}
6060
>
61-
{avatarSrc ? (
61+
{avatarSrc && (
6262
<img
6363
src={avatarSrc}
6464
alt="avatar"
6565
className="w-full h-full object-cover"
6666
draggable={false}
6767
/>
68-
) : (
69-
<div className="w-full h-full grid place-items-center text-[12px] text-[#5B5D6B]">
70-
logo
71-
</div>
7268
)}
7369
</div>
7470

app/routes/room/page.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import useChatLayout from "./hooks/useChatLayout";
1717
import useChatStomp from "./hooks/useChatStomp";
1818
import useChatActions from "./hooks/useChatActions";
1919
import { useCampaignProposalStore } from "../../stores/campaign-proposal";
20-
import CampaignListBottomSheet from "../chat/components/CampaignListBottomSheet";
20+
import CampaignProposalBottomSheet from "../chat/components/CampaignProposalBottomSheet";
2121
import { getMyCollaborations } from "../business/calendar/api/calendar";
2222

2323
type Props = {
@@ -178,6 +178,8 @@ export default function ChattingRoom({ roomId }: Props) {
178178
>
179179
<div className="w-full">
180180
<div className="w-full space-y-2">
181+
182+
{/* 채팅마다 나오는 말풍선 (Bubble) */}
181183
{messages.map((m, idx) => {
182184
const isMe = m.senderType === "USER" && m.senderId === myUserId;
183185
const { dateText, timeText } = formatKoreanDateTime(m.createdAt);
@@ -229,14 +231,16 @@ export default function ChattingRoom({ roomId }: Props) {
229231
height={sheetHeight}
230232
/>
231233

232-
<CampaignListBottomSheet
234+
{/* 캠페인 재 제안하기 버튼 */}
235+
<CampaignProposalBottomSheet
233236
isOpen={isCampaignSheetOpen}
234237
onClose={() => setIsCampaignSheetOpen(false)}
238+
brandId={detail?.brandId}
235239
onSelect={(campaign) => {
236240
setProposalData({
237241
proposalId: campaign.proposalId,
238242
campaignId: campaign.campaignId,
239-
brandId: campaign.brandId,
243+
brandId: detail?.brandId || campaign.brandId,
240244
campaignTitle: campaign.title,
241245
campaignDescription: campaign.description,
242246
rewardAmount: campaign.rewardAmount,

0 commit comments

Comments
 (0)