diff --git a/src/components/fields/Action/ActionFab.tsx b/src/components/fields/Action/ActionFab.tsx index 6f87fb15..c09c2903 100644 --- a/src/components/fields/Action/ActionFab.tsx +++ b/src/components/fields/Action/ActionFab.tsx @@ -4,7 +4,7 @@ import { get } from "lodash-es"; import { useAtom, useSetAtom } from "jotai"; import { httpsCallable } from "firebase/functions"; -import { Fab, FabProps } from "@mui/material"; +import { Button, Fab, FabProps, Link } from "@mui/material"; import RunIcon from "@mui/icons-material/PlayArrow"; import RedoIcon from "@mui/icons-material/Refresh"; import UndoIcon from "@mui/icons-material/Undo"; @@ -118,11 +118,32 @@ export default function ActionFab({ } else { result = await handleCallableAction(data); } - const { message, success } = result ?? {}; + const { message, success, link } = result ?? {}; enqueueSnackbar( typeof message === "string" ? message : JSON.stringify(message), { variant: success ? "success" : "error", + action: link ? ( + typeof link === "string" ? ( + + ) : ( + + ) + ) : undefined, } ); } catch (e) { diff --git a/src/components/fields/Action/action.d.ts b/src/components/fields/Action/action.d.ts index 1daab613..b41ff94c 100644 --- a/src/components/fields/Action/action.d.ts +++ b/src/components/fields/Action/action.d.ts @@ -22,6 +22,7 @@ type ActionResult = { success: boolean; message?: any; status?: string | number | null | undefined; + link?: string | { url: string; label: string }; }; type Action = (context: ActionContext) => Promise | ActionResult;