Skip to content

Commit

Permalink
fix: eslint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
rikuke committed Oct 21, 2024
1 parent cd779f5 commit 80410cf
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 52 deletions.
7 changes: 3 additions & 4 deletions frontend/benefit/handler/public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1498,9 +1498,7 @@
"main": "Raportointi",
"downloadAcceptedApplications": "Hyväksytyt hakemukset joita ei ole vielä ladattu",
"downloadRejectedApplications": "Hylätyt hakemukset joita ei ole vielä ladattu",
"downloadApplicationsInTimeRange": "Lataa kaikki hakemukset tietyltä ajalta",
"downloadSmallerListOfApplicationsInTimeRange": "Lataa kompaktimpi lista hakemuksista tietyltä ajalta"
},
"downloadApplicationsInTimeRange": "Lataa kaikki hakemukset tietyltä ajalta" },
"fields": {
"lastDownloadDateText": "Ladattu viimeksi {{date}}",
"startDate": "Alkaen",
Expand All @@ -1509,7 +1507,8 @@
"buttons": {
"downloadAcceptedApplications": "Hyväksytyt hakemukset",
"downloadRejectedApplications": "Hylätyt hakemukset",
"downloadApplicationsInTimeRange": "Kaikki hakemukset valitulta ajalta"
"downloadApplicationsInTimeRange": "Kaikki hakemukset valitulta ajalta",
"downloadCompactList": "Lataa kompaktimpi lista hakemuksista"
}
},
"login": {
Expand Down
3 changes: 2 additions & 1 deletion frontend/benefit/handler/public/locales/fi/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1507,7 +1507,8 @@
"buttons": {
"downloadAcceptedApplications": "Hyväksytyt hakemukset",
"downloadRejectedApplications": "Hylätyt hakemukset",
"downloadApplicationsInTimeRange": "Kaikki hakemukset valitulta ajalta"
"downloadApplicationsInTimeRange": "Kaikki hakemukset valitulta ajalta",
"downloadCompactList": "Lataa kompaktimpi lista hakemuksista"
}
},
"login": {
Expand Down
3 changes: 2 additions & 1 deletion frontend/benefit/handler/public/locales/sv/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1508,7 +1508,8 @@
"buttons": {
"downloadAcceptedApplications": "Hyväksytyt hakemukset",
"downloadRejectedApplications": "Hylätyt hakemukset",
"downloadApplicationsInTimeRange": "Kaikki hakemukset valitulta ajalta"
"downloadApplicationsInTimeRange": "Kaikki hakemukset valitulta ajalta",
"downloadCompactList": "Lataa kompaktimpi lista hakemuksista"
}
},
"login": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,50 +28,9 @@ const ApplicationReports: React.FC = () => {
buttonText={`${t(
`${translationsBase}.buttons.downloadApplicationsInTimeRange`
)}`}
isCompact={false}
>
<$GridCell $colSpan={3} css="font-weight: 500;">{`${t(
`${translationsBase}.fields.startDate`
)}`}</$GridCell>
<$GridCell $colSpan={3} css="font-weight: 500;">{`${t(
`${translationsBase}.fields.endDate`
)}`}</$GridCell>
<$GridCell $colStart={1} $colSpan={3}>
<DateInputWithSeparator
id={`${t(`${translationsBase}.fields.startDate`)}`}
name={`${t(`${translationsBase}.fields.startDate`)}`}
placeholder={`${t(`${translationsBase}.fields.startDate`)}`}
value={convertToUIDateFormat(formik.values.startDate)}
onChange={(value) =>
formik.setFieldValue(fields.startDate.name, value)
}
/>
</$GridCell>
<$GridCell $colSpan={3}>
<DateInput
id={`${t(`${translationsBase}.fields.endDate`)}`}
name={`${t(`${translationsBase}.fields.endDate`)}`}
placeholder={`${t(`${translationsBase}.fields.endDate`)}`}
value={convertToUIDateFormat(formik.values.endDate)}
onChange={(value) =>
formik.setFieldValue(
fields.endDate.name,
getCorrectEndDate(formik.values.startDate, value)
)
}
/>
</$GridCell>
</ReportsSection>
<ReportsSection
exportFileType="csv"
onDownloadButtonClick={exportApplicationsInTimeRange}
header={`${t(
`${translationsBase}.headings.downloadSmallerListOfApplicationsInTimeRange`
)}`}
buttonText={`${t(
`${translationsBase}.buttons.downloadApplicationsInTimeRange`
compactButtonText={`${t(
`${translationsBase}.buttons.downloadCompactList`
)}`}
isCompact={true}
>
<$GridCell $colSpan={3} css="font-weight: 500;">{`${t(
`${translationsBase}.fields.startDate`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ export type ReportsSectionProp = {
withDivider?: boolean;
header: string;
buttonText: string;
compactButtonText: string;
onDownloadButtonClick: (type: ExportFileType, isCompact:boolean) => void;
isCompact?: boolean;
};

const ReportsSection: React.FC<ReportsSectionProp> = ({
exportFileType,
children,
header,
buttonText,
compactButtonText,
onDownloadButtonClick,
withDivider = false,
isCompact = false
}) => {
const theme = useTheme();

Expand Down Expand Up @@ -58,11 +58,23 @@ const ReportsSection: React.FC<ReportsSectionProp> = ({
css={`
margin-top: ${theme.spacing.l};
`}
onClick={() => onDownloadButtonClick(exportFileType, isCompact)}
onClick={() => onDownloadButtonClick(exportFileType, false)}
>
{buttonText} {String(exportFileType).toUpperCase()}
</Button>
</$GridCell>
<$GridCell>
<Button
theme="coat"
iconLeft={<IconDownload />}
css={`
margin-top: ${theme.spacing.l};
`}
onClick={() => onDownloadButtonClick(exportFileType, true)}
>
{compactButtonText}
</Button>
</$GridCell>
</$Grid>
</$GridCell>
{withDivider && (
Expand Down

0 comments on commit 80410cf

Please sign in to comment.