-
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.
Merge pull request #236 from ItRecode/develop
[release] 상용 서버 배포 (스프린트 6주차)
- Loading branch information
Showing
95 changed files
with
2,366 additions
and
837 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,51 @@ | ||
import { AxiosResponse } from 'axios' | ||
import { baseInstance } from './instance' | ||
import { | ||
IMemoryRecordList, | ||
IMyRecordByDateList, | ||
IMyRecordByKeywordList, | ||
IMyRecordRequestParam, | ||
} from 'types/myRecord' | ||
|
||
const MEMORY_RECORD_SIZE = 7 | ||
const MEMORY_COMMENT_SIZE = 5 | ||
const MY_RECORD_KEYWORD_SIZE = 10 | ||
|
||
export const getMemoryRecord = ( | ||
pageParam: number | ||
): Promise<AxiosResponse<IMemoryRecordList>> => { | ||
return baseInstance.get(`/record/memory`, { | ||
params: { | ||
memoryRecordPage: pageParam, | ||
memoryRecordSize: MEMORY_RECORD_SIZE, | ||
sizeOfCommentPerRecord: MEMORY_COMMENT_SIZE, | ||
}, | ||
}) | ||
} | ||
|
||
export const getRecordByDate = ({ | ||
date, | ||
page, | ||
size, | ||
}: IMyRecordRequestParam): Promise<AxiosResponse<IMyRecordByDateList>> => { | ||
return baseInstance.get(`/record`, { | ||
params: { | ||
date, | ||
page, | ||
size, | ||
}, | ||
}) | ||
} | ||
|
||
export const getRecordByKeyword = ( | ||
pageParam: number, | ||
keyword: string | ||
): Promise<AxiosResponse<IMyRecordByKeywordList>> => { | ||
return baseInstance.get(`/record/search`, { | ||
params: { | ||
searchKeyword: keyword, | ||
page: pageParam, | ||
size: MY_RECORD_KEYWORD_SIZE, | ||
}, | ||
}) | ||
} |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 @@ | ||
export const RESET_TIME = 180 |
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 @@ | ||
export const PREVIOUS_URL = 'previousUrl' |
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,15 @@ | ||
export type keyOfRankingPeriod = 'DAY' | 'WEEK' | 'MONTH' | 'TOTAL' | ||
|
||
export type rankingPeriodType = { | ||
[key in keyOfRankingPeriod]: | ||
| '하루 기준' | ||
| '일주일 기준' | ||
| '한 달 기준' | ||
| '누적 기준' | ||
} | ||
export const RANKINGPERIOD: rankingPeriodType = { | ||
DAY: '하루 기준', | ||
WEEK: '일주일 기준', | ||
MONTH: '한 달 기준', | ||
TOTAL: '누적 기준', | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,101 @@ | ||
import { useGetCategory } from '@react-query/hooks/useGetCategory' | ||
import React, { Dispatch, SetStateAction, useEffect, useRef } from 'react' | ||
import { parentCategoryID } from 'types/category' | ||
import { getChipIconName } from '@pages/DetailRecord/getChipIconName' | ||
import Chip from './Chip' | ||
import useSwipe from '@hooks/useSwipe' | ||
import { CELEBRATION_ID, CONSOLATION_ID } from '@assets/constant/constant' | ||
import { useRecoilValue } from 'recoil' | ||
import { checkFromDetailPage } from '@store/detailPageAtom' | ||
|
||
export default function Category({ | ||
slider, | ||
parentCategoryId, | ||
choosedCategoryId, | ||
setChoosedCategoryId, | ||
isModify = false, | ||
}: { | ||
slider: boolean | ||
parentCategoryId: parentCategoryID | ||
choosedCategoryId: number | ||
setChoosedCategoryId: Dispatch<SetStateAction<number>> | ||
isModify?: boolean | ||
}) { | ||
const { categoryData } = useGetCategory(parentCategoryId) | ||
|
||
const dragRef = useRef<HTMLDivElement | null>( | ||
null | ||
) as React.MutableRefObject<HTMLDivElement> | ||
const { handleMouseDown, isDragging, setIsDragging } = useSwipe(dragRef) | ||
|
||
const isFromDetailPage = useRecoilValue(checkFromDetailPage) | ||
|
||
useEffect(() => { | ||
if (slider) { | ||
if ( | ||
choosedCategoryId !== CELEBRATION_ID && | ||
choosedCategoryId !== CONSOLATION_ID && | ||
!isFromDetailPage | ||
) { | ||
if (parentCategoryId === CELEBRATION_ID) | ||
setChoosedCategoryId(CELEBRATION_ID) | ||
if (parentCategoryId === CONSOLATION_ID) | ||
setChoosedCategoryId(CONSOLATION_ID) | ||
} | ||
dragRef.current.scrollLeft = 0 | ||
} | ||
if (!slider) { | ||
if (parentCategoryId === CELEBRATION_ID) setChoosedCategoryId(3) | ||
if (parentCategoryId === CONSOLATION_ID) setChoosedCategoryId(7) | ||
} | ||
}, [parentCategoryId]) | ||
|
||
const handleClickChip = (id?: number) => { | ||
if (slider && isDragging) { | ||
setIsDragging(false) | ||
return | ||
} | ||
if (id !== undefined) { | ||
setChoosedCategoryId(id) | ||
} else { | ||
setChoosedCategoryId(parentCategoryId) | ||
} | ||
} | ||
|
||
return ( | ||
<div | ||
className={`flex pr-4 ${ | ||
slider ? 'gap-1 overflow-scroll ' : 'flex-wrap gap-2' | ||
}`} | ||
ref={dragRef} | ||
onMouseDownCapture={(e) => { | ||
handleMouseDown(e) | ||
}} | ||
> | ||
{slider && ( | ||
<Chip | ||
icon={null} | ||
active={ | ||
choosedCategoryId === CELEBRATION_ID || | ||
choosedCategoryId === CONSOLATION_ID | ||
} | ||
message="전체" | ||
type={'button'} | ||
onClick={() => handleClickChip()} | ||
/> | ||
)} | ||
{categoryData && | ||
categoryData.map((item) => ( | ||
<Chip | ||
key={item.id} | ||
active={item.id === choosedCategoryId} | ||
icon={getChipIconName(item.name)} | ||
message={item.name} | ||
type={'button'} | ||
onClick={() => handleClickChip(item.id)} | ||
isModify={isModify} | ||
/> | ||
))} | ||
</div> | ||
) | ||
} |
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
Oops, something went wrong.