synapse-react-client 4.0.23 → 4.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/SWC.index.js +1 -1
- package/dist/components/EntityCitation/EntityCitation.d.ts.map +1 -1
- package/dist/components/EntityCitation/EntityCitation.js +28 -26
- package/dist/components/EntityCitation/EntityCitation.js.map +1 -1
- package/dist/components/Plot/SynapsePlot.d.ts +4 -0
- package/dist/components/Plot/SynapsePlot.d.ts.map +1 -1
- package/dist/components/Plot/SynapsePlot.js +57 -44
- package/dist/components/Plot/SynapsePlot.js.map +1 -1
- package/dist/components/QueryWrapperPlotNav/QueryWrapperSynapsePlot.d.ts.map +1 -1
- package/dist/components/QueryWrapperPlotNav/QueryWrapperSynapsePlot.js +77 -34
- package/dist/components/QueryWrapperPlotNav/QueryWrapperSynapsePlot.js.map +1 -1
- package/dist/components/SearchQueryWrapperPlotNav/SearchQueryWrapperPlotNav.d.ts.map +1 -1
- package/dist/components/SearchQueryWrapperPlotNav/SearchQueryWrapperPlotNav.js +1 -0
- package/dist/components/SearchQueryWrapperPlotNav/SearchQueryWrapperPlotNav.js.map +1 -1
- package/dist/components/entity/page/action_menu/EntityActionMenu.d.ts +2 -0
- package/dist/components/entity/page/action_menu/EntityActionMenu.d.ts.map +1 -1
- package/dist/components/entity/page/action_menu/EntityActionMenu.js +46 -27
- package/dist/components/entity/page/action_menu/EntityActionMenu.js.map +1 -1
- package/dist/components/entity/page/breadcrumbs/EntityPageBreadcrumbs.d.ts.map +1 -1
- package/dist/components/entity/page/breadcrumbs/EntityPageBreadcrumbs.js +0 -1
- package/dist/components/entity/page/breadcrumbs/EntityPageBreadcrumbs.js.map +1 -1
- package/dist/components/entity/page/title_bar/EntityPageTitleBar.d.ts +1 -0
- package/dist/components/entity/page/title_bar/EntityPageTitleBar.d.ts.map +1 -1
- package/dist/components/entity/page/title_bar/EntityPageTitleBar.js +31 -22
- package/dist/components/entity/page/title_bar/EntityPageTitleBar.js.map +1 -1
- package/dist/components/entity/page/title_bar/EntityTitleBarVersionInfo.d.ts.map +1 -1
- package/dist/components/entity/page/title_bar/EntityTitleBarVersionInfo.js +34 -20
- package/dist/components/entity/page/title_bar/EntityTitleBarVersionInfo.js.map +1 -1
- package/dist/components/favorites/FavoriteButton.d.ts +1 -0
- package/dist/components/favorites/FavoriteButton.d.ts.map +1 -1
- package/dist/components/favorites/FavoriteButton.js +8 -8
- package/dist/components/favorites/FavoriteButton.js.map +1 -1
- package/dist/components/menu/DropdownMenu.d.ts +1 -0
- package/dist/components/menu/DropdownMenu.d.ts.map +1 -1
- package/dist/components/menu/DropdownMenu.js +24 -24
- package/dist/components/menu/DropdownMenu.js.map +1 -1
- package/dist/components/widgets/facet-nav/FacetNavPanel.d.ts.map +1 -1
- package/dist/components/widgets/facet-nav/FacetNavPanel.js +59 -49
- package/dist/components/widgets/facet-nav/FacetNavPanel.js.map +1 -1
- package/dist/components/widgets/facet-nav/PlotsContainer.d.ts.map +1 -1
- package/dist/components/widgets/facet-nav/PlotsContainer.js +8 -2
- package/dist/components/widgets/facet-nav/PlotsContainer.js.map +1 -1
- package/dist/style/components/facet_nav/_facet-nav-panel.scss +11 -0
- package/dist/style/main.css +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +6 -6
|
@@ -3,14 +3,15 @@ import { ComplexMenu as t } from "../../../menu/ComplexMenu.js";
|
|
|
3
3
|
import { Box as n } from "@mui/material";
|
|
4
4
|
import { jsx as r } from "react/jsx-runtime";
|
|
5
5
|
//#region src/components/entity/page/action_menu/EntityActionMenu.tsx
|
|
6
|
-
|
|
6
|
+
var i = "rgba(0, 0, 0, 0.01)";
|
|
7
|
+
function a(e, t) {
|
|
7
8
|
return Object.fromEntries(Object.entries(e).filter(([e, n]) => !n || !n.visible ? !1 : ![
|
|
8
9
|
...t.buttonActions,
|
|
9
10
|
...t.primaryMenuActions.flat(),
|
|
10
11
|
...t.downloadMenuActions.flat()
|
|
11
12
|
].some((t) => t.action === e)));
|
|
12
13
|
}
|
|
13
|
-
function
|
|
14
|
+
function o(e, t) {
|
|
14
15
|
return e.reduce((e, n) => {
|
|
15
16
|
let r = t[n.action];
|
|
16
17
|
return r && r.visible && e.push({
|
|
@@ -25,17 +26,17 @@ function a(e, t) {
|
|
|
25
26
|
}), e;
|
|
26
27
|
}, []);
|
|
27
28
|
}
|
|
28
|
-
function
|
|
29
|
+
function s(e, t) {
|
|
29
30
|
return e.reduce((e, n) => {
|
|
30
|
-
let r =
|
|
31
|
+
let r = o(n, t);
|
|
31
32
|
return r.length > 0 && e.push(r), e;
|
|
32
33
|
}, []);
|
|
33
34
|
}
|
|
34
|
-
function
|
|
35
|
-
let { actionConfiguration:
|
|
36
|
-
Object.entries(
|
|
37
|
-
let
|
|
38
|
-
let n =
|
|
35
|
+
function c(o) {
|
|
36
|
+
let { actionConfiguration: c, menuConfiguration: l, layout: u } = o, d = a(c, u);
|
|
37
|
+
Object.entries(d).length > 0 && (console.warn("Actions are visible but have not been configured in the layout:", Object.entries(d).map((e) => e[0])), u.primaryMenuActions.unshift(Object.entries(d).map((e) => ({ action: e[0] }))));
|
|
38
|
+
let f = u.buttonActions.reduce((e, t) => {
|
|
39
|
+
let n = c[t.action];
|
|
39
40
|
if (n && n.visible) {
|
|
40
41
|
let r = n.onClick;
|
|
41
42
|
r == null && !n.href && (console.warn(`No handler registered for ${t.action}`), r = () => {
|
|
@@ -52,51 +53,69 @@ function s(a) {
|
|
|
52
53
|
});
|
|
53
54
|
}
|
|
54
55
|
return e;
|
|
55
|
-
}, []),
|
|
56
|
+
}, []), p = {
|
|
56
57
|
dropdownButtonText: "Download Options",
|
|
57
58
|
convertSingleItemToButton: !0,
|
|
58
59
|
renderMenuIfNoItems: !1,
|
|
59
|
-
|
|
60
|
+
variant: u.downloadMenuVariant,
|
|
61
|
+
buttonTooltip: l.DOWNLOAD.tooltipText,
|
|
60
62
|
buttonProps: {
|
|
61
|
-
disabled:
|
|
63
|
+
disabled: l.DOWNLOAD.disabled,
|
|
62
64
|
endIcon: /* @__PURE__ */ r(e, {
|
|
63
65
|
icon: "expandMore",
|
|
64
66
|
wrap: !1
|
|
65
67
|
})
|
|
66
68
|
},
|
|
67
|
-
items:
|
|
68
|
-
},
|
|
69
|
-
dropdownButtonText:
|
|
69
|
+
items: s(u.downloadMenuActions, c)
|
|
70
|
+
}, m = {
|
|
71
|
+
dropdownButtonText: u.primaryMenuText,
|
|
70
72
|
convertSingleItemToButton: !0,
|
|
71
73
|
renderMenuIfNoItems: !1,
|
|
74
|
+
variant: u.primaryMenuVariant,
|
|
72
75
|
buttonProps: { endIcon: /* @__PURE__ */ r(e, {
|
|
73
|
-
icon:
|
|
76
|
+
icon: u.primaryMenuEndIcon,
|
|
74
77
|
wrap: !1,
|
|
75
|
-
sx:
|
|
78
|
+
sx: u.primaryMenuEndIconSx
|
|
76
79
|
}) },
|
|
77
|
-
items:
|
|
78
|
-
};
|
|
80
|
+
items: s(u.primaryMenuActions, c)
|
|
81
|
+
}, h = u.menuButtonSx ?? {};
|
|
79
82
|
return /* @__PURE__ */ r(n, {
|
|
80
83
|
sx: {
|
|
81
84
|
"& .MuiButton-root": {
|
|
82
85
|
borderRadius: "6px",
|
|
83
86
|
fontWeight: 540,
|
|
84
|
-
|
|
87
|
+
padding: "10px 12px"
|
|
88
|
+
},
|
|
89
|
+
"& .MuiButton-outlined": {
|
|
90
|
+
...h,
|
|
91
|
+
"&:hover": {
|
|
92
|
+
...h,
|
|
93
|
+
backgroundColor: i
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"& .MuiButton-text": {
|
|
97
|
+
...h,
|
|
98
|
+
backgroundColor: "transparent",
|
|
99
|
+
"&:hover": {
|
|
100
|
+
...h,
|
|
101
|
+
backgroundColor: i,
|
|
102
|
+
textDecoration: "none"
|
|
103
|
+
}
|
|
85
104
|
},
|
|
86
105
|
"& .MuiButton-root .MuiTypography-root": { fontWeight: 540 }
|
|
87
106
|
},
|
|
88
107
|
children: /* @__PURE__ */ r(t, {
|
|
89
|
-
iconButtons:
|
|
90
|
-
dropdownMenus: [
|
|
108
|
+
iconButtons: f,
|
|
109
|
+
dropdownMenus: [m, p]
|
|
91
110
|
})
|
|
92
111
|
});
|
|
93
112
|
}
|
|
94
|
-
var
|
|
95
|
-
getUnmappedActions:
|
|
96
|
-
mapAndFilterItemsInMenuGroup:
|
|
97
|
-
mapAndFilterMenuGroups:
|
|
113
|
+
var l = {
|
|
114
|
+
getUnmappedActions: a,
|
|
115
|
+
mapAndFilterItemsInMenuGroup: o,
|
|
116
|
+
mapAndFilterMenuGroups: s
|
|
98
117
|
};
|
|
99
118
|
//#endregion
|
|
100
|
-
export {
|
|
119
|
+
export { l as EXPORTED_FOR_UNIT_TESTING, c as default };
|
|
101
120
|
|
|
102
121
|
//# sourceMappingURL=EntityActionMenu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityActionMenu.js","names":[],"sources":["../../../../../src/components/entity/page/action_menu/EntityActionMenu.tsx"],"sourcesContent":["import { Box, ButtonProps, SxProps, Theme } from '@mui/material'\nimport { ComplexMenu, ComplexMenuButtonProps } from '../../../menu/ComplexMenu'\nimport IconSvg, { IconName } from '../../../IconSvg/IconSvg'\nimport { DropdownMenuItem, DropdownMenuProps } from '../../../menu/DropdownMenu'\nimport { MouseEvent } from 'react'\nimport { SystemStyleObject } from '@mui/system'\n\n// Represents the two types of dropdown menus that will be displayed on the entity page\ntype EntityActionMenuDropdownMenuType = 'DOWNLOAD' | 'PRIMARY'\n\ntype EntityActionMenuDropdownMenuConfiguration = {\n visible: boolean\n tooltipText?: string\n disabled?: boolean\n}\n\nexport type ActionConfiguration = {\n visible: boolean\n text: string\n disabled?: boolean\n tooltipText?: string\n onClick?: (e: MouseEvent) => void\n href?: string\n}\n\nexport type ActionConfigurationMap = Record<string, ActionConfiguration>\n\nexport type MenuConfigurationMap = Record<\n EntityActionMenuDropdownMenuType,\n EntityActionMenuDropdownMenuConfiguration\n>\n\nexport type ActionViewProps = {\n action: string\n icon?: IconName\n textSx?: SxProps\n iconSx?: SxProps\n variant?: ButtonProps['variant']\n}\n\nexport type EntityActionMenuLayout = {\n buttonActions: ActionViewProps[]\n downloadMenuActions: ActionViewProps[][]\n primaryMenuActions: ActionViewProps[][]\n primaryMenuText: string\n primaryMenuEndIcon: IconName\n primaryMenuEndIconSx?: SxProps\n menuButtonSx?: SystemStyleObject<Theme>\n}\n\nexport type EntityActionMenuProps = {\n /* Maps a unique action string to a dynamic configuration for that particular action */\n actionConfiguration: ActionConfigurationMap\n /* Maps each dropdown menu to a dynamic configuration for that particular menu */\n menuConfiguration: MenuConfigurationMap\n /* Defines the layout of the actions. Typically depends on just the entity type and area. */\n layout: EntityActionMenuLayout\n}\n\n/*\n * All visible actions should be specified in the layout, but this is not guaranteed at compile time.\n * Find all visible actions in the action configuration that are not in the layout.\n */\nfunction getUnmappedActions(\n actionConfiguration: ActionConfigurationMap,\n layout: EntityActionMenuLayout,\n): ActionConfigurationMap {\n return Object.fromEntries(\n Object.entries(actionConfiguration).filter(([action, config]) => {\n // We don't care about actions that are not configured or should not be visible\n if (!config || !config.visible) {\n return false\n }\n\n const allLayoutActions: ActionViewProps[] = [\n ...layout.buttonActions,\n ...layout.primaryMenuActions.flat(),\n ...layout.downloadMenuActions.flat(),\n ]\n // Action is unmapped if it's visible and the layout doesn't have it\n return !allLayoutActions.some(\n layoutAction => layoutAction.action === action,\n )\n }),\n )\n}\n\n/**\n * Given a group of dropdown menu items and an action configuration,\n * return a list of dropdown menu items with non-visible and non-configured actions removed.\n * @param group\n * @param actionConfiguration\n */\nfunction mapAndFilterItemsInMenuGroup(\n group: ActionViewProps[],\n actionConfiguration: ActionConfigurationMap,\n): DropdownMenuItem[] {\n return group.reduce(\n (itemAcc: DropdownMenuItem[], actionViewProps: ActionViewProps) => {\n const configForAction = actionConfiguration[actionViewProps.action]\n // Only show the item if it's configured + visible\n if (configForAction && configForAction.visible) {\n itemAcc.push({\n text: configForAction.text ?? actionViewProps.action,\n onClick: configForAction.onClick,\n href: configForAction.href,\n tooltipText: configForAction.tooltipText,\n disabled: configForAction.disabled,\n icon: actionViewProps.icon,\n textSx: actionViewProps.textSx,\n iconSx: actionViewProps.iconSx,\n })\n }\n return itemAcc\n },\n [],\n )\n}\n\n/**\n * Given a list of groups of dropdown menu actions, returns a list of dropdown menu item\n * groups where non-visible actions have been removed, and groups with no visible actions\n * have been removed.\n * @param menuActions\n * @param actionConfiguration\n */\nfunction mapAndFilterMenuGroups(\n menuActions: ActionViewProps[][],\n actionConfiguration: ActionConfigurationMap,\n): DropdownMenuItem[][] {\n return menuActions.reduce(\n (groupAcc: DropdownMenuItem[][], group: ActionViewProps[]) => {\n const itemGroup = mapAndFilterItemsInMenuGroup(group, actionConfiguration)\n // Only show the group if it contains visible items\n if (itemGroup.length > 0) {\n groupAcc.push(itemGroup)\n }\n return groupAcc\n },\n [],\n )\n}\n\n/**\n * The EntityActionMenu renders a menu that displays the actions that can be invoked on an Entity page.\n */\nexport default function EntityActionMenu(props: EntityActionMenuProps) {\n const { actionConfiguration, menuConfiguration, layout } = props\n\n /*\n * All actions should be specified in the layout, but this is not guaranteed at compile time.\n * Find all visible actions in the action configuration that are not in the layout.\n */\n const unmappedActions = getUnmappedActions(actionConfiguration, layout)\n // Warn if unmapped actions were found and push them on to the layout.\n if (Object.entries(unmappedActions).length > 0) {\n console.warn(\n 'Actions are visible but have not been configured in the layout:',\n Object.entries(unmappedActions).map(entry => entry[0]),\n )\n // Modify the layout: put the unmapped actions in their own group at the top of the menu\n layout.primaryMenuActions.unshift(\n Object.entries(unmappedActions).map(\n (entry): ActionViewProps => ({\n action: entry[0],\n }),\n ),\n )\n }\n\n // Map button actions to a button configuration and omit non-visible actions\n const iconButtonConfigs: ComplexMenuButtonProps[] =\n layout.buttonActions.reduce(\n (acc: ComplexMenuButtonProps[], buttonViewProps: ActionViewProps) => {\n const configForAction = actionConfiguration[buttonViewProps.action]\n if (configForAction && configForAction.visible) {\n let onClick = configForAction.onClick\n if (onClick == null && !configForAction.href) {\n console.warn(`No handler registered for ${buttonViewProps.action}`)\n onClick = () => {\n console.warn(\n `No handler registered for ${buttonViewProps.action}`,\n )\n }\n }\n acc.push({\n icon: buttonViewProps.icon as IconName,\n onClick: onClick,\n tooltipText: configForAction.text,\n text: configForAction.text,\n variant: buttonViewProps.variant,\n iconSx: buttonViewProps.iconSx,\n disabled: configForAction.disabled,\n href: configForAction.href,\n })\n }\n return acc\n },\n [],\n )\n\n const downloadMenuConfig: DropdownMenuProps = {\n dropdownButtonText: 'Download Options',\n convertSingleItemToButton: true,\n renderMenuIfNoItems: false,\n buttonTooltip: menuConfiguration.DOWNLOAD.tooltipText,\n buttonProps: {\n disabled: menuConfiguration.DOWNLOAD.disabled,\n endIcon: <IconSvg icon={'expandMore'} wrap={false} />,\n },\n items: mapAndFilterMenuGroups(\n layout.downloadMenuActions,\n actionConfiguration,\n ),\n }\n\n const primaryMenuConfig: DropdownMenuProps = {\n dropdownButtonText: layout.primaryMenuText,\n convertSingleItemToButton: true,\n renderMenuIfNoItems: false,\n buttonProps: {\n endIcon: (\n <IconSvg\n icon={layout.primaryMenuEndIcon}\n wrap={false}\n sx={layout.primaryMenuEndIconSx}\n />\n ),\n },\n items: mapAndFilterMenuGroups(\n layout.primaryMenuActions,\n actionConfiguration,\n ),\n }\n\n return (\n <Box\n sx={{\n '& .MuiButton-root': {\n borderRadius: '6px',\n fontWeight: 540,\n // Optional per-layout overrides (e.g. a different border color for\n // entity pages vs the project header).\n ...(layout.menuButtonSx ?? {}),\n },\n '& .MuiButton-root .MuiTypography-root': {\n fontWeight: 540,\n },\n }}\n >\n <ComplexMenu\n iconButtons={iconButtonConfigs}\n dropdownMenus={[primaryMenuConfig, downloadMenuConfig]}\n />\n </Box>\n )\n}\n\nexport const EXPORTED_FOR_UNIT_TESTING = {\n getUnmappedActions,\n mapAndFilterItemsInMenuGroup,\n mapAndFilterMenuGroups,\n}\n"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EACnE,IAAM,IAAkB,EAAoB,EAAgB;EAC5D,IAAI,KAAmB,EAAgB,SAAS;GAC9C,IAAI,IAAU,EAAgB;GAS9B,AARI,KAAW,QAAQ,CAAC,EAAgB,SACtC,QAAQ,KAAK,6BAA6B,EAAgB,QAAQ,GAClE,UAAgB;IACd,QAAQ,KACN,6BAA6B,EAAgB,QAC/C;GACF,IAEF,EAAI,KAAK;IACP,MAAM,EAAgB;IACb;IACT,aAAa,EAAgB;IAC7B,MAAM,EAAgB;IACtB,SAAS,EAAgB;IACzB,QAAQ,EAAgB;IACxB,UAAU,EAAgB;IAC1B,MAAM,EAAgB;GACxB,CAAC;EACH;EACA,OAAO;CACT,GACA,CAAC,CACH,GAEI,IAAwC;EAC5C,oBAAoB;EACpB,2BAA2B;EAC3B,qBAAqB;EACrB,eAAe,EAAkB,SAAS;EAC1C,aAAa;GACX,UAAU,EAAkB,SAAS;GACrC,SAAS,kBAAC,GAAD;IAAS,MAAM;IAAc,MAAM;GAAQ,CAAA;EACtD;EACA,OAAO,EACL,EAAO,qBACP,CACF;CACF,GAEM,IAAuC;EAC3C,oBAAoB,EAAO;EAC3B,2BAA2B;EAC3B,qBAAqB;EACrB,aAAa,EACX,SACE,kBAAC,GAAD;GACE,MAAM,EAAO;GACb,MAAM;GACN,IAAI,EAAO;EACZ,CAAA,EAEL;EACA,OAAO,EACL,EAAO,oBACP,CACF;CACF;CAEA,OACE,kBAAC,GAAD;EACE,IAAI;GACF,qBAAqB;IACnB,cAAc;IACd,YAAY;IAGZ,GAAI,EAAO,gBAAgB,CAAC;GAC9B;GACA,yCAAyC,EACvC,YAAY,IACd;EACF;YAEA,kBAAC,GAAD;GACE,aAAa;GACb,eAAe,CAAC,GAAmB,CAAkB;EACtD,CAAA;CACE,CAAA;AAET;AAEA,IAAa,IAA4B;CACvC;CACA;CACA;AACF"}
|
|
1
|
+
{"version":3,"file":"EntityActionMenu.js","names":[],"sources":["../../../../../src/components/entity/page/action_menu/EntityActionMenu.tsx"],"sourcesContent":["import { Box, ButtonProps, SxProps, Theme } from '@mui/material'\nimport { ComplexMenu, ComplexMenuButtonProps } from '../../../menu/ComplexMenu'\nimport IconSvg, { IconName } from '../../../IconSvg/IconSvg'\nimport { DropdownMenuItem, DropdownMenuProps } from '../../../menu/DropdownMenu'\nimport { MouseEvent } from 'react'\nimport { SystemStyleObject } from '@mui/system'\n\nconst outlinedButtonHoverBackgroundColor = 'rgba(0, 0, 0, 0.01)'\n\n// Represents the two types of dropdown menus that will be displayed on the entity page\ntype EntityActionMenuDropdownMenuType = 'DOWNLOAD' | 'PRIMARY'\n\ntype EntityActionMenuDropdownMenuConfiguration = {\n visible: boolean\n tooltipText?: string\n disabled?: boolean\n}\n\nexport type ActionConfiguration = {\n visible: boolean\n text: string\n disabled?: boolean\n tooltipText?: string\n onClick?: (e: MouseEvent) => void\n href?: string\n}\n\nexport type ActionConfigurationMap = Record<string, ActionConfiguration>\n\nexport type MenuConfigurationMap = Record<\n EntityActionMenuDropdownMenuType,\n EntityActionMenuDropdownMenuConfiguration\n>\n\nexport type ActionViewProps = {\n action: string\n icon?: IconName\n textSx?: SxProps\n iconSx?: SxProps\n variant?: ButtonProps['variant']\n}\n\nexport type EntityActionMenuLayout = {\n buttonActions: ActionViewProps[]\n downloadMenuActions: ActionViewProps[][]\n primaryMenuActions: ActionViewProps[][]\n primaryMenuText: string\n primaryMenuEndIcon: IconName\n primaryMenuEndIconSx?: SxProps\n menuButtonSx?: SystemStyleObject<Theme>\n downloadMenuVariant?: ButtonProps['variant']\n primaryMenuVariant?: ButtonProps['variant']\n}\n\nexport type EntityActionMenuProps = {\n /* Maps a unique action string to a dynamic configuration for that particular action */\n actionConfiguration: ActionConfigurationMap\n /* Maps each dropdown menu to a dynamic configuration for that particular menu */\n menuConfiguration: MenuConfigurationMap\n /* Defines the layout of the actions. Typically depends on just the entity type and area. */\n layout: EntityActionMenuLayout\n}\n\n/*\n * All visible actions should be specified in the layout, but this is not guaranteed at compile time.\n * Find all visible actions in the action configuration that are not in the layout.\n */\nfunction getUnmappedActions(\n actionConfiguration: ActionConfigurationMap,\n layout: EntityActionMenuLayout,\n): ActionConfigurationMap {\n return Object.fromEntries(\n Object.entries(actionConfiguration).filter(([action, config]) => {\n // We don't care about actions that are not configured or should not be visible\n if (!config || !config.visible) {\n return false\n }\n\n const allLayoutActions: ActionViewProps[] = [\n ...layout.buttonActions,\n ...layout.primaryMenuActions.flat(),\n ...layout.downloadMenuActions.flat(),\n ]\n // Action is unmapped if it's visible and the layout doesn't have it\n return !allLayoutActions.some(\n layoutAction => layoutAction.action === action,\n )\n }),\n )\n}\n\n/**\n * Given a group of dropdown menu items and an action configuration,\n * return a list of dropdown menu items with non-visible and non-configured actions removed.\n * @param group\n * @param actionConfiguration\n */\nfunction mapAndFilterItemsInMenuGroup(\n group: ActionViewProps[],\n actionConfiguration: ActionConfigurationMap,\n): DropdownMenuItem[] {\n return group.reduce(\n (itemAcc: DropdownMenuItem[], actionViewProps: ActionViewProps) => {\n const configForAction = actionConfiguration[actionViewProps.action]\n // Only show the item if it's configured + visible\n if (configForAction && configForAction.visible) {\n itemAcc.push({\n text: configForAction.text ?? actionViewProps.action,\n onClick: configForAction.onClick,\n href: configForAction.href,\n tooltipText: configForAction.tooltipText,\n disabled: configForAction.disabled,\n icon: actionViewProps.icon,\n textSx: actionViewProps.textSx,\n iconSx: actionViewProps.iconSx,\n })\n }\n return itemAcc\n },\n [],\n )\n}\n\n/**\n * Given a list of groups of dropdown menu actions, returns a list of dropdown menu item\n * groups where non-visible actions have been removed, and groups with no visible actions\n * have been removed.\n * @param menuActions\n * @param actionConfiguration\n */\nfunction mapAndFilterMenuGroups(\n menuActions: ActionViewProps[][],\n actionConfiguration: ActionConfigurationMap,\n): DropdownMenuItem[][] {\n return menuActions.reduce(\n (groupAcc: DropdownMenuItem[][], group: ActionViewProps[]) => {\n const itemGroup = mapAndFilterItemsInMenuGroup(group, actionConfiguration)\n // Only show the group if it contains visible items\n if (itemGroup.length > 0) {\n groupAcc.push(itemGroup)\n }\n return groupAcc\n },\n [],\n )\n}\n\n/**\n * The EntityActionMenu renders a menu that displays the actions that can be invoked on an Entity page.\n */\nexport default function EntityActionMenu(props: EntityActionMenuProps) {\n const { actionConfiguration, menuConfiguration, layout } = props\n\n /*\n * All actions should be specified in the layout, but this is not guaranteed at compile time.\n * Find all visible actions in the action configuration that are not in the layout.\n */\n const unmappedActions = getUnmappedActions(actionConfiguration, layout)\n // Warn if unmapped actions were found and push them on to the layout.\n if (Object.entries(unmappedActions).length > 0) {\n console.warn(\n 'Actions are visible but have not been configured in the layout:',\n Object.entries(unmappedActions).map(entry => entry[0]),\n )\n // Modify the layout: put the unmapped actions in their own group at the top of the menu\n layout.primaryMenuActions.unshift(\n Object.entries(unmappedActions).map(\n (entry): ActionViewProps => ({\n action: entry[0],\n }),\n ),\n )\n }\n\n // Map button actions to a button configuration and omit non-visible actions\n const iconButtonConfigs: ComplexMenuButtonProps[] =\n layout.buttonActions.reduce(\n (acc: ComplexMenuButtonProps[], buttonViewProps: ActionViewProps) => {\n const configForAction = actionConfiguration[buttonViewProps.action]\n if (configForAction && configForAction.visible) {\n let onClick = configForAction.onClick\n if (onClick == null && !configForAction.href) {\n console.warn(`No handler registered for ${buttonViewProps.action}`)\n onClick = () => {\n console.warn(\n `No handler registered for ${buttonViewProps.action}`,\n )\n }\n }\n acc.push({\n icon: buttonViewProps.icon as IconName,\n onClick: onClick,\n tooltipText: configForAction.text,\n text: configForAction.text,\n variant: buttonViewProps.variant,\n iconSx: buttonViewProps.iconSx,\n disabled: configForAction.disabled,\n href: configForAction.href,\n })\n }\n return acc\n },\n [],\n )\n\n const downloadMenuConfig: DropdownMenuProps = {\n dropdownButtonText: 'Download Options',\n convertSingleItemToButton: true,\n renderMenuIfNoItems: false,\n variant: layout.downloadMenuVariant,\n buttonTooltip: menuConfiguration.DOWNLOAD.tooltipText,\n buttonProps: {\n disabled: menuConfiguration.DOWNLOAD.disabled,\n endIcon: <IconSvg icon={'expandMore'} wrap={false} />,\n },\n items: mapAndFilterMenuGroups(\n layout.downloadMenuActions,\n actionConfiguration,\n ),\n }\n\n const primaryMenuConfig: DropdownMenuProps = {\n dropdownButtonText: layout.primaryMenuText,\n convertSingleItemToButton: true,\n renderMenuIfNoItems: false,\n variant: layout.primaryMenuVariant,\n buttonProps: {\n endIcon: (\n <IconSvg\n icon={layout.primaryMenuEndIcon}\n wrap={false}\n sx={layout.primaryMenuEndIconSx}\n />\n ),\n },\n items: mapAndFilterMenuGroups(\n layout.primaryMenuActions,\n actionConfiguration,\n ),\n }\n\n const menuButtonSx = layout.menuButtonSx ?? {}\n\n return (\n <Box\n sx={{\n '& .MuiButton-root': {\n borderRadius: '6px',\n fontWeight: 540,\n padding: '10px 12px',\n },\n // Optional per-layout overrides (e.g. background/border color for entity\n // menu buttons).\n '& .MuiButton-outlined': {\n ...menuButtonSx,\n\n '&:hover': {\n ...menuButtonSx,\n backgroundColor: outlinedButtonHoverBackgroundColor,\n },\n },\n '& .MuiButton-text': {\n ...menuButtonSx,\n backgroundColor: 'transparent',\n\n '&:hover': {\n ...menuButtonSx,\n backgroundColor: outlinedButtonHoverBackgroundColor,\n textDecoration: 'none',\n },\n },\n '& .MuiButton-root .MuiTypography-root': {\n fontWeight: 540,\n },\n }}\n >\n <ComplexMenu\n iconButtons={iconButtonConfigs}\n dropdownMenus={[primaryMenuConfig, downloadMenuConfig]}\n />\n </Box>\n )\n}\n\nexport const EXPORTED_FOR_UNIT_TESTING = {\n getUnmappedActions,\n mapAndFilterItemsInMenuGroup,\n mapAndFilterMenuGroups,\n}\n"],"mappings":";;;;;AAOA,IAAM,IAAqC;AA4D3C,SAAS,EACP,GACA,GACwB;CACxB,OAAO,OAAO,YACZ,OAAO,QAAQ,CAAmB,EAAE,QAAQ,CAAC,GAAQ,OAE/C,CAAC,KAAU,CAAC,EAAO,UACd,KASF,CAAC;EALN,GAAG,EAAO;EACV,GAAG,EAAO,mBAAmB,KAAK;EAClC,GAAG,E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AC/C;GACF,IAEF,EAAI,KAAK;IACP,MAAM,EAAgB;IACb;IACT,aAAa,EAAgB;IAC7B,MAAM,EAAgB;IACtB,SAAS,EAAgB;IACzB,QAAQ,EAAgB;IACxB,UAAU,EAAgB;IAC1B,MAAM,EAAgB;GACxB,CAAC;EACH;EACA,OAAO;CACT,GACA,CAAC,CACH,GAEI,IAAwC;EAC5C,oBAAoB;EACpB,2BAA2B;EAC3B,qBAAqB;EACrB,SAAS,EAAO;EAChB,eAAe,EAAkB,SAAS;EAC1C,aAAa;GACX,UAAU,EAAkB,SAAS;GACrC,SAAS,kBAAC,GAAD;IAAS,MAAM;IAAc,MAAM;GAAQ,CAAA;EACtD;EACA,OAAO,EACL,EAAO,qBACP,CACF;CACF,GAEM,IAAuC;EAC3C,oBAAoB,EAAO;EAC3B,2BAA2B;EAC3B,qBAAqB;EACrB,SAAS,EAAO;EAChB,aAAa,EACX,SACE,kBAAC,GAAD;GACE,MAAM,EAAO;GACb,MAAM;GACN,IAAI,EAAO;EACZ,CAAA,EAEL;EACA,OAAO,EACL,EAAO,oBACP,CACF;CACF,GAEM,IAAe,EAAO,gBAAgB,CAAC;CAE7C,OACE,kBAAC,GAAD;EACE,IAAI;GACF,qBAAqB;IACnB,cAAc;IACd,YAAY;IACZ,SAAS;GACX;GAGA,yBAAyB;IACvB,GAAG;IAEH,WAAW;KACT,GAAG;KACH,iBAAiB;IACnB;GACF;GACA,qBAAqB;IACnB,GAAG;IACH,iBAAiB;IAEjB,WAAW;KACT,GAAG;KACH,iBAAiB;KACjB,gBAAgB;IAClB;GACF;GACA,yCAAyC,EACvC,YAAY,IACd;EACF;YAEA,kBAAC,GAAD;GACE,aAAa;GACb,eAAe,CAAC,GAAmB,CAAkB;EACtD,CAAA;CACE,CAAA;AAET;AAEA,IAAa,IAA4B;CACvC;CACA;CACA;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityPageBreadcrumbs.d.ts","sourceRoot":"","sources":["../../../../../src/components/entity/page/breadcrumbs/EntityPageBreadcrumbs.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAEzC,KAAK,cAAc,GAAG;IAEpB,IAAI,EAAE,MAAM,CAAA;IAEZ,OAAO,CAAC,EAAE,OAAO,CAAA;IAEjB,EAAE,CAAC,EAAE,MAAM,CAAA;IAEX,IAAI,CAAC,EAAE,MAAM,CAAA;IAEb,OAAO,CAAC,EAAE,iBAAiB,CAAA;CAC5B,CAAA;AAED,KAAK,0BAA0B,GAAG;IAChC,KAAK,EAAE,cAAc,EAAE,CAAA;IACvB,EAAE,CAAC,EAAE,OAAO,CAAA;CACb,CAAA;
|
|
1
|
+
{"version":3,"file":"EntityPageBreadcrumbs.d.ts","sourceRoot":"","sources":["../../../../../src/components/entity/page/breadcrumbs/EntityPageBreadcrumbs.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAEzC,KAAK,cAAc,GAAG;IAEpB,IAAI,EAAE,MAAM,CAAA;IAEZ,OAAO,CAAC,EAAE,OAAO,CAAA;IAEjB,EAAE,CAAC,EAAE,MAAM,CAAA;IAEX,IAAI,CAAC,EAAE,MAAM,CAAA;IAEb,OAAO,CAAC,EAAE,iBAAiB,CAAA;CAC5B,CAAA;AAED,KAAK,0BAA0B,GAAG;IAChC,KAAK,EAAE,cAAc,EAAE,CAAA;IACvB,EAAE,CAAC,EAAE,OAAO,CAAA;CACb,CAAA;AAmBD,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAC3C,KAAK,EAAE,0BAA0B,2CAUlC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityPageBreadcrumbs.js","names":[],"sources":["../../../../../src/components/entity/page/breadcrumbs/EntityPageBreadcrumbs.tsx"],"sourcesContent":["import { Breadcrumbs } from '@/components/Breadcrumbs/Breadcrumbs'\nimport { SxProps } from '@mui/material'\nimport { MouseEventHandler } from 'react'\n\ntype BreadcrumbItem = {\n /* The text to show in the breadcrumb item. Strings > 25 characters will be truncated */\n text: string\n /* Whether this item represents the current page. If true, this item will not have a link. Default false */\n current?: boolean\n /* Link for the item, if using react-router */\n to?: string\n /* Link for the item, if it should be a normal anchor */\n href?: string\n /* Event handler fired when the link is clicked */\n onClick?: MouseEventHandler\n}\n\ntype EntityPageBreadcrumbsProps = {\n items: BreadcrumbItem[]\n sx?: SxProps\n}\n\nconst ENTITY_PAGE_MAX_BREADCRUMB_LENGTH = 32\n\nconst entityPageBreadcrumbStyle: SxProps = {\n marginTop: '0px',\n padding: '10px 40px',\n
|
|
1
|
+
{"version":3,"file":"EntityPageBreadcrumbs.js","names":[],"sources":["../../../../../src/components/entity/page/breadcrumbs/EntityPageBreadcrumbs.tsx"],"sourcesContent":["import { Breadcrumbs } from '@/components/Breadcrumbs/Breadcrumbs'\nimport { SxProps } from '@mui/material'\nimport { MouseEventHandler } from 'react'\n\ntype BreadcrumbItem = {\n /* The text to show in the breadcrumb item. Strings > 25 characters will be truncated */\n text: string\n /* Whether this item represents the current page. If true, this item will not have a link. Default false */\n current?: boolean\n /* Link for the item, if using react-router */\n to?: string\n /* Link for the item, if it should be a normal anchor */\n href?: string\n /* Event handler fired when the link is clicked */\n onClick?: MouseEventHandler\n}\n\ntype EntityPageBreadcrumbsProps = {\n items: BreadcrumbItem[]\n sx?: SxProps\n}\n\nconst ENTITY_PAGE_MAX_BREADCRUMB_LENGTH = 32\n\nconst entityPageBreadcrumbStyle: SxProps = {\n marginTop: '0px',\n padding: '10px 40px',\n ['& .MuiLink-root']: {\n color: 'text.secondary',\n letterSpacing: 0,\n '&:visited': {\n color: 'text.secondary',\n },\n },\n '& .MuiSvgIcon-root': {\n color: 'grey.500',\n },\n}\n\nexport default function EntityPageBreadcrumbs(\n props: EntityPageBreadcrumbsProps,\n) {\n const { items } = props\n return (\n <Breadcrumbs\n items={items}\n sx={entityPageBreadcrumbStyle}\n maxBreadcrumbLength={ENTITY_PAGE_MAX_BREADCRUMB_LENGTH}\n />\n )\n}\n"],"mappings":";;;AAsBA,IAAM,IAAoC,IAEpC,IAAqC;CACzC,WAAW;CACX,SAAS;CACR,mBAAoB;EACnB,OAAO;EACP,eAAe;EACf,aAAa,EACX,OAAO,iBACT;CACF;CACA,sBAAsB,EACpB,OAAO,WACT;AACF;AAEA,SAAwB,EACtB,GACA;CACA,IAAM,EAAE,aAAU;CAClB,OACE,kBAAC,GAAD;EACS;EACP,IAAI;EACJ,qBAAqB;CACtB,CAAA;AAEL"}
|
|
@@ -5,6 +5,7 @@ export type EntityPageTitleBarProps = {
|
|
|
5
5
|
entityActionMenuProps?: EntityActionMenuProps;
|
|
6
6
|
onActMemberClickAddConditionsForUse: () => void;
|
|
7
7
|
};
|
|
8
|
+
export declare const FAVORITE_BUTTON_ICON_COLOR = "#9EAAB7";
|
|
8
9
|
/**
|
|
9
10
|
* The EntityPageTitleBar component is shown on every Entity page in Synapse, and shows an Entity's metadata and
|
|
10
11
|
* provides controls to view and manipulate the Entity.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityPageTitleBar.d.ts","sourceRoot":"","sources":["../../../../../src/components/entity/page/title_bar/EntityPageTitleBar.tsx"],"names":[],"mappings":"AAMA,OAAyB,EACvB,qBAAqB,EACtB,MAAM,iCAAiC,CAAA;AAIxC,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,EAAE,MAAM,CAAA;IAChB,aAAa,CAAC,EAAE,MAAM,CAAA;IAEtB,qBAAqB,CAAC,EAAE,qBAAqB,CAAA;IAE7C,mCAAmC,EAAE,MAAM,IAAI,CAAA;CAChD,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,
|
|
1
|
+
{"version":3,"file":"EntityPageTitleBar.d.ts","sourceRoot":"","sources":["../../../../../src/components/entity/page/title_bar/EntityPageTitleBar.tsx"],"names":[],"mappings":"AAMA,OAAyB,EACvB,qBAAqB,EACtB,MAAM,iCAAiC,CAAA;AAIxC,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,EAAE,MAAM,CAAA;IAChB,aAAa,CAAC,EAAE,MAAM,CAAA;IAEtB,qBAAqB,CAAC,EAAE,qBAAqB,CAAA;IAE7C,mCAAmC,EAAE,MAAM,IAAI,CAAA;CAChD,CAAA;AAED,eAAO,MAAM,0BAA0B,YAAY,CAAA;AAInD;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,2CAqGxE"}
|
|
@@ -10,18 +10,23 @@ import c from "./TitleBarProperties.js";
|
|
|
10
10
|
import { Avatar as l, Box as u, Skeleton as d, Stack as f, Typography as p } from "@mui/material";
|
|
11
11
|
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
12
12
|
//#region src/components/entity/page/title_bar/EntityPageTitleBar.tsx
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
var g = "#9EAAB7", _ = "#EAF0F5", v = "#497097";
|
|
14
|
+
function y(g) {
|
|
15
|
+
let { entityId: y, versionNumber: b, entityActionMenuProps: x } = g, S = x?.actionConfiguration.SHOW_VERSION_HISTORY?.onClick, { data: C, isLoading: w } = t(y, b), T = C?.entity && e(C.entity) ? C.entity.repositoryName : C?.entity?.name;
|
|
15
16
|
return /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m(u, {
|
|
16
17
|
sx: {
|
|
17
18
|
padding: "20px 40px",
|
|
18
|
-
backgroundColor:
|
|
19
|
+
backgroundColor: _,
|
|
20
|
+
borderRadius: "5px"
|
|
19
21
|
},
|
|
20
22
|
children: /* @__PURE__ */ h(f, {
|
|
21
|
-
sx: {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
sx: {
|
|
24
|
+
flexDirection: {
|
|
25
|
+
xs: "column",
|
|
26
|
+
sm: "row"
|
|
27
|
+
},
|
|
28
|
+
alignItems: "center"
|
|
29
|
+
},
|
|
25
30
|
children: [/* @__PURE__ */ h(f, {
|
|
26
31
|
direction: "row",
|
|
27
32
|
sx: {
|
|
@@ -29,19 +34,20 @@ function g(g) {
|
|
|
29
34
|
flexGrow: 1
|
|
30
35
|
},
|
|
31
36
|
children: [/* @__PURE__ */ m(i, {
|
|
32
|
-
condition:
|
|
37
|
+
condition: w,
|
|
33
38
|
wrapper: d,
|
|
34
39
|
wrapperProps: { variant: "circular" },
|
|
35
40
|
children: /* @__PURE__ */ m(l, {
|
|
36
41
|
sx: {
|
|
37
|
-
bgcolor:
|
|
42
|
+
bgcolor: v,
|
|
38
43
|
height: 48,
|
|
39
|
-
width: 48
|
|
44
|
+
width: 48,
|
|
45
|
+
borderRadius: "3px"
|
|
40
46
|
},
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
47
|
+
variant: "square",
|
|
48
|
+
children: C?.entityType && /* @__PURE__ */ m(n, {
|
|
49
|
+
icon: C?.entityType ? r[C.entityType] : "file",
|
|
50
|
+
wrap: !1
|
|
45
51
|
})
|
|
46
52
|
})
|
|
47
53
|
}), /* @__PURE__ */ h(u, {
|
|
@@ -56,24 +62,27 @@ function g(g) {
|
|
|
56
62
|
gap: "3px"
|
|
57
63
|
},
|
|
58
64
|
children: [/* @__PURE__ */ m(i, {
|
|
59
|
-
condition:
|
|
65
|
+
condition: w,
|
|
60
66
|
wrapper: d,
|
|
61
67
|
children: /* @__PURE__ */ m(p, {
|
|
62
68
|
variant: "headline2",
|
|
63
|
-
children:
|
|
69
|
+
children: T ?? "Name not set"
|
|
64
70
|
})
|
|
65
|
-
}),
|
|
71
|
+
}), C?.entity?.id && /* @__PURE__ */ m(a, {
|
|
72
|
+
entityId: C.entity.id,
|
|
73
|
+
iconColor: "#9EAAB7"
|
|
74
|
+
})]
|
|
66
75
|
}), /* @__PURE__ */ m(s, {
|
|
67
|
-
entityId:
|
|
68
|
-
versionNumber:
|
|
69
|
-
toggleShowVersionHistory:
|
|
76
|
+
entityId: y,
|
|
77
|
+
versionNumber: b,
|
|
78
|
+
toggleShowVersionHistory: S
|
|
70
79
|
})]
|
|
71
80
|
})]
|
|
72
|
-
}),
|
|
81
|
+
}), x && /* @__PURE__ */ m(o, { ...x })]
|
|
73
82
|
})
|
|
74
83
|
}), /* @__PURE__ */ m(c, { ...g })] });
|
|
75
84
|
}
|
|
76
85
|
//#endregion
|
|
77
|
-
export { g as default };
|
|
86
|
+
export { g as FAVORITE_BUTTON_ICON_COLOR, y as default };
|
|
78
87
|
|
|
79
88
|
//# sourceMappingURL=EntityPageTitleBar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityPageTitleBar.js","names":[],"sources":["../../../../../src/components/entity/page/title_bar/EntityPageTitleBar.tsx"],"sourcesContent":["import ConditionalWrapper from '@/components/utils/ConditionalWrapper'\nimport { useGetEntityBundle } from '@/synapse-queries'\nimport { isDockerRepository } from '@/utils/types/IsType'\nimport { Avatar, Box, Skeleton, Stack, Typography } from '@mui/material'\nimport FavoriteButton from '../../../favorites/FavoriteButton'\nimport IconSvg, { type2SvgIconName } from '../../../IconSvg/IconSvg'\nimport EntityActionMenu, {\n EntityActionMenuProps,\n} from '../action_menu/EntityActionMenu'\nimport { EntityTitleBarVersionInfo } from './EntityTitleBarVersionInfo'\nimport TitleBarProperties from './TitleBarProperties'\n\nexport type EntityPageTitleBarProps = {\n entityId: string\n versionNumber?: number\n /* Props that will be passed through to an EntityActionMenu component */\n entityActionMenuProps?: EntityActionMenuProps\n /* Callback invoked when an ACT member clicks \"Add Conditions for Use\". */\n onActMemberClickAddConditionsForUse: () => void\n}\n\n/**\n * The EntityPageTitleBar component is shown on every Entity page in Synapse, and shows an Entity's metadata and\n * provides controls to view and manipulate the Entity.\n */\nexport default function EntityPageTitleBar(props: EntityPageTitleBarProps) {\n const { entityId, versionNumber, entityActionMenuProps } = props\n\n const toggleShowVersionHistory =\n entityActionMenuProps?.actionConfiguration['SHOW_VERSION_HISTORY']?.onClick\n\n const { data: bundle, isLoading } = useGetEntityBundle(\n entityId,\n versionNumber,\n )\n\n const name =\n bundle?.entity && isDockerRepository(bundle.entity)\n ? bundle.entity.repositoryName\n : bundle?.entity?.name\n\n return (\n <div>\n <Box\n sx={{\n padding: '20px 40px',\n backgroundColor: '
|
|
1
|
+
{"version":3,"file":"EntityPageTitleBar.js","names":[],"sources":["../../../../../src/components/entity/page/title_bar/EntityPageTitleBar.tsx"],"sourcesContent":["import ConditionalWrapper from '@/components/utils/ConditionalWrapper'\nimport { useGetEntityBundle } from '@/synapse-queries'\nimport { isDockerRepository } from '@/utils/types/IsType'\nimport { Avatar, Box, Skeleton, Stack, Typography } from '@mui/material'\nimport FavoriteButton from '../../../favorites/FavoriteButton'\nimport IconSvg, { type2SvgIconName } from '../../../IconSvg/IconSvg'\nimport EntityActionMenu, {\n EntityActionMenuProps,\n} from '../action_menu/EntityActionMenu'\nimport { EntityTitleBarVersionInfo } from './EntityTitleBarVersionInfo'\nimport TitleBarProperties from './TitleBarProperties'\n\nexport type EntityPageTitleBarProps = {\n entityId: string\n versionNumber?: number\n /* Props that will be passed through to an EntityActionMenu component */\n entityActionMenuProps?: EntityActionMenuProps\n /* Callback invoked when an ACT member clicks \"Add Conditions for Use\". */\n onActMemberClickAddConditionsForUse: () => void\n}\n\nexport const FAVORITE_BUTTON_ICON_COLOR = '#9EAAB7'\nconst TITLE_BAR_BACKGROUND_COLOR = '#EAF0F5'\nconst AVATAR_BACKGROUND_COLOR = '#497097'\n\n/**\n * The EntityPageTitleBar component is shown on every Entity page in Synapse, and shows an Entity's metadata and\n * provides controls to view and manipulate the Entity.\n */\nexport default function EntityPageTitleBar(props: EntityPageTitleBarProps) {\n const { entityId, versionNumber, entityActionMenuProps } = props\n\n const toggleShowVersionHistory =\n entityActionMenuProps?.actionConfiguration['SHOW_VERSION_HISTORY']?.onClick\n\n const { data: bundle, isLoading } = useGetEntityBundle(\n entityId,\n versionNumber,\n )\n\n const name =\n bundle?.entity && isDockerRepository(bundle.entity)\n ? bundle.entity.repositoryName\n : bundle?.entity?.name\n\n return (\n <div>\n <Box\n sx={{\n padding: '20px 40px',\n backgroundColor: TITLE_BAR_BACKGROUND_COLOR,\n borderRadius: '5px',\n }}\n >\n <Stack\n sx={{\n flexDirection: { xs: 'column', sm: 'row' },\n alignItems: 'center',\n }}\n >\n <Stack\n direction={'row'}\n sx={{\n alignItems: 'center',\n flexGrow: 1,\n }}\n >\n <ConditionalWrapper\n condition={isLoading}\n wrapper={Skeleton}\n wrapperProps={{\n variant: 'circular',\n }}\n >\n <Avatar\n sx={{\n bgcolor: AVATAR_BACKGROUND_COLOR,\n height: 48,\n width: 48,\n borderRadius: '3px',\n }}\n variant={'square'}\n >\n {bundle?.entityType && (\n <IconSvg\n icon={\n bundle?.entityType\n ? type2SvgIconName[bundle.entityType]\n : 'file'\n }\n wrap={false}\n />\n )}\n </Avatar>\n </ConditionalWrapper>\n <Box sx={{ marginLeft: '10px', flexGrow: 1 }}>\n <Stack\n direction={'row'}\n sx={{\n alignItems: 'center',\n gap: '3px',\n }}\n >\n <ConditionalWrapper condition={isLoading} wrapper={Skeleton}>\n <Typography variant={'headline2'}>\n {name ?? 'Name not set'}\n </Typography>\n </ConditionalWrapper>\n {bundle?.entity?.id && (\n <FavoriteButton\n entityId={bundle.entity.id}\n iconColor={FAVORITE_BUTTON_ICON_COLOR}\n />\n )}\n </Stack>\n <EntityTitleBarVersionInfo\n entityId={entityId}\n versionNumber={versionNumber}\n toggleShowVersionHistory={toggleShowVersionHistory}\n />\n </Box>\n </Stack>\n {entityActionMenuProps && (\n <EntityActionMenu {...entityActionMenuProps} />\n )}\n </Stack>\n </Box>\n <TitleBarProperties {...props} />\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;AAqBA,IAAa,IAA6B,WACpC,IAA6B,WAC7B,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GAAI,EAAwB,CAAA,CAE3C;;CACJ,CAAA,GACL,kBAAC,GAAD,EAAoB,GAAI,EAAQ,CAAA,CAC7B,EAAA,CAAA;AAET"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityTitleBarVersionInfo.d.ts","sourceRoot":"","sources":["../../../../../src/components/entity/page/title_bar/EntityTitleBarVersionInfo.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAA;AAGrE,MAAM,MAAM,8BAA8B,GAAG;IAC3C,QAAQ,EAAE,MAAM,CAAA;IAChB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,wBAAwB,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAA;CACzD,CAAA;AAED,iBAAS,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQ/D;AAED,iBAAS,yBAAyB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAWhE;
|
|
1
|
+
{"version":3,"file":"EntityTitleBarVersionInfo.d.ts","sourceRoot":"","sources":["../../../../../src/components/entity/page/title_bar/EntityTitleBarVersionInfo.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAA;AAGrE,MAAM,MAAM,8BAA8B,GAAG;IAC3C,QAAQ,EAAE,MAAM,CAAA;IAChB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,wBAAwB,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAA;CACzD,CAAA;AAED,iBAAS,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQ/D;AAED,iBAAS,yBAAyB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAWhE;AAuBD,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,8BAA8B,kDA4DtC;AAED,eAAO,MAAM,yBAAyB;;;CAGrC,CAAA"}
|
|
@@ -13,12 +13,36 @@ function p(r) {
|
|
|
13
13
|
return n(r) ? t(r) && r.isLatestVersion ? e(r) ? "Draft Version" : "Current Version" : `V${r.versionNumber}${r.isLatestVersion ? " (Current)" : ""}` : null;
|
|
14
14
|
}
|
|
15
15
|
function m(e) {
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
return n(e) ? e.versionComment ?? null : null;
|
|
17
|
+
}
|
|
18
|
+
var h = /* @__PURE__ */ l(c, {
|
|
19
|
+
component: "span",
|
|
20
|
+
variant: "smallText1",
|
|
21
|
+
sx: {
|
|
22
|
+
color: "grey.700",
|
|
23
|
+
marginLeft: "5px",
|
|
24
|
+
marginRight: "5px"
|
|
25
|
+
},
|
|
26
|
+
children: "/"
|
|
27
|
+
});
|
|
28
|
+
function g(e) {
|
|
29
|
+
let { entityId: t, versionNumber: g, toggleShowVersionHistory: _ } = e, { data: v } = i(t, g), y = v?.entity && n(v.entity), b = v?.entity && f(v.entity), x = b ? r(b, d) : void 0, S = v?.entity && p(v.entity), C = v?.entity && m(v.entity);
|
|
30
|
+
return y ? /* @__PURE__ */ u(a, {
|
|
18
31
|
sx: { marginTop: "3px" },
|
|
19
32
|
children: [
|
|
20
33
|
/* @__PURE__ */ l(s, {
|
|
21
|
-
title:
|
|
34
|
+
title: "Click to show version history",
|
|
35
|
+
placement: "top",
|
|
36
|
+
children: /* @__PURE__ */ l(o, {
|
|
37
|
+
onClick: _,
|
|
38
|
+
variant: "smallText1",
|
|
39
|
+
sx: { fontWeight: 400 },
|
|
40
|
+
children: S
|
|
41
|
+
})
|
|
42
|
+
}),
|
|
43
|
+
b && S && h,
|
|
44
|
+
/* @__PURE__ */ l(s, {
|
|
45
|
+
title: b,
|
|
22
46
|
placement: "bottom",
|
|
23
47
|
children: /* @__PURE__ */ l(c, {
|
|
24
48
|
component: "span",
|
|
@@ -27,37 +51,27 @@ function m(e) {
|
|
|
27
51
|
color: "grey.700",
|
|
28
52
|
fontStyle: "italic"
|
|
29
53
|
},
|
|
30
|
-
children:
|
|
54
|
+
children: x
|
|
31
55
|
})
|
|
32
56
|
}),
|
|
33
|
-
|
|
57
|
+
C && h,
|
|
58
|
+
/* @__PURE__ */ l(c, {
|
|
34
59
|
component: "span",
|
|
35
60
|
variant: "smallText1",
|
|
36
61
|
sx: {
|
|
37
62
|
color: "grey.700",
|
|
38
|
-
|
|
39
|
-
marginRight: "5px"
|
|
63
|
+
fontStyle: "italic"
|
|
40
64
|
},
|
|
41
|
-
children:
|
|
42
|
-
}),
|
|
43
|
-
/* @__PURE__ */ l(s, {
|
|
44
|
-
title: "Click to show version history",
|
|
45
|
-
placement: "top",
|
|
46
|
-
children: /* @__PURE__ */ l(o, {
|
|
47
|
-
onClick: h,
|
|
48
|
-
variant: "smallText1",
|
|
49
|
-
sx: { fontWeight: 400 },
|
|
50
|
-
children: b
|
|
51
|
-
})
|
|
65
|
+
children: C
|
|
52
66
|
})
|
|
53
67
|
]
|
|
54
68
|
}) : null;
|
|
55
69
|
}
|
|
56
|
-
var
|
|
70
|
+
var _ = {
|
|
57
71
|
getDisplayedVersionLabel: f,
|
|
58
72
|
getDisplayedVersionNumber: p
|
|
59
73
|
};
|
|
60
74
|
//#endregion
|
|
61
|
-
export {
|
|
75
|
+
export { _ as EXPORTED_FOR_UNIT_TESTING, g as EntityTitleBarVersionInfo };
|
|
62
76
|
|
|
63
77
|
//# sourceMappingURL=EntityTitleBarVersionInfo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityTitleBarVersionInfo.js","names":[],"sources":["../../../../../src/components/entity/page/title_bar/EntityTitleBarVersionInfo.tsx"],"sourcesContent":["import { useGetEntityBundle } from '@/synapse-queries'\nimport {\n isEntityRefCollectionView,\n isTable,\n isVersionableEntity,\n} from '@/utils/functions/EntityTypeUtils'\nimport { truncateString } from '@/utils/functions/StringUtils'\nimport { Box, Link, Tooltip, Typography } from '@mui/material'\nimport { Entity } from '@sage-bionetworks/synapse-types'\nimport { ActionConfiguration } from '../action_menu/EntityActionMenu'\n\nconst MAX_VERSION_LABEL_LENGTH = 50\nexport type EntityTitleBarVersionInfoProps = {\n entityId: string\n versionNumber?: number\n toggleShowVersionHistory: ActionConfiguration['onClick']\n}\n\nfunction getDisplayedVersionLabel(entity: Entity): string | null {\n if (!isVersionableEntity(entity)) {\n return null\n }\n if (isTable(entity) && entity.isLatestVersion) {\n return null\n }\n return entity.versionLabel ?? null\n}\n\nfunction getDisplayedVersionNumber(entity: Entity): string | null {\n if (!isVersionableEntity(entity)) {\n return null\n }\n if (isTable(entity) && entity.isLatestVersion) {\n if (isEntityRefCollectionView(entity)) {\n return 'Draft Version'\n }\n return 'Current Version'\n }\n return `V${entity.versionNumber}${entity.isLatestVersion ? ' (Current)' : ''}`\n}\n\nexport function EntityTitleBarVersionInfo(\n props: EntityTitleBarVersionInfoProps,\n) {\n const { entityId, versionNumber, toggleShowVersionHistory } = props\n\n const { data: bundle } = useGetEntityBundle(entityId, versionNumber)\n\n const isVersionable = bundle?.entity && isVersionableEntity(bundle.entity)\n\n const fullVersionLabel =\n bundle?.entity && getDisplayedVersionLabel(bundle.entity)\n const truncatedVersionLabel = fullVersionLabel\n ? truncateString(fullVersionLabel, MAX_VERSION_LABEL_LENGTH)\n : undefined\n\n const versionNumberDisplay =\n bundle?.entity && getDisplayedVersionNumber(bundle.entity)\n\n if (!isVersionable) {\n return null\n }\n
|
|
1
|
+
{"version":3,"file":"EntityTitleBarVersionInfo.js","names":[],"sources":["../../../../../src/components/entity/page/title_bar/EntityTitleBarVersionInfo.tsx"],"sourcesContent":["import { useGetEntityBundle } from '@/synapse-queries'\nimport {\n isEntityRefCollectionView,\n isTable,\n isVersionableEntity,\n} from '@/utils/functions/EntityTypeUtils'\nimport { truncateString } from '@/utils/functions/StringUtils'\nimport { Box, Link, Tooltip, Typography } from '@mui/material'\nimport { Entity } from '@sage-bionetworks/synapse-types'\nimport { ActionConfiguration } from '../action_menu/EntityActionMenu'\n\nconst MAX_VERSION_LABEL_LENGTH = 50\nexport type EntityTitleBarVersionInfoProps = {\n entityId: string\n versionNumber?: number\n toggleShowVersionHistory: ActionConfiguration['onClick']\n}\n\nfunction getDisplayedVersionLabel(entity: Entity): string | null {\n if (!isVersionableEntity(entity)) {\n return null\n }\n if (isTable(entity) && entity.isLatestVersion) {\n return null\n }\n return entity.versionLabel ?? null\n}\n\nfunction getDisplayedVersionNumber(entity: Entity): string | null {\n if (!isVersionableEntity(entity)) {\n return null\n }\n if (isTable(entity) && entity.isLatestVersion) {\n if (isEntityRefCollectionView(entity)) {\n return 'Draft Version'\n }\n return 'Current Version'\n }\n return `V${entity.versionNumber}${entity.isLatestVersion ? ' (Current)' : ''}`\n}\n\nfunction getDisplayedVersionComment(entity: Entity): string | null {\n if (!isVersionableEntity(entity)) {\n return null\n }\n return entity.versionComment ?? null\n}\n\nconst forwardSlash = (\n <Typography\n component={'span'}\n variant=\"smallText1\"\n sx={{\n color: 'grey.700',\n marginLeft: '5px',\n marginRight: '5px',\n }}\n >\n /\n </Typography>\n)\n\nexport function EntityTitleBarVersionInfo(\n props: EntityTitleBarVersionInfoProps,\n) {\n const { entityId, versionNumber, toggleShowVersionHistory } = props\n\n const { data: bundle } = useGetEntityBundle(entityId, versionNumber)\n\n const isVersionable = bundle?.entity && isVersionableEntity(bundle.entity)\n\n const fullVersionLabel =\n bundle?.entity && getDisplayedVersionLabel(bundle.entity)\n const truncatedVersionLabel = fullVersionLabel\n ? truncateString(fullVersionLabel, MAX_VERSION_LABEL_LENGTH)\n : undefined\n\n const versionNumberDisplay =\n bundle?.entity && getDisplayedVersionNumber(bundle.entity)\n\n const versionComment =\n bundle?.entity && getDisplayedVersionComment(bundle.entity)\n\n if (!isVersionable) {\n return null\n }\n return (\n <Box sx={{ marginTop: '3px' }}>\n <Tooltip title={'Click to show version history'} placement={'top'}>\n <Link\n onClick={toggleShowVersionHistory}\n variant=\"smallText1\"\n sx={{ fontWeight: 400 }}\n >\n {versionNumberDisplay}\n </Link>\n </Tooltip>\n {fullVersionLabel && versionNumberDisplay && forwardSlash}\n <Tooltip title={fullVersionLabel} placement={'bottom'}>\n <Typography\n component={'span'}\n variant=\"smallText1\"\n sx={{\n color: 'grey.700',\n fontStyle: 'italic',\n }}\n >\n {truncatedVersionLabel}\n </Typography>\n </Tooltip>\n {versionComment && forwardSlash}\n <Typography\n component={'span'}\n variant=\"smallText1\"\n sx={{\n color: 'grey.700',\n fontStyle: 'italic',\n }}\n >\n {versionComment}\n </Typography>\n </Box>\n )\n}\n\nexport const EXPORTED_FOR_UNIT_TESTING = {\n getDisplayedVersionLabel,\n getDisplayedVersionNumber,\n}\n"],"mappings":";;;;;;;AAWA,IAAM,IAA2B;AAOjC,SAAS,EAAyB,GAA+B;CAO/D,OANI,CAAC,EAAoB,CAAM,KAG3B,EAAQ,CAAM,KAAK,EAAO,kBACrB,OAEF,EAAO,gBAAgB;AAChC;AAEA,SAAS,EAA0B,GAA+B;CAUhE,OATK,EAAoB,CAAM,IAG3B,EAAQ,CAAM,KAAK,EAAO,kBACxB,EAA0B,CAAM,IAC3B,kBAEF,oBAEF,IAAI,EAAO,gBAAgB,EAAO,kBAAkB,eAAe,OARjE;AASX;AAEA,SAAS,EAA2B,GAA+B;CAIjE,OAHK,EAAoB,CAAM,IAGxB,EAAO,kBAAkB,OAFvB;AAGX;AAEA,IAAM,IACJ,kBAAC,GAAD;CACE,WAAW;CACX,SAAQ;CACR,IAAI;EACF,OAAO;EACP,YAAY;EACZ,aAAa;CACf;WACD;AAEW,CAAA;AAGd,SAAgB,EACd,GACA;CACA,IAAM,EAAE,aAAU,kBAAe,gCAA6B,GAExD,EAAE,MAAM,MAAW,EAAmB,GAAU,CAAa,GAE7D,IAAgB,GAAQ,UAAU,EAAoB,EAAO,MAAM,GAEnE,IACJ,GAAQ,UAAU,EAAyB,EAAO,MAAM,GACpD,IAAwB,IAC1B,EAAe,GAAkB,CAAwB,IACzD,KAAA,GAEE,IACJ,GAAQ,UAAU,EAA0B,EAAO,MAAM,GAErD,IACJ,GAAQ,UAAU,EAA2B,EAAO,MAAM;CAK5D,OAHK,IAIH,kBAAC,GAAD;EAAK,IAAI,EAAE,WAAW,MAAM;YAA5B;GACE,kBAAC,GAAD;IAAS,OAAO;IAAiC,WAAW;cAC1D,kBAAC,GAAD;KACE,SAAS;KACT,SAAQ;KACR,IAAI,EAAE,YAAY,IAAI;eAErB;IACG,CAAA;GACC,CAAA;GACR,KAAoB,KAAwB;GAC7C,kBAAC,GAAD;IAAS,OAAO;IAAkB,WAAW;cAC3C,kBAAC,GAAD;KACE,WAAW;KACX,SAAQ;KACR,IAAI;MACF,OAAO;MACP,WAAW;KACb;eAEC;IACS,CAAA;GACL,CAAA;GACR,KAAkB;GACnB,kBAAC,GAAD;IACE,WAAW;IACX,SAAQ;IACR,IAAI;KACF,OAAO;KACP,WAAW;IACb;cAEC;GACS,CAAA;EACT;MArCE;AAuCX;AAEA,IAAa,IAA4B;CACvC;CACA;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FavoriteButton.d.ts","sourceRoot":"","sources":["../../../src/components/favorites/FavoriteButton.tsx"],"names":[],"mappings":"AAUA,MAAM,MAAM,mBAAmB,GAAG;IAEhC,QAAQ,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"FavoriteButton.d.ts","sourceRoot":"","sources":["../../../src/components/favorites/FavoriteButton.tsx"],"names":[],"mappings":"AAUA,MAAM,MAAM,mBAAmB,GAAG;IAEhC,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,KAAK,EAAE,mBAAmB,2CAkDhE"}
|
|
@@ -7,24 +7,24 @@ import { IconButton as o, Skeleton as s, Tooltip as c } from "@mui/material";
|
|
|
7
7
|
import { jsx as l } from "react/jsx-runtime";
|
|
8
8
|
//#region src/components/favorites/FavoriteButton.tsx
|
|
9
9
|
function u(u) {
|
|
10
|
-
let { entityId: d } = u, { isAuthenticated:
|
|
11
|
-
return
|
|
12
|
-
condition:
|
|
10
|
+
let { entityId: d, iconColor: f } = u, { isAuthenticated: p } = e(), { isFavorite: m, isLoading: h } = n(d), { mutate: g, isPending: _ } = t(), { mutate: v, isPending: y } = r(), b = h || _ || y || !p, x = "Add to Favorites";
|
|
11
|
+
return p ? m && (x = "Remove from Favorites") : x = "Sign in to add this to your favorites", /* @__PURE__ */ l(a, {
|
|
12
|
+
condition: h,
|
|
13
13
|
wrapper: s,
|
|
14
14
|
children: /* @__PURE__ */ l(c, {
|
|
15
|
-
title:
|
|
15
|
+
title: x,
|
|
16
16
|
placement: "top",
|
|
17
17
|
children: /* @__PURE__ */ l("span", { children: /* @__PURE__ */ l(o, {
|
|
18
18
|
size: "small",
|
|
19
|
-
disabled:
|
|
19
|
+
disabled: b,
|
|
20
20
|
onClick: () => {
|
|
21
|
-
|
|
21
|
+
m ? v(d) : g(d);
|
|
22
22
|
},
|
|
23
23
|
sx: { padding: "2px" },
|
|
24
24
|
children: /* @__PURE__ */ l(i, {
|
|
25
|
-
icon:
|
|
25
|
+
icon: m ? "fav" : "favOutline",
|
|
26
26
|
sx: {
|
|
27
|
-
color: "tertiary.main",
|
|
27
|
+
color: m ? "tertiary.main" : f ?? "tertiary.main",
|
|
28
28
|
width: "21px",
|
|
29
29
|
height: "21px"
|
|
30
30
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FavoriteButton.js","names":[],"sources":["../../../src/components/favorites/FavoriteButton.tsx"],"sourcesContent":["import ConditionalWrapper from '@/components/utils/ConditionalWrapper'\nimport {\n useAddFavorite,\n useIsFavorite,\n useRemoveFavorite,\n} from '@/synapse-queries'\nimport { useSynapseContext } from '@/utils/context/SynapseContext'\nimport { IconButton, Skeleton, Tooltip } from '@mui/material'\nimport IconSvg from '../IconSvg/IconSvg'\n\nexport type FavoriteButtonProps = {\n /* The entity for which to show a favorite button */\n entityId: string\n}\n\n/**\n * Renders a button that indicates if an entity is favorited by the logged-in user. When clicked, the entity is\n * added to/removed from their favorites\n */\nexport default function FavoriteButton(props: FavoriteButtonProps) {\n const { entityId } = props\n const { isAuthenticated } = useSynapseContext()\n const { isFavorite, isLoading } = useIsFavorite(entityId)\n const { mutate: onAddFavorite, isPending: isAddingFavorite } =\n useAddFavorite()\n const { mutate: onRemoveFavorite, isPending: isRemovingFavorite } =\n useRemoveFavorite()\n\n const disableButton =\n isLoading || isAddingFavorite || isRemovingFavorite || !isAuthenticated\n\n let tooltipText = 'Add to Favorites'\n if (!isAuthenticated) {\n tooltipText = 'Sign in to add this to your favorites'\n } else if (isFavorite) {\n tooltipText = 'Remove from Favorites'\n }\n return (\n <ConditionalWrapper condition={isLoading} wrapper={Skeleton}>\n <Tooltip title={tooltipText} placement={'top'}>\n <span>\n <IconButton\n size={'small'}\n disabled={disableButton}\n onClick={() => {\n if (isFavorite) {\n onRemoveFavorite(entityId)\n } else {\n onAddFavorite(entityId)\n }\n }}\n sx={{ padding: '2px' }}\n >\n <IconSvg\n icon={isFavorite ? 'fav' : 'favOutline'}\n sx={{\n color: 'tertiary.main',\n width: '21px',\n height: '21px',\n }}\n wrap={false}\n />\n </IconButton>\n </span>\n </Tooltip>\n </ConditionalWrapper>\n )\n}\n"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"FavoriteButton.js","names":[],"sources":["../../../src/components/favorites/FavoriteButton.tsx"],"sourcesContent":["import ConditionalWrapper from '@/components/utils/ConditionalWrapper'\nimport {\n useAddFavorite,\n useIsFavorite,\n useRemoveFavorite,\n} from '@/synapse-queries'\nimport { useSynapseContext } from '@/utils/context/SynapseContext'\nimport { IconButton, Skeleton, Tooltip } from '@mui/material'\nimport IconSvg from '../IconSvg/IconSvg'\n\nexport type FavoriteButtonProps = {\n /* The entity for which to show a favorite button */\n entityId: string\n iconColor?: string\n}\n\n/**\n * Renders a button that indicates if an entity is favorited by the logged-in user. When clicked, the entity is\n * added to/removed from their favorites\n */\nexport default function FavoriteButton(props: FavoriteButtonProps) {\n const { entityId, iconColor } = props\n const { isAuthenticated } = useSynapseContext()\n const { isFavorite, isLoading } = useIsFavorite(entityId)\n const { mutate: onAddFavorite, isPending: isAddingFavorite } =\n useAddFavorite()\n const { mutate: onRemoveFavorite, isPending: isRemovingFavorite } =\n useRemoveFavorite()\n\n const disableButton =\n isLoading || isAddingFavorite || isRemovingFavorite || !isAuthenticated\n\n let tooltipText = 'Add to Favorites'\n if (!isAuthenticated) {\n tooltipText = 'Sign in to add this to your favorites'\n } else if (isFavorite) {\n tooltipText = 'Remove from Favorites'\n }\n return (\n <ConditionalWrapper condition={isLoading} wrapper={Skeleton}>\n <Tooltip title={tooltipText} placement={'top'}>\n <span>\n <IconButton\n size={'small'}\n disabled={disableButton}\n onClick={() => {\n if (isFavorite) {\n onRemoveFavorite(entityId)\n } else {\n onAddFavorite(entityId)\n }\n }}\n sx={{ padding: '2px' }}\n >\n <IconSvg\n icon={isFavorite ? 'fav' : 'favOutline'}\n sx={{\n color: isFavorite\n ? 'tertiary.main'\n : (iconColor ?? 'tertiary.main'),\n width: '21px',\n height: '21px',\n }}\n wrap={false}\n />\n </IconButton>\n </span>\n </Tooltip>\n </ConditionalWrapper>\n )\n}\n"],"mappings":";;;;;;;;AAoBA,SAAwB,EAAe,GAA4B;CACjE,IAAM,EAAE,aAAU,iBAAc,GAC1B,EAAE,uBAAoB,EAAkB,GACxC,EAAE,eAAY,iBAAc,EAAc,CAAQ,GAClD,EAAE,QAAQ,GAAe,WAAW,MACxC,EAAe,GACX,EAAE,QAAQ,GAAkB,WAAW,MAC3C,EAAkB,GAEd,IACJ,KAAa,KAAoB,KAAsB,CAAC,GAEtD,IAAc;CAMlB,OALK,IAEM,MACT,IAAc,2BAFd,IAAc,yCAKd,kBAA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