bb-plane-fork/web/core/components/views/helper.tsx
Vamsi Krishna 64fd0b2830
[WEB-4321]chore: workspace views refactor (#7214)
* chore: workspace views reafactor

* chore: resolved coderabbit suggestions

* chore: added project level workspace filter

* chore: added enum for roles

* chore: removed redundant type definition

* chore: optimised the query

---------

Co-authored-by: NarayanBavisetti <narayan3119@gmail.com>
2025-06-19 16:26:32 +05:30

51 lines
1.5 KiB
TypeScript

import { EIssueLayoutTypes } from "@plane/constants";
import { WorkspaceAdditionalLayouts } from "@/plane-web/components/views/helper";
import { WorkspaceSpreadsheetRoot } from "../issues/issue-layouts/spreadsheet/roots/workspace-root";
export type TWorkspaceLayoutProps = {
activeLayout: EIssueLayoutTypes | undefined;
isDefaultView: boolean;
isLoading?: boolean;
toggleLoading: (value: boolean) => void;
workspaceSlug: string;
globalViewId: string;
routeFilters: {
[key: string]: string;
};
fetchNextPages: () => void;
globalViewsLoading: boolean;
issuesLoading: boolean;
};
export const WorkspaceActiveLayout = (props: TWorkspaceLayoutProps) => {
const {
activeLayout = EIssueLayoutTypes.SPREADSHEET,
isDefaultView,
isLoading,
toggleLoading,
workspaceSlug,
globalViewId,
routeFilters,
fetchNextPages,
globalViewsLoading,
issuesLoading,
} = props;
switch (activeLayout) {
case EIssueLayoutTypes.SPREADSHEET:
return (
<WorkspaceSpreadsheetRoot
isDefaultView={isDefaultView}
isLoading={isLoading}
toggleLoading={toggleLoading}
workspaceSlug={workspaceSlug}
globalViewId={globalViewId}
routeFilters={routeFilters}
fetchNextPages={fetchNextPages}
globalViewsLoading={globalViewsLoading}
issuesLoading={issuesLoading}
/>
);
default:
return <WorkspaceAdditionalLayouts {...props} />;
}
};