From 63b850f92fa04db49b9b0f3c3b1f3605ac7f9add Mon Sep 17 00:00:00 2001 From: rahulramesha Date: Fri, 8 Mar 2024 18:21:28 +0530 Subject: [PATCH] fix some build errors due to type changes --- packages/types/src/issues/issue.d.ts | 2 +- packages/ui/src/icons/priority-icon.tsx | 6 +- .../widgets/issue-panels/issue-list-item.tsx | 12 +- .../widgets/issue-panels/issues-list.tsx | 2 +- web/components/dropdowns/cycle/index.tsx | 4 +- web/components/dropdowns/estimate.tsx | 6 +- web/components/dropdowns/module/index.tsx | 4 +- web/components/dropdowns/priority.tsx | 16 +-- web/components/dropdowns/state.tsx | 6 +- .../inbox/modals/delete-issue-modal.tsx | 2 +- .../inbox/modals/select-duplicate.tsx | 2 +- .../inbox/sidebar/inbox-list-item.tsx | 2 +- .../issue-detail/inbox/main-content.tsx | 2 +- .../issues/issue-detail/main-content.tsx | 2 +- .../issues/issue-detail/parent/siblings.tsx | 2 +- .../issues/issue-layouts/gantt/blocks.tsx | 2 + .../issues/issue-layouts/kanban/block.tsx | 2 +- .../issues/issue-layouts/list/block.tsx | 2 +- .../properties/all-properties.tsx | 8 +- .../spreadsheet/columns/assignee-column.tsx | 2 +- .../spreadsheet/columns/cycle-column.tsx | 4 +- .../spreadsheet/columns/module-column.tsx | 6 +- .../spreadsheet/columns/state-column.tsx | 2 +- web/components/issues/issue-modal/form.tsx | 18 +-- web/components/issues/issue-modal/modal.tsx | 4 +- .../issues/parent-issues-list-modal.tsx | 2 +- .../issues/peek-overview/issue-detail.tsx | 4 +- web/components/issues/select/label.tsx | 2 +- .../issues/sub-issues/issue-list-item.tsx | 28 ++-- .../issues/sub-issues/properties.tsx | 7 +- web/hooks/use-issues-actions.tsx | 132 +++++++++--------- .../archived-issues/[archivedIssueId].tsx | 10 +- web/store/estimate.store.ts | 11 +- web/store/label.store.ts | 8 +- web/store/project/project.store.ts | 12 +- web/store/state.store.ts | 10 +- 36 files changed, 180 insertions(+), 166 deletions(-) diff --git a/packages/types/src/issues/issue.d.ts b/packages/types/src/issues/issue.d.ts index 350555358..310a34396 100644 --- a/packages/types/src/issues/issue.d.ts +++ b/packages/types/src/issues/issue.d.ts @@ -24,7 +24,7 @@ export type TBaseIssue = { project_id: string | null; parent_id: string | null; cycle_id: string | null; - module_ids: string[]; + module_ids: string[] | null; created_at: string; updated_at: string; diff --git a/packages/ui/src/icons/priority-icon.tsx b/packages/ui/src/icons/priority-icon.tsx index 0b98b3e6b..3bdc2951e 100644 --- a/packages/ui/src/icons/priority-icon.tsx +++ b/packages/ui/src/icons/priority-icon.tsx @@ -7,7 +7,7 @@ type TIssuePriorities = "urgent" | "high" | "medium" | "low" | "none"; interface IPriorityIcon { className?: string; containerClassName?: string; - priority: TIssuePriorities; + priority: TIssuePriorities | undefined | null; size?: number; withContainer?: boolean; } @@ -31,7 +31,7 @@ export const PriorityIcon: React.FC = (props) => { low: SignalLow, none: Ban, }; - const Icon = icons[priority]; + const Icon = icons[priority ?? "none"]; if (!Icon) return null; @@ -41,7 +41,7 @@ export const PriorityIcon: React.FC = (props) => {
diff --git a/web/components/dashboard/widgets/issue-panels/issue-list-item.tsx b/web/components/dashboard/widgets/issue-panels/issue-list-item.tsx index a5279f715..a0dd97c6e 100644 --- a/web/components/dashboard/widgets/issue-panels/issue-list-item.tsx +++ b/web/components/dashboard/widgets/issue-panels/issue-list-item.tsx @@ -25,7 +25,7 @@ export const AssignedUpcomingIssueListItem: React.FC = obser // derived values const issueDetails = getIssueById(issueId) as TWidgetIssue | undefined; - if (!issueDetails) return null; + if (!issueDetails || !issueDetails.project_id) return null; const projectDetails = getProjectById(issueDetails.project_id); @@ -75,7 +75,7 @@ export const AssignedOverdueIssueListItem: React.FC = observ // derived values const issueDetails = getIssueById(issueId) as TWidgetIssue | undefined; - if (!issueDetails) return null; + if (!issueDetails || !issueDetails.project_id) return null; const projectDetails = getProjectById(issueDetails.project_id); const blockedByIssues = issueDetails.issue_relation?.filter((issue) => issue.relation_type === "blocked_by") ?? []; @@ -122,7 +122,7 @@ export const AssignedCompletedIssueListItem: React.FC = obse // derived values const issueDetails = getIssueById(issueId); - if (!issueDetails) return null; + if (!issueDetails || !issueDetails.project_id) return null; const projectDetails = getProjectById(issueDetails.project_id); @@ -154,7 +154,7 @@ export const CreatedUpcomingIssueListItem: React.FC = observ // derived values const issue = getIssueById(issueId); - if (!issue) return null; + if (!issue || !issue.project_id) return null; const projectDetails = getProjectById(issue.project_id); @@ -208,7 +208,7 @@ export const CreatedOverdueIssueListItem: React.FC = observe // derived values const issue = getIssueById(issueId); - if (!issue) return null; + if (!issue || !issue.project_id) return null; const projectDetails = getProjectById(issue.project_id); @@ -260,7 +260,7 @@ export const CreatedCompletedIssueListItem: React.FC = obser // derived values const issue = getIssueById(issueId); - if (!issue) return null; + if (!issue || !issue.project_id) return null; const projectDetails = getProjectById(issue.project_id); diff --git a/web/components/dashboard/widgets/issue-panels/issues-list.tsx b/web/components/dashboard/widgets/issue-panels/issues-list.tsx index c429f3599..8690377a7 100644 --- a/web/components/dashboard/widgets/issue-panels/issues-list.tsx +++ b/web/components/dashboard/widgets/issue-panels/issues-list.tsx @@ -35,7 +35,7 @@ export const WidgetIssuesList: React.FC = (props) => { const { setPeekIssue } = useIssueDetail(); const handleIssuePeekOverview = (issue: TIssue) => - setPeekIssue({ workspaceSlug, projectId: issue.project_id, issueId: issue.id }); + issue.project_id && setPeekIssue({ workspaceSlug, projectId: issue.project_id, issueId: issue.id }); const filterParams = getRedirectionFilters(tab); diff --git a/web/components/dropdowns/cycle/index.tsx b/web/components/dropdowns/cycle/index.tsx index 8c08cd67d..7d0d755f9 100644 --- a/web/components/dropdowns/cycle/index.tsx +++ b/web/components/dropdowns/cycle/index.tsx @@ -24,7 +24,7 @@ type Props = TDropdownProps & { dropdownArrowClassName?: string; onChange: (val: string | null) => void; onClose?: () => void; - projectId: string; + projectId: string | undefined; value: string | null; }; @@ -142,7 +142,7 @@ export const CycleDropdown: React.FC = observer((props) => { )} - {isOpen && ( + {isOpen && projectId && ( )} diff --git a/web/components/dropdowns/estimate.tsx b/web/components/dropdowns/estimate.tsx index bc977d1ce..6d14ce25c 100644 --- a/web/components/dropdowns/estimate.tsx +++ b/web/components/dropdowns/estimate.tsx @@ -23,7 +23,7 @@ type Props = TDropdownProps & { dropdownArrowClassName?: string; onChange: (val: number | null) => void; onClose?: () => void; - projectId: string; + projectId: string | undefined; value: number | null; }; @@ -107,10 +107,10 @@ export const EstimateDropdown: React.FC = observer((props) => { const filteredOptions = query === "" ? options : options?.filter((o) => o.query.toLowerCase().includes(query.toLowerCase())); - const selectedEstimate = value !== null ? getEstimatePointValue(value, projectId) : null; + const selectedEstimate = value !== null && projectId ? getEstimatePointValue(value, projectId) : null; const onOpen = () => { - if (!activeEstimate && workspaceSlug) fetchProjectEstimates(workspaceSlug, projectId); + if (!activeEstimate && workspaceSlug && projectId) fetchProjectEstimates(workspaceSlug, projectId); }; const handleClose = () => { diff --git a/web/components/dropdowns/module/index.tsx b/web/components/dropdowns/module/index.tsx index 882604712..eebd9573b 100644 --- a/web/components/dropdowns/module/index.tsx +++ b/web/components/dropdowns/module/index.tsx @@ -22,7 +22,7 @@ type Props = TDropdownProps & { button?: ReactNode; dropdownArrow?: boolean; dropdownArrowClassName?: string; - projectId: string; + projectId: string | undefined; showCount?: boolean; onClose?: () => void; } & ( @@ -272,7 +272,7 @@ export const ModuleDropdown: React.FC = observer((props) => { )} - {isOpen && ( + {isOpen && projectId && ( void; onClose?: () => void; - value: TIssuePriorities; + value: TIssuePriorities | undefined | null; }; type ButtonProps = { @@ -35,7 +35,7 @@ type ButtonProps = { hideText?: boolean; isActive?: boolean; highlightUrgent: boolean; - priority: TIssuePriorities; + priority: TIssuePriorities | undefined; showTooltip: boolean; }; @@ -66,7 +66,7 @@ const BorderButton = (props: ButtonProps) => {