From 88481339080ecb4ae6ac47f612ce81d1d1699c1d Mon Sep 17 00:00:00 2001 From: RSaarivuoriLUT <167883444+RSaarivuoriLUT@users.noreply.github.com> Date: Fri, 13 Dec 2024 13:17:56 +0200 Subject: [PATCH 1/2] Add loading decorator to snackbar --- package.json | 2 +- src/components/SnackBarComp.tsx | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 5cbe46d..dbd8186 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "procasma", "productName": "Procasma", - "version": "1.5.4", + "version": "1.6.1", "description": "Dynamic Assignment Manager", "main": ".vite/build/main.js", "scripts": { diff --git a/src/components/SnackBarComp.tsx b/src/components/SnackBarComp.tsx index 6e77d54..6fe7e80 100644 --- a/src/components/SnackBarComp.tsx +++ b/src/components/SnackBarComp.tsx @@ -1,4 +1,5 @@ import { + CircularProgress, Snackbar, SnackbarCloseReason as SnackbarCloseReasonType, } from "@mui/joy"; @@ -94,6 +95,11 @@ export default function SnackbarComp({ + ) : null + } open={open} onClose={(event, reason) => { if (color === "primary") return; From 04c3ee423f7eedad787c2ed102cb54ed5008801a Mon Sep 17 00:00:00 2001 From: RSaarivuoriLUT <167883444+RSaarivuoriLUT@users.noreply.github.com> Date: Fri, 13 Dec 2024 13:37:46 +0200 Subject: [PATCH 2/2] Add other icon decorators to snackbar --- src/components/SnackBarComp.tsx | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/src/components/SnackBarComp.tsx b/src/components/SnackBarComp.tsx index 6fe7e80..cf376c6 100644 --- a/src/components/SnackBarComp.tsx +++ b/src/components/SnackBarComp.tsx @@ -3,6 +3,9 @@ import { Snackbar, SnackbarCloseReason as SnackbarCloseReasonType, } from "@mui/joy"; +import DoneAllIcon from "@mui/icons-material/DoneAll"; +import CancelIcon from "@mui/icons-material/Cancel"; +import ErrorIcon from "@mui/icons-material/Error"; import { useEffect, useState } from "react"; import texts from "../../resource/texts.json"; import { language } from "../globalsUI"; @@ -91,15 +94,31 @@ export default function SnackbarComp({ const vertical = "bottom"; const horizontal = "center"; + let autoHideDuration = 3000; + let startDecorator: React.JSX.Element = null; + switch (color) { + case "primary": + autoHideDuration = null; + startDecorator = ; + break; + case "neutral": + startDecorator = ; + break; + case "success": + startDecorator = ; + break; + case "danger": + startDecorator = ; + break; + default: + break; + } + return ( - ) : null - } + startDecorator={startDecorator} open={open} onClose={(event, reason) => { if (color === "primary") return;