-
Notifications
You must be signed in to change notification settings - Fork 18
hide filter option condition added #2396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
11e3fd4
38bef94
3286e9d
76da4c5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ import type { ViewMode } from '../../common/Layout/ProjectsLayout/MobileProjects | |
import type { SetState } from '../../common/types/common'; | ||
import type { MobileOs } from '../../../utils/projectV2'; | ||
import type { SelectedTab } from './ProjectMapTabs'; | ||
|
||
import { useMemo } from 'react'; | ||
import ProjectSiteDropdown from './ProjectSiteDropDown'; | ||
import InterventionDropDown from './InterventionDropDown'; | ||
import ProjectListControlForMobile from '../ProjectListControls/ProjectListControlForMobile'; | ||
|
@@ -54,7 +54,19 @@ const MapControls = ({ | |
setSelectedInterventionType, | ||
disableInterventionMenu, | ||
setDisableInterventionMenu, | ||
plantLocations, | ||
} = useProjects(); | ||
|
||
const uniquePlantTypes = useMemo(() => { | ||
if (!plantLocations) return []; | ||
|
||
const types = new Set(); | ||
for (let i = 0; i < plantLocations.length; i++) { | ||
types.add(plantLocations[i].type); | ||
} | ||
return [...types]; | ||
}, [plantLocations]); | ||
|
||
const hasProjectSites = | ||
singleProject?.sites?.length !== undefined && | ||
singleProject?.sites?.length > 1; | ||
|
@@ -65,7 +77,9 @@ const MapControls = ({ | |
) && selectedTab === 'field'; | ||
const isProjectDetailsPage = page === 'project-details'; | ||
const canShowInterventionDropdown = | ||
isProjectDetailsPage && selectedTab === 'field'; | ||
isProjectDetailsPage && | ||
selectedTab === 'field' && | ||
uniquePlantTypes.length > 1; | ||
|
||
const enableInterventionFilter = () => { | ||
setDisableInterventionMenu(true); | ||
|
@@ -146,6 +160,7 @@ const MapControls = ({ | |
{...interventionDropDownProps} | ||
isMobile={isMobile} | ||
hasProjectSites={hasProjectSites} | ||
existingIntervention={uniquePlantTypes} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainVerify the type definition of existingIntervention prop. The prop is consistently added, but let's verify its type definition in the InterventionDropDown component. Also applies to: 182-182 🏁 Script executed: #!/bin/bash
# Search for the InterventionDropDown component's prop types
ast-grep --pattern 'interface $name {
$$$
existingIntervention$_
$$$
}' Length of output: 79 I'll now run an additional shell script to locate the file(s) for the InterventionDropDown component and inspect its prop types—including the definition for the 🏁 Script executed: #!/bin/bash
# Find files with "InterventionDropDown" in the filename and display their contents
fd -e tsx -i "InterventionDropDown" | xargs -I {} sh -c 'echo "File: {}"; echo "------"; cat {}' Length of output: 98 I'll now run a script to search the entire repository for the keyword 🏁 Script executed: #!/bin/bash
# Search for occurrences of "existingIntervention" in TypeScript/TSX files
rg -n "existingIntervention" -ttsx Length of output: 62 I'll now run a script to search for the keyword 🏁 Script executed: #!/bin/bash
# Search for any occurrence of "InterventionDropDown" to locate its definition or usage.
rg -n "InterventionDropDown" . Length of output: 509 Missing or Undeclared Type for Our investigation couldn’t locate an explicit type declaration for the
|
||
/> | ||
)} | ||
<button | ||
|
@@ -164,6 +179,7 @@ const MapControls = ({ | |
<InterventionDropDown | ||
{...interventionDropDownProps} | ||
hasProjectSites={hasProjectSites} | ||
existingIntervention={uniquePlantTypes} | ||
/> | ||
)} | ||
</> | ||
|
Uh oh!
There was an error while loading. Please reload this page.