[WEB-1843] chore: minor file restructuring. (#5044)
This commit is contained in:
parent
509c258b07
commit
977b47d35f
14 changed files with 66 additions and 29 deletions
|
|
@ -3,3 +3,4 @@ export * from "./embed";
|
||||||
export * from "./image";
|
export * from "./image";
|
||||||
export * from "./mention-suggestion";
|
export * from "./mention-suggestion";
|
||||||
export * from "./slash-commands-suggestion";
|
export * from "./slash-commands-suggestion";
|
||||||
|
export * from "@/plane-editor/types";
|
||||||
|
|
|
||||||
2
packages/types/src/pages.d.ts
vendored
2
packages/types/src/pages.d.ts
vendored
|
|
@ -46,3 +46,5 @@ export type TPageFilters = {
|
||||||
sortBy: TPageFiltersSortBy;
|
sortBy: TPageFiltersSortBy;
|
||||||
filters?: TPageFilterProps;
|
filters?: TPageFilterProps;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type TPageEmbedType = "mention" | "issue";
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
export * from "./issue-embed";
|
export * from "./issue-embed-upgrade-card";
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,10 @@ import { Crown } from "lucide-react";
|
||||||
// ui
|
// ui
|
||||||
import { Button } from "@plane/ui";
|
import { Button } from "@plane/ui";
|
||||||
|
|
||||||
export const IssueEmbedCard: React.FC<any> = (props) => (
|
export const IssueEmbedUpgradeCard: React.FC<any> = (props) => (
|
||||||
<div
|
<div
|
||||||
className={`${
|
className={`${props.selected ? "border-custom-primary-200 border-[2px]" : ""
|
||||||
props.selected ? "border-custom-primary-200 border-[2px]" : ""
|
} w-full h-[100px] cursor-pointer space-y-2 rounded-md border-[0.5px] border-custom-border-200 shadow-custom-shadow-2xs`}
|
||||||
} w-full h-[100px] cursor-pointer space-y-2 rounded-md border-[0.5px] border-custom-border-200 shadow-custom-shadow-2xs`}
|
|
||||||
>
|
>
|
||||||
<h5 className="h-[20%] text-xs text-custom-text-300 p-2">
|
<h5 className="h-[20%] text-xs text-custom-text-300 p-2">
|
||||||
{props.node?.attrs?.project_identifier}-{props?.node?.attrs?.sequence_id}
|
{props.node?.attrs?.project_identifier}-{props?.node?.attrs?.sequence_id}
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
export const ENABLE_BULK_OPERATIONS = false;
|
|
||||||
1
web/ce/hooks/use-bulk-operation-status.ts
Normal file
1
web/ce/hooks/use-bulk-operation-status.ts
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
export const useBulkOperationStatus = () => false;
|
||||||
24
web/ce/hooks/use-issue-embed.tsx
Normal file
24
web/ce/hooks/use-issue-embed.tsx
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
// editor
|
||||||
|
import { TEmbedConfig, TReadOnlyEmbedConfig } from "@plane/editor";
|
||||||
|
// types
|
||||||
|
import { TPageEmbedType } from "@plane/types";
|
||||||
|
// plane web components
|
||||||
|
import { IssueEmbedUpgradeCard } from "@/plane-web/components/pages";
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
export const useIssueEmbed = (workspaceSlug: string, projectId: string, queryType: TPageEmbedType = "issue") => {
|
||||||
|
const widgetCallback = () => <IssueEmbedUpgradeCard />;
|
||||||
|
|
||||||
|
const issueEmbedProps: TEmbedConfig["issue"] = {
|
||||||
|
widgetCallback,
|
||||||
|
};
|
||||||
|
|
||||||
|
const issueEmbedReadOnlyProps: TReadOnlyEmbedConfig["issue"] = {
|
||||||
|
widgetCallback,
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
issueEmbedProps,
|
||||||
|
issueEmbedReadOnlyProps,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
@ -22,8 +22,8 @@ import {
|
||||||
import { cn } from "@/helpers/common.helper";
|
import { cn } from "@/helpers/common.helper";
|
||||||
// plane web components
|
// plane web components
|
||||||
import { IssueBulkOperationsRoot } from "@/plane-web/components/issues";
|
import { IssueBulkOperationsRoot } from "@/plane-web/components/issues";
|
||||||
// plane web constants
|
// plane web hooks
|
||||||
import { ENABLE_BULK_OPERATIONS } from "@/plane-web/constants/issue";
|
import { useBulkOperationStatus } from "@/plane-web/hooks/use-bulk-operation-status";
|
||||||
// helpers
|
// helpers
|
||||||
// constants
|
// constants
|
||||||
import { GANTT_SELECT_GROUP } from "../constants";
|
import { GANTT_SELECT_GROUP } from "../constants";
|
||||||
|
|
@ -78,6 +78,8 @@ export const GanttChartMainContent: React.FC<Props> = observer((props) => {
|
||||||
const ganttContainerRef = useRef<HTMLDivElement>(null);
|
const ganttContainerRef = useRef<HTMLDivElement>(null);
|
||||||
// chart hook
|
// chart hook
|
||||||
const { currentView, currentViewData } = useGanttChart();
|
const { currentView, currentViewData } = useGanttChart();
|
||||||
|
// plane web hooks
|
||||||
|
const isBulkOperationsEnabled = useBulkOperationStatus();
|
||||||
|
|
||||||
// Enable Auto Scroll for Ganttlist
|
// Enable Auto Scroll for Ganttlist
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
@ -126,7 +128,7 @@ export const GanttChartMainContent: React.FC<Props> = observer((props) => {
|
||||||
entities={{
|
entities={{
|
||||||
[GANTT_SELECT_GROUP]: blockIds ?? [],
|
[GANTT_SELECT_GROUP]: blockIds ?? [],
|
||||||
}}
|
}}
|
||||||
disabled={!ENABLE_BULK_OPERATIONS}
|
disabled={!isBulkOperationsEnabled}
|
||||||
>
|
>
|
||||||
{(helpers) => (
|
{(helpers) => (
|
||||||
<>
|
<>
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,8 @@ import { getIssueBlocksStructure } from "@/helpers/issue.helper";
|
||||||
import { useIssues, useUser } from "@/hooks/store";
|
import { useIssues, useUser } from "@/hooks/store";
|
||||||
import { useIssueStoreType } from "@/hooks/use-issue-layout-store";
|
import { useIssueStoreType } from "@/hooks/use-issue-layout-store";
|
||||||
import { useIssuesActions } from "@/hooks/use-issues-actions";
|
import { useIssuesActions } from "@/hooks/use-issues-actions";
|
||||||
// plane web constants
|
// plane web hooks
|
||||||
import { ENABLE_BULK_OPERATIONS } from "@/plane-web/constants/issue";
|
import { useBulkOperationStatus } from "@/plane-web/hooks/use-bulk-operation-status";
|
||||||
|
|
||||||
import { IssueLayoutHOC } from "../issue-layout-HOC";
|
import { IssueLayoutHOC } from "../issue-layout-HOC";
|
||||||
|
|
||||||
|
|
@ -42,6 +42,8 @@ export const BaseGanttRoot: React.FC<IBaseGanttRoot> = observer((props: IBaseGan
|
||||||
membership: { currentProjectRole },
|
membership: { currentProjectRole },
|
||||||
} = useUser();
|
} = useUser();
|
||||||
const appliedDisplayFilters = issuesFilter.issueFilters?.displayFilters;
|
const appliedDisplayFilters = issuesFilter.issueFilters?.displayFilters;
|
||||||
|
// plane web hooks
|
||||||
|
const isBulkOperationsEnabled = useBulkOperationStatus();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetchIssues("init-loader", { canGroup: false, perPageCount: 100 }, viewId);
|
fetchIssues("init-loader", { canGroup: false, perPageCount: 100 }, viewId);
|
||||||
|
|
@ -99,7 +101,7 @@ export const BaseGanttRoot: React.FC<IBaseGanttRoot> = observer((props: IBaseGan
|
||||||
enableBlockMove={isAllowed}
|
enableBlockMove={isAllowed}
|
||||||
enableReorder={appliedDisplayFilters?.order_by === "sort_order" && isAllowed}
|
enableReorder={appliedDisplayFilters?.order_by === "sort_order" && isAllowed}
|
||||||
enableAddBlock={isAllowed}
|
enableAddBlock={isAllowed}
|
||||||
enableSelection={ENABLE_BULK_OPERATIONS && isAllowed}
|
enableSelection={isBulkOperationsEnabled && isAllowed}
|
||||||
quickAdd={
|
quickAdd={
|
||||||
enableIssueCreation && isAllowed ? <GanttQuickAddIssueForm quickAddCallback={quickAddIssue} /> : undefined
|
enableIssueCreation && isAllowed ? <GanttQuickAddIssueForm quickAddCallback={quickAddIssue} /> : undefined
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,8 @@ import { useCycle, useLabel, useMember, useModule, useProject, useProjectState }
|
||||||
import { useIssueStoreType } from "@/hooks/use-issue-layout-store";
|
import { useIssueStoreType } from "@/hooks/use-issue-layout-store";
|
||||||
// plane web components
|
// plane web components
|
||||||
import { IssueBulkOperationsRoot } from "@/plane-web/components/issues";
|
import { IssueBulkOperationsRoot } from "@/plane-web/components/issues";
|
||||||
// plane web constants
|
// plane web hooks
|
||||||
import { ENABLE_BULK_OPERATIONS } from "@/plane-web/constants/issue";
|
import { useBulkOperationStatus } from "@/plane-web/hooks/use-bulk-operation-status";
|
||||||
// utils
|
// utils
|
||||||
import { getGroupByColumns, isWorkspaceLevel, GroupDropLocation, isSubGrouped } from "../utils";
|
import { getGroupByColumns, isWorkspaceLevel, GroupDropLocation, isSubGrouped } from "../utils";
|
||||||
import { ListGroup } from "./list-group";
|
import { ListGroup } from "./list-group";
|
||||||
|
|
@ -76,6 +76,8 @@ export const List: React.FC<IList> = observer((props) => {
|
||||||
const projectState = useProjectState();
|
const projectState = useProjectState();
|
||||||
const cycle = useCycle();
|
const cycle = useCycle();
|
||||||
const projectModule = useModule();
|
const projectModule = useModule();
|
||||||
|
// plane web hooks
|
||||||
|
const isBulkOperationsEnabled = useBulkOperationStatus();
|
||||||
|
|
||||||
const containerRef = useRef<HTMLDivElement | null>(null);
|
const containerRef = useRef<HTMLDivElement | null>(null);
|
||||||
|
|
||||||
|
|
@ -129,7 +131,7 @@ export const List: React.FC<IList> = observer((props) => {
|
||||||
return (
|
return (
|
||||||
<div className="relative size-full flex flex-col">
|
<div className="relative size-full flex flex-col">
|
||||||
{groups && (
|
{groups && (
|
||||||
<MultipleSelectGroup containerRef={containerRef} entities={entities} disabled={!ENABLE_BULK_OPERATIONS}>
|
<MultipleSelectGroup containerRef={containerRef} entities={entities} disabled={!isBulkOperationsEnabled}>
|
||||||
{(helpers) => (
|
{(helpers) => (
|
||||||
<>
|
<>
|
||||||
<div
|
<div
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,8 @@ import { SPREADSHEET_PROPERTY_LIST, SPREADSHEET_SELECT_GROUP } from "@/constants
|
||||||
import { useProject } from "@/hooks/store";
|
import { useProject } from "@/hooks/store";
|
||||||
// plane web components
|
// plane web components
|
||||||
import { IssueBulkOperationsRoot } from "@/plane-web/components/issues";
|
import { IssueBulkOperationsRoot } from "@/plane-web/components/issues";
|
||||||
// plane web constants
|
// plane web hooks
|
||||||
import { ENABLE_BULK_OPERATIONS } from "@/plane-web/constants/issue";
|
import { useBulkOperationStatus } from "@/plane-web/hooks/use-bulk-operation-status";
|
||||||
// types
|
// types
|
||||||
import { TRenderQuickActions } from "../list/list-view-types";
|
import { TRenderQuickActions } from "../list/list-view-types";
|
||||||
import { SpreadsheetTable } from "./spreadsheet-table";
|
import { SpreadsheetTable } from "./spreadsheet-table";
|
||||||
|
|
@ -54,8 +54,10 @@ export const SpreadsheetView: React.FC<Props> = observer((props) => {
|
||||||
// refs
|
// refs
|
||||||
const containerRef = useRef<HTMLTableElement | null>(null);
|
const containerRef = useRef<HTMLTableElement | null>(null);
|
||||||
const portalRef = useRef<HTMLDivElement | null>(null);
|
const portalRef = useRef<HTMLDivElement | null>(null);
|
||||||
|
// store hooks
|
||||||
const { currentProjectDetails } = useProject();
|
const { currentProjectDetails } = useProject();
|
||||||
|
// plane web hooks
|
||||||
|
const isBulkOperationsEnabled = useBulkOperationStatus();
|
||||||
|
|
||||||
const isEstimateEnabled: boolean = currentProjectDetails?.estimate !== null;
|
const isEstimateEnabled: boolean = currentProjectDetails?.estimate !== null;
|
||||||
|
|
||||||
|
|
@ -82,7 +84,7 @@ export const SpreadsheetView: React.FC<Props> = observer((props) => {
|
||||||
entities={{
|
entities={{
|
||||||
[SPREADSHEET_SELECT_GROUP]: issueIds,
|
[SPREADSHEET_SELECT_GROUP]: issueIds,
|
||||||
}}
|
}}
|
||||||
disabled={!ENABLE_BULK_OPERATIONS}
|
disabled={!isBulkOperationsEnabled}
|
||||||
>
|
>
|
||||||
{(helpers) => (
|
{(helpers) => (
|
||||||
<>
|
<>
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@ import { cn } from "@/helpers/common.helper";
|
||||||
// hooks
|
// hooks
|
||||||
import { useMember, useMention, useUser, useWorkspace } from "@/hooks/store";
|
import { useMember, useMention, useUser, useWorkspace } from "@/hooks/store";
|
||||||
import { usePageFilters } from "@/hooks/use-page-filters";
|
import { usePageFilters } from "@/hooks/use-page-filters";
|
||||||
// plane web components
|
// plane web hooks
|
||||||
import { IssueEmbedCard } from "@/plane-web/components/pages";
|
import { useIssueEmbed } from "@/plane-web/hooks/use-issue-embed";
|
||||||
// services
|
// services
|
||||||
import { FileService } from "@/services/file.service";
|
import { FileService } from "@/services/file.service";
|
||||||
// store
|
// store
|
||||||
|
|
@ -80,14 +80,21 @@ export const PageEditorBody: React.FC<Props> = observer((props) => {
|
||||||
members: projectMemberDetails,
|
members: projectMemberDetails,
|
||||||
user: currentUser ?? undefined,
|
user: currentUser ?? undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
// page filters
|
// page filters
|
||||||
const { isFullWidth } = usePageFilters();
|
const { isFullWidth } = usePageFilters();
|
||||||
|
// issue-embed
|
||||||
|
const { issueEmbedProps, issueEmbedReadOnlyProps } = useIssueEmbed(
|
||||||
|
workspaceSlug?.toString() ?? "",
|
||||||
|
projectId?.toString() ?? ""
|
||||||
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
updateMarkings(pageDescription ?? "<p></p>");
|
updateMarkings(pageDescription ?? "<p></p>");
|
||||||
}, [pageDescription, updateMarkings]);
|
}, [pageDescription, updateMarkings]);
|
||||||
|
|
||||||
if (pageId === undefined || !pageDescriptionYJS || !isDescriptionReady) return <PageContentLoader />;
|
if (pageId === undefined || pageDescription === undefined || !pageDescriptionYJS || !isDescriptionReady)
|
||||||
|
return <PageContentLoader />;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex items-center h-full w-full overflow-y-auto">
|
<div className="flex items-center h-full w-full overflow-y-auto">
|
||||||
|
|
@ -140,9 +147,7 @@ export const PageEditorBody: React.FC<Props> = observer((props) => {
|
||||||
suggestions: mentionSuggestions,
|
suggestions: mentionSuggestions,
|
||||||
}}
|
}}
|
||||||
embedHandler={{
|
embedHandler={{
|
||||||
issue: {
|
issue: issueEmbedProps,
|
||||||
widgetCallback: () => <IssueEmbedCard />,
|
|
||||||
},
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
|
|
@ -156,9 +161,7 @@ export const PageEditorBody: React.FC<Props> = observer((props) => {
|
||||||
highlights: mentionHighlights,
|
highlights: mentionHighlights,
|
||||||
}}
|
}}
|
||||||
embedHandler={{
|
embedHandler={{
|
||||||
issue: {
|
issue: issueEmbedReadOnlyProps,
|
||||||
widgetCallback: () => <IssueEmbedCard />,
|
|
||||||
},
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
export * from "ce/constants/issue";
|
|
||||||
1
web/ee/hooks/use-issue-embed.tsx
Normal file
1
web/ee/hooks/use-issue-embed.tsx
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
export * from "ce/hooks/use-issue-embed";
|
||||||
Loading…
Add table
Add a link
Reference in a new issue