fix: render the estimate select if estimate is enabled for the project (#2663)

This commit is contained in:
Aaryan Khandelwal 2023-11-06 20:43:10 +05:30 committed by GitHub
parent 6eb0bf4785
commit a6dea3af23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 60 additions and 56 deletions

View File

@ -4,20 +4,20 @@ import { IssuePeekOverview } from "components/issues/issue-peek-overview";
// ui // ui
import { Tooltip } from "@plane/ui"; import { Tooltip } from "@plane/ui";
// types // types
import { IIssue } from "types"; import { IIssue, IIssueDisplayProperties } from "types";
interface IssueBlockProps { interface IssueBlockProps {
columnId: string; columnId: string;
issue: IIssue; issue: IIssue;
handleIssues: (group_by: string | null, issue: IIssue, action: "update" | "delete") => void; handleIssues: (group_by: string | null, issue: IIssue, action: "update" | "delete") => void;
quickActions: (group_by: string | null, issue: IIssue) => React.ReactNode; quickActions: (group_by: string | null, issue: IIssue) => React.ReactNode;
display_properties: any; displayProperties: IIssueDisplayProperties;
isReadonly?: boolean; isReadonly?: boolean;
showEmptyGroup?: boolean; showEmptyGroup?: boolean;
} }
export const IssueBlock: React.FC<IssueBlockProps> = (props) => { export const IssueBlock: React.FC<IssueBlockProps> = (props) => {
const { columnId, issue, handleIssues, quickActions, display_properties, showEmptyGroup, isReadonly } = props; const { columnId, issue, handleIssues, quickActions, displayProperties, showEmptyGroup, isReadonly } = props;
const updateIssue = (group_by: string | null, issueToUpdate: IIssue) => { const updateIssue = (group_by: string | null, issueToUpdate: IIssue) => {
handleIssues(group_by, issueToUpdate, "update"); handleIssues(group_by, issueToUpdate, "update");
@ -26,7 +26,7 @@ export const IssueBlock: React.FC<IssueBlockProps> = (props) => {
return ( return (
<> <>
<div className="text-sm p-3 relative bg-custom-background-100 flex items-center gap-3"> <div className="text-sm p-3 relative bg-custom-background-100 flex items-center gap-3">
{display_properties && display_properties?.key && ( {displayProperties && displayProperties?.key && (
<div className="flex-shrink-0 text-xs text-custom-text-300 font-medium"> <div className="flex-shrink-0 text-xs text-custom-text-300 font-medium">
{issue?.project_detail?.identifier}-{issue.sequence_id} {issue?.project_detail?.identifier}-{issue.sequence_id}
</div> </div>
@ -54,7 +54,7 @@ export const IssueBlock: React.FC<IssueBlockProps> = (props) => {
issue={issue} issue={issue}
isReadonly={isReadonly} isReadonly={isReadonly}
handleIssues={updateIssue} handleIssues={updateIssue}
display_properties={display_properties} displayProperties={displayProperties}
showEmptyGroup={showEmptyGroup} showEmptyGroup={showEmptyGroup}
/> />
{quickActions(!columnId && columnId === "null" ? null : columnId, issue)} {quickActions(!columnId && columnId === "null" ? null : columnId, issue)}

View File

@ -2,7 +2,7 @@ import { FC } from "react";
// components // components
import { IssueBlock } from "components/issues"; import { IssueBlock } from "components/issues";
// types // types
import { IIssue } from "types"; import { IIssue, IIssueDisplayProperties } from "types";
interface Props { interface Props {
columnId: string; columnId: string;
@ -10,12 +10,12 @@ interface Props {
isReadonly?: boolean; isReadonly?: boolean;
handleIssues: (group_by: string | null, issue: IIssue, action: "update" | "delete") => void; handleIssues: (group_by: string | null, issue: IIssue, action: "update" | "delete") => void;
quickActions: (group_by: string | null, issue: IIssue) => React.ReactNode; quickActions: (group_by: string | null, issue: IIssue) => React.ReactNode;
display_properties: any; displayProperties: IIssueDisplayProperties;
showEmptyGroup?: boolean; showEmptyGroup?: boolean;
} }
export const IssueBlocksList: FC<Props> = (props) => { export const IssueBlocksList: FC<Props> = (props) => {
const { columnId, issues, handleIssues, quickActions, display_properties, showEmptyGroup, isReadonly } = props; const { columnId, issues, handleIssues, quickActions, displayProperties, showEmptyGroup, isReadonly } = props;
return ( return (
<div className="w-full h-full relative divide-y-[0.5px] divide-custom-border-200"> <div className="w-full h-full relative divide-y-[0.5px] divide-custom-border-200">
@ -28,7 +28,7 @@ export const IssueBlocksList: FC<Props> = (props) => {
handleIssues={handleIssues} handleIssues={handleIssues}
quickActions={quickActions} quickActions={quickActions}
isReadonly={isReadonly} isReadonly={isReadonly}
display_properties={display_properties} displayProperties={displayProperties}
showEmptyGroup={showEmptyGroup} showEmptyGroup={showEmptyGroup}
/> />
)) ))

View File

@ -4,7 +4,7 @@ import { observer } from "mobx-react-lite";
import { ListGroupByHeaderRoot } from "./headers/group-by-root"; import { ListGroupByHeaderRoot } from "./headers/group-by-root";
import { IssueBlocksList, ListInlineCreateIssueForm } from "components/issues"; import { IssueBlocksList, ListInlineCreateIssueForm } from "components/issues";
// types // types
import { IEstimatePoint, IIssue, IIssueLabels, IProject, IState, IUserLite } from "types"; import { IEstimatePoint, IIssue, IIssueDisplayProperties, IIssueLabels, IProject, IState, IUserLite } from "types";
// constants // constants
import { getValueFromObject } from "constants/issue"; import { getValueFromObject } from "constants/issue";
@ -16,7 +16,7 @@ export interface IGroupByList {
listKey: string; listKey: string;
handleIssues: (group_by: string | null, issue: IIssue, action: "update" | "delete") => void; handleIssues: (group_by: string | null, issue: IIssue, action: "update" | "delete") => void;
quickActions: (group_by: string | null, issue: IIssue) => React.ReactNode; quickActions: (group_by: string | null, issue: IIssue) => React.ReactNode;
display_properties: any; displayProperties: IIssueDisplayProperties;
is_list?: boolean; is_list?: boolean;
enableQuickIssueCreate?: boolean; enableQuickIssueCreate?: boolean;
showEmptyGroup?: boolean; showEmptyGroup?: boolean;
@ -31,7 +31,7 @@ const GroupByList: React.FC<IGroupByList> = observer((props) => {
listKey, listKey,
handleIssues, handleIssues,
quickActions, quickActions,
display_properties, displayProperties,
is_list = false, is_list = false,
enableQuickIssueCreate, enableQuickIssueCreate,
showEmptyGroup, showEmptyGroup,
@ -59,7 +59,7 @@ const GroupByList: React.FC<IGroupByList> = observer((props) => {
issues={is_list ? issues : issues[getValueFromObject(_list, listKey) as string]} issues={is_list ? issues : issues[getValueFromObject(_list, listKey) as string]}
handleIssues={handleIssues} handleIssues={handleIssues}
quickActions={quickActions} quickActions={quickActions}
display_properties={display_properties} displayProperties={displayProperties}
isReadonly={isReadonly} isReadonly={isReadonly}
showEmptyGroup={showEmptyGroup} showEmptyGroup={showEmptyGroup}
/> />
@ -86,7 +86,7 @@ export interface IList {
handleDragDrop?: (result: any) => void | undefined; handleDragDrop?: (result: any) => void | undefined;
handleIssues: (group_by: string | null, issue: IIssue, action: "update" | "delete") => void; handleIssues: (group_by: string | null, issue: IIssue, action: "update" | "delete") => void;
quickActions: (group_by: string | null, issue: IIssue) => React.ReactNode; quickActions: (group_by: string | null, issue: IIssue) => React.ReactNode;
display_properties: any; displayProperties: IIssueDisplayProperties;
states: IState[] | null; states: IState[] | null;
labels: IIssueLabels[] | null; labels: IIssueLabels[] | null;
members: IUserLite[] | null; members: IUserLite[] | null;
@ -105,7 +105,7 @@ export const List: React.FC<IList> = observer((props) => {
isReadonly, isReadonly,
handleIssues, handleIssues,
quickActions, quickActions,
display_properties, displayProperties,
states, states,
labels, labels,
members, members,
@ -126,7 +126,7 @@ export const List: React.FC<IList> = observer((props) => {
listKey={`id`} listKey={`id`}
handleIssues={handleIssues} handleIssues={handleIssues}
quickActions={quickActions} quickActions={quickActions}
display_properties={display_properties} displayProperties={displayProperties}
is_list is_list
enableQuickIssueCreate={enableQuickIssueCreate} enableQuickIssueCreate={enableQuickIssueCreate}
isReadonly={isReadonly} isReadonly={isReadonly}
@ -142,7 +142,7 @@ export const List: React.FC<IList> = observer((props) => {
listKey={`id`} listKey={`id`}
handleIssues={handleIssues} handleIssues={handleIssues}
quickActions={quickActions} quickActions={quickActions}
display_properties={display_properties} displayProperties={displayProperties}
enableQuickIssueCreate={enableQuickIssueCreate} enableQuickIssueCreate={enableQuickIssueCreate}
isReadonly={isReadonly} isReadonly={isReadonly}
showEmptyGroup={showEmptyGroup} showEmptyGroup={showEmptyGroup}
@ -157,7 +157,7 @@ export const List: React.FC<IList> = observer((props) => {
listKey={`id`} listKey={`id`}
handleIssues={handleIssues} handleIssues={handleIssues}
quickActions={quickActions} quickActions={quickActions}
display_properties={display_properties} displayProperties={displayProperties}
enableQuickIssueCreate={enableQuickIssueCreate} enableQuickIssueCreate={enableQuickIssueCreate}
isReadonly={isReadonly} isReadonly={isReadonly}
showEmptyGroup={showEmptyGroup} showEmptyGroup={showEmptyGroup}
@ -172,7 +172,7 @@ export const List: React.FC<IList> = observer((props) => {
listKey={`key`} listKey={`key`}
handleIssues={handleIssues} handleIssues={handleIssues}
quickActions={quickActions} quickActions={quickActions}
display_properties={display_properties} displayProperties={displayProperties}
enableQuickIssueCreate={enableQuickIssueCreate} enableQuickIssueCreate={enableQuickIssueCreate}
isReadonly={isReadonly} isReadonly={isReadonly}
showEmptyGroup={showEmptyGroup} showEmptyGroup={showEmptyGroup}
@ -187,7 +187,7 @@ export const List: React.FC<IList> = observer((props) => {
listKey={`key`} listKey={`key`}
handleIssues={handleIssues} handleIssues={handleIssues}
quickActions={quickActions} quickActions={quickActions}
display_properties={display_properties} displayProperties={displayProperties}
enableQuickIssueCreate={enableQuickIssueCreate} enableQuickIssueCreate={enableQuickIssueCreate}
isReadonly={isReadonly} isReadonly={isReadonly}
showEmptyGroup={showEmptyGroup} showEmptyGroup={showEmptyGroup}
@ -202,7 +202,7 @@ export const List: React.FC<IList> = observer((props) => {
listKey={`id`} listKey={`id`}
handleIssues={handleIssues} handleIssues={handleIssues}
quickActions={quickActions} quickActions={quickActions}
display_properties={display_properties} displayProperties={displayProperties}
enableQuickIssueCreate={enableQuickIssueCreate} enableQuickIssueCreate={enableQuickIssueCreate}
isReadonly={isReadonly} isReadonly={isReadonly}
showEmptyGroup={showEmptyGroup} showEmptyGroup={showEmptyGroup}
@ -217,7 +217,7 @@ export const List: React.FC<IList> = observer((props) => {
listKey={`id`} listKey={`id`}
handleIssues={handleIssues} handleIssues={handleIssues}
quickActions={quickActions} quickActions={quickActions}
display_properties={display_properties} displayProperties={displayProperties}
enableQuickIssueCreate={enableQuickIssueCreate} enableQuickIssueCreate={enableQuickIssueCreate}
isReadonly={isReadonly} isReadonly={isReadonly}
showEmptyGroup={showEmptyGroup} showEmptyGroup={showEmptyGroup}
@ -232,7 +232,7 @@ export const List: React.FC<IList> = observer((props) => {
listKey={`id`} listKey={`id`}
handleIssues={handleIssues} handleIssues={handleIssues}
quickActions={quickActions} quickActions={quickActions}
display_properties={display_properties} displayProperties={displayProperties}
enableQuickIssueCreate={enableQuickIssueCreate} enableQuickIssueCreate={enableQuickIssueCreate}
isReadonly={isReadonly} isReadonly={isReadonly}
showEmptyGroup={showEmptyGroup} showEmptyGroup={showEmptyGroup}

View File

@ -11,19 +11,19 @@ import { IssuePropertyDate } from "../properties/date";
// ui // ui
import { Tooltip } from "@plane/ui"; import { Tooltip } from "@plane/ui";
// types // types
import { IIssue, IState, TIssuePriorities } from "types"; import { IIssue, IIssueDisplayProperties, IState, TIssuePriorities } from "types";
export interface IKanBanProperties { export interface IKanBanProperties {
columnId: string; columnId: string;
issue: IIssue; issue: IIssue;
handleIssues: (group_by: string | null, issue: IIssue) => void; handleIssues: (group_by: string | null, issue: IIssue) => void;
display_properties: any; displayProperties: IIssueDisplayProperties;
isReadonly?: boolean; isReadonly?: boolean;
showEmptyGroup?: boolean; showEmptyGroup?: boolean;
} }
export const KanBanProperties: FC<IKanBanProperties> = observer((props) => { export const KanBanProperties: FC<IKanBanProperties> = observer((props) => {
const { columnId: group_id, issue, handleIssues, display_properties, isReadonly, showEmptyGroup } = props; const { columnId: group_id, issue, handleIssues, displayProperties, isReadonly, showEmptyGroup } = props;
const handleState = (state: IState) => { const handleState = (state: IState) => {
handleIssues(!group_id && group_id === "null" ? null : group_id, { ...issue, state: state.id }); handleIssues(!group_id && group_id === "null" ? null : group_id, { ...issue, state: state.id });
@ -57,7 +57,7 @@ export const KanBanProperties: FC<IKanBanProperties> = observer((props) => {
<div className="relative flex gap-2 overflow-x-auto whitespace-nowrap"> <div className="relative flex gap-2 overflow-x-auto whitespace-nowrap">
{/* basic properties */} {/* basic properties */}
{/* state */} {/* state */}
{display_properties && display_properties?.state && ( {displayProperties && displayProperties?.state && (
<IssuePropertyState <IssuePropertyState
projectId={issue?.project_detail?.id || null} projectId={issue?.project_detail?.id || null}
value={issue?.state_detail || null} value={issue?.state_detail || null}
@ -68,7 +68,7 @@ export const KanBanProperties: FC<IKanBanProperties> = observer((props) => {
)} )}
{/* priority */} {/* priority */}
{display_properties && display_properties?.priority && ( {displayProperties && displayProperties?.priority && (
<IssuePropertyPriority <IssuePropertyPriority
value={issue?.priority || null} value={issue?.priority || null}
onChange={handlePriority} onChange={handlePriority}
@ -78,7 +78,7 @@ export const KanBanProperties: FC<IKanBanProperties> = observer((props) => {
)} )}
{/* label */} {/* label */}
{display_properties && display_properties?.labels && (showEmptyGroup || issue?.labels.length > 0) && ( {displayProperties && displayProperties?.labels && (showEmptyGroup || issue?.labels.length > 0) && (
<IssuePropertyLabels <IssuePropertyLabels
projectId={issue?.project_detail?.id || null} projectId={issue?.project_detail?.id || null}
value={issue?.labels || null} value={issue?.labels || null}
@ -89,7 +89,7 @@ export const KanBanProperties: FC<IKanBanProperties> = observer((props) => {
)} )}
{/* assignee */} {/* assignee */}
{display_properties && display_properties?.assignee && (showEmptyGroup || issue?.assignees?.length > 0) && ( {displayProperties && displayProperties?.assignee && (showEmptyGroup || issue?.assignees?.length > 0) && (
<IssuePropertyAssignee <IssuePropertyAssignee
projectId={issue?.project_detail?.id || null} projectId={issue?.project_detail?.id || null}
value={issue?.assignees || null} value={issue?.assignees || null}
@ -101,7 +101,7 @@ export const KanBanProperties: FC<IKanBanProperties> = observer((props) => {
)} )}
{/* start date */} {/* start date */}
{display_properties && display_properties?.start_date && (showEmptyGroup || issue?.start_date) && ( {displayProperties && displayProperties?.start_date && (showEmptyGroup || issue?.start_date) && (
<IssuePropertyDate <IssuePropertyDate
value={issue?.start_date || null} value={issue?.start_date || null}
onChange={(date: string) => handleStartDate(date)} onChange={(date: string) => handleStartDate(date)}
@ -111,7 +111,7 @@ export const KanBanProperties: FC<IKanBanProperties> = observer((props) => {
)} )}
{/* target/due date */} {/* target/due date */}
{display_properties && display_properties?.due_date && (showEmptyGroup || issue?.target_date) && ( {displayProperties && displayProperties?.due_date && (showEmptyGroup || issue?.target_date) && (
<IssuePropertyDate <IssuePropertyDate
value={issue?.target_date || null} value={issue?.target_date || null}
onChange={(date: string) => handleTargetDate(date)} onChange={(date: string) => handleTargetDate(date)}
@ -121,7 +121,7 @@ export const KanBanProperties: FC<IKanBanProperties> = observer((props) => {
)} )}
{/* estimates */} {/* estimates */}
{display_properties && display_properties?.estimate && ( {displayProperties && displayProperties?.estimate && (
<IssuePropertyEstimates <IssuePropertyEstimates
projectId={issue?.project_detail?.id || null} projectId={issue?.project_detail?.id || null}
value={issue?.estimate_point || null} value={issue?.estimate_point || null}
@ -133,7 +133,7 @@ export const KanBanProperties: FC<IKanBanProperties> = observer((props) => {
{/* extra render properties */} {/* extra render properties */}
{/* sub-issues */} {/* sub-issues */}
{display_properties && display_properties?.sub_issue_count && ( {displayProperties && displayProperties?.sub_issue_count && (
<Tooltip tooltipHeading="Sub-issues" tooltipContent={`${issue.sub_issues_count}`}> <Tooltip tooltipHeading="Sub-issues" tooltipContent={`${issue.sub_issues_count}`}>
<div className="flex-shrink-0 border-[0.5px] border-custom-border-300 overflow-hidden rounded flex justify-center items-center gap-2 px-2.5 py-1 h-5"> <div className="flex-shrink-0 border-[0.5px] border-custom-border-300 overflow-hidden rounded flex justify-center items-center gap-2 px-2.5 py-1 h-5">
<Layers className="h-3 w-3 flex-shrink-0" strokeWidth={2} /> <Layers className="h-3 w-3 flex-shrink-0" strokeWidth={2} />
@ -143,7 +143,7 @@ export const KanBanProperties: FC<IKanBanProperties> = observer((props) => {
)} )}
{/* attachments */} {/* attachments */}
{display_properties && display_properties?.attachment_count && ( {displayProperties && displayProperties?.attachment_count && (
<Tooltip tooltipHeading="Attachments" tooltipContent={`${issue.attachment_count}`}> <Tooltip tooltipHeading="Attachments" tooltipContent={`${issue.attachment_count}`}>
<div className="flex-shrink-0 border-[0.5px] border-custom-border-300 overflow-hidden rounded flex justify-center items-center gap-2 px-2.5 py-1 h-5"> <div className="flex-shrink-0 border-[0.5px] border-custom-border-300 overflow-hidden rounded flex justify-center items-center gap-2 px-2.5 py-1 h-5">
<Paperclip className="h-3 w-3 flex-shrink-0" strokeWidth={2} /> <Paperclip className="h-3 w-3 flex-shrink-0" strokeWidth={2} />
@ -153,7 +153,7 @@ export const KanBanProperties: FC<IKanBanProperties> = observer((props) => {
)} )}
{/* link */} {/* link */}
{display_properties && display_properties?.link && ( {displayProperties && displayProperties?.link && (
<Tooltip tooltipHeading="Links" tooltipContent={`${issue.link_count}`}> <Tooltip tooltipHeading="Links" tooltipContent={`${issue.link_count}`}>
<div className="flex-shrink-0 border-[0.5px] border-custom-border-300 overflow-hidden rounded flex justify-center items-center gap-2 px-2.5 py-1 h-5"> <div className="flex-shrink-0 border-[0.5px] border-custom-border-300 overflow-hidden rounded flex justify-center items-center gap-2 px-2.5 py-1 h-5">
<Link className="h-3 w-3 flex-shrink-0" strokeWidth={2} /> <Link className="h-3 w-3 flex-shrink-0" strokeWidth={2} />

View File

@ -25,7 +25,7 @@ export const ArchivedIssueListLayout: FC = observer(() => {
// derived values // derived values
const issues = archivedIssueStore.getIssues; const issues = archivedIssueStore.getIssues;
const display_properties = archivedIssueFiltersStore?.userDisplayProperties || null; const displayProperties = archivedIssueFiltersStore?.userDisplayProperties || null;
const group_by: string | null = archivedIssueFiltersStore?.userDisplayFilters?.group_by || null; const group_by: string | null = archivedIssueFiltersStore?.userDisplayFilters?.group_by || null;
const handleIssues = (group_by: string | null, issue: IIssue, action: "delete" | "update") => { const handleIssues = (group_by: string | null, issue: IIssue, action: "delete" | "update") => {
@ -59,7 +59,7 @@ export const ArchivedIssueListLayout: FC = observer(() => {
quickActions={(group_by, issue) => ( quickActions={(group_by, issue) => (
<ArchivedIssueQuickActions issue={issue} handleDelete={async () => handleIssues(group_by, issue, "delete")} /> <ArchivedIssueQuickActions issue={issue} handleDelete={async () => handleIssues(group_by, issue, "delete")} />
)} )}
display_properties={display_properties} displayProperties={displayProperties}
states={states} states={states}
stateGroups={stateGroups} stateGroups={stateGroups}
priorities={priorities} priorities={priorities}

View File

@ -31,7 +31,7 @@ export const CycleListLayout: React.FC = observer(() => {
const group_by: string | null = issueFilterStore?.userDisplayFilters?.group_by || null; const group_by: string | null = issueFilterStore?.userDisplayFilters?.group_by || null;
const display_properties = issueFilterStore?.userDisplayProperties || null; const displayProperties = issueFilterStore?.userDisplayProperties || null;
const handleIssues = useCallback( const handleIssues = useCallback(
(group_by: string | null, issue: IIssue, action: "update" | "delete" | "remove") => { (group_by: string | null, issue: IIssue, action: "update" | "delete" | "remove") => {
@ -80,7 +80,7 @@ export const CycleListLayout: React.FC = observer(() => {
handleRemoveFromCycle={async () => handleIssues(group_by, issue, "remove")} handleRemoveFromCycle={async () => handleIssues(group_by, issue, "remove")}
/> />
)} )}
display_properties={display_properties} displayProperties={displayProperties}
states={states} states={states}
stateGroups={stateGroups} stateGroups={stateGroups}
priorities={priorities} priorities={priorities}

View File

@ -31,7 +31,7 @@ export const ModuleListLayout: React.FC = observer(() => {
const group_by: string | null = issueFilterStore?.userDisplayFilters?.group_by || null; const group_by: string | null = issueFilterStore?.userDisplayFilters?.group_by || null;
const display_properties = issueFilterStore?.userDisplayProperties || null; const displayProperties = issueFilterStore?.userDisplayProperties || null;
const handleIssues = useCallback( const handleIssues = useCallback(
(group_by: string | null, issue: IIssue, action: "update" | "delete" | "remove") => { (group_by: string | null, issue: IIssue, action: "update" | "delete" | "remove") => {
@ -80,7 +80,7 @@ export const ModuleListLayout: React.FC = observer(() => {
handleRemoveFromModule={async () => handleIssues(group_by, issue, "remove")} handleRemoveFromModule={async () => handleIssues(group_by, issue, "remove")}
/> />
)} )}
display_properties={display_properties} displayProperties={displayProperties}
states={states} states={states}
stateGroups={stateGroups} stateGroups={stateGroups}
priorities={priorities} priorities={priorities}

View File

@ -29,7 +29,7 @@ export const ProfileIssuesListLayout: FC = observer(() => {
const group_by: string | null = profileIssueFiltersStore?.userDisplayFilters?.group_by || null; const group_by: string | null = profileIssueFiltersStore?.userDisplayFilters?.group_by || null;
const display_properties = profileIssueFiltersStore?.userDisplayProperties || null; const displayProperties = profileIssueFiltersStore?.userDisplayProperties || null;
const handleIssues = useCallback( const handleIssues = useCallback(
(group_by: string | null, issue: IIssue, action: "update" | "delete") => { (group_by: string | null, issue: IIssue, action: "update" | "delete") => {
@ -64,7 +64,7 @@ export const ProfileIssuesListLayout: FC = observer(() => {
handleUpdate={async (data) => handleIssues(group_by, data, "update")} handleUpdate={async (data) => handleIssues(group_by, data, "update")}
/> />
)} )}
display_properties={display_properties} displayProperties={displayProperties}
states={states} states={states}
stateGroups={stateGroups} stateGroups={stateGroups}
priorities={priorities} priorities={priorities}

View File

@ -29,7 +29,7 @@ export const ListLayout: FC = observer(() => {
const userDisplayFilters = issueFilterStore?.userDisplayFilters || null; const userDisplayFilters = issueFilterStore?.userDisplayFilters || null;
const group_by: string | null = userDisplayFilters?.group_by || null; const group_by: string | null = userDisplayFilters?.group_by || null;
const display_properties = issueFilterStore?.userDisplayProperties || null; const displayProperties = issueFilterStore?.userDisplayProperties || null;
const handleIssues = useCallback( const handleIssues = useCallback(
(group_by: string | null, issue: IIssue, action: "update" | "delete") => { (group_by: string | null, issue: IIssue, action: "update" | "delete") => {
@ -68,7 +68,7 @@ export const ListLayout: FC = observer(() => {
handleUpdate={async (data) => handleIssues(group_by, data, "update")} handleUpdate={async (data) => handleIssues(group_by, data, "update")}
/> />
)} )}
display_properties={display_properties} displayProperties={displayProperties}
states={states} states={states}
stateGroups={stateGroups} stateGroups={stateGroups}
priorities={priorities} priorities={priorities}

View File

@ -1,16 +1,13 @@
import { Fragment, useState } from "react"; import { Fragment, useState } from "react";
import { observer } from "mobx-react-lite";
// hooks
import { usePopper } from "react-popper"; import { usePopper } from "react-popper";
import useEstimateOption from "hooks/use-estimate-option"; import { observer } from "mobx-react-lite";
// ui
import { Check, ChevronDown, Search, Triangle } from "lucide-react";
import { Combobox } from "@headlessui/react"; import { Combobox } from "@headlessui/react";
import { Check, ChevronDown, Search, Triangle } from "lucide-react";
// ui
import { Tooltip } from "@plane/ui"; import { Tooltip } from "@plane/ui";
// types // types
import { Placement } from "@popperjs/core"; import { Placement } from "@popperjs/core";
import { useMobxStore } from "lib/mobx/store-provider";
export interface IIssuePropertyEstimates { export interface IIssuePropertyEstimates {
view?: "profile" | "workspace" | "project"; view?: "profile" | "workspace" | "project";
@ -27,7 +24,6 @@ export interface IIssuePropertyEstimates {
export const IssuePropertyEstimates: React.FC<IIssuePropertyEstimates> = observer((props) => { export const IssuePropertyEstimates: React.FC<IIssuePropertyEstimates> = observer((props) => {
const { const {
view,
projectId, projectId,
value, value,
onChange, onChange,
@ -44,8 +40,6 @@ export const IssuePropertyEstimates: React.FC<IIssuePropertyEstimates> = observe
const [referenceElement, setReferenceElement] = useState<HTMLButtonElement | null>(null); const [referenceElement, setReferenceElement] = useState<HTMLButtonElement | null>(null);
const [popperElement, setPopperElement] = useState<HTMLDivElement | null>(null); const [popperElement, setPopperElement] = useState<HTMLDivElement | null>(null);
const { isEstimateActive, estimatePoints } = useEstimateOption();
const { styles, attributes } = usePopper(referenceElement, popperElement, { const { styles, attributes } = usePopper(referenceElement, popperElement, {
placement: placement ?? "bottom-start", placement: placement ?? "bottom-start",
modifiers: [ modifiers: [
@ -58,6 +52,14 @@ export const IssuePropertyEstimates: React.FC<IIssuePropertyEstimates> = observe
], ],
}); });
const { project: projectStore } = useMobxStore();
const projectDetails = projectId ? projectStore.project_details[projectId] : null;
const isEstimateEnabled = projectDetails?.estimate !== null;
const estimates = projectId ? projectStore.estimates?.[projectId] : null;
const estimatePoints =
projectDetails && isEstimateEnabled ? estimates?.find((e) => e.id === projectDetails.estimate)?.points : null;
const options: { value: number | null; query: string; content: any }[] | undefined = (estimatePoints ?? []).map( const options: { value: number | null; query: string; content: any }[] | undefined = (estimatePoints ?? []).map(
(estimate) => ({ (estimate) => ({
value: estimate.key, value: estimate.key,
@ -94,6 +96,8 @@ export const IssuePropertyEstimates: React.FC<IIssuePropertyEstimates> = observe
</Tooltip> </Tooltip>
); );
if (!isEstimateEnabled) return null;
return ( return (
<Combobox <Combobox
as="div" as="div"