Skip to content

Commit

Permalink
ci: upgrade package
Browse files Browse the repository at this point in the history
  • Loading branch information
Mehdi-BOUYAHIA committed May 28, 2024
1 parent a1743e9 commit 6bd2a0c
Show file tree
Hide file tree
Showing 30 changed files with 558 additions and 235 deletions.
645 changes: 471 additions & 174 deletions package-lock.json

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "cohort360_react",
"version": "2.36.0-SNAPSHOT",
"private": true,
"type": "module",
"dependencies": {
"@apollo/client": "^3.7.10",
"@apollo/react-hooks": "^4.0.0",
Expand Down Expand Up @@ -50,8 +51,7 @@
"overrides": {
"nth-check": "2.1.1",
"tough-cookie": "4.1.3",
"postcss": "8.4.31",
"pdfjs-dist": "4.2.67"
"postcss": "8.4.31"
},
"scripts": {
"start": "vite",
Expand Down Expand Up @@ -109,11 +109,12 @@
"normalize-url": "^7.0.3",
"prettier": "^2.8.7",
"typescript": "^4.9.5",
"vite": "^4.5.3",
"vite-plugin-svgr": "^3.2.0",
"vite": "^5.0.0",
"vite-plugin-svgr": "^4.2.0",
"vite-tsconfig-paths": "^4.2.0",
"vitest": "^0.34.4",
"vite-plugin-top-level-await": "^1.4.1"
"vite-plugin-top-level-await": "^1.4.1",
"vite-plugin-static-copy": "1.0.0"
},
"jest": {
"clearMocks": true
Expand Down
4 changes: 2 additions & 2 deletions src/components/CohortsTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ import {
import DeleteOutlineIcon from '@mui/icons-material/DeleteOutline'
import InfoIcon from '@mui/icons-material/Info'

import { ReactComponent as Star } from 'assets/icones/star.svg'
import { ReactComponent as StarFull } from 'assets/icones/star full.svg'
import Star from 'assets/icones/star.svg?react'
import StarFull from 'assets/icones/star full.svg?react'
import EditIcon from '@mui/icons-material/Edit'
import ExportIcon from '@mui/icons-material/GetApp'
import MoreVertIcon from '@mui/icons-material/MoreVert'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {

import ClearIcon from '@mui/icons-material/Clear'
import KeyboardBackspaceIcon from '@mui/icons-material/KeyboardBackspace'
import { ReactComponent as SearchIcon } from 'assets/icones/search.svg'
import SearchIcon from 'assets/icones/search.svg?react'

import useStyles from './styles'
import { useDebounce } from 'utils/debounce'
Expand Down
2 changes: 1 addition & 1 deletion src/components/Dashboard/Documents/Documents.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState, useEffect, useRef, useMemo } from 'react'
import { Checkbox, CircularProgress, Grid, Tooltip, Typography } from '@mui/material'
import DataTableComposition from 'components/DataTable/DataTableComposition'
import { ReactComponent as FilterList } from 'assets/icones/filter.svg'
import FilterList from 'assets/icones/filter.svg?react'
import {
CohortComposition,
CriteriaName,
Expand Down
2 changes: 1 addition & 1 deletion src/components/Dashboard/PatientList/PatientList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { CircularProgress, Grid, Tooltip } from '@mui/material'

import DataTablePatient from 'components/DataTable/DataTablePatient'

import { ReactComponent as FilterList } from 'assets/icones/filter.svg'
import FilterList from 'assets/icones/filter.svg?react'

import PatientCharts from './components/PatientCharts'

Expand Down
10 changes: 5 additions & 5 deletions src/components/DataTable/DataTableComposition.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ import DOMPurify from 'dompurify'
import FolderSharedIcon from '@mui/icons-material/FolderShared'
import DescriptionIcon from '@mui/icons-material/Description'
import LocalHospitalIcon from '@mui/icons-material/LocalHospital'
import { ReactComponent as CheckIcon } from 'assets/icones/check.svg'
import { ReactComponent as CancelIcon } from 'assets/icones/times.svg'
import { ReactComponent as UserIcon } from 'assets/icones/user.svg'
import { ReactComponent as SearchIcon } from 'assets/icones/search.svg'
import CheckIcon from 'assets/icones/check.svg?react'
import CancelIcon from 'assets/icones/times.svg?react'
import UserIcon from 'assets/icones/user.svg?react'
import SearchIcon from 'assets/icones/search.svg?react'

import DataTable from 'components/DataTable/DataTable'
import DocumentViewer from 'components/DocumentViewer/DocumentViewer'

import docTypes from 'assets/docTypes.json'
import Watermark from 'assets/images/watermark_pseudo.svg'
import Watermark from 'assets/images/watermark_pseudo.svg?react'

import { getDocumentStatus } from 'utils/documentsFormatter'

Expand Down
2 changes: 1 addition & 1 deletion src/components/DataTable/DataTableImaging.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
import DocumentViewer from 'components/DocumentViewer/DocumentViewer'
import { TableCellWrapper } from 'components/ui/TableCell/styles'
import { KeyboardArrowDown, KeyboardArrowUp, Visibility } from '@mui/icons-material'
import { ReactComponent as SearchIcon } from 'assets/icones/search.svg'
import SearchIcon from 'assets/icones/search.svg?react'

import DataTable from './DataTable'

Expand Down
30 changes: 20 additions & 10 deletions src/components/DocumentViewer/DocumentViewer.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Buffer } from 'buffer'
import Parse from 'html-react-parser'
import React, { useEffect, useLayoutEffect, useRef, useState } from 'react'
import React, { useEffect, useLayoutEffect, useRef, useState, useMemo } from 'react'

import Button from '@mui/material/Button'
import CircularProgress from '@mui/material/CircularProgress'
Expand All @@ -15,7 +15,7 @@ import services from 'services/aphp'
import { FHIR_API_URL, ACCESS_TOKEN } from '../../constants'

import { Tab, Tabs } from '@mui/material'
import Watermark from 'assets/images/watermark_pseudo.svg'
import Watermark from 'assets/images/watermark_pseudo.svg?react'
import { DocumentReference } from 'fhir/r4'
import { getAuthorizationMethod } from 'services/apiFhir'

Expand Down Expand Up @@ -86,6 +86,22 @@ const DocumentViewer: React.FC<DocumentViewerProps> = ({ deidentified, open, han
margin: 'auto'
}

const url = useMemo(() => {
return { url: `${FHIR_API_URL}/Binary/${documentId}` }
}, [documentId])

const options = useMemo(() => {
return {
cMapUrl: '/cmaps/',
standardFontDataUrl: '/standard_fonts/',
httpHeaders: {
Accept: 'application/pdf',
Authorization: `Bearer ${localStorage.getItem(ACCESS_TOKEN)}`,
authorizationMethod: getAuthorizationMethod()
}
}
}, [])

const findContent = documentContent?.content?.find((content) => content.attachment?.contentType === 'text/plain')

const documentContentDecode =
Expand Down Expand Up @@ -123,14 +139,8 @@ const DocumentViewer: React.FC<DocumentViewerProps> = ({ deidentified, open, han
<Document
error={'Le document est introuvable.'}
loading={'PDF en cours de chargement...'}
file={{
url: `${FHIR_API_URL}/Binary/${documentId}`,
httpHeaders: {
Accept: 'application/pdf',
Authorization: `Bearer ${localStorage.getItem(ACCESS_TOKEN)}`,
authorizationMethod: getAuthorizationMethod()
}
}}
file={url}
options={options}
onLoadSuccess={({ numPages }) => setNumPages(numPages)}
>
{Array.from(new Array(numPages), (el, index) => (
Expand Down
2 changes: 1 addition & 1 deletion src/components/ErrorView/CohortNoPatient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Button from '@mui/material/Button'
import Grid from '@mui/material/Grid'
import Typography from '@mui/material/Typography'

import { ReactComponent as PersonOffIcon } from 'assets/icones/person-off.svg'
import PersonOffIcon from 'assets/icones/person-off.svg?react'

import { useAppSelector } from 'state'

Expand Down
2 changes: 1 addition & 1 deletion src/components/ErrorView/PatientNotExist.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Button from '@mui/material/Button'
import Grid from '@mui/material/Grid'
import Typography from '@mui/material/Typography'

import { ReactComponent as PersonOffIcon } from 'assets/icones/person-off.svg'
import PersonOffIcon from 'assets/icones/person-off.svg?react'

import { useAppSelector } from 'state'

Expand Down
2 changes: 1 addition & 1 deletion src/components/Patient/PatientBiology/PatientBiology.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useEffect, useMemo, useRef, useState } from 'react'

import { Checkbox, CircularProgress, Grid, Tooltip, Typography, useMediaQuery, useTheme } from '@mui/material'

import { ReactComponent as FilterList } from 'assets/icones/filter.svg'
import FilterList from 'assets/icones/filter.svg?react'

import DataTableObservation from 'components/DataTable/DataTableObservation'

Expand Down
2 changes: 1 addition & 1 deletion src/components/Patient/PatientDocs/PatientDocs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useEffect, useState, useRef, useMemo } from 'react'

import { Checkbox, CircularProgress, Grid, Tooltip, Typography } from '@mui/material'

import { ReactComponent as FilterList } from 'assets/icones/filter.svg'
import FilterList from 'assets/icones/filter.svg?react'

import DataTableComposition from 'components/DataTable/DataTableComposition'

Expand Down
2 changes: 1 addition & 1 deletion src/components/Patient/PatientImaging/PatientImaging.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { fetchImaging } from 'state/patient'
import useSearchCriterias, { initImagingCriterias } from 'reducers/searchCriteriasReducer'

import { CircularProgress, Grid, Tooltip } from '@mui/material'
import { ReactComponent as FilterList } from 'assets/icones/filter.svg'
import FilterList from 'assets/icones/filter.svg?react'

import Button from 'components/ui/Button'
import Chip from 'components/ui/Chip/'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useEffect, useMemo, useRef, useState } from 'react'

import Grid from '@mui/material/Grid'

import { ReactComponent as FilterList } from 'assets/icones/filter.svg'
import FilterList from 'assets/icones/filter.svg?react'

import DataTableMedication from 'components/DataTable/DataTableMedication'

Expand Down
2 changes: 1 addition & 1 deletion src/components/Patient/PatientPMSI/PatientPMSI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'

import { CircularProgress, Grid, Tooltip } from '@mui/material'
import Chip from 'components/ui/Chip'
import { ReactComponent as FilterList } from 'assets/icones/filter.svg'
import FilterList from 'assets/icones/filter.svg?react'

import DataTablePmsi from 'components/DataTable/DataTablePmsi'

Expand Down
2 changes: 1 addition & 1 deletion src/components/Patient/PatientSidebar/PatientSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useLocation } from 'react-router-dom'

import { Divider, Drawer, Grid, IconButton, Typography } from '@mui/material'
import { ChevronRight, Sort } from '@mui/icons-material'
import { ReactComponent as FilterList } from 'assets/icones/filter.svg'
import FilterList from 'assets/icones/filter.svg?react'

import { selectFiltersAsArray } from 'utils/filters'
import { cancelPendingRequest } from 'utils/abortController'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import {
} from '@mui/material'
import { TableCellWrapper } from 'components/ui/TableCell/styles'

import { ReactComponent as CancelIcon } from 'assets/icones/times.svg'
import { ReactComponent as CheckIcon } from 'assets/icones/check.svg'
import CancelIcon from 'assets/icones/times.svg?react'
import CheckIcon from 'assets/icones/check.svg?react'

import DocumentViewer from 'components/DocumentViewer/DocumentViewer'

Expand Down
2 changes: 1 addition & 1 deletion src/components/Patient/PatientTimeline/PatientTimeline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import HospitDialog from './HospitDialog/HospitDialog'
import FilterTimelineDialog from './FilterTimelineDialog/FilterTimelineDialog'

import MoreVertIcon from '@mui/icons-material/MoreVert'
import { ReactComponent as FilterList } from 'assets/icones/filter.svg'
import FilterList from 'assets/icones/filter.svg?react'

import { CohortComposition, CohortEncounter, HierarchyElement, PMSIEntry } from 'types'

Expand Down
4 changes: 2 additions & 2 deletions src/components/Requests/ProjectsTable/VersionRow/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import { TableCellWrapper } from 'components/ui/TableCell/styles'

import EditIcon from '@mui/icons-material/Edit'
import ExportIcon from '@mui/icons-material/GetApp'
import { ReactComponent as Star } from 'assets/icones/star.svg'
import { ReactComponent as StarFull } from 'assets/icones/star full.svg'
import Star from 'assets/icones/star.svg?react'
import StarFull from 'assets/icones/star full.svg?react'

import ExportModal from 'components/Dashboard/ExportModal/ExportModal'

Expand Down
10 changes: 5 additions & 5 deletions src/components/Routes/LeftSideBar/LeftSideBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ import ExpandMore from '@mui/icons-material/ExpandMore'
import HelpIcon from '@mui/icons-material/Help'

import cohortLogo from 'assets/images/logo_v3.1_ld.png'
import { ReactComponent as HomeIcon } from 'assets/icones/home-lg.svg'
import { ReactComponent as LogoutIcon } from 'assets/icones/power-off.svg'
import { ReactComponent as MenuIcon } from 'assets/icones/bars.svg'
import { ReactComponent as PatientIcon } from 'assets/icones/user.svg'
import { ReactComponent as ResearchIcon } from 'assets/icones/chart-bar.svg'
import HomeIcon from 'assets/icones/home-lg.svg?react'
import LogoutIcon from 'assets/icones/power-off.svg?react'
import MenuIcon from 'assets/icones/bars.svg?react'
import PatientIcon from 'assets/icones/user.svg?react'
import ResearchIcon from 'assets/icones/chart-bar.svg?react'

import { useAppSelector, useAppDispatch } from 'state'
import { logout as logoutAction } from 'state/me'
Expand Down
4 changes: 2 additions & 2 deletions src/components/TopBar/TopBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import FaceIcon from '@mui/icons-material/Face'
import CloseIcon from '@mui/icons-material/Close'
import MoreHorizIcon from '@mui/icons-material/MoreHoriz'

import { ReactComponent as StarIcon } from 'assets/icones/star.svg'
import { ReactComponent as StarFullIcon } from 'assets/icones/star full.svg'
import StarIcon from 'assets/icones/star.svg?react'
import StarFullIcon from 'assets/icones/star full.svg?react'
import MoreButton from '@mui/icons-material/MoreVert'

import { AvatarWrapper } from 'components/ui/Avatar/styles'
Expand Down
6 changes: 3 additions & 3 deletions src/components/ui/GenderIcon/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react'

import { ReactComponent as FemaleIcon } from 'assets/icones/venus.svg'
import { ReactComponent as MaleIcon } from 'assets/icones/mars.svg'
import { ReactComponent as UnknownIcon } from 'assets/icones/autre-inconnu.svg'
import FemaleIcon from 'assets/icones/venus.svg?react'
import MaleIcon from 'assets/icones/mars.svg?react'
import UnknownIcon from 'assets/icones/autre-inconnu.svg?react'

import { GenderStatus } from 'types/searchCriterias'

Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/Searchbar/SearchInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React, { useEffect, useState } from 'react'
import { Grid, IconButton, InputAdornment, InputBase, Typography } from '@mui/material'
import ClearIcon from '@mui/icons-material/Clear'
import WarningIcon from '@mui/icons-material/Warning'
import { ReactComponent as SearchIcon } from 'assets/icones/search.svg'
import SearchIcon from 'assets/icones/search.svg?react'
import { ErrorWrapper, SearchInputWrapper } from './styles'
import { useDebounce } from 'utils/debounce'
import InfoIcon from '@mui/icons-material/Info'
Expand Down
6 changes: 0 additions & 6 deletions src/custom.d.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/react-app-env.d.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/views/Login/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import NoRights from 'components/ErrorView/NoRights'

import logo from 'assets/images/logo-login.png'
import logoAPHP from 'assets/images/logo-aphp.png'
import { ReactComponent as Keycloak } from 'assets/icones/keycloak.svg'
import Keycloak from 'assets/icones/keycloak.svg?react'

import { useAppDispatch } from 'state'
import { MeState, login as loginAction } from 'state/me'
Expand Down
2 changes: 1 addition & 1 deletion src/views/MyRequests/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {

import AddIcon from '@mui/icons-material/Add'
import DeleteIcon from '@mui/icons-material/Delete'
import { ReactComponent as DriveFileMoveIcon } from 'assets/icones/drive-file-move.svg'
import DriveFileMoveIcon from 'assets/icones/drive-file-move.svg?react'

import useStyles from '../MyCohorts/styles'

Expand Down
1 change: 1 addition & 0 deletions vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/// <reference types="vite-plugin-svgr/client" />
/// <reference types="vite/client" />
25 changes: 23 additions & 2 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
import { defineConfig } from 'vite'
import { defineConfig, normalizePath } from 'vite'
import react from '@vitejs/plugin-react'
import tsconfigPaths from 'vite-tsconfig-paths'
import svgr from 'vite-plugin-svgr'
import topLevelAwait from 'vite-plugin-top-level-await'

import path from 'node:path'
import { createRequire } from 'node:module'
import { viteStaticCopy } from 'vite-plugin-static-copy'

const require = createRequire(import.meta.url)
const cMapsDir = normalizePath(path.join(path.dirname(require.resolve('pdfjs-dist/package.json')), 'cmaps'))
const standardFontsDir = normalizePath(
path.join(path.dirname(require.resolve('pdfjs-dist/package.json')), 'standard_fonts')
)

export default defineConfig(() => {
return {
build: {
Expand All @@ -12,7 +22,18 @@ export default defineConfig(() => {
server: {
port: 3000
},
plugins: [react(), tsconfigPaths(), svgr(), topLevelAwait()],
plugins: [
react(),
tsconfigPaths(),
svgr(),
topLevelAwait(),
viteStaticCopy({
targets: [
{ src: cMapsDir, dest: '' },
{ src: standardFontsDir, dest: '' }
]
})
],
test: {
globals: true,
environment: 'jsdom', // tells Vitest to run our tests in a mock browser environment rather than the default Node environment
Expand Down

0 comments on commit 6bd2a0c

Please sign in to comment.