Skip to content

Commit

Permalink
Organize ReviewEntriesTableState; Tidy other things (#2794)
Browse files Browse the repository at this point in the history
  • Loading branch information
imnasnainaec authored Dec 4, 2023
1 parent 0771f05 commit 79100ad
Show file tree
Hide file tree
Showing 18 changed files with 113 additions and 123 deletions.
6 changes: 3 additions & 3 deletions src/components/App/SignalRHub.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default function SignalRHub(): ReactElement {
const finishDisconnect = useCallback((): void => {
setConnection(undefined);
setDisconnect(false);
}, [setConnection, setDisconnect]);
}, []);

/** Act on the disconnect state to stop and delete the connection. */
useEffect(() => {
Expand All @@ -57,7 +57,7 @@ export default function SignalRHub(): ReactElement {
setReconnect(false);
setConnection(newConnection);
}
}, [disconnect, reconnect, setConnection, setReconnect]);
}, [disconnect, reconnect]);

/** Any change in exportState should cause a disconnect.
* Only ExportStatus.Exporting should open a new connection.
Expand All @@ -67,7 +67,7 @@ export default function SignalRHub(): ReactElement {
if (exportState.status === ExportStatus.Exporting) {
setReconnect(true);
}
}, [exportState, setDisconnect, setReconnect]);
}, [exportState]);

/** Once a connection is opened, start the relevant methods. */
useEffect(() => {
Expand Down
4 changes: 2 additions & 2 deletions src/components/AppBar/UserMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
MenuItem,
Typography,
} from "@mui/material";
import React, { ReactElement, useState } from "react";
import React, { Fragment, ReactElement, useState } from "react";
import { useTranslation } from "react-i18next";
import { useNavigate } from "react-router-dom";

Expand Down Expand Up @@ -89,7 +89,7 @@ export default function UserMenu(props: TabProps): ReactElement {
</Typography>
</Hidden>
) : (
<React.Fragment />
<Fragment />
)}
{avatar ? (
<Avatar alt="User avatar" src={avatar} />
Expand Down
2 changes: 1 addition & 1 deletion src/components/Buttons/FlagButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default function FlagButton(props: FlagButtonProps): ReactElement {
useEffect(() => {
setActive(props.flag.active);
setText(props.flag.active ? props.flag.text : undefined);
}, [props.flag, setActive, setText]);
}, [props.flag]);

function updateFlag(text: string): void {
setActive(true);
Expand Down
10 changes: 5 additions & 5 deletions src/components/Buttons/LoadingDoneButton.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { Check } from "@mui/icons-material";
import { Button, CircularProgress } from "@mui/material";
import { ButtonProps } from "@mui/material/Button";
import React, { ReactElement } from "react";
import { ReactElement, ReactNode } from "react";
import { useTranslation } from "react-i18next";

import { themeColors } from "types/theme";

interface LoadingDoneProps {
buttonProps?: ButtonProps;
children?: React.ReactNode;
children?: ReactNode;
disabled?: boolean;
done?: boolean;
doneText?: React.ReactNode | string;
doneText?: ReactNode | string;
loading?: boolean;
}

Expand All @@ -36,10 +36,10 @@ export default function LoadingDoneButton(
}}
>
{props.done ? (
<React.Fragment>
<>
<Check />
{props.doneText ?? t("buttons.done")}
</React.Fragment>
</>
) : (
props.children
)}
Expand Down
6 changes: 3 additions & 3 deletions src/components/DataEntry/DataEntryHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Help } from "@mui/icons-material";
import { Switch, Typography } from "@mui/material";
import React, { ReactElement } from "react";
import { ReactElement } from "react";
import { useTranslation } from "react-i18next";
import { Key } from "ts-key-enum";

Expand Down Expand Up @@ -52,12 +52,12 @@ export default function DataEntryHeader(

function Questions(props: { questions: string[] }): ReactElement {
return (
<React.Fragment>
<>
{props.questions.map((question, index) => (
<Typography id={"q" + index} key={index}>
{question}
</Typography>
))}
</React.Fragment>
</>
);
}
2 changes: 1 addition & 1 deletion src/components/DataEntry/DataEntryTable/NewEntry/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export default function NewEntry(props: NewEntryProps): ReactElement {
resetNewEntry();
setVernOpen(false);
focus(FocusTarget.Vernacular);
}, [focus, resetNewEntry, setVernOpen]);
}, [focus, resetNewEntry]);

/** Reset when tree opens, except for the first time it is open. */
useEffect(() => {
Expand Down
Loading

0 comments on commit 79100ad

Please sign in to comment.