diff --git a/frontend/src/layouts/OrganizationLayout/OrganizationLayout.tsx b/frontend/src/layouts/OrganizationLayout/OrganizationLayout.tsx index 9064eec7f..c5a0953de 100644 --- a/frontend/src/layouts/OrganizationLayout/OrganizationLayout.tsx +++ b/frontend/src/layouts/OrganizationLayout/OrganizationLayout.tsx @@ -8,10 +8,13 @@ import { CreateOrgModal } from "@app/components/organization/CreateOrgModal"; import { Banner } from "@app/components/page-frames/Banner"; import { useServerConfig } from "@app/context"; import { usePopUp } from "@app/hooks"; +import { useFetchServerStatus } from "@app/hooks/api"; import { InsecureConnectionBanner } from "./components/InsecureConnectionBanner"; import { Navbar } from "./components/NavBar"; import { OrgSidebar } from "./components/OrgSidebar"; +import { RedisBanner } from "./components/RedisBanner"; +import { SmtpBanner } from "./components/SmtpBanner"; export const OrganizationLayout = () => { const { config } = useServerConfig(); @@ -27,6 +30,8 @@ export const OrganizationLayout = () => { const containerHeight = config.pageFrameContent ? "h-[94vh]" : "h-screen"; + const { data: serverDetails, isLoading } = useFetchServerStatus(); + return ( <> @@ -34,6 +39,8 @@ export const OrganizationLayout = () => { className={`dark hidden ${containerHeight} w-full flex-col overflow-x-hidden bg-bunker-800 transition-all md:flex`} > + {!isLoading && !serverDetails?.redisConfigured && } + {!isLoading && !serverDetails?.emailConfigured && } {!window.isSecureContext && }
diff --git a/frontend/src/layouts/OrganizationLayout/components/InsecureConnectionBanner/InsecureConnectionBanner.tsx b/frontend/src/layouts/OrganizationLayout/components/InsecureConnectionBanner/InsecureConnectionBanner.tsx index e213276b3..084fb6ff5 100644 --- a/frontend/src/layouts/OrganizationLayout/components/InsecureConnectionBanner/InsecureConnectionBanner.tsx +++ b/frontend/src/layouts/OrganizationLayout/components/InsecureConnectionBanner/InsecureConnectionBanner.tsx @@ -1,37 +1,10 @@ -import { useState } from "react"; -import { faWarning, faXmark } from "@fortawesome/free-solid-svg-icons"; -import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; - -import { IconButton } from "@app/components/v2"; +import { OrgAlertBanner } from "../OrgAlertBanner"; export const InsecureConnectionBanner = () => { - const [isAcknowledged, setIsAcknowledged] = useState( - localStorage.getItem("insecureConnectionAcknowledged") ?? false - ); - - const handleDismiss = () => { - setIsAcknowledged(true); - localStorage.setItem("insecureConnectionAcknowledged", "true"); - }; - - if (isAcknowledged) return null; - return ( -
- - - Your connection to this Infisical instance is not secured via HTTPS. Some features may not - behave as expected. - - - - -
+ ); }; diff --git a/frontend/src/layouts/OrganizationLayout/components/OrgAlertBanner/OrgAlertBanner.tsx b/frontend/src/layouts/OrganizationLayout/components/OrgAlertBanner/OrgAlertBanner.tsx new file mode 100644 index 000000000..de4b65a71 --- /dev/null +++ b/frontend/src/layouts/OrganizationLayout/components/OrgAlertBanner/OrgAlertBanner.tsx @@ -0,0 +1,52 @@ +import { faArrowUpRightFromSquare, faWarning, faXmark } from "@fortawesome/free-solid-svg-icons"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; + +import { IconButton } from "@app/components/v2"; +import { useToggle } from "@app/hooks"; + +type Props = { + text: string; + link?: string; +}; + +export const OrgAlertBanner = ({ text, link }: Props) => { + const [isDismissed, setIsDismissed] = useToggle(false); + + if (isDismissed) return null; + + return ( +
+ + {text}{" "} + {link && ( + <> + Learn how to configure it + + + here + + + + . + + )} + setIsDismissed.on()} + > + + +
+ ); +}; diff --git a/frontend/src/layouts/OrganizationLayout/components/OrgAlertBanner/index.ts b/frontend/src/layouts/OrganizationLayout/components/OrgAlertBanner/index.ts new file mode 100644 index 000000000..277fc4064 --- /dev/null +++ b/frontend/src/layouts/OrganizationLayout/components/OrgAlertBanner/index.ts @@ -0,0 +1 @@ +export * from "./OrgAlertBanner"; diff --git a/frontend/src/layouts/OrganizationLayout/components/RedisBanner/RedisBanner.tsx b/frontend/src/layouts/OrganizationLayout/components/RedisBanner/RedisBanner.tsx new file mode 100644 index 000000000..4fe89d238 --- /dev/null +++ b/frontend/src/layouts/OrganizationLayout/components/RedisBanner/RedisBanner.tsx @@ -0,0 +1,10 @@ +import { OrgAlertBanner } from "../OrgAlertBanner"; + +export const RedisBanner = () => { + return ( + + ); +}; diff --git a/frontend/src/layouts/OrganizationLayout/components/RedisBanner/index.ts b/frontend/src/layouts/OrganizationLayout/components/RedisBanner/index.ts new file mode 100644 index 000000000..d5d6821e3 --- /dev/null +++ b/frontend/src/layouts/OrganizationLayout/components/RedisBanner/index.ts @@ -0,0 +1 @@ +export * from "./RedisBanner"; diff --git a/frontend/src/layouts/OrganizationLayout/components/SmtpBanner/SmtpBanner.tsx b/frontend/src/layouts/OrganizationLayout/components/SmtpBanner/SmtpBanner.tsx new file mode 100644 index 000000000..624dde04d --- /dev/null +++ b/frontend/src/layouts/OrganizationLayout/components/SmtpBanner/SmtpBanner.tsx @@ -0,0 +1,10 @@ +import { OrgAlertBanner } from "../OrgAlertBanner"; + +export const SmtpBanner = () => { + return ( + + ); +}; diff --git a/frontend/src/layouts/OrganizationLayout/components/SmtpBanner/index.ts b/frontend/src/layouts/OrganizationLayout/components/SmtpBanner/index.ts new file mode 100644 index 000000000..305503a79 --- /dev/null +++ b/frontend/src/layouts/OrganizationLayout/components/SmtpBanner/index.ts @@ -0,0 +1 @@ +export * from "./SmtpBanner"; diff --git a/frontend/src/pages/organization/ProjectsPage/ProjectsPage.tsx b/frontend/src/pages/organization/ProjectsPage/ProjectsPage.tsx index 1a2dd6460..f1f667fa4 100644 --- a/frontend/src/pages/organization/ProjectsPage/ProjectsPage.tsx +++ b/frontend/src/pages/organization/ProjectsPage/ProjectsPage.tsx @@ -2,14 +2,11 @@ import { useState } from "react"; import { Helmet } from "react-helmet"; import { useTranslation } from "react-i18next"; -import { faExclamationCircle } from "@fortawesome/free-solid-svg-icons"; -import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal"; import { NewProjectModal } from "@app/components/projects"; import { PageHeader } from "@app/components/v2"; import { useSubscription } from "@app/context"; -import { useFetchServerStatus } from "@app/hooks/api/serverDetails"; import { usePopUp } from "@app/hooks/usePopUp"; import { AllProjectView } from "./components/AllProjectView"; @@ -38,8 +35,6 @@ export const ProjectsPage = () => { "upgradePlan" ] as const); - const { data: serverDetails, isLoading } = useFetchServerStatus(); - const { subscription } = useSubscription(); const isAddingProjectsAllowed = subscription?.workspaceLimit @@ -52,30 +47,6 @@ export const ProjectsPage = () => { {t("common.head-title", { title: t("settings.members.title") })} - - {!isLoading && !serverDetails?.redisConfigured && ( -
-

Announcements

-
- - Attention: Updated versions of Infisical now require Redis for full functionality. Learn - how to configure it - - - here - - - . -
-
- )}