From febf11f50250b735831351053c9458b0e29d05f8 Mon Sep 17 00:00:00 2001 From: = Date: Sun, 15 Dec 2024 21:22:01 +0530 Subject: [PATCH] feat: added organization layout base with subscription and user loading --- .../{signup => auth}/CodeInputStep.tsx | 0 .../DonwloadBackupPDFStep.tsx | 0 .../{signup => auth}/EnterEmailStep.tsx | 0 .../{signup => auth}/InitialSignupStep.tsx | 2 +- .../-components => components/auth}/Mfa.tsx | 0 .../{signup => auth}/TeamInviteStep.tsx | 0 .../{signup => auth}/UserInfoStep.tsx | 0 .../src/components/features/WishForm.tsx | 109 ++++ .../src/components/navigation/NavHeader.tsx | 2 +- .../components/navigation/RegionSelect.tsx | 2 +- .../components/utilities/attemptLoginMfa.ts | 2 +- .../utilities/cryptography/crypto.ts | 2 +- .../src/components/v2/Accordion/Accordion.tsx | 6 +- frontend-v2/src/components/v2/Alert/Alert.tsx | 2 +- .../v2/CreatableSelect/CreatableSelect.tsx | 4 +- .../src/components/v2/Drawer/Drawer.tsx | 2 +- .../v2/FilterableSelect/FilterableSelect.tsx | 10 +- .../InfisicalSecretInput.tsx | 2 +- frontend-v2/src/components/v2/Modal/Modal.tsx | 4 +- .../v2/NoticeBanner/NoticeBanner.tsx | 32 +- .../components/v2/Pagination/Pagination.tsx | 2 +- .../src/components/v2/Popover/Popover.tsx | 6 +- .../src/components/v2/Popoverv2/Popoverv2.tsx | 2 +- .../components/v2/SecretInput/SecretInput.tsx | 4 +- .../src/components/v2/Select/Select.tsx | 11 +- frontend-v2/src/components/v2/Table/Table.tsx | 2 +- frontend-v2/src/components/v2/Tabs/Tabs.tsx | 2 +- .../src/components/v2/Tooltip/Tooltip.tsx | 11 +- .../v2/projects/NewProjectModal.tsx | 2 +- frontend-v2/src/config/request.ts | 3 +- .../OrganizationContext.tsx | 11 +- .../ServerConfigContext.tsx | 4 +- .../SubscriptionContext.tsx | 11 +- .../src/context/UserContext/UserContext.tsx | 8 +- .../WorkspaceContext/WorkspaceContext.tsx | 2 +- frontend-v2/src/helpers/parseEnvVar.ts | 62 +- frontend-v2/src/helpers/policies.ts | 2 +- frontend-v2/src/helpers/string.ts | 1 - .../src/hooks/api/auditLogStreams/queries.tsx | 40 +- frontend-v2/src/hooks/api/auth/queries.tsx | 6 +- frontend-v2/src/hooks/api/auth/types.ts | 1 + frontend-v2/src/hooks/api/ca/index.tsx | 9 +- frontend-v2/src/hooks/api/ca/queries.tsx | 2 +- .../src/hooks/api/dynamicSecret/queries.ts | 4 +- .../hooks/api/dynamicSecretLease/queries.ts | 9 +- .../src/hooks/api/dynamicSecretLease/types.ts | 1 - .../src/hooks/api/ldapConfig/index.tsx | 3 +- .../src/hooks/api/organization/queries.tsx | 19 +- .../src/hooks/api/pkiCollections/index.tsx | 3 +- frontend-v2/src/hooks/api/policies/enums.ts | 8 +- .../src/hooks/api/secretApproval/types.ts | 6 +- frontend-v2/src/hooks/api/secrets/index.ts | 3 +- .../src/hooks/api/subscriptions/queries.tsx | 6 +- .../OrganizationLayout/OrganizationLayout.tsx | 508 ++++++++++++++++ .../InsecureConnectionBanner.tsx | 37 ++ .../InsecureConnectionBanner/index.tsx | 1 + .../src/layouts/OrganizationLayout/index.tsx | 1 + frontend-v2/src/routeTree.gen.ts | 573 +++++++++++++----- frontend-v2/src/routes/__root.tsx | 2 + frontend-v2/src/routes/_authenticate.tsx | 41 ++ .../src/routes/_authenticate/_org_details.tsx | 20 + .../_org_details/_organization_layout.tsx | 6 + .../organization/$organizationId/index.tsx | 38 ++ .../$organizationId/secret-manager.tsx | 11 + .../organization/index.tsx | 15 + .../_authenticate/_restrict_login_signup.tsx | 15 + .../-components/InitialStep/InitialStep.tsx | 2 +- .../login/-components/InitialStep/index.tsx | 0 .../login/-components/Login.utils.tsx | 0 .../login/-components/LoginSSO.tsx | 0 .../-components/PasswordStep/PasswordStep.tsx | 4 +- .../login/-components/PasswordStep/index.tsx | 0 .../login/-components/SSOStep/SSOStep.tsx | 0 .../login/-components/SSOStep/index.tsx | 0 .../login/-components/index.tsx | 0 .../_restrict_login_signup}/login/index.tsx | 2 +- .../login/ldap/index.tsx | 15 +- .../login/provider/error.tsx | 4 +- .../login/provider/success.tsx | 6 +- .../login/select-organization/index.tsx | 11 +- .../login/sso/index.tsx | 10 +- .../_restrict_login_signup}/signup/index.tsx | 14 +- .../BackupPDFStep/BackupPDFStep.tsx | 2 +- .../sso/-components/BackupPDFStep/index.tsx | 0 .../EmailConfirmationStep.tsx | 2 +- .../EmailConfirmationStep/index.tsx | 0 .../UserInfoSSOStep/UserInfoSSOStep.tsx | 0 .../sso/-components/UserInfoSSOStep/index.tsx | 0 .../signup/sso/index.tsx | 2 +- frontend-v2/vite.config.ts | 10 + 90 files changed, 1450 insertions(+), 349 deletions(-) rename frontend-v2/src/components/{signup => auth}/CodeInputStep.tsx (100%) rename frontend-v2/src/components/{signup => auth}/DonwloadBackupPDFStep.tsx (100%) rename frontend-v2/src/components/{signup => auth}/EnterEmailStep.tsx (100%) rename frontend-v2/src/components/{signup => auth}/InitialSignupStep.tsx (100%) rename frontend-v2/src/{routes/login/-components => components/auth}/Mfa.tsx (100%) rename frontend-v2/src/components/{signup => auth}/TeamInviteStep.tsx (100%) rename frontend-v2/src/components/{signup => auth}/UserInfoStep.tsx (100%) create mode 100644 frontend-v2/src/components/features/WishForm.tsx create mode 100644 frontend-v2/src/layouts/OrganizationLayout/OrganizationLayout.tsx create mode 100644 frontend-v2/src/layouts/OrganizationLayout/components/InsecureConnectionBanner/InsecureConnectionBanner.tsx create mode 100644 frontend-v2/src/layouts/OrganizationLayout/components/InsecureConnectionBanner/index.tsx create mode 100644 frontend-v2/src/layouts/OrganizationLayout/index.tsx create mode 100644 frontend-v2/src/routes/_authenticate.tsx create mode 100644 frontend-v2/src/routes/_authenticate/_org_details.tsx create mode 100644 frontend-v2/src/routes/_authenticate/_org_details/_organization_layout.tsx create mode 100644 frontend-v2/src/routes/_authenticate/_org_details/_organization_layout/organization/$organizationId/index.tsx create mode 100644 frontend-v2/src/routes/_authenticate/_org_details/_organization_layout/organization/$organizationId/secret-manager.tsx create mode 100644 frontend-v2/src/routes/_authenticate/_org_details/_organization_layout/organization/index.tsx create mode 100644 frontend-v2/src/routes/_authenticate/_restrict_login_signup.tsx rename frontend-v2/src/routes/{ => _authenticate/_restrict_login_signup}/login/-components/InitialStep/InitialStep.tsx (100%) rename frontend-v2/src/routes/{ => _authenticate/_restrict_login_signup}/login/-components/InitialStep/index.tsx (100%) rename frontend-v2/src/routes/{ => _authenticate/_restrict_login_signup}/login/-components/Login.utils.tsx (100%) rename frontend-v2/src/routes/{ => _authenticate/_restrict_login_signup}/login/-components/LoginSSO.tsx (100%) rename frontend-v2/src/routes/{ => _authenticate/_restrict_login_signup}/login/-components/PasswordStep/PasswordStep.tsx (99%) rename frontend-v2/src/routes/{ => _authenticate/_restrict_login_signup}/login/-components/PasswordStep/index.tsx (100%) rename frontend-v2/src/routes/{ => _authenticate/_restrict_login_signup}/login/-components/SSOStep/SSOStep.tsx (100%) rename frontend-v2/src/routes/{ => _authenticate/_restrict_login_signup}/login/-components/SSOStep/index.tsx (100%) rename frontend-v2/src/routes/{ => _authenticate/_restrict_login_signup}/login/-components/index.tsx (100%) rename frontend-v2/src/routes/{ => _authenticate/_restrict_login_signup}/login/index.tsx (96%) rename frontend-v2/src/routes/{ => _authenticate/_restrict_login_signup}/login/ldap/index.tsx (97%) rename frontend-v2/src/routes/{ => _authenticate/_restrict_login_signup}/login/provider/error.tsx (74%) rename frontend-v2/src/routes/{ => _authenticate/_restrict_login_signup}/login/provider/success.tsx (80%) rename frontend-v2/src/routes/{ => _authenticate/_restrict_login_signup}/login/select-organization/index.tsx (98%) rename frontend-v2/src/routes/{ => _authenticate/_restrict_login_signup}/login/sso/index.tsx (95%) rename frontend-v2/src/routes/{ => _authenticate/_restrict_login_signup}/signup/index.tsx (91%) rename frontend-v2/src/routes/{ => _authenticate/_restrict_login_signup}/signup/sso/-components/BackupPDFStep/BackupPDFStep.tsx (100%) rename frontend-v2/src/routes/{ => _authenticate/_restrict_login_signup}/signup/sso/-components/BackupPDFStep/index.tsx (100%) rename frontend-v2/src/routes/{ => _authenticate/_restrict_login_signup}/signup/sso/-components/EmailConfirmationStep/EmailConfirmationStep.tsx (100%) rename frontend-v2/src/routes/{ => _authenticate/_restrict_login_signup}/signup/sso/-components/EmailConfirmationStep/index.tsx (100%) rename frontend-v2/src/routes/{ => _authenticate/_restrict_login_signup}/signup/sso/-components/UserInfoSSOStep/UserInfoSSOStep.tsx (100%) rename frontend-v2/src/routes/{ => _authenticate/_restrict_login_signup}/signup/sso/-components/UserInfoSSOStep/index.tsx (100%) rename frontend-v2/src/routes/{ => _authenticate/_restrict_login_signup}/signup/sso/index.tsx (96%) diff --git a/frontend-v2/src/components/signup/CodeInputStep.tsx b/frontend-v2/src/components/auth/CodeInputStep.tsx similarity index 100% rename from frontend-v2/src/components/signup/CodeInputStep.tsx rename to frontend-v2/src/components/auth/CodeInputStep.tsx diff --git a/frontend-v2/src/components/signup/DonwloadBackupPDFStep.tsx b/frontend-v2/src/components/auth/DonwloadBackupPDFStep.tsx similarity index 100% rename from frontend-v2/src/components/signup/DonwloadBackupPDFStep.tsx rename to frontend-v2/src/components/auth/DonwloadBackupPDFStep.tsx diff --git a/frontend-v2/src/components/signup/EnterEmailStep.tsx b/frontend-v2/src/components/auth/EnterEmailStep.tsx similarity index 100% rename from frontend-v2/src/components/signup/EnterEmailStep.tsx rename to frontend-v2/src/components/auth/EnterEmailStep.tsx diff --git a/frontend-v2/src/components/signup/InitialSignupStep.tsx b/frontend-v2/src/components/auth/InitialSignupStep.tsx similarity index 100% rename from frontend-v2/src/components/signup/InitialSignupStep.tsx rename to frontend-v2/src/components/auth/InitialSignupStep.tsx index c4b6ce95e..d5bc8081c 100644 --- a/frontend-v2/src/components/signup/InitialSignupStep.tsx +++ b/frontend-v2/src/components/auth/InitialSignupStep.tsx @@ -1,8 +1,8 @@ import { useTranslation } from "react-i18next"; -import { Link } from "@tanstack/react-router"; import { faGithub, faGitlab, faGoogle } from "@fortawesome/free-brands-svg-icons"; import { faEnvelope } from "@fortawesome/free-regular-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import { Link } from "@tanstack/react-router"; import { RegionSelect } from "@app/components/navigation/RegionSelect"; import { useServerConfig } from "@app/context"; diff --git a/frontend-v2/src/routes/login/-components/Mfa.tsx b/frontend-v2/src/components/auth/Mfa.tsx similarity index 100% rename from frontend-v2/src/routes/login/-components/Mfa.tsx rename to frontend-v2/src/components/auth/Mfa.tsx diff --git a/frontend-v2/src/components/signup/TeamInviteStep.tsx b/frontend-v2/src/components/auth/TeamInviteStep.tsx similarity index 100% rename from frontend-v2/src/components/signup/TeamInviteStep.tsx rename to frontend-v2/src/components/auth/TeamInviteStep.tsx diff --git a/frontend-v2/src/components/signup/UserInfoStep.tsx b/frontend-v2/src/components/auth/UserInfoStep.tsx similarity index 100% rename from frontend-v2/src/components/signup/UserInfoStep.tsx rename to frontend-v2/src/components/auth/UserInfoStep.tsx diff --git a/frontend-v2/src/components/features/WishForm.tsx b/frontend-v2/src/components/features/WishForm.tsx new file mode 100644 index 000000000..fc38d0731 --- /dev/null +++ b/frontend-v2/src/components/features/WishForm.tsx @@ -0,0 +1,109 @@ +import { useForm } from "react-hook-form"; +import { faRocketchat } from "@fortawesome/free-brands-svg-icons"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import { zodResolver } from "@hookform/resolvers/zod"; +import { z } from "zod"; + +import { createNotification } from "@app/components/notifications"; +import { + Button, + FormControl, + Popover, + PopoverContent, + PopoverTrigger, + TextArea +} from "@app/components/v2"; +import { useToggle } from "@app/hooks"; +import { useCreateUserWish } from "@app/hooks/api/userEngagement"; + +const formSchema = z.object({ + text: z.string().trim().min(1) +}); + +type TFormData = z.infer; + +export const WishForm = () => { + const { + handleSubmit, + register, + reset, + formState: { isSubmitting, errors } + } = useForm({ + resolver: zodResolver(formSchema) + }); + const { mutateAsync } = useCreateUserWish(); + const [isOpen, setIsOpen] = useToggle(false); + + const createWish = async (data: TFormData) => { + try { + await mutateAsync({ + text: data.text + }); + + createNotification({ + text: "Your wish has been sent to the Infisical team!", + type: "success" + }); + + setIsOpen.off(); + } catch { + createNotification({ + text: "An error occured while sending your wish to the Infisical team.", + type: "error" + }); + } + }; + + return ( + { + setIsOpen.toggle(); + reset(); + }} + open={isOpen} + > + +
+ + Request a feature +
+
+ +
+ +