X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/f0ac109691369516a5adf9370838cb4eacf16a45..2c2339c775f9112f5da638b2beb81d8b6d5abc2b:/src/views-components/favorite-star/favorite-star.tsx

diff --git a/src/views-components/favorite-star/favorite-star.tsx b/src/views-components/favorite-star/favorite-star.tsx
index 755cc67c26..f21fcdc4e5 100644
--- a/src/views-components/favorite-star/favorite-star.tsx
+++ b/src/views-components/favorite-star/favorite-star.tsx
@@ -2,11 +2,11 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import * as React from "react";
-import { FavoriteIcon } from "~/components/icon/icon";
+import React from "react";
+import { FavoriteIcon, PublicFavoriteIcon } from "components/icon/icon";
 import { connect } from "react-redux";
-import { RootState } from "~/store/store";
-import { withStyles, StyleRulesCallback, WithStyles } from "@material-ui/core";
+import { RootState } from "store/store";
+import { withStyles, StyleRulesCallback, WithStyles, Tooltip } from "@material-ui/core";
 
 type CssRules = "icon";
 
@@ -18,10 +18,24 @@ const styles: StyleRulesCallback<CssRules> = theme => ({
 
 const mapStateToProps = (state: RootState, props: { resourceUuid: string; className?: string; }) => ({
     ...props,
-    visible: state.favorites[props.resourceUuid],
+    isFavoriteVisible: state.favorites[props.resourceUuid],
+    isPublicFavoriteVisible: state.publicFavorites[props.resourceUuid]
 });
 
 export const FavoriteStar = connect(mapStateToProps)(
-    withStyles(styles)((props: { visible: boolean; className?: string; } & WithStyles<CssRules>) =>
-        props.visible ? <FavoriteIcon className={props.className || props.classes.icon} /> : null
-    ));
+    withStyles(styles)((props: { isFavoriteVisible: boolean; className?: string; } & WithStyles<CssRules>) => {
+        if (props.isFavoriteVisible) {
+            return <Tooltip enterDelay={500} title="Favorite"><FavoriteIcon className={props.className || props.classes.icon} /></Tooltip>;
+        } else {
+            return null;
+        }
+    }));
+
+export const PublicFavoriteStar = connect(mapStateToProps)(
+    withStyles(styles)((props: { isPublicFavoriteVisible: boolean; className?: string; } & WithStyles<CssRules>) => {
+        if (props.isPublicFavoriteVisible) {
+            return <Tooltip enterDelay={500} title="Public Favorite"><PublicFavoriteIcon className={props.className || props.classes.icon} /></Tooltip>;
+        } else {
+            return null;
+        }
+    }));
