-
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.
closes #70 Signed-off-by: Sean Sundberg <[email protected]>
- Loading branch information
Showing
6 changed files
with
110 additions
and
54 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,27 @@ | ||
|
||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
import React from 'react'; | ||
import {KycCaseModel} from "../../models"; | ||
import {Stack} from "../Stack"; | ||
|
||
export interface KycCaseOverviewProps { | ||
currentCase: KycCaseModel; | ||
} | ||
|
||
export const KycCaseOverview: React.FunctionComponent<KycCaseOverviewProps> = (props: KycCaseOverviewProps) => { | ||
|
||
return ( | ||
<div className="infoBox"> | ||
<Stack gap={3}> | ||
<div><span className="label">Customer name:</span> {props.currentCase.customer.name}</div> | ||
<div><span className="label">Country:</span> {props.currentCase.customer.countryOfResidence}</div> | ||
<div><span className="label">Entity type:</span> {props.currentCase.customer.entityType}</div> | ||
<div><span className="label">Industry type:</span> {props.currentCase.customer.industryType}</div> | ||
<div><span className="label">Customer outreach:</span> {props.currentCase.customerOutreach || 'N/A'}</div> | ||
<div><span className="label">Counterparty name:</span> {props.currentCase.counterparty.name}</div> | ||
<div><span className="label">Counterparty country:</span> {props.currentCase.counterparty.countryOfResidence}</div> | ||
</Stack> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
export * from './KycCaseOverview'; |
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,71 @@ | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
import React, {ComponentType} from 'react'; | ||
import {Error, Pending} from "@carbon/icons-react"; | ||
import {Tab, TabList, TabPanel, TabPanels, Tabs} from "@carbon/react"; | ||
import {useMediaQuery} from "usehooks-ts"; | ||
|
||
import {CustomerRisk} from "../CustomerRisk"; | ||
import {KycSummary} from "../KycSummary"; | ||
import {NegativeNews} from "../NegativeNews"; | ||
import {KycCaseModel} from "../../models"; | ||
|
||
export interface KycCaseResultProps { | ||
currentCase: KycCaseModel; | ||
} | ||
|
||
export const KycCaseResult: React.FunctionComponent<KycCaseResultProps> = (props: KycCaseResultProps) => { | ||
const printMode = useMediaQuery('print') | ||
|
||
const getIcon = (data?: {error?: string}): ComponentType<{size: number}> => { | ||
|
||
if (!data) { | ||
return Pending as never; | ||
} | ||
|
||
if (data.error) { | ||
return Error as never; | ||
} | ||
|
||
return undefined | ||
} | ||
|
||
const isDisabled = (data?: {error?: string}): boolean => { | ||
return !data; | ||
} | ||
|
||
const tabProps = (data: {error?: string}) => { | ||
return { | ||
renderIcon: getIcon(data), | ||
disabled: isDisabled(data), | ||
} | ||
} | ||
|
||
if (printMode) { | ||
return ( | ||
<> | ||
<CustomerRisk customerRisk={props.currentCase.customerRiskAssessment} /> | ||
<NegativeNews type="Party" news={props.currentCase.negativeScreening} /> | ||
<NegativeNews type="Counterparty" news={props.currentCase.counterpartyNegativeScreening} /> | ||
<KycSummary kycSummary={props.currentCase.caseSummary} /> | ||
</> | ||
) | ||
} | ||
|
||
return ( | ||
<Tabs> | ||
<TabList aria-label="List of tabs"> | ||
<Tab {...tabProps(props.currentCase.customerRiskAssessment)}>Customer Risk</Tab> | ||
<Tab {...tabProps(props.currentCase.negativeScreening)}>Negative News - Party</Tab> | ||
<Tab {...tabProps(props.currentCase.counterpartyNegativeScreening)}>Negative News - Counterparty</Tab> | ||
<Tab {...tabProps(props.currentCase.caseSummary)}>KYC Summary</Tab> | ||
</TabList> | ||
<TabPanels> | ||
<TabPanel><CustomerRisk hideTitle={true} customerRisk={props.currentCase.customerRiskAssessment} /></TabPanel> | ||
<TabPanel><NegativeNews hideTitle={true} type="Party" news={props.currentCase.negativeScreening} /></TabPanel> | ||
<TabPanel><NegativeNews hideTitle={true} type="Counterparty" news={props.currentCase.counterpartyNegativeScreening} /></TabPanel> | ||
<TabPanel><KycSummary hideTitle={true} kycSummary={props.currentCase.caseSummary} /></TabPanel> | ||
</TabPanels> | ||
</Tabs> | ||
) | ||
} |
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 './KycCaseResult' |
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