Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type Options = {

export const cycleEstimateOptions: Options[] = [
{ value: "issues", label: "Work items" },
{ value: "points", label: "Points" },
{ value: "points", label: "Estimates" },
];
export const cycleChartOptions: Options[] = [
{ value: "burndown", label: "Burn-down" },
Expand Down
11 changes: 7 additions & 4 deletions web/core/components/cycles/dropdowns/estimate-type-dropdown.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import React from "react";
import { observer } from "mobx-react-lite";
import { TCycleEstimateType } from "@plane/types";
import { EEstimateSystem } from "@plane/types/src/enums";
import { CustomSelect } from "@plane/ui";
import { useCycle, useProjectEstimates } from "@/hooks/store";
import { cycleEstimateOptions } from "../analytics-sidebar";
Expand All @@ -12,12 +14,13 @@ type TProps = {
cycleId: string;
};

export const EstimateTypeDropdown = (props: TProps) => {
export const EstimateTypeDropdown = observer((props: TProps) => {
const { value, onChange, projectId, cycleId, showDefault = false } = props;
const { getIsPointsDataAvailable } = useCycle();
const { areEstimateEnabledByProjectId } = useProjectEstimates();
const { areEstimateEnabledByProjectId, currentProjectEstimateType } = useProjectEstimates();
const isCurrentProjectEstimateEnabled = projectId && areEstimateEnabledByProjectId(projectId) ? true : false;
return getIsPointsDataAvailable(cycleId) || isCurrentProjectEstimateEnabled ? (
return (getIsPointsDataAvailable(cycleId) || isCurrentProjectEstimateEnabled) &&
currentProjectEstimateType !== EEstimateSystem.CATEGORIES ? (
<div className="relative flex items-center gap-2">
<CustomSelect
value={value}
Expand All @@ -36,4 +39,4 @@ export const EstimateTypeDropdown = (props: TProps) => {
) : showDefault ? (
<span className="capitalize">{value}</span>
) : null;
};
});
7 changes: 7 additions & 0 deletions web/core/store/estimates/project-estimate.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export interface IProjectEstimateStore {
currentActiveEstimateId: string | undefined;
currentActiveEstimate: IEstimate | undefined;
archivedEstimateIds: string[] | undefined;
currentProjectEstimateType: TEstimateSystemKeys | undefined;
areEstimateEnabledByProjectId: (projectId: string) => boolean;
estimateIdsByProjectId: (projectId: string) => string[] | undefined;
currentActiveEstimateIdByProjectId: (projectId: string) => string | undefined;
Expand Down Expand Up @@ -63,6 +64,7 @@ export class ProjectEstimateStore implements IProjectEstimateStore {
currentActiveEstimateId: computed,
currentActiveEstimate: computed,
archivedEstimateIds: computed,
currentProjectEstimateType: computed,
// actions
getWorkspaceEstimates: action,
getProjectEstimates: action,
Expand All @@ -73,6 +75,11 @@ export class ProjectEstimateStore implements IProjectEstimateStore {
}

// computed

get currentProjectEstimateType(): TEstimateSystemKeys | undefined {
return this.currentActiveEstimateId ? this.estimates[this.currentActiveEstimateId]?.type : undefined;
}

/**
* @description get current active estimate id for a project
* @returns { string | undefined }
Expand Down