Merge branch 'develop' of github.com:makeplane/plane into develop

This commit is contained in:
sriram veeraghanta 2024-03-06 19:52:46 +05:30
commit 466f69a0b9
2 changed files with 45 additions and 62 deletions

View File

@ -1,6 +1,5 @@
import React from "react"; import React from "react";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { useRouter } from "next/router";
// components // components
import { ISSUE_DISPLAY_PROPERTIES } from "constants/issue"; import { ISSUE_DISPLAY_PROPERTIES } from "constants/issue";
import { IIssueDisplayProperties } from "@plane/types"; import { IIssueDisplayProperties } from "@plane/types";
@ -14,19 +13,10 @@ type Props = {
}; };
export const FilterDisplayProperties: React.FC<Props> = observer((props) => { export const FilterDisplayProperties: React.FC<Props> = observer((props) => {
const router = useRouter();
const { moduleId, cycleId } = router.query;
const { displayProperties, handleUpdate } = props; const { displayProperties, handleUpdate } = props;
const [previewEnabled, setPreviewEnabled] = React.useState(true); const [previewEnabled, setPreviewEnabled] = React.useState(true);
const handleDisplayPropertyVisibility = (key: keyof IIssueDisplayProperties): boolean => {
const visibility = true;
if (key === "modules" && moduleId) return false;
if (key === "cycle" && cycleId) return false;
return visibility;
};
return ( return (
<> <>
<FilterHeader <FilterHeader
@ -36,9 +26,7 @@ export const FilterDisplayProperties: React.FC<Props> = observer((props) => {
/> />
{previewEnabled && ( {previewEnabled && (
<div className="mt-1 flex flex-wrap items-center gap-2"> <div className="mt-1 flex flex-wrap items-center gap-2">
{ISSUE_DISPLAY_PROPERTIES.map( {ISSUE_DISPLAY_PROPERTIES.map((displayProperty) => (
(displayProperty) =>
handleDisplayPropertyVisibility(displayProperty?.key) && (
<button <button
key={displayProperty.key} key={displayProperty.key}
type="button" type="button"
@ -55,8 +43,7 @@ export const FilterDisplayProperties: React.FC<Props> = observer((props) => {
> >
{displayProperty.title} {displayProperty.title}
</button> </button>
) ))}
)}
</div> </div>
)} )}
</> </>

View File

@ -52,7 +52,7 @@ export const IssueProperties: React.FC<IIssueProperties> = observer((props) => {
const { getStateById } = useProjectState(); const { getStateById } = useProjectState();
// router // router
const router = useRouter(); const router = useRouter();
const { workspaceSlug, cycleId, moduleId } = router.query; const { workspaceSlug } = router.query;
const currentLayout = `${activeLayout} layout`; const currentLayout = `${activeLayout} layout`;
// derived values // derived values
const stateDetails = getStateById(issue.state_id); const stateDetails = getStateById(issue.state_id);
@ -328,7 +328,6 @@ export const IssueProperties: React.FC<IIssueProperties> = observer((props) => {
</WithDisplayPropertiesHOC> </WithDisplayPropertiesHOC>
{/* modules */} {/* modules */}
{moduleId === undefined && (
<WithDisplayPropertiesHOC displayProperties={displayProperties} displayPropertyKey="modules"> <WithDisplayPropertiesHOC displayProperties={displayProperties} displayPropertyKey="modules">
<div className="h-5"> <div className="h-5">
<ModuleDropdown <ModuleDropdown
@ -343,10 +342,8 @@ export const IssueProperties: React.FC<IIssueProperties> = observer((props) => {
/> />
</div> </div>
</WithDisplayPropertiesHOC> </WithDisplayPropertiesHOC>
)}
{/* cycles */} {/* cycles */}
{cycleId === undefined && (
<WithDisplayPropertiesHOC displayProperties={displayProperties} displayPropertyKey="cycle"> <WithDisplayPropertiesHOC displayProperties={displayProperties} displayPropertyKey="cycle">
<div className="h-5 truncate"> <div className="h-5 truncate">
<CycleDropdown <CycleDropdown
@ -359,7 +356,6 @@ export const IssueProperties: React.FC<IIssueProperties> = observer((props) => {
/> />
</div> </div>
</WithDisplayPropertiesHOC> </WithDisplayPropertiesHOC>
)}
{/* estimates */} {/* estimates */}
{areEstimatesEnabledForCurrentProject && ( {areEstimatesEnabledForCurrentProject && (