Skip to content

Commit 211d5e1

Browse files
chore: code refactor and build fix (#6285)
* chore: code refactor and build fix * chore: code refactor * chore: code refactor
1 parent 3c6bbae commit 211d5e1

33 files changed

+293
-102
lines changed

web/core/components/issues/delete-issue-modal.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@ import { PROJECT_ERROR_MESSAGES } from "@/constants/project";
1111
import { useIssues, useProject, useUser, useUserPermissions } from "@/hooks/store";
1212
// plane-web
1313
import { EUserPermissions, EUserPermissionsLevel } from "@/plane-web/constants/user-permissions";
14-
1514
type Props = {
1615
isOpen: boolean;
1716
handleClose: () => void;
1817
dataId?: string | null | undefined;
1918
data?: TIssue | TDeDupeIssue;
2019
isSubIssue?: boolean;
2120
onSubmit?: () => Promise<void>;
21+
isEpic?: boolean;
2222
};
2323

2424
export const DeleteIssueModal: React.FC<Props> = (props) => {
25-
const { dataId, data, isOpen, handleClose, isSubIssue = false, onSubmit } = props;
25+
const { dataId, data, isOpen, handleClose, isSubIssue = false, onSubmit, isEpic = false } = props;
2626
// states
2727
const [isDeleting, setIsDeleting] = useState(false);
2828
// store hooks
@@ -70,12 +70,14 @@ export const DeleteIssueModal: React.FC<Props> = (props) => {
7070
setToast({
7171
type: TOAST_TYPE.SUCCESS,
7272
title: "Success!",
73-
message: `${isSubIssue ? "Sub-issue" : "Issue"} deleted successfully`,
73+
message: `${isSubIssue ? "Sub-issue" : isEpic ? "Epic" : "Issue"} deleted successfully`,
7474
});
7575
onClose();
7676
})
7777
.catch((errors) => {
78-
const isPermissionError = errors?.error === "Only admin or creator can delete the issue";
78+
const isPermissionError =
79+
errors?.error ===
80+
`Only admin or creator can delete the ${isSubIssue ? "sub-issue" : isEpic ? "epic" : "issue"}`;
7981
const currentError = isPermissionError
8082
? PROJECT_ERROR_MESSAGES.permissionError
8183
: PROJECT_ERROR_MESSAGES.issueDeleteError;
@@ -94,14 +96,14 @@ export const DeleteIssueModal: React.FC<Props> = (props) => {
9496
handleSubmit={handleIssueDelete}
9597
isSubmitting={isDeleting}
9698
isOpen={isOpen}
97-
title="Delete issue"
99+
title={`Delete ${isEpic ? "epic" : "issue"}`}
98100
content={
99101
<>
100-
Are you sure you want to delete issue{" "}
102+
{`Are you sure you want to delete ${isEpic ? "epic" : "issue"} `}
101103
<span className="break-words font-medium text-custom-text-100">
102104
{projectDetails?.identifier}-{issue?.sequence_id}
103105
</span>
104-
{""}? All of the data related to the issue will be permanently removed. This action cannot be undone.
106+
{` ? All of the data related to the ${isEpic ? "epic" : "issue"} will be permanently removed. This action cannot be undone.`}
105107
</>
106108
}
107109
/>

web/core/components/issues/filters.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ const HeaderFilters = observer((props: Props) => {
123123
states={projectStates}
124124
cycleViewDisabled={!currentProjectDetails?.cycle_view}
125125
moduleViewDisabled={!currentProjectDetails?.module_view}
126+
isEpic={storeType === EIssuesStoreType.EPIC}
126127
/>
127128
</FiltersDropdown>
128129
<FiltersDropdown title="Display" placement="bottom-end">
@@ -134,6 +135,7 @@ const HeaderFilters = observer((props: Props) => {
134135
handleDisplayPropertiesUpdate={handleDisplayProperties}
135136
cycleViewDisabled={!currentProjectDetails?.cycle_view}
136137
moduleViewDisabled={!currentProjectDetails?.module_view}
138+
isEpic={storeType === EIssuesStoreType.EPIC}
137139
/>
138140
</FiltersDropdown>
139141
{canUserCreateIssue ? (

web/core/components/issues/issue-detail-widgets/sub-issues/content.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,10 @@ export const SubIssuesCollapsibleContent: FC<Props> = observer((props) => {
5353
},
5454
});
5555
// store hooks
56+
const { toggleCreateIssueModal, toggleDeleteIssueModal } = useIssueDetail();
5657
const {
5758
subIssues: { subIssueHelpersByIssueId, setSubIssueHelpers },
58-
toggleCreateIssueModal,
59-
toggleDeleteIssueModal,
60-
} = useIssueDetail();
59+
} = useIssueDetail(issueServiceType);
6160

6261
// helpers
6362
const subIssueOperations = useSubIssueOperations(issueServiceType);

web/core/components/issues/issue-detail-widgets/sub-issues/title.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export const SubIssuesCollapsibleTitle: FC<Props> = observer((props) => {
3838
return (
3939
<CollapsibleButton
4040
isOpen={isOpen}
41-
title="Sub-issues"
41+
title={`${issueServiceType === EIssueServiceType.EPICS ? "Issues" : "Sub-issues"}`}
4242
indicatorElement={
4343
<div className="flex items-center gap-1.5 text-custom-text-300 text-sm">
4444
<CircularProgressIndicator size={18} percentage={percentage} strokeWidth={3} />

web/core/components/issues/issue-detail/issue-activity/sort-root.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,24 @@ import { cn } from "@/helpers/common.helper";
99
export type TActivitySortRoot = {
1010
sortOrder: "asc" | "desc";
1111
toggleSort: () => void;
12+
className?: string;
13+
iconClassName?: string;
1214
};
1315
export const ActivitySortRoot: FC<TActivitySortRoot> = memo((props) => (
1416
<div
15-
className={cn(getButtonStyling("neutral-primary", "sm"), "px-2 text-custom-text-300 cursor-pointer")}
17+
className={cn(
18+
getButtonStyling("neutral-primary", "sm"),
19+
"px-2 text-custom-text-300 cursor-pointer",
20+
props.className
21+
)}
1622
onClick={() => {
1723
props.toggleSort();
1824
}}
1925
>
2026
{props.sortOrder === "asc" ? (
21-
<ArrowUpWideNarrow className="size-4 " />
27+
<ArrowUpWideNarrow className={cn("size-4", props.iconClassName)} />
2228
) : (
23-
<ArrowDownWideNarrow className="size-4 " />
29+
<ArrowDownWideNarrow className={cn("size-4", props.iconClassName)} />
2430
)}
2531
</div>
2632
));

web/core/components/issues/issue-layouts/calendar/base-calendar-root.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export const BaseCalendarRoot = observer((props: IBaseCalendarRoot) => {
5050
const { workspaceSlug } = useParams();
5151

5252
// hooks
53-
const storeType = useIssueStoreType() as CalendarStoreType;
53+
const storeType = isEpic ? EIssuesStoreType.EPIC : (useIssueStoreType() as CalendarStoreType);
5454
const { allowPermissions } = useUserPermissions();
5555
const { issues, issuesFilter, issueMap } = useIssues(storeType);
5656
const {

web/core/components/issues/issue-layouts/calendar/issue-blocks.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ export const CalendarIssueBlocks: React.FC<Props> = observer((props) => {
8787
}}
8888
quickAddCallback={quickAddCallback}
8989
addIssuesToView={addIssuesToView}
90+
isEpic={isEpic}
9091
/>
9192
</div>
9293
)}

web/core/components/issues/issue-layouts/filters/header/display-filters/display-filters-selection.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ type Props = {
2525
ignoreGroupedFilters?: Partial<TIssueGroupByOptions>[];
2626
cycleViewDisabled?: boolean;
2727
moduleViewDisabled?: boolean;
28+
isEpic?: boolean;
2829
};
2930

3031
export const DisplayFiltersSelection: React.FC<Props> = observer((props) => {
@@ -37,6 +38,7 @@ export const DisplayFiltersSelection: React.FC<Props> = observer((props) => {
3738
ignoreGroupedFilters = [],
3839
cycleViewDisabled = false,
3940
moduleViewDisabled = false,
41+
isEpic = false,
4042
} = props;
4143

4244
const isDisplayFilterEnabled = (displayFilter: keyof IIssueDisplayFilterOptions) =>
@@ -61,6 +63,7 @@ export const DisplayFiltersSelection: React.FC<Props> = observer((props) => {
6163
handleUpdate={handleDisplayPropertiesUpdate}
6264
cycleViewDisabled={cycleViewDisabled}
6365
moduleViewDisabled={moduleViewDisabled}
66+
isEpic={isEpic}
6467
/>
6568
</div>
6669
)}

web/core/components/issues/issue-layouts/filters/header/display-filters/display-properties.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ type Props = {
1616
handleUpdate: (updatedDisplayProperties: Partial<IIssueDisplayProperties>) => void;
1717
cycleViewDisabled?: boolean;
1818
moduleViewDisabled?: boolean;
19+
isEpic?: boolean;
1920
};
2021

2122
export const FilterDisplayProperties: React.FC<Props> = observer((props) => {
@@ -25,6 +26,7 @@ export const FilterDisplayProperties: React.FC<Props> = observer((props) => {
2526
handleUpdate,
2627
cycleViewDisabled = false,
2728
moduleViewDisabled = false,
29+
isEpic = false,
2830
} = props;
2931
// router
3032
const { workspaceSlug, projectId: routerProjectId } = useParams();
@@ -45,6 +47,11 @@ export const FilterDisplayProperties: React.FC<Props> = observer((props) => {
4547
default:
4648
return shouldRenderDisplayProperty({ workspaceSlug: workspaceSlug?.toString(), projectId, key: property.key });
4749
}
50+
}).map((property) => {
51+
if (isEpic && property.key === "sub_issue_count") {
52+
return { ...property, title: "Issue count" };
53+
}
54+
return property;
4855
});
4956

5057
return (

web/core/components/issues/issue-layouts/filters/header/display-filters/issue-grouping.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ import { ISSUE_FILTER_OPTIONS } from "@/constants/issue";
1111
type Props = {
1212
selectedIssueType: TIssueGroupingFilters | undefined;
1313
handleUpdate: (val: TIssueGroupingFilters) => void;
14+
isEpic?: boolean;
1415
};
1516

1617
export const FilterIssueGrouping: React.FC<Props> = observer((props) => {
17-
const { selectedIssueType, handleUpdate } = props;
18+
const { selectedIssueType, handleUpdate, isEpic = false } = props;
1819

1920
const [previewEnabled, setPreviewEnabled] = React.useState(true);
2021

@@ -23,7 +24,7 @@ export const FilterIssueGrouping: React.FC<Props> = observer((props) => {
2324
return (
2425
<>
2526
<FilterHeader
26-
title="Issue Grouping"
27+
title={`${isEpic ? "Epic" : "Issue"} Grouping`}
2728
isPreviewEnabled={previewEnabled}
2829
handleIsPreviewEnabled={() => setPreviewEnabled(!previewEnabled)}
2930
/>
@@ -34,7 +35,7 @@ export const FilterIssueGrouping: React.FC<Props> = observer((props) => {
3435
key={issueType?.key}
3536
isChecked={activeIssueType === issueType?.key ? true : false}
3637
onClick={() => handleUpdate(issueType?.key)}
37-
title={issueType.title}
38+
title={`${issueType.title} ${isEpic ? "Epics" : "Issues"}`}
3839
multiple={false}
3940
/>
4041
))}

0 commit comments

Comments
 (0)