Skip to content

Commit

Permalink
(chore) Configure prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
denniskigen committed Apr 4, 2024
1 parent 5608b66 commit cd1e197
Show file tree
Hide file tree
Showing 63 changed files with 770 additions and 1,272 deletions.
8 changes: 8 additions & 0 deletions prettier.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
bracketSpacing: true,
printWidth: 120,
semi: true,
singleQuote: true,
tabWidth: 2,
trailingComma: 'all',
};
24 changes: 9 additions & 15 deletions src/CancelModal.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
import {
Button,
ComposedModal,
ModalBody,
ModalFooter,
ModalHeader,
} from "@carbon/react";
import React from "react";
import { useTranslation } from "react-i18next";
import { Button, ComposedModal, ModalBody, ModalFooter, ModalHeader } from '@carbon/react';
import React from 'react';
import { useTranslation } from 'react-i18next';

const CancelModal = ({ open, setOpen, context }) => {
const { t } = useTranslation();
Expand All @@ -23,22 +17,22 @@ const CancelModal = ({ open, setOpen, context }) => {

return (
<ComposedModal open={open}>
<ModalHeader>{t("areYouSure", "Are you sure?")}</ModalHeader>
<ModalHeader>{t('areYouSure', 'Are you sure?')}</ModalHeader>
<ModalBody>
{t(
"cancelExplanation",
"You will lose any unsaved changes on the current form. Do you want to discard the current session?"
'cancelExplanation',
'You will lose any unsaved changes on the current form. Do you want to discard the current session?',
)}
</ModalBody>
<ModalFooter>
<Button kind="secondary" onClick={onCancel}>
{t("cancel", "Cancel")}
{t('cancel', 'Cancel')}
</Button>
<Button kind="danger" onClick={onDiscard}>
{t("discard", "Discard")}
{t('discard', 'Discard')}
</Button>
<Button kind="primary" onClick={onSaveAndClose}>
{t("saveSession", "Save Session")}
{t('saveSession', 'Save Session')}
</Button>
</ModalFooter>
</ComposedModal>
Expand Down
25 changes: 7 additions & 18 deletions src/CompleteModal.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
import {
Button,
ComposedModal,
ModalBody,
ModalFooter,
ModalHeader,
} from "@carbon/react";
import React from "react";
import { useTranslation } from "react-i18next";
import { Button, ComposedModal, ModalBody, ModalFooter, ModalHeader } from '@carbon/react';
import React from 'react';
import { useTranslation } from 'react-i18next';

const CompleteModal = ({ open, setOpen, context, validateFirst = false }) => {
const { t } = useTranslation();
Expand All @@ -24,19 +18,14 @@ const CompleteModal = ({ open, setOpen, context, validateFirst = false }) => {

return (
<ComposedModal open={open}>
<ModalHeader>{t("areYouSure", "Are you sure?")}</ModalHeader>
<ModalBody>
{t(
"saveExplanation",
"Do you want to save the current form and exit the workflow?"
)}
</ModalBody>
<ModalHeader>{t('areYouSure', 'Are you sure?')}</ModalHeader>
<ModalBody>{t('saveExplanation', 'Do you want to save the current form and exit the workflow?')}</ModalBody>
<ModalFooter>
<Button kind="secondary" onClick={onCancel}>
{t("cancel", "Cancel")}
{t('cancel', 'Cancel')}
</Button>
<Button kind="primary" onClick={onComplete}>
{t("complete", "Complete")}
{t('complete', 'Complete')}
</Button>
</ModalFooter>
</ComposedModal>
Expand Down
18 changes: 9 additions & 9 deletions src/FormBootstrap.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useContext, useEffect, useState } from "react";
import { detach, ExtensionSlot } from "@openmrs/esm-framework";
import useGetPatient from "./hooks/useGetPatient";
import GroupFormWorkflowContext from "./context/GroupFormWorkflowContext";
import React, { useContext, useEffect, useState } from 'react';
import { detach, ExtensionSlot } from '@openmrs/esm-framework';
import useGetPatient from './hooks/useGetPatient';
import GroupFormWorkflowContext from './context/GroupFormWorkflowContext';

export interface Order {
uuid: string;
Expand Down Expand Up @@ -131,7 +131,7 @@ const FormBootstrap = ({
const { activeSessionMeta } = useContext(GroupFormWorkflowContext);

useEffect(() => {
return () => detach("form-widget-slot", "form-widget-slot");
return () => detach('form-widget-slot', 'form-widget-slot');
});

// FIXME This should not be necessary
Expand All @@ -150,13 +150,13 @@ const FormBootstrap = ({
<ExtensionSlot
name="form-widget-slot"
state={{
view: "form",
view: 'form',
formUuid,
visitUuid: visitUuid ?? "",
visitTypeUuid: visitTypeUuid ?? "",
visitUuid: visitUuid ?? '',
visitTypeUuid: visitTypeUuid ?? '',
patientUuid,
patient,
encounterUuid: encounterUuid ?? "",
encounterUuid: encounterUuid ?? '',
closeWorkspace: () => undefined,
handlePostResponse: (encounter) => {
handlePostResponse(encounter);
Expand Down
19 changes: 7 additions & 12 deletions src/Root.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import React from "react";
import { BrowserRouter, Route, Routes } from "react-router-dom";
import { appPath } from "./constant";
const FormsPage = React.lazy(() => import("./forms-page"));
const FormEntryWorkflow = React.lazy(() => import("./form-entry-workflow"));
const GroupFormEntryWorkflow = React.lazy(
() => import("./group-form-entry-workflow")
);
import React from 'react';
import { BrowserRouter, Route, Routes } from 'react-router-dom';
import { appPath } from './constant';
const FormsPage = React.lazy(() => import('./forms-page'));
const FormEntryWorkflow = React.lazy(() => import('./form-entry-workflow'));
const GroupFormEntryWorkflow = React.lazy(() => import('./group-form-entry-workflow'));

const Root = () => {
return (
Expand All @@ -14,10 +12,7 @@ const Root = () => {
<Routes>
<Route path="/" element={<FormsPage />} />
<Route path="/form/:formUuid" element={<FormEntryWorkflow />} />
<Route
path="/groupform/:formUuid"
element={<GroupFormEntryWorkflow />}
/>
<Route path="/groupform/:formUuid" element={<GroupFormEntryWorkflow />} />
</Routes>
</BrowserRouter>
</main>
Expand Down
Loading

0 comments on commit cd1e197

Please sign in to comment.