mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
chore: minor improvements.
This commit is contained in:
parent
d6e87f0c4e
commit
33ebce09a4
@ -27,10 +27,9 @@ const CycleDropdownOption: React.FC<{ cycleId: string }> = ({ cycleId }) => {
|
||||
// router
|
||||
const router = useRouter();
|
||||
const { workspaceSlug, projectId } = router.query;
|
||||
|
||||
// store hooks
|
||||
const { getCycleById } = useCycle();
|
||||
|
||||
// derived values
|
||||
const cycle = getCycleById(cycleId);
|
||||
|
||||
if (!cycle) return null;
|
||||
@ -130,8 +129,8 @@ export const CycleIssuesHeader: React.FC = observer(() => {
|
||||
[workspaceSlug, projectId, cycleId, updateFilters]
|
||||
);
|
||||
|
||||
// derived values
|
||||
const cycleDetails = cycleId ? getCycleById(cycleId.toString()) : undefined;
|
||||
|
||||
const canUserCreateIssue =
|
||||
currentProjectRole && [EUserProjectRoles.ADMIN, EUserProjectRoles.MEMBER].includes(currentProjectRole);
|
||||
|
||||
|
@ -28,10 +28,9 @@ const ModuleDropdownOption: React.FC<{ moduleId: string }> = ({ moduleId }) => {
|
||||
// router
|
||||
const router = useRouter();
|
||||
const { workspaceSlug, projectId } = router.query;
|
||||
|
||||
// store hooks
|
||||
const { getModuleById } = useModule();
|
||||
|
||||
// derived values
|
||||
const moduleDetail = getModuleById(moduleId);
|
||||
|
||||
if (!moduleDetail) return null;
|
||||
@ -130,8 +129,8 @@ export const ModuleIssuesHeader: React.FC = observer(() => {
|
||||
[workspaceSlug, projectId, moduleId, updateFilters]
|
||||
);
|
||||
|
||||
// derived values
|
||||
const moduleDetails = moduleId ? getModuleById(moduleId.toString()) : undefined;
|
||||
|
||||
const canUserCreateIssue =
|
||||
currentProjectRole && [EUserProjectRoles.ADMIN, EUserProjectRoles.MEMBER].includes(currentProjectRole);
|
||||
|
||||
|
@ -34,8 +34,7 @@ export const IssueCycleSelect: React.FC<IssueCycleSelectProps> = observer((props
|
||||
if (workspaceSlug && projectId) fetchAllCycles(workspaceSlug, projectId);
|
||||
};
|
||||
|
||||
const selectedCycleId = projectAllCycles ? projectAllCycles?.find((cycleId) => cycleId === value) : null;
|
||||
const selectedCycle = selectedCycleId ? getCycleById(selectedCycleId) : null;
|
||||
const selectedCycle = value ? getCycleById(value) : null;
|
||||
|
||||
const options = projectAllCycles?.map((cycleId) => {
|
||||
const cycleDetail = getCycleById(cycleId);
|
||||
|
@ -64,9 +64,6 @@ export const SidebarModuleSelect: React.FC<Props> = observer((props) => {
|
||||
});
|
||||
};
|
||||
|
||||
const selectedModuleId = projectModules ? projectModules.find((moduleId) => moduleId === issueModule?.module) : null;
|
||||
const selectedModule = selectedModuleId ? getModuleById(selectedModuleId) : null;
|
||||
|
||||
const options = projectModules?.map((moduleId) => {
|
||||
const moduleDetail = getModuleById(moduleId);
|
||||
return {
|
||||
@ -83,8 +80,9 @@ export const SidebarModuleSelect: React.FC<Props> = observer((props) => {
|
||||
};
|
||||
});
|
||||
|
||||
// derived values
|
||||
const issueModule = issueDetail?.issue_module;
|
||||
|
||||
const selectedModule = issueModule?.module ? getModuleById(issueModule?.module) : null;
|
||||
const disableSelect = disabled || isUpdating;
|
||||
|
||||
return (
|
||||
@ -101,10 +99,7 @@ export const SidebarModuleSelect: React.FC<Props> = observer((props) => {
|
||||
options={options}
|
||||
customButton={
|
||||
<div>
|
||||
<Tooltip
|
||||
position="left"
|
||||
tooltipContent={`${selectedModule?.name ?? "No module"}`}
|
||||
>
|
||||
<Tooltip position="left" tooltipContent={`${selectedModule?.name ?? "No module"}`}>
|
||||
<button
|
||||
type="button"
|
||||
className={`flex w-full items-center rounded bg-custom-background-80 px-2.5 py-0.5 text-xs ${
|
||||
@ -117,9 +112,7 @@ export const SidebarModuleSelect: React.FC<Props> = observer((props) => {
|
||||
}`}
|
||||
>
|
||||
<span className="flex-shrink-0">{issueModule && <DiceIcon className="h-3.5 w-3.5" />}</span>
|
||||
<span className="truncate">
|
||||
{selectedModule?.name ?? "No module"}
|
||||
</span>
|
||||
<span className="truncate">{selectedModule?.name ?? "No module"}</span>
|
||||
</span>
|
||||
</button>
|
||||
</Tooltip>
|
||||
|
Loading…
Reference in New Issue
Block a user