diff --git a/apps/app/components/issues/sidebar-select/assignee.tsx b/apps/app/components/issues/sidebar-select/assignee.tsx index ad7db744f4..61ece6f786 100644 --- a/apps/app/components/issues/sidebar-select/assignee.tsx +++ b/apps/app/components/issues/sidebar-select/assignee.tsx @@ -48,10 +48,10 @@ export const SidebarAssigneeSelect: React.FC = ({ value, onChange, disabl {value && value.length > 0 && Array.isArray(value) ? (
- {value.length} Assignees + {value.length} Assignees
) : ( - )} diff --git a/apps/app/components/issues/sidebar-select/blocked.tsx b/apps/app/components/issues/sidebar-select/blocked.tsx index 76373700cc..fbe58b4b2f 100644 --- a/apps/app/components/issues/sidebar-select/blocked.tsx +++ b/apps/app/components/issues/sidebar-select/blocked.tsx @@ -18,7 +18,6 @@ type Props = { issueId?: string; submitChanges: (formData: Partial) => void; watch: UseFormWatch; - userAuth: UserAuth; disabled?: boolean; }; @@ -26,7 +25,6 @@ export const SidebarBlockedSelect: React.FC = ({ issueId, submitChanges, watch, - userAuth, disabled = false, }) => { const [isBlockedModalOpen, setIsBlockedModalOpen] = useState(false); @@ -73,8 +71,6 @@ export const SidebarBlockedSelect: React.FC = ({ handleClose(); }; - const isNotAllowed = userAuth.isGuest || userAuth.isViewer || disabled; - return ( <> = ({ diff --git a/apps/app/components/issues/sidebar-select/blocker.tsx b/apps/app/components/issues/sidebar-select/blocker.tsx index c25adc49e1..49a6bc505e 100644 --- a/apps/app/components/issues/sidebar-select/blocker.tsx +++ b/apps/app/components/issues/sidebar-select/blocker.tsx @@ -18,7 +18,6 @@ type Props = { issueId?: string; submitChanges: (formData: Partial) => void; watch: UseFormWatch; - userAuth: UserAuth; disabled?: boolean; }; @@ -26,7 +25,6 @@ export const SidebarBlockerSelect: React.FC = ({ issueId, submitChanges, watch, - userAuth, disabled = false, }) => { const [isBlockerModalOpen, setIsBlockerModalOpen] = useState(false); @@ -73,8 +71,6 @@ export const SidebarBlockerSelect: React.FC = ({ handleClose(); }; - const isNotAllowed = userAuth.isGuest || userAuth.isViewer || disabled; - return ( <> = ({ diff --git a/apps/app/components/issues/sidebar-select/cycle.tsx b/apps/app/components/issues/sidebar-select/cycle.tsx index 1eacba2451..3451be2c3c 100644 --- a/apps/app/components/issues/sidebar-select/cycle.tsx +++ b/apps/app/components/issues/sidebar-select/cycle.tsx @@ -11,24 +11,20 @@ import cyclesService from "services/cycles.service"; import { Spinner, CustomSelect, Tooltip } from "components/ui"; // helper import { truncateText } from "helpers/string.helper"; -// icons -import { ContrastIcon } from "components/icons"; // types -import { ICycle, IIssue, UserAuth } from "types"; +import { ICycle, IIssue } from "types"; // fetch-keys import { CYCLE_ISSUES, INCOMPLETE_CYCLES_LIST, ISSUE_DETAILS } from "constants/fetch-keys"; type Props = { issueDetail: IIssue | undefined; handleCycleChange: (cycle: ICycle) => void; - userAuth: UserAuth; disabled?: boolean; }; export const SidebarCycleSelect: React.FC = ({ issueDetail, handleCycleChange, - userAuth, disabled = false, }) => { const router = useRouter(); @@ -63,59 +59,56 @@ export const SidebarCycleSelect: React.FC = ({ const issueCycle = issueDetail?.issue_cycle; - const isNotAllowed = userAuth.isGuest || userAuth.isViewer || disabled; - return ( -
-
- -

Cycle

-
-
- - - - {issueCycle ? truncateText(issueCycle.cycle_detail.name, 15) : "No cycle"} - - - - } - value={issueCycle ? issueCycle.cycle_detail.id : null} - onChange={(value: any) => { - !value - ? removeIssueFromCycle(issueCycle?.id ?? "", issueCycle?.cycle ?? "") - : handleCycleChange(incompleteCycles?.find((c) => c.id === value) as ICycle); - }} - width="w-full" - position="right" - maxHeight="rg" - disabled={isNotAllowed} + - {incompleteCycles ? ( - incompleteCycles.length > 0 ? ( - <> - {incompleteCycles.map((option) => ( - - - {truncateText(option.name, 25)} - - - ))} - None - - ) : ( -
No cycles found
- ) - ) : ( - - )} -
-
-
+ + + } + value={issueCycle ? issueCycle.cycle_detail.id : null} + onChange={(value: any) => { + !value + ? removeIssueFromCycle(issueCycle?.id ?? "", issueCycle?.cycle ?? "") + : handleCycleChange(incompleteCycles?.find((c) => c.id === value) as ICycle); + }} + width="w-full" + position="right" + maxHeight="rg" + disabled={disabled} + > + {incompleteCycles ? ( + incompleteCycles.length > 0 ? ( + <> + {incompleteCycles.map((option) => ( + + + {truncateText(option.name, 25)} + + + ))} + None + + ) : ( +
No cycles found
+ ) + ) : ( + + )} + ); }; diff --git a/apps/app/components/issues/sidebar-select/estimate.tsx b/apps/app/components/issues/sidebar-select/estimate.tsx index 0636941414..7ebdfe2b9d 100644 --- a/apps/app/components/issues/sidebar-select/estimate.tsx +++ b/apps/app/components/issues/sidebar-select/estimate.tsx @@ -14,9 +14,7 @@ type Props = { }; export const SidebarEstimateSelect: React.FC = ({ value, onChange, disabled = false }) => { - const { isEstimateActive, estimatePoints } = useEstimateOption(); - - if (!isEstimateActive) return null; + const { estimatePoints } = useEstimateOption(); return ( void; - userAuth: UserAuth; disabled?: boolean; }; export const SidebarModuleSelect: React.FC = ({ issueDetail, handleModuleChange, - userAuth, disabled = false, }) => { const router = useRouter(); @@ -57,66 +53,60 @@ export const SidebarModuleSelect: React.FC = ({ const issueModule = issueDetail?.issue_module; - const isNotAllowed = userAuth.isGuest || userAuth.isViewer || disabled; - return ( -
-
- -

Module

-
-
- m.id === issueModule?.module)?.name ?? "No module" + m.id === issueModule?.module)?.name ?? "No module" + }`} + > +
-
+ {modules?.find((m) => m.id === issueModule?.module)?.name ?? "No module"} + + + + } + value={issueModule ? issueModule.module_detail?.id : null} + onChange={(value: any) => { + !value + ? removeIssueFromModule(issueModule?.id ?? "", issueModule?.module ?? "") + : handleModuleChange(modules?.find((m) => m.id === value) as IModule); + }} + width="w-full" + position="right" + maxHeight="rg" + disabled={disabled} + > + {modules ? ( + modules.length > 0 ? ( + <> + {modules.map((option) => ( + + + {truncateText(option.name, 25)} + + + ))} + None + + ) : ( +
No modules found
+ ) + ) : ( + + )} +
); }; diff --git a/apps/app/components/issues/sidebar-select/parent.tsx b/apps/app/components/issues/sidebar-select/parent.tsx index 1e780dd572..dd5d4f55b4 100644 --- a/apps/app/components/issues/sidebar-select/parent.tsx +++ b/apps/app/components/issues/sidebar-select/parent.tsx @@ -2,8 +2,6 @@ import React, { useState } from "react"; import { useRouter } from "next/router"; -// icons -import { UserIcon } from "@heroicons/react/24/outline"; // components import { ParentIssuesListModal } from "components/issues"; // types @@ -12,14 +10,12 @@ import { IIssue, ISearchIssueResponse, UserAuth } from "types"; type Props = { onChange: (value: string) => void; issueDetails: IIssue | undefined; - userAuth: UserAuth; disabled?: boolean; }; export const SidebarParentSelect: React.FC = ({ onChange, issueDetails, - userAuth, disabled = false, }) => { const [isParentModalOpen, setIsParentModalOpen] = useState(false); @@ -28,42 +24,34 @@ export const SidebarParentSelect: React.FC = ({ const router = useRouter(); const { projectId, issueId } = router.query; - const isNotAllowed = userAuth.isGuest || userAuth.isViewer || disabled; - return ( -
-
- -

Parent

-
-
- setIsParentModalOpen(false)} - onChange={(issue) => { - onChange(issue.id); - setSelectedParentIssue(issue); - }} - issueId={issueId as string} - projectId={projectId as string} - /> - -
-
+ <> + setIsParentModalOpen(false)} + onChange={(issue) => { + onChange(issue.id); + setSelectedParentIssue(issue); + }} + issueId={issueId as string} + projectId={projectId as string} + /> + + ); }; diff --git a/apps/app/components/issues/sidebar-select/priority.tsx b/apps/app/components/issues/sidebar-select/priority.tsx index dfaa712e21..fd1c77f289 100644 --- a/apps/app/components/issues/sidebar-select/priority.tsx +++ b/apps/app/components/issues/sidebar-select/priority.tsx @@ -18,7 +18,7 @@ export const SidebarPrioritySelect: React.FC = ({ value, onChange, disabl customButton={