improvement: minor improvements for workspace switcher (#6609)
This commit is contained in:
parent
c4a3e1e8ac
commit
bf1f12378e
9 changed files with 13 additions and 7 deletions
1
packages/types/src/workspace.d.ts
vendored
1
packages/types/src/workspace.d.ts
vendored
|
|
@ -22,7 +22,6 @@ export interface IWorkspace {
|
||||||
readonly updated_by: string;
|
readonly updated_by: string;
|
||||||
organization_size: string;
|
organization_size: string;
|
||||||
total_projects?: number;
|
total_projects?: number;
|
||||||
current_plan?: string;
|
|
||||||
role: number;
|
role: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,3 +10,4 @@ export * from "./issue";
|
||||||
export * from "./state";
|
export * from "./state";
|
||||||
export * from "./string";
|
export * from "./string";
|
||||||
export * from "./theme";
|
export * from "./theme";
|
||||||
|
export * from "./workspace";
|
||||||
|
|
|
||||||
5
packages/utils/src/workspace.ts
Normal file
5
packages/utils/src/workspace.ts
Normal 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));
|
||||||
1
web/ce/components/common/index.ts
Normal file
1
web/ce/components/common/index.ts
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
export * from "./subscription";
|
||||||
1
web/ce/components/common/subscription/index.ts
Normal file
1
web/ce/components/common/subscription/index.ts
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
export * from "./subscription-pill";
|
||||||
|
|
@ -12,7 +12,7 @@ import { cn, getFileURL } from "@plane/utils";
|
||||||
// helpers
|
// helpers
|
||||||
import { getUserRole } from "@/helpers/user.helper";
|
import { getUserRole } from "@/helpers/user.helper";
|
||||||
// plane web imports
|
// plane web imports
|
||||||
import { SubscriptionPill } from "@/plane-web/components/common/subscription-pill";
|
import { SubscriptionPill } from "@/plane-web/components/common/subscription";
|
||||||
|
|
||||||
type TProps = {
|
type TProps = {
|
||||||
workspace: IWorkspace;
|
workspace: IWorkspace;
|
||||||
|
|
|
||||||
|
|
@ -8,13 +8,13 @@ import { usePopper } from "react-popper";
|
||||||
import { ChevronDown, CirclePlus, LogOut, Mails, Settings } from "lucide-react";
|
import { ChevronDown, CirclePlus, LogOut, Mails, Settings } from "lucide-react";
|
||||||
// ui
|
// ui
|
||||||
import { Menu, Transition } from "@headlessui/react";
|
import { Menu, Transition } from "@headlessui/react";
|
||||||
// types
|
// plane imports
|
||||||
import { useTranslation } from "@plane/i18n";
|
import { useTranslation } from "@plane/i18n";
|
||||||
import { IWorkspace } from "@plane/types";
|
import { IWorkspace } from "@plane/types";
|
||||||
// plane ui
|
|
||||||
import { Avatar, Loader, TOAST_TYPE, setToast } from "@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
|
// helpers
|
||||||
|
import { GOD_MODE_URL, cn } from "@/helpers/common.helper";
|
||||||
import { getFileURL } from "@/helpers/file.helper";
|
import { getFileURL } from "@/helpers/file.helper";
|
||||||
// hooks
|
// hooks
|
||||||
import { useAppTheme, useUser, useUserProfile, useWorkspace } from "@/hooks/store";
|
import { useAppTheme, useUser, useUserProfile, useWorkspace } from "@/hooks/store";
|
||||||
|
|
@ -66,7 +66,7 @@ export const SidebarDropdown = observer(() => {
|
||||||
toggleSidebar();
|
toggleSidebar();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const workspacesList = Object.values(workspaces ?? {});
|
const workspacesList = orderWorkspacesList(Object.values(workspaces ?? {}));
|
||||||
// TODO: fix workspaces list scroll
|
// TODO: fix workspaces list scroll
|
||||||
return (
|
return (
|
||||||
<div className="flex items-center justify-center gap-x-3 gap-y-2">
|
<div className="flex items-center justify-center gap-x-3 gap-y-2">
|
||||||
|
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
export * from "ce/components/common/subscription-pill";
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue