-
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 #152 from kakao-tech-campus-2nd-step3/Feat/issue-#151
์ฝ๋ฐฑ ์์ฒญ ๋ฐ ์๋ถ์ ํ ์์ฒญ ์๋น์ค ์ ์ฒญ ๋ชฉ๋ก
- Loading branch information
Showing
56 changed files
with
642 additions
and
71 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
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
10 changes: 0 additions & 10 deletions
10
src/pages/guard/hello-call-report/api/apply-call-list.api.ts
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
src/pages/guard/hello-call-report/api/hooks/useGetApplyCallList.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,7 +1,6 @@ | ||
export { getReport } from './report.api'; | ||
export { getTimeLog } from './time-log.api'; | ||
export { getAcceptCallList } from './accept-call-list.api'; | ||
export { getApplyCallList } from './apply-call-list.api'; | ||
|
||
export * from './hooks'; | ||
export * from './types'; |
9 changes: 0 additions & 9 deletions
9
src/pages/guard/hello-call-report/api/types/apply-call-list.response.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,3 @@ | ||
export type { ReportResponse } from './report.response'; | ||
export type { TimeLog, TimeLogResponse } from './time-log.response'; | ||
export type { AcceptCallListResponse } from './accept-call-list.response'; | ||
export type { ApplyCallListResponse } from './apply-call-list.response'; |
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 { usePostWriteReport } from './usePostWriteReport.ts'; |
21 changes: 21 additions & 0 deletions
21
src/pages/sinitto/hello-call-report/api/hooks/usePostWriteReport.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,21 @@ | ||
import { WriteReportRequest } from '../types'; | ||
import { postWriteReport } from '../write-report.api'; | ||
import { useMutation, UseMutationResult } from '@tanstack/react-query'; | ||
|
||
export const usePostWriteReport = (): UseMutationResult< | ||
WriteReportRequest, | ||
Error, | ||
WriteReportRequest | ||
> => { | ||
return useMutation<WriteReportRequest, Error, WriteReportRequest>({ | ||
mutationFn: (requestPayload: WriteReportRequest) => | ||
postWriteReport(requestPayload), | ||
onSuccess: () => { | ||
alert('๋ณด๊ณ ์๊ฐ ์์ฑ๋์์ต๋๋ค.'); | ||
}, | ||
onError: (error) => { | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './hooks'; | ||
export * from './types'; |
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 type { WriteReportRequest } from './write-report.request'; |
4 changes: 4 additions & 0 deletions
4
src/pages/sinitto/hello-call-report/api/types/write-report.request.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,4 @@ | ||
export type WriteReportRequest = { | ||
helloCallId: number; | ||
report: string; | ||
}; |
14 changes: 14 additions & 0 deletions
14
src/pages/sinitto/hello-call-report/api/write-report.api.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,14 @@ | ||
import { WriteReportRequest } from './types'; | ||
import { fetchInstance } from '@/shared/api/instance'; | ||
|
||
export const postWriteReportPath = () => `/api/hellocalls/reports`; | ||
|
||
export const postWriteReport = async ( | ||
data: WriteReportRequest | ||
): Promise<WriteReportRequest> => { | ||
const response = await fetchInstance.post<WriteReportRequest>( | ||
postWriteReportPath(), | ||
data | ||
); | ||
return response.data; | ||
}; |
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 |
---|---|---|
@@ -1,3 +1,2 @@ | ||
export { useGetServiceDetail } from './useGetServiceDetail'; | ||
export { usePutAcceptHelloCall } from './usePutAcceptHelloCall'; | ||
export { usePutCancelHelloCall } from './usePutCancelHelloCall'; |
19 changes: 0 additions & 19 deletions
19
src/pages/sinitto/hello-call-service/api/hooks/usePutCancelHelloCall.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
99 changes: 99 additions & 0 deletions
99
src/pages/sinitto/service-history/SinittoServiceHistory.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,99 @@ | ||
import { useGetAcceptedCallBackList, useGetApplyHelloCallList } from './api'; | ||
import { | ||
CallBackServiceList, | ||
HelloCallServiceList, | ||
TextArea, | ||
} from './components'; | ||
import { CALLBACK_SCHEMA, HELLO_CALL_SCHEMA } from './data'; | ||
import { Spinner } from '@chakra-ui/react'; | ||
import styled from '@emotion/styled'; | ||
|
||
export const SinittoServiceHistoryPage = () => { | ||
const { data: acceptedCallBackList, isLoading: isAcceptedLoading } = | ||
useGetAcceptedCallBackList(); | ||
const { data: applyHelloCallList, isLoading: isApplyHelloLoading } = | ||
useGetApplyHelloCallList(); | ||
|
||
console.log(applyHelloCallList); | ||
return ( | ||
<ServiceHistoryLayout> | ||
<TextArea | ||
title={CALLBACK_SCHEMA.TITLE} | ||
status={CALLBACK_SCHEMA.STATUS} | ||
description={CALLBACK_SCHEMA.DESCRIPTION} | ||
textDirection='start' | ||
/> | ||
{isAcceptedLoading ? ( | ||
<StyledSpinnerWrapper> | ||
<Spinner size='lg' thickness='3px' color='blue.500' /> | ||
</StyledSpinnerWrapper> | ||
) : acceptedCallBackList ? ( | ||
<CallBackServiceList | ||
key={acceptedCallBackList.callbackId} | ||
date={acceptedCallBackList.postTime} | ||
name={acceptedCallBackList.seniorName} | ||
serviceStatus={acceptedCallBackList.status} | ||
callbackId={acceptedCallBackList.callbackId} | ||
/> | ||
) : ( | ||
<NoServiceMessage>์งํ์ค์ธ ์๋น์ค๊ฐ ์์ด์! ๐ฅ</NoServiceMessage> | ||
)} | ||
|
||
<TextArea | ||
title={HELLO_CALL_SCHEMA.TITLE} | ||
status={[ | ||
HELLO_CALL_SCHEMA.STATUS_PROCESS, | ||
HELLO_CALL_SCHEMA.STATUS_FINISH, | ||
]} | ||
description={[ | ||
HELLO_CALL_SCHEMA.DESCRIPTION_PROCESS, | ||
HELLO_CALL_SCHEMA.DESCRIPTION_FINISH, | ||
]} | ||
textDirection='end' | ||
/> | ||
{isApplyHelloLoading ? ( | ||
<StyledSpinnerWrapper> | ||
<Spinner size='lg' thickness='3px' color='blue.500' /> | ||
</StyledSpinnerWrapper> | ||
) : applyHelloCallList && applyHelloCallList.length > 0 ? ( | ||
applyHelloCallList.map((call) => ( | ||
<HelloCallServiceList | ||
key={call.helloCallId} | ||
name={call.seniorName} | ||
serviceStatus={call.status} | ||
helloCallId={call.helloCallId} | ||
days={call.days} | ||
/> | ||
)) | ||
) : ( | ||
<NoServiceMessage>์งํ์ค์ธ ์๋น์ค๊ฐ ์์ด์! ๐ฅ</NoServiceMessage> | ||
)} | ||
</ServiceHistoryLayout> | ||
); | ||
}; | ||
|
||
const ServiceHistoryLayout = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
width: 100%; | ||
padding: 0 2rem; | ||
`; | ||
|
||
const StyledSpinnerWrapper = styled.div` | ||
display: flex; | ||
height: 60px; | ||
align-items: center; | ||
justify-content: center; | ||
width: 100%; | ||
margin: 10px 0; | ||
`; | ||
|
||
const NoServiceMessage = styled.p` | ||
font-size: 1rem; | ||
font-weight: 700; | ||
color: var(--color-black); | ||
text-align: center; | ||
margin: 20px 0; | ||
`; |
12 changes: 12 additions & 0 deletions
12
src/pages/sinitto/service-history/api/accepted-call-back-list.api.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,12 @@ | ||
import { AcceptedCallBackListResponse } from './types'; | ||
import { fetchInstance } from '@/shared'; | ||
|
||
export const getAcceptedCallBackListPath = '/api/callbacks/sinitto/accepted'; | ||
|
||
export const getAcceptedCallBackList = | ||
async (): Promise<AcceptedCallBackListResponse> => { | ||
const response = await fetchInstance.get<AcceptedCallBackListResponse>( | ||
getAcceptedCallBackListPath | ||
); | ||
return response.data; | ||
}; |
12 changes: 12 additions & 0 deletions
12
src/pages/sinitto/service-history/api/apply-hello-call-list.api.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,12 @@ | ||
import { ApplyHelloCallListResponse } from './types'; | ||
import { fetchInstance } from '@/shared/api/instance'; | ||
|
||
export const applyHelloCallListPath = () => `/api/hellocalls/own`; | ||
|
||
export const getApplyHelloCallList = | ||
async (): Promise<ApplyHelloCallListResponse> => { | ||
const response = await fetchInstance.get<ApplyHelloCallListResponse>( | ||
applyHelloCallListPath() | ||
); | ||
return response.data; | ||
}; |
File renamed without changes.
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,3 @@ | ||
export { useGetAcceptedCallBackList } from './useGetAcceptedCallBackList'; | ||
export { useGetApplyHelloCallList } from './useGetApplyHelloCallList'; | ||
export { usePutCancelHelloCall } from './usePutCancelHelloCall'; |
Oops, something went wrong.