X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/7400998048d63d93ac6eb63895cd4a9e4d728591..da61c0b626bfef292175bb0c623213cb1efad63d:/src/views-components/search-bar/search-bar-recent-queries.tsx

diff --git a/src/views-components/search-bar/search-bar-recent-queries.tsx b/src/views-components/search-bar/search-bar-recent-queries.tsx
index 3de3ca7a1f..a3c03e4074 100644
--- a/src/views-components/search-bar/search-bar-recent-queries.tsx
+++ b/src/views-components/search-bar/search-bar-recent-queries.tsx
@@ -5,6 +5,7 @@
 import * as React from 'react';
 import { withStyles, WithStyles, StyleRulesCallback, List, ListItem, ListItemText } from '@material-ui/core';
 import { ArvadosTheme } from '~/common/custom-theme';
+import { SearchBarSelectedItem } from "~/store/search-bar/search-bar-reducer";
 
 type CssRules = 'root' | 'listItem' | 'listItemText';
 
@@ -22,22 +23,26 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
     }
 });
 
+export interface SearchBarRecentQueriesDataProps {
+    selectedItem: SearchBarSelectedItem;
+}
+
 export interface SearchBarRecentQueriesActionProps {
     onSearch: (searchValue: string) => void;
     loadRecentQueries: () => string[];
 }
 
-type SearchBarRecentQueriesProps = SearchBarRecentQueriesActionProps & WithStyles<CssRules>;
+type SearchBarRecentQueriesProps = SearchBarRecentQueriesDataProps & SearchBarRecentQueriesActionProps & WithStyles<CssRules>;
 
 export const SearchBarRecentQueries = withStyles(styles)(
-    ({ classes, onSearch, loadRecentQueries }: SearchBarRecentQueriesProps) =>
+    ({ classes, onSearch, loadRecentQueries, selectedItem }: SearchBarRecentQueriesProps) =>
         <List component="nav" className={classes.root}>
             {loadRecentQueries().map((query, index) =>
-                <ListItem button key={index} className={classes.listItem}>
-                    <ListItemText disableTypography 
-                        secondary={query} 
-                        onClick={() => onSearch(query)} 
+                <ListItem button key={index} className={classes.listItem} selected={`RQ-${index}-${query}` === selectedItem.id}>
+                    <ListItemText disableTypography
+                        secondary={query}
+                        onClick={() => onSearch(query)}
                         className={classes.listItemText} />
                 </ListItem>
             )}
-        </List>);
\ No newline at end of file
+        </List>);
