-
Notifications
You must be signed in to change notification settings - Fork 5
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
[FE] 행사 삭제 기능 구현 #903
Merged
Merged
[FE] 행사 삭제 기능 구현 #903
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
7d3dcaa
feat: 항목 터치를 길게 했을 때 애니메이션 발생하는 기능 구현
jinhokim98 b5df826
Merge branch 'fe-dev' of https://github.com/woowacourse-teams/2024-ha…
jinhokim98 49ad133
refactor: long press 애니메이션 커스텀 훅으로 분리
jinhokim98 60a8128
refactor: animation hook으로 분리한 것 적용
jinhokim98 f4e4cc8
feat: mode와 선택된 행사를 관리할 수 있는 context 생성
jinhokim98 ae12825
feat: 체크박스 label 숨길 수 있도록 기능 추가
jinhokim98 e139fd0
feat: 현재 리스트에 포함되어있는지를 찾는 함수 추가
jinhokim98 26cde86
feat: 편집하기를 누른 후 체크박스를 선택할 수 있도록 기능추가
jinhokim98 763cc1d
style: 불필요한 theme 주입 삭제
jinhokim98 a0765e2
fix: 애니메이션 색 보이지 않던 문제 해결
jinhokim98 4f12343
feat: 행사 목록에서 행사를 지우는 기능 추가
jinhokim98 3623755
refactor: toast를 query hook으로 이동
jinhokim98 e903cea
feat: 행사 페이지 내에서 행사 삭제 기능 추가
jinhokim98 38b70d8
style: default 값 상수화
jinhokim98 b30c41f
refactor: handleTouchEnd와 handleTouchMove 기능 하나로 합침
jinhokim98 8d561c8
style: console.log 제거거
jinhokim98 530e74a
style: CreatedEventList 컴포넌트 분리
jinhokim98 b6795b4
style: isAlreadySelected로 메서드 이름 변경
jinhokim98 fe6fbab
style: labelText를 option으로 주어 hideLabelText prop 삭제
jinhokim98 62025e2
feat: 편집 모드가 켜졌을 때 애니메이션 보이지 않도록 설정
jinhokim98 2d2b459
feat: 애니메이션 비활성화
jinhokim98 2e9b234
feat: 시간보다 행사 상태를 기준으로 먼저 정렬하는 기능 추가
jinhokim98 919c9a3
feat: 행사 삭제 시 회원이면 마이페이지, 비회원이면 랜딩으로 보내는 기능
jinhokim98 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,59 @@ | ||
import useRequestDeleteEvents from '@hooks/queries/event/useRequestDeleteEvents'; | ||
import {useCreatedEventsPageContext} from '@pages/mypage/events/CreatedEvent.context'; | ||
import {CreatedEvent} from 'types/serviceType'; | ||
import {CreatedEventItem} from '@components/Design/components/CreatedEvent/CreatedEvent'; | ||
|
||
import {FixedButton, Flex, Input} from '@components/Design'; | ||
|
||
type CreatedEventListProps = { | ||
eventName: string; | ||
onSearch: ({target}: React.ChangeEvent<HTMLInputElement>) => void; | ||
placeholder: string; | ||
createdEvents: CreatedEvent[]; | ||
}; | ||
|
||
export const CreatedEventList = ({createdEvents, eventName, onSearch, placeholder}: CreatedEventListProps) => { | ||
const {mode, handleMode, selectedEvents, isAlreadySelected, handleSelectedEvents} = useCreatedEventsPageContext(); | ||
const setViewMode = () => handleMode('view'); | ||
|
||
const {deleteEvents} = useRequestDeleteEvents(); | ||
|
||
const onDeleteClick = async () => { | ||
const selectedEventsId = selectedEvents.map(event => event.eventId); | ||
await deleteEvents({eventIds: selectedEventsId}); | ||
handleMode('view'); | ||
}; | ||
|
||
return ( | ||
<> | ||
<Flex | ||
flexDirection="column" | ||
width="100%" | ||
backgroundColor="white" | ||
padding="0.5rem 1rem" | ||
paddingInline="0.5rem" | ||
gap="0.5rem" | ||
height="100%" | ||
cssProp={{borderRadius: '1rem'}} | ||
> | ||
<Input inputType="search" value={eventName} onChange={onSearch} placeholder={placeholder} /> | ||
{createdEvents.length !== 0 && | ||
createdEvents.map(createdEvent => ( | ||
<CreatedEventItem | ||
key={createdEvent.eventId} | ||
isEditMode={mode === 'edit'} | ||
setEditMode={() => handleMode('edit')} | ||
isChecked={isAlreadySelected(createdEvent)} | ||
onChange={handleSelectedEvents} | ||
createdEvent={createdEvent} | ||
/> | ||
))} | ||
</Flex> | ||
{mode === 'edit' && ( | ||
<FixedButton variants="tertiary" onDeleteClick={onDeleteClick} onClick={setViewMode}> | ||
편집완료 | ||
</FixedButton> | ||
)} | ||
</> | ||
); | ||
}; |
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
12 changes: 0 additions & 12 deletions
12
client/src/components/Design/components/CreatedEvent/CreatedEvent.type.ts
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import {useMutation, useQueryClient} from '@tanstack/react-query'; | ||
|
||
import {requestDeleteEvents} from '@apis/request/event'; | ||
import toast from '@hooks/useToast/toast'; | ||
|
||
import QUERY_KEYS from '@constants/queryKeys'; | ||
|
||
const useRequestDeleteEvents = () => { | ||
const queryClient = useQueryClient(); | ||
|
||
const {mutateAsync} = useMutation({ | ||
mutationFn: requestDeleteEvents, | ||
onSuccess: () => { | ||
toast.confirm('행사가 정상적으로 삭제되었습니다'); | ||
queryClient.invalidateQueries({queryKey: [QUERY_KEYS.createdEvents]}); | ||
}, | ||
}); | ||
|
||
return { | ||
deleteEvents: mutateAsync, | ||
}; | ||
}; | ||
|
||
export default useRequestDeleteEvents; |
11 changes: 10 additions & 1 deletion
11
client/src/hooks/queries/event/useRequestGetCreatedEvents.ts
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
나중에 생성된 이벤트들을 목록에서 보여줄때 정산중인 행사들이 시간순으로 상단에 오면 좋을 것 같아요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오 좋아요~~ 반영해봤습니다. 지금 isFinished 상태가 반전돼서 상태가 반대로 보이지만 토다리 pr이 반영되면 정상적으로 보일거예요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오~ 반영해주신 부분 너무 좋아요!
다만, 제가 생각했던 순서는 정산중이 목록 상단, 정산 완료가 목록 하단으로 오는 것이었습니다!
아래 처럼요!