CHZZK-Study / Grass-Diary-Client

취지직 2νŒ€ ν”„λ‘œμ νŠΈ Grass Diary
1 stars 3 forks source link

πŸ’„ design: 메인 νŽ˜μ΄μ§€ λ””μžμΈ λ³€κ²½ #173

Closed KKYHH closed 2 months ago

KKYHH commented 2 months ago

βœ… 체크리슀트

πŸ“ μž‘μ—… 상세 λ‚΄μš©

grass API μ£Όμ†Œ λ³€κ²½


// λ³€κ²½ μ „

 GRASS: (memberId: Id) => `/main/grass/${memberId}`,

// λ³€κ²½ ν›„

  TOTAL_GRASS: (memberId: Id) => `/grass/${memberId}`,
  GRASS: (memberId: Id) => `/grass/main-page/${memberId}`,

API μ£Όμ†Œμ— main이 μ‚­μ œλ˜μ—ˆμŠ΅λ‹ˆλ‹€. μ‚¬μš©μžμ˜ 전체 μž”λ””λ₯Ό λΆˆλŸ¬μ˜€λŠ” 건 TOTAL_GRASS μ‚¬μš©μžμ˜ 일기 κ°œμˆ˜λ‚˜ μž”λ”” 기둝을 λΆˆλŸ¬μ˜€λŠ” 건 GRASS둜 μ„€μ •ν•΄ μ£Όμ—ˆμŠ΅λ‹ˆλ‹€.

useReward, useGrassRecord ν›… 뢄리

// λ³€κ²½ μ „ ν•˜λ‚˜μ˜ μ»΄ν¬λ„ŒνŠΈμ— 같이 μž‘μ„± λ˜μ—ˆλ˜ 데이터 둜직

const MiddleSection = () => {
  // μž”λ”” λ‚ μ§œ 계산
  const currentDate = dayjs();
  const currentMonth = currentDate.format('M');
  const nextMonthFirstDay = currentDate.add(1, 'month').startOf('month');
  const currentMonthLastDay = nextMonthFirstDay.subtract(1, 'day');

  const { memberId } = useUser();

  // reward 쿼리
  const { data: reward } = useQuery<RewardPointResponse>({
    queryKey: ['rewardPoint'],
    queryFn: () =>
      API.get(END_POINT.TOTAL_REWARD(memberId)).then(response => response.data),
    initialData: { rewardPoint: 0 }, // 초기 데이터 μ„€μ •
    enabled: !!memberId, // memberIdκ°€ μžˆμ„ λ•Œλ§Œ 쿼리λ₯Ό μ‹€ν–‰
  });

  // grass 쿼리
  const { data: grassQuery } = useQuery<GrassApiResponse>({
    queryKey: ['grass'],
    queryFn: () =>
      API.get(END_POINT.GRASS(memberId)).then(response => response.data),
    enabled: !!memberId, // memberIdκ°€ μžˆμ„ λ•Œλ§Œ 쿼리λ₯Ό μ‹€ν–‰
  });
// λ³€κ²½ ν›„ 바뀐 λ””μžμΈμ— 맞게 λΆ„λ¦¬λ˜μ–΄ μ‚¬μš©

const MiddleSection = () => {
  const { grassQuery } = useGrassRecord();

const BottomSection = () => {
  const { reward } = useReward();

메인 νŽ˜μ΄μ§€ μ»΄ν¬λ„ŒνŠΈμ—μ„œ 같이 μ‚¬μš©λ˜λ˜ 데이터 λ‘œμ§μ„ ν›…μœΌλ‘œ λΆ„λ¦¬ν–ˆμŠ΅λ‹ˆλ‹€. μ›λž˜λŠ” μ½”λ“œ μž‘μ„± μ‹œ ν•΄λ‹Ή μ»΄ν¬λ„ŒνŠΈμ—μ„œλ§Œ μ‚¬μš©λ  κ±° κ°™λ‹€κ³  μƒκ°λ˜μ–΄ 같이 λ‘μ—ˆμ§€λ§Œ λ‹Ήμž₯ μž¬μ‚¬μš©ν•˜μ§€ μ•Šμ„μ§€λΌλ„ λ¦¬μœ μ €λΈ”ν•œ μ»΄ν¬λ„ŒνŠΈλ‘œ λ§Œλ“ λ‹€λŠ” 의의λ₯Ό 두고 μˆ˜μ •ν–ˆμŠ΅λ‹ˆλ‹€.

UI λ³€κ²½

main pr

🚨 버그 λ°œμƒ 이유 (선택 사항)

πŸ”Ž 후속 μž‘μ—… (선택 사항)

메인 νŽ˜μ΄μ§€μ™€ 채연 λ‹˜μ˜ 곡유 νŽ˜μ΄μ§€μ— 같이 μ‚¬μš©λ˜λŠ” TOP10 μ»΄ν¬λ„ŒνŠΈλ₯Ό μ œμ™Έ UI 변경이 λ˜μ—ˆμŠ΅λ‹ˆλ‹€. TOP10 μ»΄ν¬λ„ŒνŠΈλŠ” μ œκ°€ λ§‘μ•„μ„œ λ°”λ‘œ μž‘μ—…ν•  μ˜ˆμ •μž…λ‹ˆλ‹€.

πŸ€” 질문 사항 (선택 사항)

questionPR

μ½”λ“œ λ¦¬νŒ©ν† λ§ ν›„ νŽ˜μ΄μ§€ λ‘œλ”©μ΄ λ‹€μ‹œ μ’€ λŠλ €μ§„ κ±° 같은데 μ–΄λ–»κ²Œ 해결할지 κ³ λ―Όν•΄ 봐야 ν•  것 κ°™μŠ΅λ‹ˆλ‹€. πŸ‘€

πŸ“š μ°Έκ³  자료 (선택 사항)

좔가적인 μ°Έκ³  μ‚¬ν•­μ΄λ‚˜ κ΄€λ ¨λœ λ¬Έμ„œ, 링크 등을 μ œκ³΅ν•΄μ£Όμ„Έμš”.

πŸ“Έ μŠ€ν¬λ¦°μƒ· (선택 사항)

λ³€κ²½ 사항에 λŒ€ν•œ μŠ€ν¬λ¦°μƒ·μ΄ μžˆλ‹€λ©΄ μ²¨λΆ€ν•΄μ£Όμ„Έμš”.

βœ… μ…€ν”„ 체크리슀트

이슈 번호: #167

rkdcodus commented 2 months ago

μ†Œν¬λ‹˜ 리뷰 μ—„μ²­ κΌΌκΌΌν•˜μ‹œλ„€μš”!! λ¦¬λ·°λŠ” μ΄λ ‡κ²Œ ν•˜λŠ” κ±°κ΅°μš”!