fix: minor refactoring changes for state dropdowns
This commit is contained in:
parent
da469dac18
commit
952eee8d55
39 changed files with 291 additions and 266 deletions
1
web/ce/components/command-palette/actions/index.ts
Normal file
1
web/ce/components/command-palette/actions/index.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export * from "./work-item-actions";
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
import { Command } from "cmdk";
|
||||
import { observer } from "mobx-react";
|
||||
import { Check } from "lucide-react";
|
||||
// plane imports
|
||||
import { Spinner, StateGroupIcon } from "@plane/ui";
|
||||
// store hooks
|
||||
import { useProjectState } from "@/hooks/store";
|
||||
|
||||
export type TChangeWorkItemStateListProps = {
|
||||
projectId: string | null;
|
||||
currentStateId: string | null;
|
||||
handleStateChange: (stateId: string) => void;
|
||||
};
|
||||
|
||||
export const ChangeWorkItemStateList = observer((props: TChangeWorkItemStateListProps) => {
|
||||
const { projectId, currentStateId, handleStateChange } = props;
|
||||
// store hooks
|
||||
const { getProjectStates } = useProjectState();
|
||||
// derived values
|
||||
const projectStates = getProjectStates(projectId);
|
||||
|
||||
return (
|
||||
<>
|
||||
{projectStates ? (
|
||||
projectStates.length > 0 ? (
|
||||
projectStates.map((state) => (
|
||||
<Command.Item key={state.id} onSelect={() => handleStateChange(state.id)} className="focus:outline-none">
|
||||
<div className="flex items-center space-x-3">
|
||||
<StateGroupIcon stateGroup={state.group} color={state.color} height="16px" width="16px" />
|
||||
<p>{state.name}</p>
|
||||
</div>
|
||||
<div>{state.id === currentStateId && <Check className="h-3 w-3" />}</div>
|
||||
</Command.Item>
|
||||
))
|
||||
) : (
|
||||
<div className="text-center">No states found</div>
|
||||
)
|
||||
) : (
|
||||
<Spinner />
|
||||
)}
|
||||
</>
|
||||
);
|
||||
});
|
||||
|
|
@ -0,0 +1 @@
|
|||
export * from "./change-state-list";
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
import { Plus } from "lucide-react";
|
||||
// plane utils
|
||||
import { cn } from "@plane/utils";
|
||||
|
||||
type Props = {
|
||||
workspaceSlug: string;
|
||||
projectId: string;
|
||||
parentStateId: string;
|
||||
onTransitionAdd?: () => void;
|
||||
};
|
||||
|
||||
export const AddStateTransition = (props: Props) => (
|
||||
<div className={cn("flex w-full px-3 h-6 items-center justify-start gap-2 text-sm bg-custom-background-90")}>
|
||||
<>
|
||||
<Plus className="h-4 w-4" color="#8591AD" />
|
||||
<span className="text-custom-text-400 font-medium"> Add Transition</span>
|
||||
<div className="text-white bg-custom-background-80 font-semibold px-2 rounded-lg">Pro</div>
|
||||
</>
|
||||
</div>
|
||||
);
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
export * from "./state-option";
|
||||
export * from "./state-item-child";
|
||||
export * from "./state-transition-count";
|
||||
export * from "./use-workflow-drag-n-drop";
|
||||
export * from "./workflow-disabled-message";
|
||||
export * from "./workflow-group-tree";
|
||||
export * from "./workflow-disabled-overlay";
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
import { SetStateAction } from "react";
|
||||
import { observer } from "mobx-react";
|
||||
// Plane
|
||||
import { DISPLAY_WORKFLOW_PRO_CTA } from "@plane/constants";
|
||||
import { IState } from "@plane/types";
|
||||
// components
|
||||
import { StateItemTitle } from "@/components/project-states/state-item-title";
|
||||
// constants
|
||||
//
|
||||
import { AddStateTransition } from "./add-state-transition";
|
||||
|
||||
export type StateItemChildProps = {
|
||||
workspaceSlug: string;
|
||||
projectId: string;
|
||||
stateCount: number;
|
||||
disabled: boolean;
|
||||
state: IState;
|
||||
setUpdateStateModal: (value: SetStateAction<boolean>) => void;
|
||||
};
|
||||
|
||||
export const StateItemChild = observer((props: StateItemChildProps) => {
|
||||
const { workspaceSlug, projectId, stateCount, setUpdateStateModal, disabled, state } = props;
|
||||
|
||||
return (
|
||||
<div className="flex flex-col w-full items-center justify-between">
|
||||
<StateItemTitle
|
||||
workspaceSlug={workspaceSlug}
|
||||
projectId={projectId}
|
||||
setUpdateStateModal={setUpdateStateModal}
|
||||
stateCount={stateCount}
|
||||
disabled={disabled}
|
||||
state={state}
|
||||
/>
|
||||
{DISPLAY_WORKFLOW_PRO_CTA && (
|
||||
<AddStateTransition workspaceSlug={workspaceSlug} projectId={projectId} parentStateId={state.id} />
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
|
@ -12,6 +12,7 @@ type Props = {
|
|||
filterAvailableStateIds: boolean;
|
||||
selectedValue: string | null | undefined;
|
||||
className?: string;
|
||||
isForWorkItemCreation?: boolean;
|
||||
};
|
||||
|
||||
export const StateOption = observer((props: Props) => {
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
import { IStateWorkFlow } from "@/plane-web/types";
|
||||
|
||||
type Props = {
|
||||
currentTransitionMap?: IStateWorkFlow;
|
||||
};
|
||||
|
||||
export const StateTransitionCount = (props: Props) => <></>;
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
import { TIssueGroupByOptions } from "@plane/types";
|
||||
|
||||
export const useWorkFlowFDragNDrop = (
|
||||
|
|
@ -6,6 +7,7 @@ export const useWorkFlowFDragNDrop = (
|
|||
) => ({
|
||||
workflowDisabledSource: undefined,
|
||||
isWorkflowDropDisabled: false,
|
||||
getIsWorkflowWorkItemCreationDisabled: (groupId: string, subGroupId?: string) => false,
|
||||
handleWorkFlowState: (
|
||||
sourceGroupId: string,
|
||||
destinationGroupId: string,
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
type Props = {
|
||||
parentStateId: string;
|
||||
className?: string;
|
||||
|
|
|
|||
10
web/ce/components/workflow/workflow-disabled-overlay.tsx
Normal file
10
web/ce/components/workflow/workflow-disabled-overlay.tsx
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import { observer } from "mobx-react";
|
||||
|
||||
export type TWorkflowDisabledOverlayProps = {
|
||||
messageContainerRef: React.RefObject<HTMLDivElement>;
|
||||
workflowDisabledSource: string;
|
||||
shouldOverlayBeVisible: boolean;
|
||||
};
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
export const WorkFlowDisabledOverlay = observer((props: TWorkflowDisabledOverlayProps) => <></>);
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
import { TIssueGroupByOptions } from "@plane/types";
|
||||
|
||||
type Props = {
|
||||
|
|
|
|||
2
web/ce/hooks/use-workspace-issue-properties-extended.tsx
Normal file
2
web/ce/hooks/use-workspace-issue-properties-extended.tsx
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
export const useWorkspaceIssuePropertiesExtended = (workspaceSlug: string | string[] | undefined) => {};
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
export * from "./projects";
|
||||
export * from "./issue-types";
|
||||
export * from "./gantt-chart";
|
||||
export * from "./state.d";
|
||||
|
|
|
|||
8
web/ce/types/state.d.ts
vendored
8
web/ce/types/state.d.ts
vendored
|
|
@ -1,8 +0,0 @@
|
|||
export interface IStateTransition {
|
||||
transition_state_id: string;
|
||||
actors: string[];
|
||||
}
|
||||
|
||||
export interface IStateWorkFlow {
|
||||
[transitionId: string]: IStateTransition;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue