Skip to content

Commit 6afc979

Browse files
authored
Improve help text on track category dropdown (#5199)
1 parent 59c26fe commit 6afc979

File tree

1 file changed

+24
-27
lines changed
  • plugins/data-management/src/HierarchicalTrackSelectorWidget/components/tree

1 file changed

+24
-27
lines changed

plugins/data-management/src/HierarchicalTrackSelectorWidget/components/tree/TrackCategory.tsx

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { useState } from 'react'
22

3-
import JBrowseMenu from '@jbrowse/core/ui/Menu'
3+
import { CascadingMenuButton } from '@jbrowse/core/ui'
44
import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown'
55
import ArrowRightIcon from '@mui/icons-material/ArrowRight'
66
import MoreHorizIcon from '@mui/icons-material/MoreHoriz'
7-
import { IconButton, Typography } from '@mui/material'
7+
import { Typography } from '@mui/material'
88
import { makeStyles } from 'tss-react/mui'
99

1010
import { getAllChildren, treeToMap } from '../util'
@@ -47,7 +47,7 @@ export default function Category({
4747
data: NodeData
4848
}) {
4949
const { classes } = useStyles()
50-
const [menuEl, setMenuEl] = useState<HTMLElement | null>(null)
50+
const [menuOpen, setMenuOpen] = useState(false)
5151
const { menuItems = [], name, model, id, tree } = data
5252

5353
const currentNode = treeToMap(tree).get(id)
@@ -58,7 +58,7 @@ export default function Category({
5858
<div
5959
className={classes.accordionText}
6060
onClick={() => {
61-
if (!menuEl) {
61+
if (!menuOpen) {
6262
data.toggleCollapse(id)
6363
setOpen(!isOpen)
6464
}
@@ -67,33 +67,25 @@ export default function Category({
6767
<Typography data-testid={`htsCategory-${name}`}>
6868
{isOpen ? <ArrowDropDownIcon /> : <ArrowRightIcon />}
6969
{name}
70-
<IconButton
71-
onClick={event => {
72-
setMenuEl(event.currentTarget)
73-
event.stopPropagation()
74-
}}
75-
className={classes.contrastColor}
76-
>
77-
<MoreHorizIcon />
78-
</IconButton>
79-
</Typography>
80-
{menuEl ? (
81-
<JBrowseMenu
82-
anchorEl={menuEl}
70+
<CascadingMenuButton
8371
menuItems={[
8472
{
8573
label: 'Add to selection',
8674
onClick: () => {
8775
const r = treeToMap(tree).get(id)
8876
model.addToSelection(getAllChildren(r))
8977
},
78+
helpText:
79+
'Add all tracks in this category to the current selection. This allows you to perform bulk operations on multiple tracks at once, such as configuring settings or exporting track configurations.',
9080
},
9181
{
9282
label: 'Remove from selection',
9383
onClick: () => {
9484
const r = treeToMap(tree).get(id)
9585
model.removeFromSelection(getAllChildren(r))
9686
},
87+
helpText:
88+
'Remove all tracks in this category from the current selection. Use this to deselect tracks that were previously added to your selection.',
9789
},
9890
{
9991
label: 'Show all',
@@ -104,6 +96,8 @@ export default function Category({
10496
}
10597
}
10698
},
99+
helpText:
100+
'Display all tracks in this category on the current view. This is useful when you want to visualize multiple related tracks simultaneously to compare their data.',
107101
},
108102
{
109103
label: 'Hide all',
@@ -114,6 +108,8 @@ export default function Category({
114108
}
115109
}
116110
},
111+
helpText:
112+
'Hide all tracks in this category from the current view. This helps declutter your view by removing tracks you are not currently analyzing.',
117113
},
118114
...(hasSubcategories
119115
? [
@@ -127,6 +123,8 @@ export default function Category({
127123
}
128124
}
129125
},
126+
helpText:
127+
'Collapse all nested subcategories within this category. This provides a cleaner, more compact view of the track hierarchy by hiding the detailed contents of subcategories.',
130128
},
131129
{
132130
label: 'Expand all subcategories',
@@ -138,21 +136,20 @@ export default function Category({
138136
}
139137
}
140138
},
139+
helpText:
140+
'Expand all nested subcategories within this category. This reveals all tracks and subcategories at once, making it easier to browse and select tracks from the entire hierarchy.',
141141
},
142142
]
143143
: []),
144144
...menuItems,
145145
]}
146-
onMenuItemClick={(_event, callback) => {
147-
callback()
148-
setMenuEl(null)
149-
}}
150-
open={Boolean(menuEl)}
151-
onClose={() => {
152-
setMenuEl(null)
153-
}}
154-
/>
155-
) : null}
146+
className={classes.contrastColor}
147+
stopPropagation
148+
setOpen={setMenuOpen}
149+
>
150+
<MoreHorizIcon />
151+
</CascadingMenuButton>
152+
</Typography>
156153
</div>
157154
)
158155
}

0 commit comments

Comments
 (0)