Skip to content

Commit

Permalink
chore: code refactor (#5952)
Browse files Browse the repository at this point in the history
* chore: code refactor

* chore: code refactor
  • Loading branch information
anmolsinghbhatia authored Nov 5, 2024
1 parent eed2ca7 commit ea8583b
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 26 deletions.
15 changes: 15 additions & 0 deletions web/ce/components/de-dupe/de-dupe-button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"use client";
import React, { FC } from "react";
// local components

type TDeDupeButtonRoot = {
workspaceSlug: string;
isDuplicateModalOpen: boolean;
handleOnClick: () => void;
label: string;
};

export const DeDupeButtonRoot: FC<TDeDupeButtonRoot> = (props) => {
const { workspaceSlug, isDuplicateModalOpen, label, handleOnClick } = props;
return <></>;
};
1 change: 1 addition & 0 deletions web/ce/components/de-dupe/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from "./de-dupe-button";
export * from "./duplicate-modal";
export * from "./duplicate-popover";
export * from "./issue-block";
20 changes: 7 additions & 13 deletions web/core/components/inbox/modals/create-modal/create-root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { useAppRouter } from "@/hooks/use-app-router";
import useKeypress from "@/hooks/use-keypress";
import { usePlatformOS } from "@/hooks/use-platform-os";
// services
import { DeDupeIssueButtonLabel, DuplicateModalRoot } from "@/plane-web/components/de-dupe";
import { DeDupeButtonRoot, DuplicateModalRoot } from "@/plane-web/components/de-dupe";
import { useDebouncedDuplicateIssues } from "@/plane-web/hooks/use-debounced-duplicate-issues";
import { FileService } from "@/services/file.service";

Expand Down Expand Up @@ -210,18 +210,12 @@ export const InboxIssueCreateRoot: FC<TInboxIssueCreateRoot> = observer((props)
<div className="flex items-center justify-between gap-2">
<h3 className="text-xl font-medium text-custom-text-200">Create intake issue</h3>
{duplicateIssues?.length > 0 && (
<button
onClick={(e) => {
e.stopPropagation();
e.preventDefault();
handleDuplicateIssueModal(!isDuplicateModalOpen);
}}
>
<DeDupeIssueButtonLabel
isOpen={isDuplicateModalOpen}
buttonLabel={`${duplicateIssues.length} duplicate issue${duplicateIssues.length > 1 ? "s" : ""} found!`}
/>
</button>
<DeDupeButtonRoot
workspaceSlug={workspaceSlug}
isDuplicateModalOpen={isDuplicateModalOpen}
label={`${duplicateIssues.length} duplicate issue${duplicateIssues.length > 1 ? "s" : ""} found!`}
handleOnClick={() => handleDuplicateIssueModal(!isDuplicateModalOpen)}
/>
)}
</div>
<div className="space-y-3">
Expand Down
20 changes: 7 additions & 13 deletions web/core/components/issues/issue-modal/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { useIssueDetail, useProject, useProjectState, useWorkspaceDraftIssues }
import { usePlatformOS } from "@/hooks/use-platform-os";
import { useProjectIssueProperties } from "@/hooks/use-project-issue-properties";
// plane web components
import { DeDupeIssueButtonLabel, DuplicateModalRoot } from "@/plane-web/components/de-dupe";
import { DeDupeButtonRoot, DuplicateModalRoot } from "@/plane-web/components/de-dupe";
import { IssueAdditionalProperties, IssueTypeSelect } from "@/plane-web/components/issues/issue-modal";
import { useDebouncedDuplicateIssues } from "@/plane-web/hooks/use-debounced-duplicate-issues";

Expand Down Expand Up @@ -350,18 +350,12 @@ export const IssueFormRoot: FC<IssueFormProps> = observer((props) => {
)}
</div>
{duplicateIssues.length > 0 && (
<button
onClick={(e) => {
e.stopPropagation();
e.preventDefault();
handleDuplicateIssueModal(!isDuplicateModalOpen);
}}
>
<DeDupeIssueButtonLabel
isOpen={isDuplicateModalOpen}
buttonLabel={`${duplicateIssues.length} duplicate issue${duplicateIssues.length > 1 ? "s" : ""} found!`}
/>
</button>
<DeDupeButtonRoot
workspaceSlug={workspaceSlug?.toString()}
isDuplicateModalOpen={isDuplicateModalOpen}
label={`${duplicateIssues.length} duplicate issue${duplicateIssues.length > 1 ? "s" : ""} found!`}
handleOnClick={() => handleDuplicateIssueModal(!isDuplicateModalOpen)}
/>
)}
</div>
{watch("parent_id") && selectedParentIssue && (
Expand Down
1 change: 1 addition & 0 deletions web/ee/components/de-dupe/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "ce/components/de-dupe";

0 comments on commit ea8583b

Please sign in to comment.