[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 "./mention-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;
|
||||
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
|
||||
import { Button } from "@plane/ui";
|
||||
|
||||
export const IssueEmbedCard: React.FC<any> = (props) => (
|
||||
export const IssueEmbedUpgradeCard: React.FC<any> = (props) => (
|
||||
<div
|
||||
className={`${
|
||||
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`}
|
||||
className={`${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`}
|
||||
>
|
||||
<h5 className="h-[20%] text-xs text-custom-text-300 p-2">
|
||||
{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";
|
||||
// plane web components
|
||||
import { IssueBulkOperationsRoot } from "@/plane-web/components/issues";
|
||||
// plane web constants
|
||||
import { ENABLE_BULK_OPERATIONS } from "@/plane-web/constants/issue";
|
||||
// plane web hooks
|
||||
import { useBulkOperationStatus } from "@/plane-web/hooks/use-bulk-operation-status";
|
||||
// helpers
|
||||
// constants
|
||||
import { GANTT_SELECT_GROUP } from "../constants";
|
||||
|
|
@ -78,6 +78,8 @@ export const GanttChartMainContent: React.FC<Props> = observer((props) => {
|
|||
const ganttContainerRef = useRef<HTMLDivElement>(null);
|
||||
// chart hook
|
||||
const { currentView, currentViewData } = useGanttChart();
|
||||
// plane web hooks
|
||||
const isBulkOperationsEnabled = useBulkOperationStatus();
|
||||
|
||||
// Enable Auto Scroll for Ganttlist
|
||||
useEffect(() => {
|
||||
|
|
@ -126,7 +128,7 @@ export const GanttChartMainContent: React.FC<Props> = observer((props) => {
|
|||
entities={{
|
||||
[GANTT_SELECT_GROUP]: blockIds ?? [],
|
||||
}}
|
||||
disabled={!ENABLE_BULK_OPERATIONS}
|
||||
disabled={!isBulkOperationsEnabled}
|
||||
>
|
||||
{(helpers) => (
|
||||
<>
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ import { getIssueBlocksStructure } from "@/helpers/issue.helper";
|
|||
import { useIssues, useUser } from "@/hooks/store";
|
||||
import { useIssueStoreType } from "@/hooks/use-issue-layout-store";
|
||||
import { useIssuesActions } from "@/hooks/use-issues-actions";
|
||||
// plane web constants
|
||||
import { ENABLE_BULK_OPERATIONS } from "@/plane-web/constants/issue";
|
||||
// plane web hooks
|
||||
import { useBulkOperationStatus } from "@/plane-web/hooks/use-bulk-operation-status";
|
||||
|
||||
import { IssueLayoutHOC } from "../issue-layout-HOC";
|
||||
|
||||
|
|
@ -42,6 +42,8 @@ export const BaseGanttRoot: React.FC<IBaseGanttRoot> = observer((props: IBaseGan
|
|||
membership: { currentProjectRole },
|
||||
} = useUser();
|
||||
const appliedDisplayFilters = issuesFilter.issueFilters?.displayFilters;
|
||||
// plane web hooks
|
||||
const isBulkOperationsEnabled = useBulkOperationStatus();
|
||||
|
||||
useEffect(() => {
|
||||
fetchIssues("init-loader", { canGroup: false, perPageCount: 100 }, viewId);
|
||||
|
|
@ -99,7 +101,7 @@ export const BaseGanttRoot: React.FC<IBaseGanttRoot> = observer((props: IBaseGan
|
|||
enableBlockMove={isAllowed}
|
||||
enableReorder={appliedDisplayFilters?.order_by === "sort_order" && isAllowed}
|
||||
enableAddBlock={isAllowed}
|
||||
enableSelection={ENABLE_BULK_OPERATIONS && isAllowed}
|
||||
enableSelection={isBulkOperationsEnabled && isAllowed}
|
||||
quickAdd={
|
||||
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";
|
||||
// plane web components
|
||||
import { IssueBulkOperationsRoot } from "@/plane-web/components/issues";
|
||||
// plane web constants
|
||||
import { ENABLE_BULK_OPERATIONS } from "@/plane-web/constants/issue";
|
||||
// plane web hooks
|
||||
import { useBulkOperationStatus } from "@/plane-web/hooks/use-bulk-operation-status";
|
||||
// utils
|
||||
import { getGroupByColumns, isWorkspaceLevel, GroupDropLocation, isSubGrouped } from "../utils";
|
||||
import { ListGroup } from "./list-group";
|
||||
|
|
@ -76,6 +76,8 @@ export const List: React.FC<IList> = observer((props) => {
|
|||
const projectState = useProjectState();
|
||||
const cycle = useCycle();
|
||||
const projectModule = useModule();
|
||||
// plane web hooks
|
||||
const isBulkOperationsEnabled = useBulkOperationStatus();
|
||||
|
||||
const containerRef = useRef<HTMLDivElement | null>(null);
|
||||
|
||||
|
|
@ -129,7 +131,7 @@ export const List: React.FC<IList> = observer((props) => {
|
|||
return (
|
||||
<div className="relative size-full flex flex-col">
|
||||
{groups && (
|
||||
<MultipleSelectGroup containerRef={containerRef} entities={entities} disabled={!ENABLE_BULK_OPERATIONS}>
|
||||
<MultipleSelectGroup containerRef={containerRef} entities={entities} disabled={!isBulkOperationsEnabled}>
|
||||
{(helpers) => (
|
||||
<>
|
||||
<div
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ import { SPREADSHEET_PROPERTY_LIST, SPREADSHEET_SELECT_GROUP } from "@/constants
|
|||
import { useProject } from "@/hooks/store";
|
||||
// plane web components
|
||||
import { IssueBulkOperationsRoot } from "@/plane-web/components/issues";
|
||||
// plane web constants
|
||||
import { ENABLE_BULK_OPERATIONS } from "@/plane-web/constants/issue";
|
||||
// plane web hooks
|
||||
import { useBulkOperationStatus } from "@/plane-web/hooks/use-bulk-operation-status";
|
||||
// types
|
||||
import { TRenderQuickActions } from "../list/list-view-types";
|
||||
import { SpreadsheetTable } from "./spreadsheet-table";
|
||||
|
|
@ -54,8 +54,10 @@ export const SpreadsheetView: React.FC<Props> = observer((props) => {
|
|||
// refs
|
||||
const containerRef = useRef<HTMLTableElement | null>(null);
|
||||
const portalRef = useRef<HTMLDivElement | null>(null);
|
||||
|
||||
// store hooks
|
||||
const { currentProjectDetails } = useProject();
|
||||
// plane web hooks
|
||||
const isBulkOperationsEnabled = useBulkOperationStatus();
|
||||
|
||||
const isEstimateEnabled: boolean = currentProjectDetails?.estimate !== null;
|
||||
|
||||
|
|
@ -82,7 +84,7 @@ export const SpreadsheetView: React.FC<Props> = observer((props) => {
|
|||
entities={{
|
||||
[SPREADSHEET_SELECT_GROUP]: issueIds,
|
||||
}}
|
||||
disabled={!ENABLE_BULK_OPERATIONS}
|
||||
disabled={!isBulkOperationsEnabled}
|
||||
>
|
||||
{(helpers) => (
|
||||
<>
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ import { cn } from "@/helpers/common.helper";
|
|||
// hooks
|
||||
import { useMember, useMention, useUser, useWorkspace } from "@/hooks/store";
|
||||
import { usePageFilters } from "@/hooks/use-page-filters";
|
||||
// plane web components
|
||||
import { IssueEmbedCard } from "@/plane-web/components/pages";
|
||||
// plane web hooks
|
||||
import { useIssueEmbed } from "@/plane-web/hooks/use-issue-embed";
|
||||
// services
|
||||
import { FileService } from "@/services/file.service";
|
||||
// store
|
||||
|
|
@ -80,14 +80,21 @@ export const PageEditorBody: React.FC<Props> = observer((props) => {
|
|||
members: projectMemberDetails,
|
||||
user: currentUser ?? undefined,
|
||||
});
|
||||
|
||||
// page filters
|
||||
const { isFullWidth } = usePageFilters();
|
||||
// issue-embed
|
||||
const { issueEmbedProps, issueEmbedReadOnlyProps } = useIssueEmbed(
|
||||
workspaceSlug?.toString() ?? "",
|
||||
projectId?.toString() ?? ""
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
updateMarkings(pageDescription ?? "<p></p>");
|
||||
}, [pageDescription, updateMarkings]);
|
||||
|
||||
if (pageId === undefined || !pageDescriptionYJS || !isDescriptionReady) return <PageContentLoader />;
|
||||
if (pageId === undefined || pageDescription === undefined || !pageDescriptionYJS || !isDescriptionReady)
|
||||
return <PageContentLoader />;
|
||||
|
||||
return (
|
||||
<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,
|
||||
}}
|
||||
embedHandler={{
|
||||
issue: {
|
||||
widgetCallback: () => <IssueEmbedCard />,
|
||||
},
|
||||
issue: issueEmbedProps,
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
|
|
@ -156,9 +161,7 @@ export const PageEditorBody: React.FC<Props> = observer((props) => {
|
|||
highlights: mentionHighlights,
|
||||
}}
|
||||
embedHandler={{
|
||||
issue: {
|
||||
widgetCallback: () => <IssueEmbedCard />,
|
||||
},
|
||||
issue: issueEmbedReadOnlyProps,
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -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