X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/ab54fbc8f8934aab2b4a824bb2b71e354503c9ec..00b22552554ddcae9cf3b68ed4017067555ba02e:/src/views/favorite-panel/favorite-panel.tsx diff --git a/src/views/favorite-panel/favorite-panel.tsx b/src/views/favorite-panel/favorite-panel.tsx index 803d8002..9f35ecd6 100644 --- a/src/views/favorite-panel/favorite-panel.tsx +++ b/src/views/favorite-panel/favorite-panel.tsx @@ -28,6 +28,10 @@ import { openContextMenu, resourceKindToContextMenuKind } from '~/store/context- import { loadDetailsPanel } from '~/store/details-panel/details-panel-action'; import { navigateTo } from '~/store/navigation/navigation-action'; import { ContainerRequestState } from "~/models/container-request"; +import { FavoritesState } from '../../store/favorites/favorites-reducer'; +import { RootState } from '~/store/store'; +import { PanelDefaultView } from '~/components/panel-default-view/panel-default-view'; +import { DataTableDefaultView } from '~/components/data-table-default-view/data-table-default-view'; type CssRules = "toolbar" | "button"; @@ -124,7 +128,7 @@ export const favoritePanelColumns: DataColumns = [ ]; interface FavoritePanelDataProps { - currentItemId: string; + favorites: FavoritesState; } interface FavoritePanelActionProps { @@ -133,6 +137,9 @@ interface FavoritePanelActionProps { onDialogOpen: (ownerUuid: string) => void; onItemDoubleClick: (item: string) => void; } +const mapStateToProps = ({ favorites }: RootState): FavoritePanelDataProps => ({ + favorites +}); const mapDispatchToProps = (dispatch: Dispatch): FavoritePanelActionProps => ({ onContextMenu: (event, resourceUuid) => { @@ -160,17 +167,26 @@ type FavoritePanelProps = FavoritePanelDataProps & FavoritePanelActionProps & Di & WithStyles & RouteComponentProps<{ id: string }>; export const FavoritePanel = withStyles(styles)( - connect(undefined, mapDispatchToProps)( + connect(mapStateToProps, mapDispatchToProps)( class extends React.Component { render() { - return ; + return this.hasAnyFavorites() + ? } /> + : ; + } + + hasAnyFavorites = () => { + return Object + .keys(this.props.favorites) + .find(uuid => this.props.favorites[uuid]); } } )