-
-
+
+
{name} v{version}
@@ -142,11 +140,7 @@ export default function About() {
display="block"
>
Update available: {latestUpdate.tag_name}
-
+
)}
@@ -164,7 +158,9 @@ export default function About() {
href={WIKI_LINKS.updating}
target="_blank"
rel="noopener noreferrer"
- endIcon={}
+ endIcon={
+
+ }
>
How to Update
@@ -194,11 +190,7 @@ export default function About() {
variant="body2"
>
Firebase Console
-
+
diff --git a/src/components/Settings/ProjectSettings/Authentication.tsx b/src/components/Settings/ProjectSettings/Authentication.tsx
index bc63bf71..f9333089 100644
--- a/src/components/Settings/ProjectSettings/Authentication.tsx
+++ b/src/components/Settings/ProjectSettings/Authentication.tsx
@@ -4,7 +4,7 @@ import _startCase from "lodash/startCase";
import MultiSelect from "@antlerengineering/multiselect";
import { Typography, Link } from "@material-ui/core";
-import OpenInNewIcon from "@material-ui/icons/OpenInNew";
+import InlineOpenInNewIcon from "components/InlineOpenInNewIcon";
import { IProjectSettingsChildProps } from "pages/Settings/ProjectSettings";
@@ -42,11 +42,7 @@ export default function Authentication({
rel="noopener"
>
How to configure sign-in options
-
+
>
diff --git a/src/components/Settings/ProjectSettings/CloudRun.tsx b/src/components/Settings/ProjectSettings/CloudRun.tsx
index 03dc3ed6..197247fd 100644
--- a/src/components/Settings/ProjectSettings/CloudRun.tsx
+++ b/src/components/Settings/ProjectSettings/CloudRun.tsx
@@ -1,6 +1,6 @@
import { Typography, Link, Grid, TextField } from "@material-ui/core";
import LoadingButton from "@material-ui/lab/LoadingButton";
-import OpenInNewIcon from "@material-ui/icons/OpenInNew";
+import InlineOpenInNewIcon from "components/InlineOpenInNewIcon";
import { IProjectSettingsChildProps } from "pages/Settings/ProjectSettings";
import WIKI_LINKS from "constants/wikiLinks";
@@ -21,11 +21,7 @@ export default function CloudRun({
rel="noopener noreferrer"
>
Learn more
-
+
@@ -51,7 +47,6 @@ export default function CloudRun({
.join("/")}/FunctionsBuilder.git`}
target="_blank"
rel="noopener noreferrer"
- endIcon={}
loading={
settings.cloudRunDeployStatus === "BUILDING" ||
settings.cloudRunDeployStatus === "COMPLETE"
diff --git a/src/components/Settings/ThemeColorPicker.tsx b/src/components/Settings/ThemeColorPicker.tsx
index 6c09bb02..d24a734a 100644
--- a/src/components/Settings/ThemeColorPicker.tsx
+++ b/src/components/Settings/ThemeColorPicker.tsx
@@ -60,14 +60,6 @@ export default function ThemeColorPicker({
backgroundColor={light}
textColor={lightTheme.palette.getContrastText(light)}
/>
-
-
+
@@ -112,14 +105,6 @@ export default function ThemeColorPicker({
backgroundColor={dark}
textColor={darkTheme.palette.getContrastText(dark)}
/>
-
-
+
@@ -148,8 +136,16 @@ export default function ThemeColorPicker({
borderRadius: 1,
borderTopLeftRadius: 0,
borderTopRightRadius: 0,
- bgcolor: "background.paper",
- boxShadow: (theme) => `0 0 0 16px ${theme.palette.background.paper}`,
+ bgcolor: (theme) =>
+ theme.palette.mode === "dark"
+ ? "#1C1E21"
+ : theme.palette.background.paper,
+ boxShadow: (theme) =>
+ `0 0 0 16px ${
+ theme.palette.mode === "dark"
+ ? "#1C1E21"
+ : theme.palette.background.paper
+ }`,
paddingBottom: "env(safe-area-inset-bottom)",
}}
>
@@ -185,39 +181,40 @@ function Swatch({ backgroundColor, textColor }: Record
) {
bgcolor: backgroundColor,
color: textColor,
p: 1,
- pl: 1.5,
+ pr: 1.5,
typography: "button",
display: "flex",
justifyContent: "space-between",
alignItems: "center",
fontVariantNumeric: "tabular-nums",
+ textAlign: "right",
}}
>
- {contrast}
-
- {AAA ? "AAA" : AA ? "AA" : "FAIL"}
{AAA || AA ? : }
+ {AAA ? "AAA" : AA ? "AA" : "FAIL"}
+
+ {contrast.toFixed(2)}
);
}
diff --git a/src/components/Snack.tsx b/src/components/Snack.tsx
deleted file mode 100644
index ac62f4f1..00000000
--- a/src/components/Snack.tsx
+++ /dev/null
@@ -1,101 +0,0 @@
-import { makeStyles, createStyles } from "@material-ui/styles";
-import { Snackbar, CircularProgress } from "@material-ui/core";
-import Alert from "@material-ui/core/Alert";
-
-import { useSnackContext } from "contexts/SnackContext";
-import antlerPalette from "theme/palette";
-
-const useStyles = makeStyles((theme) =>
- createStyles({
- progressAction: { marginRight: 0 },
- progressText: { marginLeft: theme.spacing(2) },
- progress: {
- color: antlerPalette.green[100],
- marginLeft: theme.spacing(2),
- },
-
- alertIcon: { padding: 0 },
- alertMessage: { padding: theme.spacing(0.75, 2) },
- })
-);
-
-export default function Snack() {
- const classes = useStyles();
-
- const {
- position,
- isOpen,
- close,
- message,
- duration,
- action,
- variant,
- progress,
- } = useSnackContext();
-
- if (variant === "progress")
- return (
-
-
- {progress.value}
- {progress.target && `/${progress.target}`}
-
-
-
- >
- }
- ContentProps={{ classes: { action: classes.progressAction } }}
- // Stop closing when user clicks
- ClickAwayListenerProps={{ mouseEvent: false }}
- />
- );
-
- if (!variant)
- return (
-
- );
-
- return (
-
-
- {message}
-
-
- );
-}
diff --git a/src/components/SnackbarProgress.tsx b/src/components/SnackbarProgress.tsx
new file mode 100644
index 00000000..70c427ec
--- /dev/null
+++ b/src/components/SnackbarProgress.tsx
@@ -0,0 +1,43 @@
+import { useState, Dispatch, SetStateAction, MutableRefObject } from "react";
+import { Stack, CircularProgress } from "@material-ui/core";
+
+export interface ISnackbarProgressRef {
+ setProgress: Dispatch>;
+ setTarget: Dispatch>;
+}
+
+export interface ISnackbarProgressProps {
+ target?: number;
+ stateRef: MutableRefObject;
+}
+
+export default function SnackbarProgress({
+ target: targetProp = 100,
+ stateRef,
+}: ISnackbarProgressProps) {
+ const [progress, setProgress] = useState(0);
+ const [target, setTarget] = useState(targetProp);
+
+ stateRef.current = { setProgress, setTarget };
+
+ return (
+
+
+ {progress}/{target}
+
+
+
+
+ );
+}
diff --git a/src/components/Table/BulkActions/index.tsx b/src/components/Table/BulkActions/index.tsx
index 70b3ee2a..c092a3b5 100644
--- a/src/components/Table/BulkActions/index.tsx
+++ b/src/components/Table/BulkActions/index.tsx
@@ -1,5 +1,6 @@
import { useState } from "react";
import _find from "lodash/find";
+import { useSnackbar } from "notistack";
import { makeStyles, createStyles } from "@material-ui/styles";
import {
@@ -21,7 +22,6 @@ import ArrowDropUpIcon from "@material-ui/icons/ArrowDropUp";
import { useConfirmation } from "components/ConfirmationDialog/Context";
import { useProjectContext } from "contexts/ProjectContext";
-import { useSnackContext } from "contexts/SnackContext";
import { formatPath } from "utils/fns";
import { cloudFunction } from "firebase/callables";
@@ -105,7 +105,7 @@ export default function BulkActions({ selectedRows, columns, clearSelection }) {
const { tableActions, tableState } = useProjectContext();
const { requestConfirmation } = useConfirmation();
- const snack = useSnackContext();
+ const { enqueueSnackbar } = useSnackbar();
const actionColumns: { name: string; key: string; config: any }[] = columns
.filter((column) => column.type === "ACTION")
@@ -164,8 +164,7 @@ export default function BulkActions({ selectedRows, columns, clearSelection }) {
async (response) => {
const { message, cellValue, success } = response.data;
// setIsRunning(false);
- snack.open({
- message: JSON.stringify(message),
+ enqueueSnackbar(JSON.stringify(message), {
variant: success ? "success" : "error",
});
if (cellValue && cellValue.status) {
@@ -175,7 +174,7 @@ export default function BulkActions({ selectedRows, columns, clearSelection }) {
(error) => {
console.error("ERROR", callableName, error);
//setIsRunning(false);
- snack.open({ message: JSON.stringify(error), variant: "error" });
+ enqueueSnackbar(JSON.stringify(error), { variant: "error" });
}
);
});
diff --git a/src/components/Table/ColumnMenu/FieldSettings/index.tsx b/src/components/Table/ColumnMenu/FieldSettings/index.tsx
index 8bba2d30..b92a05cd 100644
--- a/src/components/Table/ColumnMenu/FieldSettings/index.tsx
+++ b/src/components/Table/ColumnMenu/FieldSettings/index.tsx
@@ -1,4 +1,5 @@
-import React, { useState, Suspense, useMemo } from "react";
+import { useState, Suspense, useMemo, createElement } from "react";
+import { useSnackbar } from "notistack";
import _set from "lodash/set";
import { IMenuModalProps } from "..";
@@ -10,7 +11,6 @@ import ErrorBoundary from "components/ErrorBoundary";
import Loading from "components/Loading";
import { useProjectContext } from "contexts/ProjectContext";
-import { useSnackContext } from "contexts/SnackContext";
import { useSnackLogContext } from "contexts/SnackLogContext";
import { db } from "../../../../firebase";
import { useAppContext } from "contexts/AppContext";
@@ -22,6 +22,7 @@ import Divider from "@material-ui/core/Divider";
import Button from "@material-ui/core/Button";
import routes from "constants/routes";
import { SETTINGS } from "config/dbPaths";
+import { name as appName } from "@root/package.json";
export default function FieldSettings(props: IMenuModalProps) {
const { name, fieldName, type, open, config, handleClose, handleSave } =
@@ -33,8 +34,8 @@ export default function FieldSettings(props: IMenuModalProps) {
const initializable = getFieldProp("initializable", type);
const { requestConfirmation } = useConfirmation();
+ const { enqueueSnackbar } = useSnackbar();
const { tableState } = useProjectContext();
- const snack = useSnackContext();
const snackLog = useSnackLogContext();
const appContext = useAppContext();
@@ -85,7 +86,7 @@ export default function FieldSettings(props: IMenuModalProps) {
{customFieldSettings &&
- React.createElement(customFieldSettings, {
+ createElement(customFieldSettings, {
config: newConfig,
handleChange,
})}
@@ -94,10 +95,9 @@ export default function FieldSettings(props: IMenuModalProps) {
- {" "}
Rendered field config
- {React.createElement(rendedFieldSettings, {
+ {createElement(rendedFieldSettings, {
config: newConfig,
handleChange,
})}
@@ -126,12 +126,12 @@ export default function FieldSettings(props: IMenuModalProps) {
const settingsDoc = await db.doc(SETTINGS).get();
const buildUrl = settingsDoc.get("buildUrl");
if (!buildUrl) {
- snack.open({
- message: `Functions Builder is not yet setup`,
+ enqueueSnackbar(`${appName} Run is not set up`, {
variant: "error",
action: (
+
+