improvement: minor improvements for workspace switcher (#6609)

This commit is contained in:
Prateek Shourya 2025-02-14 19:03:32 +05:30 committed by GitHub
parent c4a3e1e8ac
commit bf1f12378e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 13 additions and 7 deletions

View file

@ -22,7 +22,6 @@ export interface IWorkspace {
readonly updated_by: string;
organization_size: string;
total_projects?: number;
current_plan?: string;
role: number;
}

View file

@ -10,3 +10,4 @@ export * from "./issue";
export * from "./state";
export * from "./string";
export * from "./theme";
export * from "./workspace";

View file

@ -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));

View file

@ -0,0 +1 @@
export * from "./subscription";

View file

@ -0,0 +1 @@
export * from "./subscription-pill";

View file

@ -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;

View file

@ -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">

View file

@ -1 +0,0 @@
export * from "ce/components/common/subscription-pill";