Skip to content

Commit

Permalink
Update to React v19.
Browse files Browse the repository at this point in the history
  • Loading branch information
fniessink committed Jan 20, 2025
1 parent fe5406e commit 092e27e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 128 deletions.
118 changes: 1 addition & 117 deletions components/frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions components/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.0",
"@mui/icons-material": "^6.4.0",
"@mui/lab": "^6.0.0-beta.17",
"@mui/material": "^6.4.0",
"@mui/x-date-pickers": "^7.24.0",
"crypto-js": "^4.2.0",
Expand Down Expand Up @@ -57,7 +56,7 @@
"@eslint/js": "^9.18.0",
"@testing-library/dom": "10.4.0",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.1.0",
"@testing-library/react": "^16.2.0",
"@testing-library/user-event": "^14.6.0",
"eslint": "^9.18.0",
"eslint-config-prettier": "^10.0.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import PictureAsPdf from "@mui/icons-material/PictureAsPdf"
import { LoadingButton } from "@mui/lab"
import { Tooltip } from "@mui/material"
import { Button, Tooltip } from "@mui/material"
import { string } from "prop-types"
import { useState } from "react"

import { get_report_pdf } from "../../api/report"
import { registeredURLSearchParams } from "../../hooks/url_search_query"
import { showMessage } from "../../widgets/toast"

function download_pdf(report_uuid, query_string, callback) {
function downloadPDF(report_uuid, queryString, callback) {
const reportId = report_uuid ? `report-${report_uuid}` : "reports-overview"
return get_report_pdf(report_uuid, query_string)
return get_report_pdf(report_uuid, queryString)
.then((response) => {
if (response.ok === false) {
showMessage(
Expand Down Expand Up @@ -43,20 +42,21 @@ export function DownloadAsPDFButton({ report_uuid }) {
const label = `Download ${itemType} as PDF`
return (
<Tooltip title={`Generate a PDF version of the ${itemType} as currently displayed. This may take some time.`}>
<LoadingButton
<Button
aria-label={label}
color="inherit"
loading={loading}
loadingPosition="start"
onClick={() => {
setLoading(true)
download_pdf(report_uuid, `?${query.toString()}`, () => {
downloadPDF(report_uuid, `?${query.toString()}`, () => {
setLoading(false)
})
}}
startIcon={<PictureAsPdf />}
>
Download as PDF
</LoadingButton>
</Button>
</Tooltip>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ async function clickDownload(nrClicks = 1) {
}

function expectButtonIsLoading() {
expect(screen.getByRole("button").className).toContain("MuiLoadingButton-loading")
expect(screen.getByRole("button").className).toContain("MuiButton-loading")
}

function expectButtonIsNotLoading() {
expect(screen.getByRole("button").className).not.toContain("MuiLoadingButton-loading")
expect(screen.getByRole("button").className).not.toContain("MuiButton-loading")
}

function mockGetReportPDFWithTimeout() {
Expand Down

0 comments on commit 092e27e

Please sign in to comment.