From bb59bb18681606af20ab4eeadb2b3742ebcd4b36 Mon Sep 17 00:00:00 2001 From: x032205 Date: Tue, 1 Jul 2025 22:46:16 -0400 Subject: [PATCH] Remove file --- .../MinimizedOrgSidebar.tsx | 644 ------------------ 1 file changed, 644 deletions(-) delete mode 100644 frontend/src/layouts/OrganizationLayout/components/MinimizedOrgSidebar/MinimizedOrgSidebar.tsx diff --git a/frontend/src/layouts/OrganizationLayout/components/MinimizedOrgSidebar/MinimizedOrgSidebar.tsx b/frontend/src/layouts/OrganizationLayout/components/MinimizedOrgSidebar/MinimizedOrgSidebar.tsx deleted file mode 100644 index f4ce9bc40b..0000000000 --- a/frontend/src/layouts/OrganizationLayout/components/MinimizedOrgSidebar/MinimizedOrgSidebar.tsx +++ /dev/null @@ -1,644 +0,0 @@ -import { useState } from "react"; -import { faGithub, faSlack } from "@fortawesome/free-brands-svg-icons"; -import { - faArrowUpRightFromSquare, - faBook, - faCheck, - faCheckCircle, - faCog, - faDoorClosed, - faEnvelope, - faInfinity, - faInfo, - faInfoCircle, - faMoneyBill, - faPlug, - faSignOut, - faUser, - faUserCog, - faUsers -} from "@fortawesome/free-solid-svg-icons"; -import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import { useQueryClient } from "@tanstack/react-query"; -import { Link, linkOptions, useLocation, useNavigate, useRouter } from "@tanstack/react-router"; - -import { Mfa } from "@app/components/auth/Mfa"; -import { createNotification } from "@app/components/notifications"; -import { CreateOrgModal } from "@app/components/organization/CreateOrgModal"; -import SecurityClient from "@app/components/utilities/SecurityClient"; -import { - Button, - DropdownMenu, - DropdownMenuContent, - DropdownMenuItem, - DropdownMenuLabel, - DropdownMenuTrigger, - Modal, - ModalContent, - Tooltip -} from "@app/components/v2"; -import { envConfig } from "@app/config/env"; -import { useOrganization, useSubscription, useUser } from "@app/context"; -import { isInfisicalCloud } from "@app/helpers/platform"; -import { usePopUp, useToggle } from "@app/hooks"; -import { - useGetOrganizations, - useGetOrgTrialUrl, - useLogoutUser, - useSelectOrganization, - workspaceKeys -} from "@app/hooks/api"; -import { authKeys } from "@app/hooks/api/auth/queries"; -import { MfaMethod } from "@app/hooks/api/auth/types"; -import { getAuthToken } from "@app/hooks/api/reactQuery"; -import { SubscriptionPlan } from "@app/hooks/api/types"; -import { AuthMethod } from "@app/hooks/api/users/types"; -import { ProjectType } from "@app/hooks/api/workspace/types"; -import { navigateUserToOrg } from "@app/pages/auth/LoginPage/Login.utils"; - -import { MenuIconButton } from "../MenuIconButton"; -import { ServerAdminsPanel } from "../ServerAdminsPanel/ServerAdminsPanel"; - -const getPlan = (subscription: SubscriptionPlan) => { - if (subscription.groups) return "Enterprise Plan"; - if (subscription.pitRecovery) return "Pro Plan"; - return "Free Plan"; -}; - -export const INFISICAL_SUPPORT_OPTIONS = [ - [ - , - "Support Forum", - "https://infisical.com/slack" - ], - [ - , - "Read Docs", - "https://infisical.com/docs/documentation/getting-started/introduction" - ], - [ - , - "GitHub Issues", - "https://github.com/Infisical/infisical/issues" - ], - [ - , - "Email Support", - "mailto:support@infisical.com" - ], - [ - , - "Instance Admins", - "server-admins" - ] -]; - -export const MinimizedOrgSidebar = () => { - const [shouldShowMfa, toggleShowMfa] = useToggle(false); - const [requiredMfaMethod, setRequiredMfaMethod] = useState(MfaMethod.EMAIL); - const [mfaSuccessCallback, setMfaSuccessCallback] = useState<() => void>(() => {}); - const { subscription } = useSubscription(); - const [open, setOpen] = useState(false); - const [openSupport, setOpenSupport] = useState(false); - const [openUser, setOpenUser] = useState(false); - const [openOrg, setOpenOrg] = useState(false); - const [showAdminsModal, setShowAdminsModal] = useState(false); - - const { user } = useUser(); - const { mutateAsync } = useGetOrgTrialUrl(); - - const { currentOrg } = useOrganization(); - const { data: orgs } = useGetOrganizations(); - - const { popUp, handlePopUpToggle } = usePopUp(["createOrg"] as const); - const { mutateAsync: selectOrganization } = useSelectOrganization(); - const navigate = useNavigate(); - const router = useRouter(); - const location = useLocation(); - const queryClient = useQueryClient(); - - const isMoreSelected = ( - [ - linkOptions({ to: "/organization/access-management" }).to, - linkOptions({ to: "/organization/app-connections" }).to, - linkOptions({ to: "/organization/billing" }).to, - linkOptions({ to: "/organization/sso" }).to, - linkOptions({ to: "/organization/gateways" }).to, - linkOptions({ to: "/organization/settings" }).to, - linkOptions({ to: "/organization/audit-logs" }).to - ] as string[] - ).includes(location.pathname); - - const handleOrgChange = async (orgId: string) => { - queryClient.removeQueries({ queryKey: authKeys.getAuthToken }); - queryClient.removeQueries({ queryKey: workspaceKeys.getAllUserWorkspace() }); - - const { token, isMfaEnabled, mfaMethod } = await selectOrganization({ - organizationId: orgId - }); - - if (isMfaEnabled) { - SecurityClient.setMfaToken(token); - if (mfaMethod) { - setRequiredMfaMethod(mfaMethod); - } - toggleShowMfa.on(); - setMfaSuccessCallback(() => () => handleOrgChange(orgId)); - return; - } - await router.invalidate(); - await navigateUserToOrg(navigate, orgId); - }; - - const logout = useLogoutUser(); - const logOutUser = async () => { - try { - console.log("Logging out..."); - await logout.mutateAsync(); - navigate({ to: "/login" }); - } catch (error) { - console.error(error); - } - }; - - const handleCopyToken = async () => { - try { - await window.navigator.clipboard.writeText(getAuthToken()); - createNotification({ - type: "success", - text: "Copied current login session token to clipboard" - }); - } catch (error) { - console.log(error); - createNotification({ type: "error", text: "Failed to copy user token to clipboard" }); - } - }; - - if (shouldShowMfa) { - return ( -
- toggleShowMfa.off()} - /> -
- ); - } - - return ( - <> - - - -
- -
-
-
- handlePopUpToggle("createOrg", false)} - /> - - ); -};