chore: completed cycle empty state valdidation updated (#3959)

This commit is contained in:
Anmol Singh Bhatia 2024-03-15 17:30:26 +05:30 committed by GitHub
parent 94f1e6d957
commit c17748eec2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -62,12 +62,14 @@ export const CycleEmptyState: React.FC<Props> = observer((props) => {
const isCompletedCycleSnapshotAvailable = !isEmpty(cycleDetails?.progress_snapshot ?? {}); const isCompletedCycleSnapshotAvailable = !isEmpty(cycleDetails?.progress_snapshot ?? {});
const emptyStateType = isCompletedCycleSnapshotAvailable const isCompletedAndEmpty = isCompletedCycleSnapshotAvailable || cycleDetails?.status.toLowerCase() === "completed";
const emptyStateType = isCompletedAndEmpty
? EmptyStateType.PROJECT_CYCLE_COMPLETED_NO_ISSUES ? EmptyStateType.PROJECT_CYCLE_COMPLETED_NO_ISSUES
: isEmptyFilters : isEmptyFilters
? EmptyStateType.PROJECT_EMPTY_FILTER ? EmptyStateType.PROJECT_EMPTY_FILTER
: EmptyStateType.PROJECT_CYCLE_NO_ISSUES; : EmptyStateType.PROJECT_CYCLE_NO_ISSUES;
const additionalPath = isCompletedCycleSnapshotAvailable ? undefined : activeLayout ?? "list"; const additionalPath = isCompletedAndEmpty ? undefined : activeLayout ?? "list";
const emptyStateSize = isEmptyFilters ? "lg" : "sm"; const emptyStateSize = isEmptyFilters ? "lg" : "sm";
return ( return (
@ -86,7 +88,7 @@ export const CycleEmptyState: React.FC<Props> = observer((props) => {
additionalPath={additionalPath} additionalPath={additionalPath}
size={emptyStateSize} size={emptyStateSize}
primaryButtonOnClick={ primaryButtonOnClick={
!isCompletedCycleSnapshotAvailable && !isEmptyFilters !isCompletedAndEmpty && !isEmptyFilters
? () => { ? () => {
setTrackElement("Cycle issue empty state"); setTrackElement("Cycle issue empty state");
toggleCreateIssueModal(true, EIssuesStoreType.CYCLE); toggleCreateIssueModal(true, EIssuesStoreType.CYCLE);
@ -94,9 +96,7 @@ export const CycleEmptyState: React.FC<Props> = observer((props) => {
: undefined : undefined
} }
secondaryButtonOnClick={ secondaryButtonOnClick={
!isCompletedCycleSnapshotAvailable && isEmptyFilters !isCompletedAndEmpty && isEmptyFilters ? handleClearAllFilters : () => setCycleIssuesListModal(true)
? handleClearAllFilters
: () => setCycleIssuesListModal(true)
} }
/> />
</div> </div>