1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as React from "react";
6 import { ListItemIcon, ListItemText } from "@material-ui/core";
7 import { FavoriteIcon, AddFavoriteIcon, RemoveFavoriteIcon } from "../../../components/icon/icon";
8 import { connect } from "react-redux";
9 import { RootState } from "../../../store/store";
11 const mapStateToProps = (state: RootState) => ({
12 isFavorite: state.contextMenu.resource && state.favorites[state.contextMenu.resource.uuid] === true
15 export const FavoriteActionText = connect(mapStateToProps)((props: { isFavorite: boolean }) =>
17 ? <>Remove from favorites</>
18 : <>Add to favorites</>);
20 export const FavoriteActionIcon = connect(mapStateToProps)((props: { isFavorite: boolean }) =>
22 ? <RemoveFavoriteIcon />
23 : <AddFavoriteIcon />);