Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Updated notifications

Vladyslav Matsiiako7cdafe0eedca
diff --git a/frontend/components/context/Notifications/Notification.tsx b/frontend/components/context/Notifications/Notification.tsx
index e473ddb52b..ad556a6f53 100644
--- a/frontend/components/context/Notifications/Notification.tsx
+++ b/frontend/components/context/Notifications/Notification.tsx
@@ -1,9 +1,8 @@
-import { useEffect, useRef } from "react";
-import { faXmarkCircle } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import classnames from "classnames";
+import { useEffect, useRef } from 'react';
+import { faX } from '@fortawesome/free-solid-svg-icons';
+import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
-import { Notification as NotificationType } from "./NotificationProvider";
+import { Notification as NotificationType } from './NotificationProvider';
interface NotificationProps {
notification: Required<NotificationType>;
@@ -12,7 +11,7 @@ interface NotificationProps {
const Notification = ({
notification,
- clearNotification,
+ clearNotification
}: NotificationProps) => {
const timeout = useRef<number>();
@@ -37,22 +36,29 @@ const Notification = ({
return (
<div
- className={classnames(
- "w-full flex items-center justify-between px-4 py-3 rounded pointer-events-auto",
- {
- "bg-green-600": notification.type === "success",
- "bg-red-500": notification.type === "error",
- "bg-blue-500": notification.type === "info",
- }
- )}
+ className="relative w-full flex items-center justify-between px-4 py-6 rounded-md border border-bunker-500 pointer-events-auto bg-bunker-500"
role="alert"
>
- <p className="text-white text-sm font-bold">{notification.text}</p>
+ {notification.type === 'error' && (
+ <div className="absolute w-full h-1 bg-red top-0 left-0 rounded-t-md"></div>
+ )}
+ {notification.type === 'success' && (
+ <div className="absolute w-full h-1 bg-green top-0 left-0 rounded-t-md"></div>
+ )}
+ {notification.type === 'info' && (
+ <div className="absolute w-full h-1 bg-yellow top-0 left-0 rounded-t-md"></div>
+ )}
+ <p className="text-bunker-200 text-sm font-semibold mt-0.5">
+ {notification.text}
+ </p>
<button
- className="bg-white/5 rounded-lg p-3"
+ className="rounded-lg"
onClick={() => clearNotification(notification.text)}
>
- <FontAwesomeIcon className="text-white" icon={faXmarkCircle} />
+ <FontAwesomeIcon
+ className="text-white w-4 h-3 hover:text-red"
+ icon={faX}
+ />
</button>
</div>
);
diff --git a/frontend/components/context/Notifications/NotificationProvider.tsx b/frontend/components/context/Notifications/NotificationProvider.tsx
index b029dc6c61..05f9eee19f 100644
--- a/frontend/components/context/Notifications/NotificationProvider.tsx
+++ b/frontend/components/context/Notifications/NotificationProvider.tsx
@@ -1,8 +1,8 @@
-import { createContext, ReactNode, useContext, useState } from "react";
+import { createContext, ReactNode, useContext, useState } from 'react';
-import Notifications from "./Notifications";
+import Notifications from './Notifications';
-type NotificationType = "success" | "error" | "info";
+type NotificationType = 'success' | 'error' | 'info';
export type Notification = {
text: string;
@@ -15,7 +15,7 @@ type NotificationContextState = {
};
const NotificationContext = createContext<NotificationContextState>({
- createNotification: () => console.log("createNotification not set!"),
+ createNotification: () => console.log('createNotification not set!')
});
export const useNotificationContext = () => useContext(NotificationContext);
@@ -37,8 +37,8 @@ const NotificationProvider = ({ children }: NotificationProviderProps) => {
const createNotification = ({
text,
- type = "success",
- timeoutMs = 2000,
+ type = 'success',
+ timeoutMs = 5000
}: Notification) => {
const doesNotifExist = notifications.some((notif) => notif.text === text);
@@ -54,7 +54,7 @@ const NotificationProvider = ({ children }: NotificationProviderProps) => {
return (
<NotificationContext.Provider
value={{
- createNotification,
+ createNotification
}}
>
<Notifications
diff --git a/frontend/components/context/Notifications/Notifications.tsx b/frontend/components/context/Notifications/Notifications.tsx
index 6940c33454..2baba521b5 100644
--- a/frontend/components/context/Notifications/Notifications.tsx
+++ b/frontend/components/context/Notifications/Notifications.tsx
@@ -1,5 +1,5 @@
-import Notification from "./Notification";
-import { Notification as NotificationType } from "./NotificationProvider";
+import Notification from './Notification';
+import { Notification as NotificationType } from './NotificationProvider';
interface NoticationsProps {
notifications: Required<NotificationType>[];
@@ -8,14 +8,14 @@ interface NoticationsProps {
const Notifications = ({
notifications,
- clearNotification,
+ clearNotification
}: NoticationsProps) => {
if (!notifications.length) {
return null;
}
return (
- <div className="hidden fixed z-50 md:flex md:flex-col-reverse bottom-1 gap-y-2 w-96 h-full right-1 pointer-events-none">
+ <div className="hidden fixed z-50 md:flex md:flex-col-reverse bottom-1 gap-y-2 w-96 h-full right-2 bottom-2 pointer-events-none">
{notifications.map((notif) => (
<Notification
key={notif.text}