-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ✨ #205 - 날짜별 heatmap 데이터 조회 커스텀 훅 생성 - 타입 정의 및 api 구현 * 🩹 #205 - dateFormat 공백 제거 * 💡 #205 - Formatter 함수에 js doc 적용 * ✨ #205 - YYYY.MM.DD Day of week 형식 날짜 포맷 함수 생성 * ✨ #205 - 날짜별 활동 내역을 조회하기 위한 YYYY-MM-DD 형식 날짜 포맷 함수 생성 * ✨ #205 - 활동 내역 상세 컴포넌트 생성 * ✨ #205 - 히트맵 셀 클릭 시 해당 날짜 활동 내역 상세 노출 구현 * 🩹 #205 - 잘못된 import 수정 * ♻️ #205 - 상수 정의 및 적용 * 🔥 #205 - 불필요한 import 제거 * 🩹 #205 - 활동탭 진입 시 날짜 선택하지 않은 상태로 변경 * 💄 #205 - 활동 내역 상세 로딩 UI 적용 * 💄 #205 - 활동 달력 내 폰트 수정 * 💄 #205 - hover 스타일 제거 및 class name 추가 * 🔥 #205 - 불필요한 코드 제거 * 👽️ #205 - API endpoint 및 queryKeys 수정 * 🔧 #205 - tsconfig 수정 * 🔥 #205 - 불필요한 코드 및 파일 삭제 * 🐛 #205 - build error 해결 * 🚚 #205 - HeatmapCalendar > ActivitiesContainer 파일명 변경 * ♻️ #205 - ActivitiesCalendar 컴포넌트 생성 및 적용 * 🚚 #205 - HeatmapDetail > ActivityDetail 파일명 변경 * ♻️ #205 - ActivityDiariesContainer 컴포넌트 생성 및 적용 * 🚚 #205 - types/heatmap > types/activity 파일명 변경 및 타입 명 변경 * 🚚 #205 - api/heatmap > api/activities 파일명 변경 및 api 명 변경 * 🚚 #205 - 활동 탭 관련 커스텀 훅 및 컴포넌트 props 네이밍 변경 * ✨ #205 - 활동 탭 진입 시 오늘 날짜 활성화 되도록 적용
- Loading branch information
1 parent
72eb75f
commit de60e7a
Showing
30 changed files
with
431 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import type { | ||
GetActivitiesByUsernameRequest, | ||
GetActivityDetailRequest, | ||
Activity, | ||
ActivityDetail, | ||
} from 'types/activity'; | ||
import type { SuccessResponse } from 'types/response'; | ||
import { API_PATH } from 'constants/services'; | ||
import axios from 'lib/axios'; | ||
|
||
export const getActivitiesByUsername = async ({ | ||
username, | ||
}: GetActivitiesByUsernameRequest) => { | ||
const { | ||
data: { data }, | ||
} = await axios.get<SuccessResponse<Activity[]>>( | ||
`${API_PATH.activities.index}/${username}`, | ||
); | ||
return data; | ||
}; | ||
|
||
export const getActivityDetail = async ({ | ||
username, | ||
dateString, | ||
}: GetActivityDetailRequest) => { | ||
const { | ||
data: { data }, | ||
} = await axios.get<SuccessResponse<ActivityDetail>>( | ||
`${API_PATH.activities.index}/${username}/${dateString}`, | ||
); | ||
return data; | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import styled from '@emotion/styled'; | ||
import Diary from './Diary'; | ||
import type { DiaryDetail } from 'types/diary'; | ||
import { ScreenReaderOnly } from 'styles'; | ||
|
||
interface ActivityDiariesContainerProps { | ||
title: string; | ||
diariesData: DiaryDetail[]; | ||
empty: JSX.Element; | ||
} | ||
|
||
export const ActivityDiariesContainer = ({ | ||
title, | ||
diariesData, | ||
empty, | ||
}: ActivityDiariesContainerProps) => { | ||
const isEmptyDiaries = diariesData.length === 0; | ||
|
||
if (isEmptyDiaries) return empty; | ||
|
||
return ( | ||
<section> | ||
<Title>{title}</Title> | ||
<List> | ||
{diariesData.map((diary) => { | ||
const { id } = diary; | ||
return <Diary key={`diary-list-${id}`} {...diary} />; | ||
})} | ||
</List> | ||
</section> | ||
); | ||
}; | ||
|
||
const Title = styled.h2` | ||
${ScreenReaderOnly} | ||
`; | ||
|
||
const List = styled.ul` | ||
display: grid; | ||
gap: 6px; | ||
background-color: ${({ theme }) => theme.colors.gray_06}; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import styled from '@emotion/styled'; | ||
import { useRouter } from 'next/router'; | ||
import { Button } from 'components/common'; | ||
import { PAGE_PATH } from 'constants/common'; | ||
|
||
export const EmptyActivitiesDiary = () => { | ||
const router = useRouter(); | ||
|
||
const handleGoToWriteDiary = () => { | ||
void router.push(PAGE_PATH.diary); | ||
}; | ||
|
||
return ( | ||
<EmptyContainer> | ||
<EmptyTextContainer> | ||
<p>일기가 없습니다.</p> | ||
<p>오늘 일기를 작성해보세요.</p> | ||
</EmptyTextContainer> | ||
<Button | ||
text="일기 작성하러 가기" | ||
size="sm" | ||
onClick={handleGoToWriteDiary} | ||
/> | ||
</EmptyContainer> | ||
); | ||
}; | ||
|
||
const EmptyContainer = styled.div` | ||
padding: 50px; | ||
text-align: center; | ||
`; | ||
|
||
const EmptyTextContainer = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
gap: 6px; | ||
margin-bottom: 16px; | ||
color: ${({ theme }) => theme.colors.gray_02}; | ||
${({ theme }) => theme.fonts.body_08}; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { useState } from 'react'; | ||
import { ActivitiesCalendar } from './ActivitiesCalendar'; | ||
import { ActivityDetail } from './ActivityDetail'; | ||
import type { Activity } from 'types/activity'; | ||
import { dateStringFormat } from 'utils'; | ||
|
||
interface ActivitiesContainerProps { | ||
activitiesData: Activity[]; | ||
} | ||
|
||
export const ActivitiesContainer = ({ | ||
activitiesData, | ||
}: ActivitiesContainerProps) => { | ||
const todayDateString = dateStringFormat(new Date().toDateString()) as string; | ||
const [selectedDate, setSelectedDate] = useState<string>(todayDateString); | ||
|
||
const isSelected = selectedDate.length !== 0; | ||
|
||
const handleClick = (value: Activity) => { | ||
const { date } = value; | ||
|
||
setSelectedDate(dateStringFormat(date) as string); | ||
}; | ||
|
||
return ( | ||
<section> | ||
<ActivitiesCalendar | ||
activitiesData={activitiesData} | ||
selectedDate={selectedDate} | ||
onClick={handleClick} | ||
/> | ||
|
||
{isSelected && <ActivityDetail dateString={selectedDate} />} | ||
</section> | ||
); | ||
}; |
Oops, something went wrong.