-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
745 additions
and
2,786 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import styled from 'styled-components' | ||
import Loader from '@l3-lib/ui-core/dist/Loader' | ||
import { useCallByIdService } from 'plugins/contact/services/call/useCallByIdService' | ||
|
||
type CallLogsProps = { | ||
chatId: string | ||
} | ||
|
||
const CallLogs = ({ chatId }: CallLogsProps) => { | ||
const { data, loading } = useCallByIdService({ id: chatId }) | ||
|
||
if (loading) { | ||
return ( | ||
<StyledLoaderWrapper> | ||
<Loader size={40} /> | ||
</StyledLoaderWrapper> | ||
) | ||
} | ||
|
||
return ( | ||
<StyledWrapper> | ||
{data?.logs.map(({ content }: any, index: number) => ( | ||
<p key={index}> | ||
{index + 1}. {content} | ||
</p> | ||
))} | ||
</StyledWrapper> | ||
) | ||
} | ||
|
||
export default CallLogs | ||
|
||
const StyledWrapper = styled.div` | ||
width: 100%; | ||
height: 100%; | ||
display: flex; | ||
flex-direction: column; | ||
overflow-y: scroll; | ||
color: #000; | ||
font-weight: bold; | ||
` | ||
|
||
const StyledLoaderWrapper = styled.div` | ||
position: absolute; | ||
width: 40px; | ||
left: 50%; | ||
top: 50%; | ||
transform: translate(-50%, -50%); | ||
margin-bottom: 20px; | ||
margin-left: 5px; | ||
` |
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 { default } from './CallLogs' |
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,63 @@ | ||
import withRenderModal from 'hocs/withRenderModal' | ||
import styled from 'styled-components' | ||
import Modal from '@l3-lib/ui-core/dist/Modal' | ||
import IconButton from '@l3-lib/ui-core/dist/IconButton' | ||
import { useModal } from 'hooks' | ||
import Close from '@l3-lib/ui-core/dist/icons/Close' | ||
import CallLogs from './CallLogs' | ||
|
||
export const CALL_LOGS_MODAL_NAME = 'call-logs-modal' | ||
|
||
type CallLogsModalProps = { | ||
data: { | ||
chatId: string | ||
} | ||
} | ||
|
||
const CallLogsModal = ({ data }: CallLogsModalProps) => { | ||
const { closeModal } = useModal() | ||
|
||
return ( | ||
<StyledModal | ||
onClose={() => closeModal(CALL_LOGS_MODAL_NAME)} | ||
show | ||
backgroundColor='light' | ||
hideCloseButton | ||
> | ||
<StyledModalBody> | ||
<CallLogs chatId={data.chatId} /> | ||
</StyledModalBody> | ||
|
||
<StyledButtonWrapper> | ||
<IconButton | ||
size={IconButton.sizes.XS} | ||
icon={() => <Close />} | ||
kind={IconButton.kinds.TERTIARY} | ||
onClick={() => closeModal(CALL_LOGS_MODAL_NAME)} | ||
/> | ||
</StyledButtonWrapper> | ||
</StyledModal> | ||
) | ||
} | ||
|
||
export default withRenderModal(CALL_LOGS_MODAL_NAME)(CallLogsModal) | ||
|
||
const StyledModal = styled(Modal)` | ||
.components-Modal-Modal-module__overlay--OO00T { | ||
backdrop-filter: unset; | ||
} | ||
` | ||
|
||
const StyledModalBody = styled.div` | ||
min-height: 400px; | ||
max-width: 1200px; | ||
max-height: 800px; | ||
width: 100vw; | ||
` | ||
|
||
export const StyledButtonWrapper = styled.div` | ||
position: absolute; | ||
top: 4px; | ||
right: 4px; | ||
` |
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 { default, CALL_LOGS_MODAL_NAME } from './CallLogsModal' |
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 @@ | ||
query callById($id: id!) @api(name: pro) { | ||
callById(id: $id) @rest(type: "Call", path: "/call/{args.id}", method: "GET", endpoint: "pro") { | ||
id | ||
chat_id | ||
contact_id | ||
logs { | ||
content | ||
} | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
apps/ui/src/plugins/contact/services/call/useCallByIdService.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 { useQuery } from '@apollo/client' | ||
import CALL_BY_ID_GQL from '../../gql/call/callById.gql' | ||
|
||
export const useCallByIdService = ({ id }: { id?: string }) => { | ||
const { | ||
data: { callById } = {}, | ||
error, | ||
loading, | ||
refetch, | ||
} = useQuery(CALL_BY_ID_GQL, { | ||
variables: { id }, | ||
skip: !id, | ||
}) | ||
|
||
return { | ||
data: callById, | ||
error, | ||
loading, | ||
refetch, | ||
} | ||
} |
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.