Skip to content

armgit / plane

Public Imported from GitHub
0

πŸ”₯πŸ”₯πŸ”₯ Open-source Jira, Linear, Monday, and ClickUp alternative. Plane is a modern project management platform to manage tasks, sprints, docs, and triage.

improvement: minor improvements for workspace switcher (#6609)

Prateek Shouryabf1f12378ea6
diff --git a/packages/types/src/workspace.d.ts b/packages/types/src/workspace.d.ts
index d72dad7cc6..3cec14baa4 100644
--- a/packages/types/src/workspace.d.ts
+++ b/packages/types/src/workspace.d.ts
@@ -22,7 +22,6 @@ export interface IWorkspace {
readonly updated_by: string;
organization_size: string;
total_projects?: number;
- current_plan?: string;
role: number;
}
diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.ts
index 510155f6a1..7ae2693187 100644
--- a/packages/utils/src/index.ts
+++ b/packages/utils/src/index.ts
@@ -10,3 +10,4 @@ export * from "./issue";
export * from "./state";
export * from "./string";
export * from "./theme";
+export * from "./workspace";
diff --git a/packages/utils/src/workspace.ts b/packages/utils/src/workspace.ts
new file mode 100644
index 0000000000..1fb74e89c2
--- /dev/null
+++ b/packages/utils/src/workspace.ts
@@ -0,0 +1,5 @@
+// plane imports
+import { IWorkspace } from "@plane/types";
+
+export const orderWorkspacesList = (workspaces: IWorkspace[]): IWorkspace[] =>
+ workspaces.sort((a, b) => a.name.localeCompare(b.name));
diff --git a/web/ce/components/common/index.ts b/web/ce/components/common/index.ts
new file mode 100644
index 0000000000..75c2cf410a
--- /dev/null
+++ b/web/ce/components/common/index.ts
@@ -0,0 +1 @@
+export * from "./subscription";
diff --git a/web/ce/components/common/subscription/index.ts b/web/ce/components/common/subscription/index.ts
new file mode 100644
index 0000000000..beb26e1d97
--- /dev/null
+++ b/web/ce/components/common/subscription/index.ts
@@ -0,0 +1 @@
+export * from "./subscription-pill";
\ No newline at end of file
diff --git a/web/ce/components/common/subscription-pill.tsx b/web/ce/components/common/subscription/subscription-pill.tsx
similarity index 100%
rename from web/ce/components/common/subscription-pill.tsx
rename to web/ce/components/common/subscription/subscription-pill.tsx
diff --git a/web/core/components/workspace/sidebar/dropdown-item.tsx b/web/core/components/workspace/sidebar/dropdown-item.tsx
index 7638b65727..2259f95d20 100644
--- a/web/core/components/workspace/sidebar/dropdown-item.tsx
+++ b/web/core/components/workspace/sidebar/dropdown-item.tsx
@@ -12,7 +12,7 @@ import { cn, getFileURL } from "@plane/utils";
// helpers
import { getUserRole } from "@/helpers/user.helper";
// plane web imports
-import { SubscriptionPill } from "@/plane-web/components/common/subscription-pill";
+import { SubscriptionPill } from "@/plane-web/components/common/subscription";
type TProps = {
workspace: IWorkspace;
diff --git a/web/core/components/workspace/sidebar/dropdown.tsx b/web/core/components/workspace/sidebar/dropdown.tsx
index ac9acf42e5..0719d95c0a 100644
--- a/web/core/components/workspace/sidebar/dropdown.tsx
+++ b/web/core/components/workspace/sidebar/dropdown.tsx
@@ -8,13 +8,13 @@ import { usePopper } from "react-popper";
import { ChevronDown, CirclePlus, LogOut, Mails, Settings } from "lucide-react";
// ui
import { Menu, Transition } from "@headlessui/react";
-// types
+// plane imports
import { useTranslation } from "@plane/i18n";
import { IWorkspace } from "@plane/types";
-// plane ui
import { Avatar, Loader, TOAST_TYPE, setToast } from "@plane/ui";
-import { GOD_MODE_URL, cn } from "@/helpers/common.helper";
+import { orderWorkspacesList } from "@plane/utils";
// helpers
+import { GOD_MODE_URL, cn } from "@/helpers/common.helper";
import { getFileURL } from "@/helpers/file.helper";
// hooks
import { useAppTheme, useUser, useUserProfile, useWorkspace } from "@/hooks/store";
@@ -66,7 +66,7 @@ export const SidebarDropdown = observer(() => {
toggleSidebar();
}
};
- const workspacesList = Object.values(workspaces ?? {});
+ const workspacesList = orderWorkspacesList(Object.values(workspaces ?? {}));
// TODO: fix workspaces list scroll
return (
<div className="flex items-center justify-center gap-x-3 gap-y-2">
diff --git a/web/ee/components/common/subscription-pill.tsx b/web/ee/components/common/subscription-pill.tsx
deleted file mode 100644
index 38bcdebd5a..0000000000
--- a/web/ee/components/common/subscription-pill.tsx
+++ /dev/null
@@ -1 +0,0 @@
-export * from "ce/components/common/subscription-pill";