diff --git a/app/actions/index.ts b/app/actions/index.ts
index b1b25bd04..6985dc934 100644
--- a/app/actions/index.ts
+++ b/app/actions/index.ts
@@ -101,9 +101,7 @@ export function actionToKBar(
keywords: action.keywords ?? "",
shortcut: action.shortcut || [],
icon: resolvedIcon,
- perform: action.perform
- ? () => action.perform && action.perform(context)
- : undefined,
+ perform: action.perform ? () => action?.perform?.(context) : undefined,
},
// @ts-expect-error ts-migrate(2769) FIXME: No overload matches this call.
].concat(children.map((child) => ({ ...child, parent: action.id })));
diff --git a/app/components/Authenticated.tsx b/app/components/Authenticated.tsx
index 225791c66..976063b50 100644
--- a/app/components/Authenticated.tsx
+++ b/app/components/Authenticated.tsx
@@ -15,7 +15,7 @@ type Props = {
const Authenticated = ({ children }: Props) => {
const { auth } = useStores();
const { i18n } = useTranslation();
- const language = auth.user && auth.user.language;
+ const language = auth.user?.language;
// Watching for language changes here as this is the earliest point we have
// the user available and means we can start loading translations faster
diff --git a/app/components/CommandBar.tsx b/app/components/CommandBar.tsx
index 3f63e4caa..5f4efc16d 100644
--- a/app/components/CommandBar.tsx
+++ b/app/components/CommandBar.tsx
@@ -67,7 +67,7 @@ function CommandBar() {
);
}
-function KBarPortal({ children }: { children: React.ReactNode }) {
+const KBarPortal: React.FC = ({ children }) => {
const { showing } = useKBar((state) => ({
showing: state.visualState !== "hidden",
}));
@@ -77,7 +77,7 @@ function KBarPortal({ children }: { children: React.ReactNode }) {
}
return {children};
-}
+};
const Hint = styled(Text)`
display: flex;
diff --git a/app/components/ContextMenu/MenuItem.tsx b/app/components/ContextMenu/MenuItem.tsx
index c1354f798..cf033e3f1 100644
--- a/app/components/ContextMenu/MenuItem.tsx
+++ b/app/components/ContextMenu/MenuItem.tsx
@@ -8,7 +8,6 @@ import MenuIconWrapper from "../MenuIconWrapper";
type Props = {
onClick?: (arg0: React.SyntheticEvent) => void | Promise;
- children?: React.ReactNode;
selected?: boolean;
disabled?: boolean;
dangerous?: boolean;
@@ -21,7 +20,7 @@ type Props = {
icon?: React.ReactElement;
};
-const MenuItem = ({
+const MenuItem: React.FC = ({
onClick,
children,
selected,
@@ -30,7 +29,7 @@ const MenuItem = ({
hide,
icon,
...rest
-}: Props) => {
+}) => {
const handleClick = React.useCallback(
(ev) => {
if (onClick) {
diff --git a/app/components/ContextMenu/index.tsx b/app/components/ContextMenu/index.tsx
index 735b4069f..893c638ea 100644
--- a/app/components/ContextMenu/index.tsx
+++ b/app/components/ContextMenu/index.tsx
@@ -38,19 +38,18 @@ type Props = {
visible?: boolean;
placement?: Placement;
animating?: boolean;
- children: React.ReactNode;
unstable_disclosureRef?: React.RefObject;
onOpen?: () => void;
onClose?: () => void;
hide?: () => void;
};
-export default function ContextMenu({
+const ContextMenu: React.FC = ({
children,
onOpen,
onClose,
...rest
-}: Props) {
+}) => {
const previousVisible = usePrevious(rest.visible);
const maxHeight = useMenuHeight(rest.visible, rest.unstable_disclosureRef);
const backgroundRef = React.useRef(null);
@@ -137,7 +136,9 @@ export default function ContextMenu({
)}
>
);
-}
+};
+
+export default ContextMenu;
export const Backdrop = styled.div`
animation: ${fadeIn} 200ms ease-in-out;
diff --git a/app/components/DocumentMeta.tsx b/app/components/DocumentMeta.tsx
index c97570555..719f296b1 100644
--- a/app/components/DocumentMeta.tsx
+++ b/app/components/DocumentMeta.tsx
@@ -35,11 +35,10 @@ type Props = {
showLastViewed?: boolean;
showParentDocuments?: boolean;
document: Document;
- children?: React.ReactNode;
to?: string;
};
-function DocumentMeta({
+const DocumentMeta: React.FC = ({
showPublished,
showCollection,
showLastViewed,
@@ -48,7 +47,7 @@ function DocumentMeta({
children,
to,
...rest
-}: Props) {
+}) => {
const { t } = useTranslation();
const { collections } = useStores();
const user = useCurrentUser();
@@ -172,6 +171,6 @@ function DocumentMeta({
{children}
);
-}
+};
export default observer(DocumentMeta);
diff --git a/app/components/ErrorBoundary.tsx b/app/components/ErrorBoundary.tsx
index 1698bed47..83749e0f3 100644
--- a/app/components/ErrorBoundary.tsx
+++ b/app/components/ErrorBoundary.tsx
@@ -10,6 +10,7 @@ import CenteredContent from "~/components/CenteredContent";
import PageTitle from "~/components/PageTitle";
import Text from "~/components/Text";
import env from "~/env";
+import isHosted from "~/utils/isHosted";
type Props = WithTranslation & {
reloadOnChunkMissing?: boolean;
@@ -61,7 +62,7 @@ class ErrorBoundary extends React.Component {
if (this.error) {
const error = this.error;
- const isReported = !!env.SENTRY_DSN && env.DEPLOYMENT === "hosted";
+ const isReported = !!env.SENTRY_DSN && isHosted;
const isChunkError = this.error.message.match(/chunk/);
if (isChunkError) {
diff --git a/app/components/LocaleTime.tsx b/app/components/LocaleTime.tsx
index a437828c8..b94785554 100644
--- a/app/components/LocaleTime.tsx
+++ b/app/components/LocaleTime.tsx
@@ -22,7 +22,6 @@ function eachMinute(fn: () => void) {
type Props = {
dateTime: string;
- children?: React.ReactNode;
tooltipDelay?: number;
addSuffix?: boolean;
shorten?: boolean;
@@ -30,7 +29,7 @@ type Props = {
format?: string;
};
-function LocaleTime({
+const LocaleTime: React.FC = ({
addSuffix,
children,
dateTime,
@@ -38,7 +37,7 @@ function LocaleTime({
format,
relative,
tooltipDelay,
-}: Props) {
+}) => {
const userLocale = useUserLocale();
const [_, setMinutesMounted] = React.useState(0); // eslint-disable-line @typescript-eslint/no-unused-vars
const callback = React.useRef<() => void>();
@@ -86,6 +85,6 @@ function LocaleTime({
);
-}
+};
export default LocaleTime;
diff --git a/app/components/Notice.tsx b/app/components/Notice.tsx
index 8fff91d67..fe6fd10c3 100644
--- a/app/components/Notice.tsx
+++ b/app/components/Notice.tsx
@@ -4,12 +4,11 @@ import Flex from "./Flex";
import Text from "./Text";
type Props = {
- children: React.ReactNode;
icon?: JSX.Element;
description?: JSX.Element;
};
-const Notice = ({ children, icon, description }: Props) => {
+const Notice: React.FC = ({ children, icon, description }) => {
return (
diff --git a/app/components/NoticeAlert.tsx b/app/components/NoticeAlert.tsx
index 16e0a2b4c..c2d55d574 100644
--- a/app/components/NoticeAlert.tsx
+++ b/app/components/NoticeAlert.tsx
@@ -1,11 +1,7 @@
import * as React from "react";
import Notice from "~/components/Notice";
-export default function AlertNotice({
- children,
-}: {
- children: React.ReactNode;
-}) {
+const AlertNotice: React.FC = ({ children }) => {
return (