Skip to content

Commit

Permalink
Use react-jsx transform (medplum#3338)
Browse files Browse the repository at this point in the history
* Use react-jsx transform

* Use babel preset-react runtime automatic
  • Loading branch information
codyebberson authored Nov 18, 2023
1 parent 0565b5d commit a28d504
Show file tree
Hide file tree
Showing 466 changed files with 350 additions and 623 deletions.
3 changes: 2 additions & 1 deletion examples/foomedical/src/components/InfoButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createStyles, Group, UnstyledButton } from '@mantine/core';
import { ReactNode } from 'react';

const useStyles = createStyles((theme) => ({
button: {
Expand All @@ -18,7 +19,7 @@ const useStyles = createStyles((theme) => ({

export interface InfoButtonProps {
onClick?: () => void;
children: React.ReactNode;
children: ReactNode;
}

export function InfoButton(props: InfoButtonProps): JSX.Element {
Expand Down
4 changes: 2 additions & 2 deletions examples/foomedical/src/components/InfoSection.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Card, CloseButton, createStyles, Title } from '@mantine/core';
import React from 'react';
import { ReactNode } from 'react';

const useStyles = createStyles((theme) => ({
titleSection: {
Expand All @@ -16,7 +16,7 @@ const useStyles = createStyles((theme) => ({

interface InfoSectionProps {
title: string | JSX.Element;
children: React.ReactNode;
children: ReactNode;
onButtonClick?: (id: string) => void;
resourceType?: string;
id?: string;
Expand Down
6 changes: 3 additions & 3 deletions examples/foomedical/src/components/SideMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createStyles, getStylesRef, Title } from '@mantine/core';
import React from 'react';
import { Fragment } from 'react';
import { NavLink } from 'react-router-dom';

export interface SubMenuProps {
Expand Down Expand Up @@ -70,7 +70,7 @@ export function SideMenu(props: SideMenuProps): JSX.Element {
{props.title}
</Title>
{props.menu.map((item) => (
<React.Fragment key={item.href}>
<Fragment key={item.href}>
<NavLink to={item.href} end className={({ isActive }) => cx(classes.link, isActive && classes.linkActive)}>
<span>{item.name}</span>
</NavLink>
Expand All @@ -81,7 +81,7 @@ export function SideMenu(props: SideMenuProps): JSX.Element {
</NavLink>
</div>
))}
</React.Fragment>
</Fragment>
))}
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion examples/medplum-chart-demo/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AppShell, ErrorBoundary, Loading, Logo, useMedplum, useMedplumProfile } from '@medplum/react';
import { IconUser } from '@tabler/icons-react';
import React, { Suspense } from 'react';
import { Suspense } from 'react';
import { Route, Routes, useLocation } from 'react-router-dom';
import { HomePage } from './pages/HomePage';
import { LandingPage } from './pages/LandingPage';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useDisclosure } from '@mantine/hooks';
import { createReference } from '@medplum/core';
import { AllergyIntolerance, CodeableConcept, Encounter, Patient } from '@medplum/fhirtypes';
import { CodeableConceptDisplay, CodeableConceptInput, Form, useMedplum } from '@medplum/react';
import React, { useCallback, useState } from 'react';
import { useCallback, useState } from 'react';

export interface AllergiesProps {
patient: Patient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useDisclosure } from '@mantine/hooks';
import { createReference } from '@medplum/core';
import { CodeableConcept, Encounter, MedicationRequest, Patient } from '@medplum/fhirtypes';
import { CodeableConceptDisplay, CodeableConceptInput, Form, useMedplum } from '@medplum/react';
import React, { useCallback, useState } from 'react';
import { useCallback, useState } from 'react';

export interface MedicationsProps {
patient: Patient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { useDisclosure } from '@mantine/hooks';
import { createReference } from '@medplum/core';
import { Condition, Encounter, Patient } from '@medplum/fhirtypes';
import { CodeableConceptDisplay, Form, useMedplum } from '@medplum/react';
import React, { useCallback, useState } from 'react';
import { Fragment, useCallback, useState } from 'react';

export interface ProblemListProps {
patient: Patient;
Expand Down Expand Up @@ -62,14 +62,14 @@ export function ProblemList(props: ProblemListProps): JSX.Element {
{problems.length > 0 ? (
<Grid gutter="xs">
{problems.map((problem) => (
<React.Fragment key={problem.id}>
<Fragment key={problem.id}>
<Grid.Col span={2}>{problem.onsetDateTime?.substring(0, 4)}</Grid.Col>
<Grid.Col span={10}>
<Badge key={problem.id} maw="100%">
<CodeableConceptDisplay value={problem.code} />
</Badge>
</Grid.Col>
</React.Fragment>
</Fragment>
))}
</Grid>
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useDisclosure } from '@mantine/hooks';
import { createReference } from '@medplum/core';
import { Encounter, Observation, Patient } from '@medplum/fhirtypes';
import { CodeableConceptDisplay, Form, useMedplum } from '@medplum/react';
import React, { useCallback, useState } from 'react';
import { useCallback, useState } from 'react';

// Smoking Status widget
// See: https://build.fhir.org/ig/HL7/US-Core/StructureDefinition-us-core-smokingstatus.html
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useDisclosure } from '@mantine/hooks';
import { generateId } from '@medplum/core';
import { Encounter, Observation, Patient } from '@medplum/fhirtypes';
import { Form, QuantityDisplay, useMedplum } from '@medplum/react';
import React, { useCallback, useState } from 'react';
import { useCallback, useState } from 'react';
import {
createCompoundObservation,
createLoincCode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Box, Flex, Text } from '@mantine/core';
import { Questionnaire, QuestionnaireResponse, Task } from '@medplum/fhirtypes';
import { Document, QuestionnaireForm, useMedplum } from '@medplum/react';
import { IconCircleCheck } from '@tabler/icons-react';
import React, { useEffect, useState } from 'react';
import { useEffect, useState } from 'react';
import { useParams } from 'react-router-dom';

export function SoapNote(): JSX.Element {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Button, Flex, Modal } from '@mantine/core';
import { DiagnosticReport, Task } from '@medplum/fhirtypes';
import { CodeableConceptDisplay, DiagnosticReportDisplay, useMedplum } from '@medplum/react';
import { IconCircleCheck } from '@tabler/icons-react';
import React, { useState } from 'react';
import { useState } from 'react';
import { TaskCellProps } from './TaskList';

export function DiagnosticReportModal(props: TaskCellProps): JSX.Element {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { getTypedPropertyValue, TypedValue } from '@medplum/core';
import { Questionnaire, QuestionnaireResponse, QuestionnaireResponseItem, Task } from '@medplum/fhirtypes';
import { QuestionnaireForm, ResourcePropertyDisplay, useMedplum } from '@medplum/react';
import { IconCircleCheck } from '@tabler/icons-react';
import React, { useEffect, useState } from 'react';
import { useEffect, useState } from 'react';
import { TaskCellProps } from './TaskList';

export function QuestionnaireTask(props: TaskCellProps): JSX.Element {
Expand Down
8 changes: 4 additions & 4 deletions examples/medplum-chart-demo/src/components/tasks/TaskList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
useResource,
} from '@medplum/react';
import { IconFilePencil, IconHeart, IconListCheck, IconReportMedical } from '@tabler/icons-react';
import React, { useEffect, useState } from 'react';
import { Fragment, ReactNode, useEffect, useState } from 'react';
import { useParams } from 'react-router-dom';
import { DiagnosticReportModal } from './DiagnosticReportTask';
import { QuestionnaireTask, ResponseDisplay } from './QuestionnaireTask';
Expand All @@ -32,7 +32,7 @@ interface TaskItemProps {
task: Task;
resource: Resource;
profile?: Reference;
children?: React.ReactNode;
children?: ReactNode;
}

export function TaskList(): JSX.Element | null {
Expand Down Expand Up @@ -62,10 +62,10 @@ export function TaskList(): JSX.Element | null {
<Box>
<Timeline>
{tasks.map((task, idx) => (
<React.Fragment key={idx}>
<Fragment key={idx}>
<FocusTimeline key={task.id} task={task} />
{idx !== tasks.length - 1 ? <Divider w="100%" /> : null}
</React.Fragment>
</Fragment>
))}
</Timeline>
</Box>
Expand Down
6 changes: 3 additions & 3 deletions examples/medplum-chart-demo/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { MantineProvider, MantineThemeOverride } from '@mantine/core';
import { MedplumClient } from '@medplum/core';
import { MedplumProvider } from '@medplum/react';
import React from 'react';
import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import { BrowserRouter } from 'react-router-dom';
import { App } from './App';
Expand Down Expand Up @@ -33,13 +33,13 @@ const theme: MantineThemeOverride = {
const container = document.getElementById('root') as HTMLDivElement;
const root = createRoot(container);
root.render(
<React.StrictMode>
<StrictMode>
<BrowserRouter>
<MedplumProvider medplum={medplum}>
<MantineProvider theme={theme} withGlobalStyles withNormalizeCSS>
<App />
</MantineProvider>
</MedplumProvider>
</BrowserRouter>
</React.StrictMode>
</StrictMode>
);
1 change: 0 additions & 1 deletion examples/medplum-chart-demo/src/pages/HomePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Title } from '@mantine/core';
import { getReferenceString } from '@medplum/core';
import { Practitioner } from '@medplum/fhirtypes';
import { Document, ResourceName, SearchControl, useMedplumNavigate, useMedplumProfile } from '@medplum/react';
import React from 'react';
import { Outlet } from 'react-router-dom';

/**
Expand Down
1 change: 0 additions & 1 deletion examples/medplum-chart-demo/src/pages/LandingPage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Anchor, Button, Stack, Text, Title } from '@mantine/core';
import { Document } from '@medplum/react';
import React from 'react';
import { Link } from 'react-router-dom';

export function LandingPage(): JSX.Element {
Expand Down
6 changes: 3 additions & 3 deletions examples/medplum-chart-demo/src/pages/PatientPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Flex, Loader } from '@mantine/core';
import { getReferenceString } from '@medplum/core';
import { Patient } from '@medplum/fhirtypes';
import { useResource } from '@medplum/react';
import React from 'react';
import { Fragment } from 'react';
import { useParams } from 'react-router-dom';
import { PatientChart } from '../components/chart/PatientChart';
import { SoapNote } from '../components/soapnote/SoapNote';
Expand All @@ -16,12 +16,12 @@ export function PatientPage(): JSX.Element {
}

return (
<React.Fragment key={getReferenceString(patient)}>
<Fragment key={getReferenceString(patient)}>
<Flex gap="xs" justify="center" align="flex-start" direction="row">
<PatientChart />
<TaskList />
<SoapNote />
</Flex>
</React.Fragment>
</Fragment>
);
}
2 changes: 1 addition & 1 deletion examples/medplum-chart-demo/src/pages/ResourcePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Title } from '@mantine/core';
import { getDisplayString, getReferenceString } from '@medplum/core';
import { Resource, ResourceType } from '@medplum/fhirtypes';
import { Document, ResourceTable, useMedplum } from '@medplum/react';
import React, { useEffect, useState } from 'react';
import { useEffect, useState } from 'react';
import { useParams } from 'react-router-dom';

/**
Expand Down
2 changes: 1 addition & 1 deletion examples/medplum-chart-demo/src/pages/SearchPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
} from '@medplum/core';
import { UserConfiguration } from '@medplum/fhirtypes';
import { Loading, MemoizedSearchControl, useMedplum } from '@medplum/react';
import React, { useEffect, useState } from 'react';
import { useEffect, useState } from 'react';
import { useLocation, useNavigate } from 'react-router-dom';

const useStyles = createStyles((theme) => {
Expand Down
1 change: 0 additions & 1 deletion examples/medplum-chart-demo/src/pages/SignInPage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Title } from '@mantine/core';
import { Logo, SignInForm } from '@medplum/react';
import React from 'react';
import { useNavigate } from 'react-router-dom';

export function SignInPage(): JSX.Element {
Expand Down
6 changes: 3 additions & 3 deletions examples/medplum-fhircast-demo/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { MantineProvider, MantineThemeOverride } from '@mantine/core';
import { MedplumClient } from '@medplum/core';
import { MedplumProvider } from '@medplum/react';
import React from 'react';
import { StrictMode } from 'react';
import ReactDOM from 'react-dom/client';
import { BrowserRouter } from 'react-router-dom';
import App from './App.tsx';
Expand Down Expand Up @@ -36,13 +36,13 @@ const medplum = new MedplumClient({
});

ReactDOM.createRoot(root).render(
<React.StrictMode>
<StrictMode>
<BrowserRouter>
<MedplumProvider medplum={medplum}>
<MantineProvider theme={theme} withGlobalStyles withNormalizeCSS>
<App />
</MantineProvider>
</MedplumProvider>
</BrowserRouter>
</React.StrictMode>
</StrictMode>
);
2 changes: 1 addition & 1 deletion examples/medplum-hello-world/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AppShell, ErrorBoundary, Loading, Logo, useMedplum, useMedplumProfile } from '@medplum/react';
import { IconUser } from '@tabler/icons-react';
import React, { Suspense } from 'react';
import { Suspense } from 'react';
import { Route, Routes, useLocation } from 'react-router-dom';
import { PatientHistory } from './components/PatientHistory';
import { PatientOverview } from './components/PatientOverview';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Title } from '@mantine/core';
import { Document, ResourceHistoryTable } from '@medplum/react';
import React from 'react';
import { useParams } from 'react-router-dom';

export function PatientHistory(): JSX.Element {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Title } from '@mantine/core';
import { Document, ResourceTable } from '@medplum/react';
import React from 'react';
import { useParams } from 'react-router-dom';

/*
Expand Down
1 change: 0 additions & 1 deletion examples/medplum-hello-world/src/components/Timeline.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { PatientTimeline } from '@medplum/react';
import React from 'react';
import { useParams } from 'react-router-dom';

/*
Expand Down
6 changes: 3 additions & 3 deletions examples/medplum-hello-world/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { MantineProvider, MantineThemeOverride } from '@mantine/core';
import { MedplumClient } from '@medplum/core';
import { MedplumProvider } from '@medplum/react';
import React from 'react';
import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import { BrowserRouter } from 'react-router-dom';
import { App } from './App';
Expand Down Expand Up @@ -33,13 +33,13 @@ const theme: MantineThemeOverride = {
const container = document.getElementById('root') as HTMLDivElement;
const root = createRoot(container);
root.render(
<React.StrictMode>
<StrictMode>
<BrowserRouter>
<MedplumProvider medplum={medplum}>
<MantineProvider theme={theme} withGlobalStyles withNormalizeCSS>
<App />
</MantineProvider>
</MedplumProvider>
</BrowserRouter>
</React.StrictMode>
</StrictMode>
);
1 change: 0 additions & 1 deletion examples/medplum-hello-world/src/pages/HomePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Title } from '@mantine/core';
import { getReferenceString } from '@medplum/core';
import { Practitioner } from '@medplum/fhirtypes';
import { Document, ResourceName, SearchControl, useMedplumNavigate, useMedplumProfile } from '@medplum/react';
import React from 'react';
import { Outlet } from 'react-router-dom';

/**
Expand Down
1 change: 0 additions & 1 deletion examples/medplum-hello-world/src/pages/LandingPage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Anchor, Button, Stack, Text, Title } from '@mantine/core';
import { Document } from '@medplum/react';
import React from 'react';
import { Link } from 'react-router-dom';

export function LandingPage(): JSX.Element {
Expand Down
1 change: 0 additions & 1 deletion examples/medplum-hello-world/src/pages/PatientHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { createStyles } from '@mantine/core';
import { calculateAgeString } from '@medplum/core';
import { Patient, Reference } from '@medplum/fhirtypes';
import { HumanNameDisplay, MedplumLink, ResourceAvatar, useResource } from '@medplum/react';
import React from 'react';

const useStyles = createStyles((theme) => ({
root: {
Expand Down
Loading

0 comments on commit a28d504

Please sign in to comment.