Skip to content

Commit

Permalink
Merge pull request #4078 from ProjectMirador/prop-bool-warning
Browse files Browse the repository at this point in the history
Correct propType to return expected Boolean
  • Loading branch information
cbeer authored Jan 16, 2025
2 parents 6c5204c + 368110e commit 88cc3f9
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/containers/WindowSideBarButtons.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ function hasAnnotations(canvases) {
});
}

/** */
function hasSearchResults(state, { windowId }) {
const { suggestedSearches } = getWindow(state, { windowId });
const companionWindowId = getCompanionWindowsForPosition(state, { position: 'left', windowId })?.[0]?.id;
const searchQuery = getSearchQuery(state, { companionWindowId, windowId });

return Boolean(suggestedSearches || searchQuery);
}

/**
* mapStateToProps - used to hook up connect to state
* @memberof WindowSideButtons
Expand All @@ -54,10 +63,7 @@ const mapStateToProps = (state, { windowId }) => ({
hasAnyAnnotations: hasAnnotations(getCanvases(state, { windowId })),
hasAnyLayers: hasLayers(getCanvases(state, { windowId })),
hasCurrentLayers: hasLayers(getVisibleCanvases(state, { windowId })),
hasSearchResults: getWindow(state, { windowId }).suggestedSearches || getSearchQuery(state, {
companionWindowId: (getCompanionWindowsForPosition(state, { position: 'left', windowId })[0] || {}).id,
windowId,
}),
hasSearchResults: hasSearchResults(state, { windowId }),
hasSearchService: getManifestSearchService(state, { windowId }) !== null,
panels: getWindowConfig(state, { windowId }).panels,
sideBarPanel: ((getCompanionWindowsForPosition(state, { position: 'left', windowId }))[0] || {}).content,
Expand Down

0 comments on commit 88cc3f9

Please sign in to comment.