-
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.
모든 api 기능 구현
- Loading branch information
Showing
15 changed files
with
110 additions
and
108 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
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: 4 additions & 8 deletions
12
packages/admin/src/features/people-management/api/hook/usePutDepositCheck.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,16 @@ | ||
import { putDepositCheck, putDepositCheckPath } from "../deposit-check"; | ||
import { putDepositCheck } from "../deposit-check"; | ||
import { DepositCheckResponse } from "../types"; | ||
import { queryClient } from "@/shared"; | ||
import { useMutation, UseMutationResult } from "@tanstack/react-query"; | ||
|
||
const putDepositCheckQueryKey = [putDepositCheckPath]; | ||
|
||
export const usePutDepositCheck = (id: number): UseMutationResult<DepositCheckResponse, Error, void> => { | ||
return useMutation<DepositCheckResponse, Error, void>({ | ||
mutationFn: () => putDepositCheck(id), | ||
onSuccess: () => { | ||
queryClient.invalidateQueries({ queryKey: [putDepositCheckQueryKey, id] }); | ||
alert("승인 상태로 변경되었습니다."); | ||
alert("입금 완료로 상태가 변경되었습니다."); | ||
}, | ||
onError: (error) => { | ||
console.error("승인 상태 변경에 실패했습니다.", error); | ||
alert("승인 상태 변경에 실패했습니다."); | ||
console.error("입금 완료 상태 변경에 실패했습니다.", error); | ||
alert("입금 완료 상태 변경에 실패했습니다."); | ||
}, | ||
}); | ||
}; |
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
13 changes: 13 additions & 0 deletions
13
packages/admin/src/features/people-management/components/features/CheckInStatus.tsx
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,13 @@ | ||
type Props = { | ||
checkined: boolean; | ||
}; | ||
|
||
export const CheckInStatus = ({ checkined }: Props) => ( | ||
<span | ||
className={`inline-flex items-center px-3 py-1 rounded-full text-sm font-medium ${ | ||
checkined ? "bg-blue-100 text-blue-800" : "bg-gray-100 text-gray-800" | ||
}`} | ||
> | ||
{checkined ? "체크인됨" : "미체크인"} | ||
</span> | ||
); |
26 changes: 26 additions & 0 deletions
26
packages/admin/src/features/people-management/components/features/DeleteButton.tsx
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,26 @@ | ||
import { X } from "lucide-react"; | ||
|
||
import { useDeleteInfo } from "../../api"; | ||
|
||
type Props = { | ||
id: number; | ||
name: string; | ||
}; | ||
|
||
export const DeleteButton = ({ id, name }: Props) => { | ||
const { mutate: deleteInfo } = useDeleteInfo(id); | ||
|
||
const deletePerson = () => { | ||
const isConfirmed = window.confirm(`${name}님을 정말 삭제하시겠습니까?`); | ||
|
||
if (isConfirmed) { | ||
deleteInfo(); | ||
} | ||
}; | ||
|
||
return ( | ||
<button className="text-red-600 hover:text-red-900" onClick={deletePerson}> | ||
<X className="w-5 h-5" /> | ||
</button> | ||
); | ||
}; |
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
27 changes: 27 additions & 0 deletions
27
packages/admin/src/features/people-management/components/features/StatusButton.tsx
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,27 @@ | ||
import { ChevronDown } from "lucide-react"; | ||
|
||
import { usePutDepositCheck } from "../../api"; | ||
|
||
type Props = { | ||
accepted: boolean; | ||
id: number; | ||
}; | ||
|
||
export const StatusButton = ({ accepted, id }: Props) => { | ||
const { mutate: updatePersonStatus } = usePutDepositCheck(id); | ||
const handleChangeStatus = () => { | ||
updatePersonStatus(); | ||
}; | ||
|
||
return ( | ||
<button | ||
className={`inline-flex items-center px-3 py-1 rounded-full text-sm font-medium ${ | ||
accepted ? "bg-green-100 text-green-800" : "bg-yellow-100 text-yellow-800" | ||
}`} | ||
onClick={handleChangeStatus} | ||
> | ||
{accepted ? "입금 완료" : "입금 전"} | ||
<ChevronDown className="w-4 h-4 ml-1" /> | ||
</button> | ||
); | ||
}; |
3 changes: 3 additions & 0 deletions
3
packages/admin/src/features/people-management/components/features/index.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
export { InputField } from "./InputField"; | ||
export { PeopleTable } from "./PeopleTable"; | ||
export { StatusButton } from "./StatusButton"; | ||
export { CheckInStatus } from "./CheckInStatus"; | ||
export { DeleteButton } from "./DeleteButton"; |
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 * from "./table-header"; |
10 changes: 10 additions & 0 deletions
10
packages/admin/src/features/people-management/data/table-header/TableHeader.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export const TABLE_HEADERS = [ | ||
{ label: "이름", key: "name" }, | ||
{ label: "학번", key: "studentId" }, | ||
{ label: "전화번호", key: "phoneNumber" }, | ||
{ label: "팀 이름", key: "teamName" }, | ||
{ label: "전공", key: "major" }, | ||
{ label: "입금 확인", key: "accepted" }, | ||
{ label: "체크인 상태", key: "checkined" }, | ||
{ label: "삭제", key: "delete" }, | ||
]; |
1 change: 1 addition & 0 deletions
1
packages/admin/src/features/people-management/data/table-header/index.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { TABLE_HEADERS } from "./TableHeader"; |
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 |
---|---|---|
@@ -1,2 +1 @@ | ||
export { useFilteredPeople } from "./useFilteredPeople"; | ||
export { useUpdatePersonStatus } from "./useUpdatePersonStatus"; |
27 changes: 0 additions & 27 deletions
27
packages/admin/src/features/people-management/hook/useUpdatePersonStatus.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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export * from "./api"; | ||
export * from "./data"; | ||
export * from "./hook"; | ||
export * from "./components"; | ||
export * from "./ui"; |