-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 3270 - Update Print Style - PR 1 (#3620) * 3270 - Add server side print * 3270 - Update print buttons * 3270 - Fix server side api handler * 3270 - Fix deepscan * 3270 - Use Responses.sendFile * 3496 - Print: fix puppeteer page.waitForTimeout (#3653) * 3270 - Print - Cache pdf (#3649) * 3270 - Update yarn lock * 3270 - Add country iso to Repository getOne props * 3270 - Add country_summary getLastUpdate * 3270 - Add FileRepository removeOne * 3270 - Omit id and uuid unnecessary properties when creating a repository item * 3270 - Add pdfRepository controller * 3270 - Update print report endpoint logic * 3270 - Fix Report naming and export * 3270 - Fix yarn.lock * 3270 - Remove country_iso from Repository.getOne props * 3270 - Add CountrySummary getOneOrNone * 3270 - Account for reports per language and with only tables * 3270 - update force req param * 3270 - remove FileRepository.removeOne * 3270 - update file cleanup: call repo.remove only if uuids.length * 3270 - restore file cleanup repeat pattern --------- Co-authored-by: minotogna <[email protected]> * 3270 - Fix screenshotDashboardCharts build page.waitForTimeout (#3662) --------- Co-authored-by: Yhoan Alejandro Guzmán García <[email protected]>
- Loading branch information
Showing
38 changed files
with
938 additions
and
214 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
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 |
---|---|---|
|
@@ -49,3 +49,9 @@ div.editorWYSIWYG { | |
} | ||
} | ||
} | ||
|
||
@include print { | ||
div.editorWYSIWYG { | ||
height: unset; | ||
} | ||
} |
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,36 @@ | ||
@import 'src/client/style/partials'; | ||
|
||
$toolbarHeight: $spacing-l; | ||
|
||
.print-header { | ||
display: grid; | ||
align-items: center; | ||
grid-row-gap: $spacing-xxs; | ||
padding-top: $toolbarHeight; | ||
} | ||
|
||
.print-header__toolbar { | ||
align-items: center; | ||
background-color: $ui-bg; | ||
border-bottom: 1px solid $ui-border; | ||
display: flex; | ||
gap: $spacing-xs; | ||
height: $toolbarHeight; | ||
justify-content: end; | ||
left: 0; | ||
padding: 0 $spacing-s; | ||
position: fixed; | ||
top: 0; | ||
width: 100dvw; | ||
z-index: 1; | ||
} | ||
|
||
@media print { | ||
.print-header { | ||
padding-top: 0; | ||
} | ||
|
||
.print-header__toolbar { | ||
display: none; | ||
} | ||
} |
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,74 @@ | ||
import './Header.scss' | ||
import React, { useMemo } from 'react' | ||
import { useTranslation } from 'react-i18next' | ||
import { Link } from 'react-router-dom' | ||
|
||
import { ApiEndPoint } from 'meta/api/endpoint' | ||
import { AssessmentStatus, CountryIso } from 'meta/area' | ||
import { Routes } from 'meta/routes' | ||
|
||
import { useCountry } from 'client/store/area' | ||
import { useIsPrintRoute } from 'client/hooks/useIsRoute' | ||
import { useLanguage } from 'client/hooks/useLanguage' | ||
import { useCountryRouteParams } from 'client/hooks/useRouteParams' | ||
import { ButtonSize, useButtonClassName } from 'client/components/Buttons/Button' | ||
import Icon from 'client/components/Icon' | ||
|
||
const iconName = 'hit-down' | ||
const label = 'Label' | ||
const noPrint = false | ||
const size = ButtonSize.m | ||
|
||
const Header: React.FC = () => { | ||
const { t } = useTranslation() | ||
const { assessmentName, cycleName, countryIso } = useCountryRouteParams<CountryIso>() | ||
const country = useCountry(countryIso) | ||
const { onlyTables } = useIsPrintRoute() | ||
const lang = useLanguage() | ||
|
||
const downloadClassName = useButtonClassName({ iconName, label, noPrint, size }) | ||
const onlyTablesClassName = useButtonClassName({ iconName, inverse: !onlyTables, label, noPrint, size }) | ||
|
||
const params = new URLSearchParams({ assessmentName, countryIso, cycleName, lang, onlyTables: String(onlyTables) }) | ||
const downloadHref = `${ApiEndPoint.CycleData.Print.Report.one()}?${params.toString()}` | ||
const PrintRoute = onlyTables ? Routes.Print : Routes.PrintTables | ||
|
||
const { deskStudy, status } = country?.props ?? {} | ||
|
||
const title = useMemo<string>(() => { | ||
if (onlyTables) return t(`${assessmentName}.print.titleTables`, { cycleName }) | ||
if (deskStudy) return `${t(`assessment.${assessmentName}`)} ${t('assessment.deskStudy')}` | ||
return t(`${assessmentName}.print.title`, { cycleName }) | ||
}, [assessmentName, cycleName, deskStudy, onlyTables, t]) | ||
|
||
const withDownload = ![AssessmentStatus.notStarted, AssessmentStatus.editing].includes(status) | ||
|
||
return ( | ||
<div className="print-header"> | ||
<div className="print-header__toolbar"> | ||
{withDownload && ( | ||
<a className={downloadClassName} href={downloadHref} rel="noreferrer" target="_blank"> | ||
<Icon className="icon-white icon-sub" name="hit-down" /> | ||
<Icon className="icon-white icon-sub" name="icon-files" /> | ||
</a> | ||
)} | ||
|
||
{!onlyTables && ( | ||
<Link | ||
className={onlyTablesClassName} | ||
target="_blank" | ||
to={PrintRoute.generatePath({ assessmentName, cycleName, countryIso })} | ||
> | ||
<Icon className="icon-white icon-sub" name="small-print" /> | ||
<Icon className="icon-white icon-sub" name="icon-table2" /> | ||
</Link> | ||
)} | ||
</div> | ||
|
||
<h1>{t(`area.${countryIso}.listName`)}</h1> | ||
<h1>{title}</h1> | ||
</div> | ||
) | ||
} | ||
|
||
export default Header |
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 './Header' |
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.