[ARVADOS-WORKBENCH2] updated: 1.1.4-369-g09dedf9

Git user git at public.curoverse.com
Tue Jul 24 04:04:39 EDT 2018


Summary of changes:
 src/components/context-menu/context-menu.tsx       | 23 ++++++++++++----------
 .../context-menu/action-sets/favorite-action.tsx   | 22 ++++++++++++---------
 .../context-menu/action-sets/project-action-set.ts |  9 ++++-----
 .../action-sets/root-project-action-set.ts         |  1 -
 4 files changed, 30 insertions(+), 25 deletions(-)

       via  09dedf976871785e061bb78d56f5cb466147627a (commit)
      from  8599d5cc749a87f5cc6195315ae72d2af06ac58d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 09dedf976871785e061bb78d56f5cb466147627a
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Tue Jul 24 10:04:23 2018 +0200

    Fix lack of icon styling applied to context menu item
    
    Feature #13784
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/components/context-menu/context-menu.tsx b/src/components/context-menu/context-menu.tsx
index f519e30..95bbeaf 100644
--- a/src/components/context-menu/context-menu.tsx
+++ b/src/components/context-menu/context-menu.tsx
@@ -7,8 +7,9 @@ import { DefaultTransformOrigin } from "../popover/helpers";
 import { IconType } from "../icon/icon";
 
 export interface ContextMenuItem {
-    name: string | React.ComponentType;
-    icon: React.ComponentType<any>;
+    name?: string | React.ComponentType;
+    icon?: IconType;
+    component?: React.ComponentType<any>;
 }
 
 export type ContextMenuItemGroup = ContextMenuItem[];
@@ -39,14 +40,16 @@ export class ContextMenu extends React.PureComponent<ContextMenuProps> {
                                 button
                                 key={actionIndex}
                                 onClick={() => onItemClick(item)}>
-                                <ListItemIcon>
-                                    <item.icon />
-                                </ListItemIcon>
-                                <ListItemText>
-                                    {typeof item.name === "string"
-                                        ? item.name
-                                        : <item.name />}
-                                </ListItemText>
+                                {item.icon &&
+                                    <ListItemIcon>
+                                        <item.icon />
+                                    </ListItemIcon>}
+                                {item.name &&
+                                    <ListItemText>
+                                        {item.name}
+                                    </ListItemText>}
+                                {item.component &&
+                                    <item.component />}
                             </ListItem>)}
                         {groupIndex < items.length - 1 && <Divider />}
                     </React.Fragment>)}
diff --git a/src/views-components/context-menu/action-sets/favorite-action.tsx b/src/views-components/context-menu/action-sets/favorite-action.tsx
index 7976eb5..a4cf4e3 100644
--- a/src/views-components/context-menu/action-sets/favorite-action.tsx
+++ b/src/views-components/context-menu/action-sets/favorite-action.tsx
@@ -12,12 +12,16 @@ const mapStateToProps = (state: RootState) => ({
     isFavorite: state.contextMenu.resource && state.favorites[state.contextMenu.resource.uuid] === true
 });
 
-export const FavoriteActionText = connect(mapStateToProps)((props: { isFavorite: boolean }) =>
-    props.isFavorite
-        ? <>Remove from favorites</>
-        : <>Add to favorites</>);
-
-export const FavoriteActionIcon = connect(mapStateToProps)((props: { isFavorite: boolean }) =>
-    props.isFavorite
-        ? <RemoveFavoriteIcon />
-        : <AddFavoriteIcon />);
+export const ToggleFavoriteAction = connect(mapStateToProps)((props: { isFavorite: boolean }) =>
+    <>
+        <ListItemIcon>
+            {props.isFavorite
+                ? <RemoveFavoriteIcon />
+                : <AddFavoriteIcon />}
+        </ListItemIcon>
+        <ListItemText>
+            {props.isFavorite
+                ? <>Remove from favorites</>
+                : <>Add to favorites</>}
+        </ListItemText>
+    </>);
diff --git a/src/views-components/context-menu/action-sets/project-action-set.ts b/src/views-components/context-menu/action-sets/project-action-set.ts
index e0284e8..dd257b7 100644
--- a/src/views-components/context-menu/action-sets/project-action-set.ts
+++ b/src/views-components/context-menu/action-sets/project-action-set.ts
@@ -4,9 +4,9 @@
 
 import { ContextMenuActionSet } from "../context-menu-action-set";
 import { projectActions } from "../../../store/project/project-action";
-import { ShareIcon, NewProjectIcon } from "../../../components/icon/icon";
-import { FavoriteActionText, FavoriteActionIcon } from "./favorite-action";
-import { favoritesActions, toggleFavorite } from "../../../store/favorites/favorites-actions";
+import { NewProjectIcon } from "../../../components/icon/icon";
+import { ToggleFavoriteAction } from "./favorite-action";
+import { toggleFavorite } from "../../../store/favorites/favorites-actions";
 
 export const projectActionSet: ContextMenuActionSet = [[{
     icon: NewProjectIcon,
@@ -15,8 +15,7 @@ export const projectActionSet: ContextMenuActionSet = [[{
         dispatch(projectActions.OPEN_PROJECT_CREATOR({ ownerUuid: resource.uuid }));
     }
 }, {
-    name: FavoriteActionText,
-    icon: FavoriteActionIcon,
+    component: ToggleFavoriteAction,
     execute: (dispatch, resource) => {
         dispatch<any>(toggleFavorite(resource.uuid));
     }
diff --git a/src/views-components/context-menu/action-sets/root-project-action-set.ts b/src/views-components/context-menu/action-sets/root-project-action-set.ts
index 8d3d035..139bd26 100644
--- a/src/views-components/context-menu/action-sets/root-project-action-set.ts
+++ b/src/views-components/context-menu/action-sets/root-project-action-set.ts
@@ -5,7 +5,6 @@
 import { ContextMenuActionSet } from "../context-menu-action-set";
 import { projectActions } from "../../../store/project/project-action";
 import { NewProjectIcon } from "../../../components/icon/icon";
-import { FavoriteActionText, FavoriteActionIcon } from "./favorite-action";
 
 export const rootProjectActionSet: ContextMenuActionSet =  [[{
     icon: NewProjectIcon,

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list