Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…ng-ggood into fix/908-fix-bugs-after-qa
  • Loading branch information
skiende74 committed Oct 24, 2024
2 parents 8a66efb + 1b52867 commit 02e6076
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@ const ChecklistDetailSection = () => {
return (
<>
<RoomInfoSection
checklist={checklist}
room={checklist?.room}
options={checklist?.options}
isLiked={checklist?.isLiked}
checklistId={Number(checklistId)}
nearSubways={checklist.stations.stations}
nearSubways={checklist?.room.address === '' ? [] : checklist?.stations}
/>
<ChecklistAnswerSection categories={checklist?.categories} />
<MemoSection memo={checklist?.room?.memo} />
Expand Down
6 changes: 2 additions & 4 deletions frontend/src/components/ChecklistDetail/RoomInfoSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import AddressMap from '@/components/_common/Map/AddressMap';
import SubwayStations from '@/components/_common/Subway/SubwayStations';
import { IncludedMaintenancesData } from '@/constants/roomInfo';
import { flexColumn, flexRow, flexSpaceBetween, title2, title3, title4 } from '@/styles/common';
import { ChecklistInfo } from '@/types/checklist';
import { Option } from '@/types/option';
import { RoomInfo } from '@/types/room';
import { SubwayStation } from '@/types/subway';
Expand All @@ -30,10 +29,9 @@ interface Props {
checklistId: number;
isLiked: boolean;
nearSubways: SubwayStation[];
checklist: ChecklistInfo;
}

const RoomInfoSection = ({ checklist, nearSubways, room, options, checklistId, isLiked }: Props) => {
const RoomInfoSection = ({ nearSubways, room, options, checklistId, isLiked }: Props) => {
const {
roomName,
deposit,
Expand Down Expand Up @@ -167,7 +165,7 @@ const RoomInfoSection = ({ checklist, nearSubways, room, options, checklistId, i
가까운 지하철
</S.Label>
<S.Text>
<SubwayStations stations={nearSubways} checklist={checklist} />
<SubwayStations stations={nearSubways} />
</S.Text>
</S.Column>

Expand Down
24 changes: 15 additions & 9 deletions frontend/src/components/_common/Map/AddressMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ const AddressMap = ({ location }: { location: string }) => {
});
};

loadExternalScriptWithCallback('kakaoMap', initializeMap);
if (location) {
loadExternalScriptWithCallback('kakaoMap', initializeMap);
}
}, [location]);

const handleOpenKakaoMap = () => {
Expand All @@ -54,14 +56,18 @@ const AddressMap = ({ location }: { location: string }) => {
};

return (
<S.Box>
<S.Map ref={mapContainerRef}>
<S.LinkButtonBox>
<S.LinkButton onClick={handleOpenKakaoMap} src={kakaoMapImg} />
<S.LinkButton onClick={handleOpenNaverMap} src={naverMapImg} />
</S.LinkButtonBox>
</S.Map>
</S.Box>
<>
{location && (
<S.Box>
<S.Map ref={mapContainerRef}>
<S.LinkButtonBox>
<S.LinkButton onClick={handleOpenKakaoMap} src={kakaoMapImg} />
<S.LinkButton onClick={handleOpenNaverMap} src={naverMapImg} />
</S.LinkButtonBox>
</S.Map>
</S.Box>
)}
</>
);
};

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/hooks/query/useToggleLikeQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const useToggleLikeQuery = () => {
mutationFn: async ({ checklistId, isLiked }: { checklistId: number; isLiked: boolean }) => {
isLiked ? await postLike(checklistId) : await deleteLike(checklistId);
},
retry: 3,
retry: 1,
onSettled: async () => {
await invalidateChecklistListQuery();
await queryClient.invalidateQueries({ queryKey: [QUERY_KEYS.CHECKLIST] });
Expand Down
4 changes: 1 addition & 3 deletions frontend/src/mocks/fixtures/checklistDetail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,5 @@ export const checklistDetail: ChecklistInfo = {
],
},
],
stations: {
stations: nearSubway,
},
stations: nearSubway,
};
5 changes: 1 addition & 4 deletions frontend/src/types/checklist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,7 @@ export interface ChecklistInfo {
room: Partial<RoomInfo>;
options: Option[];
categories: ChecklistCategoryWithAnswer[];
//TODO: 나중에 백엔드 api 수정되면 수정
stations: {
stations: SubwayStation[];
};
stations: SubwayStation[];
}

export interface ChecklistSelectedQuestions {
Expand Down

0 comments on commit 02e6076

Please sign in to comment.