Skip to content

Commit

Permalink
feat: add subsidy info on asset cards
Browse files Browse the repository at this point in the history
* Add subsidy info

* fix: display subsidy info only if the value is set

Relies #9
  • Loading branch information
NandyBa authored Oct 1, 2023
1 parent d6977f6 commit dc286df
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
15 changes: 15 additions & 0 deletions src/components/cards/AssetCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ const AssetCardComponent: FC<{ value: OwnedRealtoken }> = (props) => {
const { t } = useTranslation('common', { keyPrefix: 'assetCard' })

const { classes } = useStyles()
const isSubsidized =
props.value.subsidyStatus !== 'no' && props.value.subsidyStatusValue

return (
<Card
Expand Down Expand Up @@ -129,6 +131,19 @@ const AssetCardComponent: FC<{ value: OwnedRealtoken }> = (props) => {
</div>
</div>

{isSubsidized && (
<div className={classes.groupApart}>
<div className={classes.textSm}>{t('subsidy')}</div>
<div className={classes.textSm}>
{tNumbers('percentInteger', {
value:
(props.value.subsidyStatusValue / props.value.grossRentMonth) *
100,
})}
</div>
</div>
)}

<div className={classes.groupApart}>
<div className={classes.textSm}>{t('propertyValue')}</div>
<div className={classes.textSm}>
Expand Down
5 changes: 3 additions & 2 deletions src/i18next/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"occupancy": "Occupancy rate",
"initialLaunch": "Initial launch"
},
"sortReverse": "Reverse" ,
"sortReverse": "Reverse",
"viewOptions": {
"table": "Table",
"grid": "Grid"
Expand All @@ -87,7 +87,8 @@
"full": "Rented",
"partial": "Partially rented",
"none": "Not rented"
}
},
"subsidy": "Subsidy"
},
"assetTable": {
"property": "Property",
Expand Down
5 changes: 3 additions & 2 deletions src/i18next/locales/fr/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@
"full": "Louée",
"partial": "Partiellement louée",
"none": "Non louée"
}
},
"subsidy": "Loyer subventioné"
},
"assetTable": {
"property": "Propriété",
Expand All @@ -105,4 +106,4 @@
"value_other": "{{count}} portefeuilles",
"manage": "Gérer les portefeuilles"
}
}
}
2 changes: 2 additions & 0 deletions src/types/APIRealToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ export interface APIRealToken {
section8paid: number
grossRentYear: number
grossRentMonth: number
subsidyStatus: string
subsidyStatusValue: number

// Monthly expenses
insurance: number
Expand Down

0 comments on commit dc286df

Please sign in to comment.