Skip to content

Commit 4f55a92

Browse files
committed
fix: 미션 소팅, 홀드 노출
1 parent 6f34fbd commit 4f55a92

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

src/routes/mission/-components/MissionGridCard.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,11 @@ export default function MissionGridCard({
129129
)}
130130
</div>
131131
{status !== "not_tried" && (
132-
<div className="flex justify-center items-center py-2 xs:py-3">
132+
<div className="flex justify-center items-center max-h-[180px] max-w-[180px] w-full h-full mx-auto">
133133
<img
134134
src={holdImageUrl}
135135
alt="mission-image"
136-
className="w-[140px] h-[140px] xs:w-[180px] xs:h-[180px] object-cover"
136+
className="object-contain w-full h-full"
137137
/>
138138
</div>
139139
)}

src/routes/mission/-components/MissionListCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export default function MissionListCard({
4343
<img
4444
src={holdImageUrl}
4545
alt=""
46-
className="w-full h-full rounded-[20px] object-cover"
46+
className="w-full h-full rounded-[20px] object-contain"
4747
/>
4848
)}
4949
</div>

src/routes/mission/index.tsx

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useQuery } from "@tanstack/react-query";
22
import { createFileRoute } from "@tanstack/react-router";
3-
import { countBy } from "es-toolkit/compat";
3+
import { countBy, sample } from "es-toolkit/compat";
44
import { useCallback, useState } from "react";
55
import GridIcon from "@/components/icons/GridIcon";
66
import { MISSION_GUIDE_COMPLETED_KEY } from "@/constants/mission";
@@ -69,13 +69,13 @@ const createMissionCardProps = (
6969
return {
7070
...baseProps,
7171
completedAt: mission.attempts?.[0]?.createdAt,
72-
holdImageUrl: mission.imageUrl,
72+
holdImageUrl: sample(mission.gymLevel?.imageUrls ?? []),
7373
};
7474
case "failed":
7575
return {
7676
...baseProps,
7777
removedAt: mission.removedAt,
78-
holdImageUrl: mission.imageUrl,
78+
holdImageUrl: sample(mission.gymLevel?.imageUrls ?? []),
7979
};
8080
default:
8181
return baseProps;
@@ -97,10 +97,15 @@ function Mission() {
9797
getRouteMissionRecommendations({ headers: getHeaderToken() }),
9898
select: (data) => {
9999
const missions = data.data ?? [];
100-
return missions.map((mission) => ({
101-
...mission,
102-
status: calculateMissionStatus(mission.attempts),
103-
}));
100+
return missions
101+
.map((mission) => ({
102+
...mission,
103+
status: calculateMissionStatus(mission.attempts),
104+
}))
105+
.sort((a, b) => {
106+
const statusOrder = { not_tried: 0, failed: 1, success: 2 };
107+
return statusOrder[a.status] - statusOrder[b.status];
108+
});
104109
},
105110
enabled: isSessionStarted,
106111
});

0 commit comments

Comments
 (0)