Skip to content

Update search UI in right hand panel#1276

Merged
shashankbrgowda merged 25 commits intomainfrom
side-bar-search-panel
Apr 9, 2026
Merged

Update search UI in right hand panel#1276
shashankbrgowda merged 25 commits intomainfrom
side-bar-search-panel

Conversation

@shashankbrgowda
Copy link
Copy Markdown
Contributor

Description

This pr updates the search UI in the right hand panel of SS, GB and EV.

  • Enclose search in collapsible sections instead of tabs
  • Refactor InAppSearch component to create separate search components for sidebar and Interstitial page.

Related JIRA Issue(s)

https://embl.atlassian.net/browse/ENSWBSITES-2968

Deployment URL(s)

http://side-bar-search-panel.review.ensembl.org

@shashankbrgowda shashankbrgowda self-assigned this Mar 6, 2026
@shashankbrgowda shashankbrgowda changed the title Update search modal in right hand panel Update search UI in right hand panel Mar 6, 2026
Comment thread src/content/app/genome-browser/components/interstitial/BrowserInterstitial.tsx Outdated
const { featureSearchMode, searchResults, speciesList } = props;

return (
<div className={styles.resultsWrapper}>
Copy link
Copy Markdown
Collaborator

@azangru azangru Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FeatureSearchResults component has a top-level div in it as well. I wonder if we give that component an optional className property, and pass whichever styles the resultsWrapper has via that property, would it remove the need for this wrapper div?

On the other hand, I see you also have VariantFeatureSearchResults, which uses the resultsWrapper; so maybe there is no need to change anything here.

overflow-y: auto;
padding-left: 20px;
margin-top: 20px;
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is this used?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's used in structural variants FeatureSearchModal.tsx

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmm, that's not good. FeatureSearchModal is something that is shown in the sidebar; it should not depend on the interstitial. Hmm 🤔

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've pushed a commit to move the styles imported by structural variants FeatureSearchModal into its own styles file.

Comment thread src/shared/components/interstitial-search/InterstitialSearch.module.css Outdated
expect(interstitialSearch).toBeTruthy();
});

it('renders with interstitial mode', () => {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this test seems to be testing the same as the previous one

Comment thread src/shared/components/interstitial-search/InterstitialSearch.tsx Outdated
Comment thread src/shared/components/layout/sidebar-modal/SidebarModal.module.css Outdated
overflow: auto;
padding: 21px calc(18px - var(--scrollbar-width)) 90px 20px;

padding: 21px calc(18px - var(--scrollbar-width)) 21px 20px;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, that 90px from the bottom was the same as --global-padding-bottom CSS variable, which we normally use to leave space in the bottom of various scrollable containers. Are we saying that in all sidebar modals we are going to have only 21px of space in the bottom?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, 90px padding was too much for search modal. 21px padding shouldn't cause any issues for other modals.

Comment thread src/shared/components/sidebar-search/SidebarSearch.tsx Outdated
}

return null;
};
Copy link
Copy Markdown
Collaborator

@azangru azangru Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this getPageDetails function, as well as the getResultsContent function below it should either be turned into components (like SidebarHelpSection or PageDetails below, or at the very least wrapped in a useMemo. As it is, these functions return completely new components every render cycle.

Ideally, changing text in an input box shouldn't cause everything around it to rerender. This is something that the compiler is promised to take care of; but we don't have the compiler yet.

rerendering.mp4

Comment thread src/shared/components/search-match/GeneSearchMatches.tsx Outdated

const searchMatchAnchorClass = classNames(
styles.searchMatchAnchor,
styles[`searchMatchAnchor${mode}`]
Copy link
Copy Markdown
Contributor

@veidenberg veidenberg Mar 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

searchMatchAnchor${mode} won't match the CSS class in SearchMatch.module.css, because mode is in lowercase (sidebar/interstitial) while the class name is in camelCase (searchMatchAnchorInterstitial). Same in VariantSearchMatches.tsx

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch

Comment thread src/shared/state/api-slices/restSlice.ts Outdated
@azangru
Copy link
Copy Markdown
Collaborator

azangru commented Mar 16, 2026

Oof! This is not good:

Screen.Recording.2026-03-16.at.13.15.26.mov

--image-button-default-svg-color: var(--color-blue);
--image-button-disabled-svg-color: var(--color-grey);
width: var(--browser-nav-button-size, 22px);
height: var(--browser-nav-button-size, 22px);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Why does the variable have the word browser in its name?
  • These are styles for a component (SidebarSearch) that combines a lot of other components. Why does it need to expose variables for configuring nav buttons sizes at all?

export type FeatureSearchAppName =
| 'speciesHome'
| 'genomeBrowser'
| 'entityViewer';
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am of two minds about this.

On the one hand, we have a central place for listing our apps. On the other hand, that place uses an enum, and my hope is that we gradually get rid of enums. On the one hand, it seems like a good idea to not proliferate places that list apps. On the other hand, I don't know if listing possible apps specifically for feature search component has its benefits.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The AppName used is from here - https://github.com/Ensembl/ensembl-client/blob/main/src/shared/state/in-app-search/inAppSearchSlice.ts#L19

So this is existing code moved to a common place

@azangru
Copy link
Copy Markdown
Collaborator

azangru commented Mar 23, 2026

I still don't quite understand what the rules for search state persistence are, and whether they aren't too complicated to us to push back against. For example, here, with the preservation of rs699 even after we explicitly close the search sidebar.

I would personally so much prefer that we could just clear the search state every time we unmount the search sidebar component; but I don't know if I can convince others to agree to that.

search-persistence.mp4

Comment thread src/shared/components/interstitial-search/InterstitialSearch.tsx Outdated

const featureSearchQueries = useAppSelector((state) =>
getFeatureSearchQueries(state, app, genomeId)
);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So now that we no longer persist query information when we move between apps, or between different genomes, why are we still storing search queries in redux? Why aren't they in local state?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the web-standup slack chat, Its applicable only for Sidebar search.

Right hand panel search should not hold state for any element (gene, variation, transcript)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we keeping the redux state just for the interstitial search?

type StateForApp = Record<string, { queries: Queries }>;

type State = Record<AppName, StateForApp>;
// app -> genomeId -> queries mapping
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this comment still correct? I see app name is gone from the file

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. Its now FeatureSearchAppName

Copy link
Copy Markdown
Collaborator

@azangru azangru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was hoping the relaxed requirements for state management would allow us to get rid of the redux state responsible for feature search; but even if not, it's not a blocker. Leaving it up to you to decide if you want to keep it.

@shashankbrgowda
Copy link
Copy Markdown
Contributor Author

I was hoping the relaxed requirements for state management would allow us to get rid of the redux state responsible for feature search; but even if not, it's not a blocker. Leaving it up to you to decide if you want to keep it.

We can keep it for now as its existing functionality in prod and the state is simple like before.

@shashankbrgowda
Copy link
Copy Markdown
Contributor Author

Thanks for the review @azangru

@shashankbrgowda shashankbrgowda merged commit 5147cb1 into main Apr 9, 2026
1 check passed
@shashankbrgowda shashankbrgowda deleted the side-bar-search-panel branch April 9, 2026 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants