Skip to content

Commit

Permalink
[fix] 운동 계획 상태가 변경될 때 화면에 보여지는 순서도 변경되는 이슈
Browse files Browse the repository at this point in the history
  • Loading branch information
jiyaaany committed Oct 10, 2022
1 parent ef792f6 commit beb8d4a
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/screens/PlansScreen/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,19 @@ const PlansScreen: React.FC<P> = ({ navigation, route }) => {
showDeletePlanModal,
deletePlans,
} = useDelete(selectedDate);
const plansBySelectedDate = useRecoilValue<PlanType[]>(plansState).filter(
({ plannedAt }) => dayjs(plannedAt).isSame(selectedDate, 'day'),
);
const plansBySelectedDate = useRecoilValue<PlanType[]>(plansState)
.filter(({ plannedAt }) => dayjs(plannedAt).isSame(selectedDate, 'day'))
.sort((a, b) => {
const trainingNameOfA = a.training.name.toLowerCase();
const trainingNameOfB = b.training.name.toLowerCase();

if (trainingNameOfA < trainingNameOfB) {
return -1;
} else if (trainingNameOfA > trainingNameOfB) {
return 1;
}
return 0;
});

return (
<>
Expand Down

0 comments on commit beb8d4a

Please sign in to comment.