diff --git a/frontend/src/pages/organization/SecretManagerOverviewPage/SecretManagerOverviewPage.tsx b/frontend/src/pages/organization/SecretManagerOverviewPage/SecretManagerOverviewPage.tsx
index 0d49e05f9..24e2b9729 100644
--- a/frontend/src/pages/organization/SecretManagerOverviewPage/SecretManagerOverviewPage.tsx
+++ b/frontend/src/pages/organization/SecretManagerOverviewPage/SecretManagerOverviewPage.tsx
@@ -2,21 +2,20 @@
import { useState } from "react";
import { Helmet } from "react-helmet";
import { useTranslation } from "react-i18next";
-import { faExclamationCircle, faPlus } from "@fortawesome/free-solid-svg-icons";
+import { faExclamationCircle } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
-import { OrgPermissionCan } from "@app/components/permissions";
import { NewProjectModal } from "@app/components/projects";
-import { Button, PageHeader } from "@app/components/v2";
-import { OrgPermissionActions, OrgPermissionSubjects, useSubscription } from "@app/context";
+import { PageHeader } from "@app/components/v2";
+import { useSubscription } from "@app/context";
import { useFetchServerStatus } from "@app/hooks/api/serverDetails";
import { ProjectType } from "@app/hooks/api/workspace/types";
import { usePopUp } from "@app/hooks/usePopUp";
import { AllProjectView } from "./components/AllProjectView";
import { MyProjectView } from "./components/MyProjectView";
-import { ProjectListView } from "./components/ProjectListToggle";
+import { ProjectListToggle, ProjectListView } from "./components/ProjectListToggle";
const formatDescription = (type: ProjectType) => {
if (type === ProjectType.SecretManager)
@@ -80,33 +79,30 @@ export const ProductOverviewPage = ({ type }: Props) => {
)}
-
-
- {(isAllowed) => (
- }
- onClick={() => {
- if (isAddingProjectsAllowed) {
- handlePopUpOpen("addNewWs");
- } else {
- handlePopUpOpen("upgradePlan");
- }
- }}
- className="ml-2"
- >
- Add New Project
-
- )}
-
+
+
+
+ }
+ description={formatDescription(type)}
+ >
- {projectListView === ProjectListView.MyProjects && (
-
- )}
- {projectListView === ProjectListView.AllProjects && (
-
+ {projectListView === ProjectListView.MyProjects ? (
+ handlePopUpOpen("addNewWs")}
+ onUpgradePlan={() => handlePopUpOpen("upgradePlan")}
+ isAddingProjectsAllowed={isAddingProjectsAllowed}
+ />
+ ) : (
+ handlePopUpOpen("addNewWs")}
+ onUpgradePlan={() => handlePopUpOpen("upgradePlan")}
+ isAddingProjectsAllowed={isAddingProjectsAllowed}
+ />
)}
void;
+ onAddNewProject: () => void;
+ onUpgradePlan: () => void;
+ isAddingProjectsAllowed: boolean;
};
type RequestAccessModalProps = {
@@ -83,7 +86,7 @@ const RequestAccessModal = ({ projectId, onPopUpToggle }: RequestAccessModalProp
);
};
-export const AllProjectView = ({ type, onListViewToggle }: Props) => {
+export const AllProjectView = ({ type, onAddNewProject, onUpgradePlan, isAddingProjectsAllowed }: Props) => {
const navigate = useNavigate();
const [searchFilter, setSearchFilter] = useState("");
const [debouncedSearch] = useDebounce(searchFilter);
@@ -119,11 +122,10 @@ export const AllProjectView = ({ type, onListViewToggle }: Props) => {
return (
-
setSearchFilter(e.target.value)}
@@ -163,6 +165,25 @@ export const AllProjectView = ({ type, onListViewToggle }: Props) => {
+
+ {(isAllowed) => (
+ }
+ onClick={() => {
+ if (isAddingProjectsAllowed) {
+ onAddNewProject();
+ } else {
+ onUpgradePlan();
+ }
+ }}
+ className="ml-2"
+ >
+ Add New Project
+
+ )}
+
{isProjectLoading &&
@@ -266,7 +287,7 @@ export const AllProjectView = ({ type, onListViewToggle }: Props) => {
>
handlePopUpToggle("requestAccessConfirmation")}
diff --git a/frontend/src/pages/organization/SecretManagerOverviewPage/components/MyProjectView.tsx b/frontend/src/pages/organization/SecretManagerOverviewPage/components/MyProjectView.tsx
index 2eecb540d..fb78b3ac0 100644
--- a/frontend/src/pages/organization/SecretManagerOverviewPage/components/MyProjectView.tsx
+++ b/frontend/src/pages/organization/SecretManagerOverviewPage/components/MyProjectView.tsx
@@ -7,6 +7,7 @@ import {
faBorderAll,
faList,
faMagnifyingGlass,
+ faPlus,
faSearch,
faStar as faSolidStar
} from "@fortawesome/free-solid-svg-icons";
@@ -14,8 +15,9 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { useNavigate } from "@tanstack/react-router";
import { createNotification } from "@app/components/notifications";
-import { IconButton, Input, Pagination, Skeleton, Tooltip } from "@app/components/v2";
-import { useOrganization } from "@app/context";
+import { OrgPermissionCan } from "@app/components/permissions";
+import { Button, IconButton, Input, Pagination, Skeleton, Tooltip } from "@app/components/v2";
+import { OrgPermissionActions, OrgPermissionSubjects, useOrganization } from "@app/context";
import { getProjectHomePage } from "@app/helpers/project";
import { usePagination, useResetPageHelper } from "@app/hooks";
import { useGetUserWorkspaces } from "@app/hooks/api";
@@ -24,11 +26,11 @@ import { useUpdateUserProjectFavorites } from "@app/hooks/api/users/mutation";
import { useGetUserProjectFavorites } from "@app/hooks/api/users/queries";
import { ProjectType, Workspace } from "@app/hooks/api/workspace/types";
-import { ProjectListToggle, ProjectListView } from "./ProjectListToggle";
-
type Props = {
type: ProjectType;
- onListViewToggle: (value: ProjectListView) => void;
+ onAddNewProject: () => void;
+ onUpgradePlan: () => void;
+ isAddingProjectsAllowed: boolean;
};
enum ProjectOrderBy {
@@ -40,7 +42,7 @@ enum ProjectsViewMode {
LIST = "list"
}
-export const MyProjectView = ({ type, onListViewToggle }: Props) => {
+export const MyProjectView = ({ type, onAddNewProject, onUpgradePlan, isAddingProjectsAllowed }: Props) => {
const navigate = useNavigate();
const { currentOrg } = useOrganization();
@@ -318,11 +320,10 @@ export const MyProjectView = ({ type, onListViewToggle }: Props) => {
return (
-
setSearchFilter(e.target.value)}
@@ -376,6 +377,25 @@ export const MyProjectView = ({ type, onListViewToggle }: Props) => {
+
+ {(isAllowed) => (
+ }
+ onClick={() => {
+ if (isAddingProjectsAllowed) {
+ onAddNewProject();
+ } else {
+ onUpgradePlan();
+ }
+ }}
+ className="ml-2"
+ >
+ Add New Project
+
+ )}
+
{projectsComponents}
{!isProjectViewLoading && Boolean(filteredWorkspaces.length) && (
diff --git a/frontend/src/pages/organization/SecretManagerOverviewPage/components/ProjectListToggle.tsx b/frontend/src/pages/organization/SecretManagerOverviewPage/components/ProjectListToggle.tsx
index 4c16f8cfb..2566ee46d 100644
--- a/frontend/src/pages/organization/SecretManagerOverviewPage/components/ProjectListToggle.tsx
+++ b/frontend/src/pages/organization/SecretManagerOverviewPage/components/ProjectListToggle.tsx
@@ -1,4 +1,6 @@
import { Select, SelectItem } from "@app/components/v2";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { faChevronDown } from "@fortawesome/free-solid-svg-icons";
export enum ProjectListView {
MyProjects = "my-projects",
@@ -11,10 +13,18 @@ type Props = {
};
export const ProjectListToggle = ({ value, onChange }: Props) => {
+ const getDisplayText = (value: ProjectListView) => {
+ return value === ProjectListView.MyProjects ? "My Projects" : "All Projects";
+ };
+
return (
-
+
+
{getDisplayText(value)}
+
+
+
);
};