feat: init
This commit is contained in:
3
apps/web/ce/components/issues/issue-modal/index.ts
Normal file
3
apps/web/ce/components/issues/issue-modal/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from "./provider";
|
||||
export * from "./issue-type-select";
|
||||
export * from "./template-select";
|
||||
@@ -0,0 +1,26 @@
|
||||
import type { Control } from "react-hook-form";
|
||||
// plane imports
|
||||
import type { EditorRefApi } from "@plane/editor";
|
||||
// types
|
||||
import type { TBulkIssueProperties, TIssue } from "@plane/types";
|
||||
|
||||
export type TIssueFields = TIssue & TBulkIssueProperties;
|
||||
|
||||
export type TIssueTypeDropdownVariant = "xs" | "sm";
|
||||
|
||||
export type TIssueTypeSelectProps<T extends Partial<TIssueFields>> = {
|
||||
control: Control<T>;
|
||||
projectId: string | null;
|
||||
editorRef?: React.MutableRefObject<EditorRefApi | null>;
|
||||
disabled?: boolean;
|
||||
variant?: TIssueTypeDropdownVariant;
|
||||
placeholder?: string;
|
||||
isRequired?: boolean;
|
||||
renderChevron?: boolean;
|
||||
dropDownContainerClassName?: string;
|
||||
showMandatoryFieldInfo?: boolean; // Show info about mandatory fields
|
||||
handleFormChange?: () => void;
|
||||
};
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
export const IssueTypeSelect = <T extends Partial<TIssueFields>>(props: TIssueTypeSelectProps<T>) => <></>;
|
||||
@@ -0,0 +1,10 @@
|
||||
import type React from "react";
|
||||
|
||||
export type TWorkItemModalAdditionalPropertiesProps = {
|
||||
isDraft?: boolean;
|
||||
projectId: string | null;
|
||||
workItemId: string | undefined;
|
||||
workspaceSlug: string;
|
||||
};
|
||||
|
||||
export const WorkItemModalAdditionalProperties: React.FC<TWorkItemModalAdditionalPropertiesProps> = () => null;
|
||||
53
apps/web/ce/components/issues/issue-modal/provider.tsx
Normal file
53
apps/web/ce/components/issues/issue-modal/provider.tsx
Normal file
@@ -0,0 +1,53 @@
|
||||
import React, { useState } from "react";
|
||||
import { observer } from "mobx-react";
|
||||
// plane imports
|
||||
import type { ISearchIssueResponse, TIssue } from "@plane/types";
|
||||
// components
|
||||
import { IssueModalContext } from "@/components/issues/issue-modal/context";
|
||||
// hooks
|
||||
import { useUser } from "@/hooks/store/user/user-user";
|
||||
|
||||
export type TIssueModalProviderProps = {
|
||||
templateId?: string;
|
||||
dataForPreload?: Partial<TIssue>;
|
||||
allowedProjectIds?: string[];
|
||||
children: React.ReactNode;
|
||||
};
|
||||
|
||||
export const IssueModalProvider = observer((props: TIssueModalProviderProps) => {
|
||||
const { children, allowedProjectIds } = props;
|
||||
// states
|
||||
const [selectedParentIssue, setSelectedParentIssue] = useState<ISearchIssueResponse | null>(null);
|
||||
// store hooks
|
||||
const { projectsWithCreatePermissions } = useUser();
|
||||
// derived values
|
||||
const projectIdsWithCreatePermissions = Object.keys(projectsWithCreatePermissions ?? {});
|
||||
|
||||
return (
|
||||
<IssueModalContext.Provider
|
||||
value={{
|
||||
allowedProjectIds: allowedProjectIds ?? projectIdsWithCreatePermissions,
|
||||
workItemTemplateId: null,
|
||||
setWorkItemTemplateId: () => {},
|
||||
isApplyingTemplate: false,
|
||||
setIsApplyingTemplate: () => {},
|
||||
selectedParentIssue,
|
||||
setSelectedParentIssue,
|
||||
issuePropertyValues: {},
|
||||
setIssuePropertyValues: () => {},
|
||||
issuePropertyValueErrors: {},
|
||||
setIssuePropertyValueErrors: () => {},
|
||||
getIssueTypeIdOnProjectChange: () => null,
|
||||
getActiveAdditionalPropertiesLength: () => 0,
|
||||
handlePropertyValuesValidation: () => true,
|
||||
handleCreateUpdatePropertyValues: () => Promise.resolve(),
|
||||
handleProjectEntitiesFetch: () => Promise.resolve(),
|
||||
handleTemplateChange: () => Promise.resolve(),
|
||||
handleConvert: () => Promise.resolve(),
|
||||
handleCreateSubWorkItem: () => Promise.resolve(),
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</IssueModalContext.Provider>
|
||||
);
|
||||
});
|
||||
@@ -0,0 +1,16 @@
|
||||
export type TWorkItemTemplateDropdownSize = "xs" | "sm";
|
||||
|
||||
export type TWorkItemTemplateSelect = {
|
||||
projectId: string | null;
|
||||
typeId: string | null;
|
||||
disabled?: boolean;
|
||||
size?: TWorkItemTemplateDropdownSize;
|
||||
placeholder?: string;
|
||||
renderChevron?: boolean;
|
||||
dropDownContainerClassName?: string;
|
||||
handleModalClose: () => void;
|
||||
handleFormChange?: () => void;
|
||||
};
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
export const WorkItemTemplateSelect = (props: TWorkItemTemplateSelect) => <></>;
|
||||
Reference in New Issue
Block a user