-
Notifications
You must be signed in to change notification settings - Fork 3
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 #3441 from bcgov/NDT-380-Display-CCBC-Summary-Data…
…-in-Portal feat: ccbc summary page
- Loading branch information
Showing
27 changed files
with
1,940 additions
and
11 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
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,8 +1,20 @@ | ||
import { WidgetProps } from '@rjsf/utils'; | ||
import { StyledSourceSpan } from './DefaultWidget'; | ||
|
||
const DateWidget: React.FC<WidgetProps> = ({ value }) => { | ||
const DateWidget: React.FC<WidgetProps> = ({ value, formContext, name }) => { | ||
const date = value?.toString().split('T')[0]; | ||
return <>{date}</>; | ||
return ( | ||
<> | ||
{date} | ||
{formContext?.formDataSource?.[name] && | ||
value !== null && | ||
typeof value !== 'undefined' && ( | ||
<StyledSourceSpan> | ||
{` (${formContext.formDataSource?.[name]})`} | ||
</StyledSourceSpan> | ||
)} | ||
</> | ||
); | ||
}; | ||
|
||
export default DateWidget; |
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,23 @@ | ||
import { WidgetProps } from '@rjsf/utils'; | ||
import styled from 'styled-components'; | ||
|
||
const DefaultWidget: React.FC<WidgetProps> = ({ value }) => ( | ||
<>{value?.toString()}</> | ||
); | ||
export const StyledSourceSpan = styled('span')` | ||
color: #2e8540; | ||
`; | ||
|
||
const DefaultWidget: React.FC<WidgetProps> = ({ value, formContext, name }) => { | ||
return ( | ||
<> | ||
{value?.toString()} | ||
{formContext?.formDataSource?.[name] && | ||
value !== null && | ||
typeof value !== 'undefined' && ( | ||
<StyledSourceSpan> | ||
{` (${formContext.formDataSource?.[name]})`} | ||
</StyledSourceSpan> | ||
)} | ||
</> | ||
); | ||
}; | ||
|
||
export default DefaultWidget; |
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,47 @@ | ||
import { WidgetProps } from '@rjsf/utils'; | ||
import styled from 'styled-components'; | ||
import { StyledSourceSpan } from './DefaultWidget'; | ||
|
||
const LinkArrayWidget: React.FC<WidgetProps> = ({ | ||
value, | ||
formContext, | ||
name, | ||
}) => { | ||
const StyledLink = styled.a` | ||
color: ${(props) => props.theme.color.links}; | ||
text-decoration-line: underline; | ||
word-break: break-word; | ||
width: fit-content; | ||
:hover { | ||
cursor: pointer; | ||
} | ||
`; | ||
return ( | ||
<> | ||
{value && | ||
Array.isArray(value) && | ||
value.length > 0 && | ||
value.map((item, index) => ( | ||
<> | ||
<StyledLink | ||
href={item.link} | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
> | ||
{item.name} | ||
</StyledLink> | ||
{index < value.length - 1 ? ', ' : ''} | ||
</> | ||
))} | ||
{formContext?.formDataSource?.[name] && | ||
value !== null && | ||
typeof value !== 'undefined' && ( | ||
<StyledSourceSpan> | ||
{` (${formContext.formDataSource?.[name]})`} | ||
</StyledSourceSpan> | ||
)} | ||
</> | ||
); | ||
}; | ||
|
||
export default LinkArrayWidget; |
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,8 +1,19 @@ | ||
import { WidgetProps } from '@rjsf/utils'; | ||
import formatMoney from 'utils/formatMoney'; | ||
import { StyledSourceSpan } from './DefaultWidget'; | ||
|
||
const MoneyWidget: React.FC<WidgetProps> = ({ value }) => ( | ||
<>{formatMoney(value)}</> | ||
const MoneyWidget: React.FC<WidgetProps> = ({ value, formContext, name }) => ( | ||
<> | ||
{formatMoney(value)} | ||
{formContext?.formDataSource?.[name] && | ||
value !== null && | ||
typeof value !== 'undefined' && | ||
!!value && ( | ||
<StyledSourceSpan> | ||
{` (${formContext.formDataSource?.[name]})`} | ||
</StyledSourceSpan> | ||
)} | ||
</> | ||
); | ||
|
||
export default MoneyWidget; |
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,43 @@ | ||
import { RJSFSchema } from '@rjsf/utils'; | ||
|
||
const counts: RJSFSchema = { | ||
title: 'Counts', | ||
description: '', | ||
type: 'object', | ||
required: [ | ||
'communities', | ||
'benefitingCommunities', | ||
'indigenousCommunities', | ||
'benefitingIndigenousCommunities', | ||
'totalHouseholdsImpacted', | ||
'numberOfIndigenousHouseholds', | ||
], | ||
properties: { | ||
communities: { | ||
type: 'number', | ||
title: 'Communities', | ||
}, | ||
benefitingCommunities: { | ||
type: 'number', | ||
title: 'Benefiting Communities', | ||
}, | ||
indigenousCommunities: { | ||
type: 'number', | ||
title: 'Indigenous Communities', | ||
}, | ||
benefitingIndigenousCommunities: { | ||
type: 'number', | ||
title: 'Benefiting Indigenous Communities', | ||
}, | ||
totalHouseholdsImpacted: { | ||
type: 'number', | ||
title: 'Total Households Impacted', | ||
}, | ||
numberOfIndigenousHouseholds: { | ||
type: 'number', | ||
title: 'Number of Indigenous Households', | ||
}, | ||
}, | ||
}; | ||
|
||
export default counts; |
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,20 @@ | ||
import { RJSFSchema } from '@rjsf/utils'; | ||
|
||
const dependency: RJSFSchema = { | ||
title: 'Dependency', | ||
description: '', | ||
type: 'object', | ||
required: ['connectedCoastNetworkDependent', 'crtcProjectDependent'], | ||
properties: { | ||
connectedCoastNetworkDependent: { | ||
type: 'string', | ||
title: 'Connected Coast Network Dependent', | ||
}, | ||
crtcProjectDependent: { | ||
type: 'string', | ||
title: 'CRTC Project Dependent', | ||
}, | ||
}, | ||
}; | ||
|
||
export default dependency; |
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,48 @@ | ||
import { RJSFSchema } from '@rjsf/utils'; | ||
|
||
const eventsAndDates: RJSFSchema = { | ||
title: 'Events and Dates', | ||
description: '', | ||
type: 'object', | ||
required: [ | ||
'announcedByProvince', | ||
'dateApplicationReceived', | ||
'dateConditionallyApproved', | ||
'dateAgreementSigned', | ||
'effectiveStartDate', | ||
'proposedStartDate', | ||
'proposedCompletionDate', | ||
], | ||
properties: { | ||
announcedByProvince: { | ||
type: 'string', | ||
title: 'Announced by Province', | ||
}, | ||
dateApplicationReceived: { | ||
type: 'string', | ||
title: 'Date Application Received', | ||
}, | ||
dateConditionallyApproved: { | ||
type: 'string', | ||
title: 'Date Conditionally Approved', | ||
}, | ||
dateAgreementSigned: { | ||
type: 'string', | ||
title: 'Date Agreement Signed', | ||
}, | ||
effectiveStartDate: { | ||
type: 'string', | ||
title: 'Effective Start Date', | ||
}, | ||
proposedStartDate: { | ||
type: 'string', | ||
title: 'Proposed Start Date', | ||
}, | ||
proposedCompletionDate: { | ||
type: 'string', | ||
title: 'Proposed Completion Date', | ||
}, | ||
}, | ||
}; | ||
|
||
export default eventsAndDates; |
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,48 @@ | ||
import { RJSFSchema } from '@rjsf/utils'; | ||
|
||
const funding: RJSFSchema = { | ||
title: 'Funding', | ||
description: '', | ||
type: 'object', | ||
required: [ | ||
'bcFundingRequested', | ||
'federalFunding', | ||
'applicantAmount', | ||
'cibFunding', | ||
'fhnaFunding', | ||
'otherFunding', | ||
'totalProjectBudget', | ||
], | ||
properties: { | ||
bcFundingRequested: { | ||
type: 'number', | ||
title: 'BC Funding Requested', | ||
}, | ||
federalFunding: { | ||
type: 'number', | ||
title: 'Federal Funding', | ||
}, | ||
applicantAmount: { | ||
type: 'number', | ||
title: 'Applicant Amount', | ||
}, | ||
cibFunding: { | ||
type: 'number', | ||
title: 'CIB Funding', | ||
}, | ||
fhnaFunding: { | ||
type: 'number', | ||
title: 'FHNA Funding', | ||
}, | ||
otherFunding: { | ||
type: 'number', | ||
title: 'Other Funding', | ||
}, | ||
totalProjectBudget: { | ||
type: 'number', | ||
title: 'Total Project Budget', | ||
}, | ||
}, | ||
}; | ||
|
||
export default funding; |
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,16 @@ | ||
import { RJSFSchema } from '@rjsf/utils'; | ||
|
||
const milestone: RJSFSchema = { | ||
title: 'Milestone', | ||
description: '', | ||
type: 'object', | ||
required: ['percentProjectMilestoneComplete'], | ||
properties: { | ||
percentProjectMilestoneComplete: { | ||
type: 'string', | ||
title: 'Project Milestone Complete', | ||
}, | ||
}, | ||
}; | ||
|
||
export default milestone; |
Oops, something went wrong.