Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat] 어드민 - API 연동 #139

Merged
merged 20 commits into from
Aug 13, 2024
Merged

[Feat] 어드민 - API 연동 #139

merged 20 commits into from
Aug 13, 2024

Conversation

jhj2713
Copy link
Member

@jhj2713 jhj2713 commented Aug 12, 2024

🖥️ Preview

close #137

✏️ 한 일

  • 선착순 이벤트 전체 조회
  • 선착순 이벤트 수정
  • 추첨 이벤트 수정

❗️ 발생한 이슈 (해결 방안)

실제 API 연동은 아니고 명세서 기반으로 mock Promise 만들어서 연동해뒀습니다. 추후 API 완성되는대로 연결 테스트 해보겠습니다.

❓ 논의가 필요한 사항

@jhj2713 jhj2713 added the feat 기능 구현 label Aug 12, 2024
@jhj2713 jhj2713 requested a review from sooyeoniya August 12, 2024 08:22
@jhj2713 jhj2713 self-assigned this Aug 12, 2024
Copy link

빌드를 성공했습니다! 🎉

Copy link
Member

@sooyeoniya sooyeoniya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고 많으셨어용 ㅠㅠ 화이팅🩷

Comment on lines 94 to 102
<Button buttonSize="sm" onClick={() => navigate("/lottery/participant-list")}>
참여자 리스트 보러가기
</Button>
<Button
buttonSize="sm"
onClick={() =>
navigate("/lottery/winner-list", {
state: { id: lottery.lotteryEventId },
})
}
>
<Button buttonSize="sm" onClick={() => navigate("/lottery/winner")}>
당첨자 추첨하기
</Button>
<Button buttonSize="sm" onClick={() => navigate("/lottery/winner-list")}>
당첨자 보러가기
</Button>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기 공통 로직 분리하는 건 너무 사치일까용..?

const buttons = [
    { path: "/lottery/participant-list", label: "참여자 리스트 보러가기" },
    { path: "/lottery/winner", label: "당첨자 추첨하기" },
    { path: "/lottery/winner-list", label: "당첨자 보러가기" },
];
....
{buttons.map((button, idx) => (
    <Button 
        key={idx} 
        buttonSize="sm" 
        onClick={() => navigate({button.path})}
    >
        {button.label}
    </Button>
))}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

중간에 state 넣는건 생각 못했다만...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

흠 개인적으로는 Button 만으로 충분히 공통 로직을 묶어준 느낌이라서 buttons 배열로까지는 안 묶어줘두 될 것 같아요! 오히려 코드가 더 길어지기도 하구용,,,

Comment on lines +1 to +15
export function getDateDifference(startDate: string, endDate: string) {
const dateRegex = /^\d{4}-\d{2}-\d{2}$/;

if (!startDate || !endDate || !startDate.match(dateRegex) || !endDate.match(dateRegex)) {
return "";
}

const start = new Date(startDate);
const end = new Date(endDate);

const differenceInTime = end.getTime() - start.getTime();
const differenceInDays = Math.ceil(differenceInTime / (1000 * 3600 * 24));

return `${differenceInDays}일`;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이런식으로 시간 차이 구하는 로직 따로 빼서 사용하는 것도 좋은 방식인 것 같아용!

Copy link

빌드를 성공했습니다! 🎉

Copy link

빌드를 성공했습니다! 🎉

Copy link

빌드를 성공했습니다! 🎉

Copy link

빌드를 성공했습니다! 🎉

Copy link

빌드를 성공했습니다! 🎉

@jhj2713 jhj2713 merged commit 00aceac into dev Aug 13, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat 기능 구현
Projects
None yet
Development

Successfully merging this pull request may close these issues.

어드민 API 연동
2 participants