Skip to content

Commit cb7d2ab

Browse files
Make table visible by default, other table improvements (#268)
* 1st version done * More table improvements --------- Co-authored-by: Garrett Stevens <[email protected]>
1 parent 0b1c631 commit cb7d2ab

File tree

4 files changed

+40
-30
lines changed

4 files changed

+40
-30
lines changed

packages/jbrowse-plugin-apollo/src/LinearApolloDisplay/components/LinearApolloDisplay.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ export const LinearApolloDisplay = observer(function LinearApolloDisplay(
5656
const [contextCoord, setContextCoord] = useState<Coord>()
5757
const [contextMenuItems, setContextMenuItems] = useState<MenuItem[]>([])
5858
const message = regionCannotBeRendered()
59+
// eslint-disable-next-line unicorn/consistent-destructuring
60+
model.tabularEditor.showPane()
5961
if (!isShown) {
6062
return null
6163
}

packages/jbrowse-plugin-apollo/src/TabularEditor/HybridGrid/Feature.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const useStyles = makeStyles()((theme) => ({
4242
transform: 'rotate(90deg)',
4343
},
4444
hoveredFeature: {
45-
backgroundColor: theme.palette.grey[300],
45+
backgroundColor: theme.palette.action.hover,
4646
},
4747
typeInputElement: {
4848
border: 'none',

packages/jbrowse-plugin-apollo/src/TabularEditor/HybridGrid/HybridGrid.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const useStyles = makeStyles()((theme) => ({
2424
td: { whiteSpace: 'normal' },
2525
},
2626
selectedFeature: {
27-
backgroundColor: theme.palette.secondary.light,
27+
backgroundColor: theme.palette.action.selected,
2828
},
2929
}))
3030

packages/jbrowse-plugin-apollo/src/makeDisplayComponent.tsx

Lines changed: 36 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,26 @@ const useStyles = makeStyles()((theme) => ({
3131
'&:hover': {
3232
background: theme.palette.action.hover,
3333
},
34+
display: 'flex',
35+
alignItems: 'center',
36+
justifyContent: 'center',
3437
},
3538
accordionRoot: {
36-
background: theme.palette.background.paper,
39+
background: theme.palette.divider,
40+
},
41+
resizeHandle: {
42+
width: '100%',
43+
height: 4,
44+
position: 'absolute',
45+
cursor: 'row-resize',
46+
zIndex: 100,
47+
},
48+
expandIcon: {
49+
// position: 'relative',
50+
},
51+
title: {
52+
// position: 'relative',
53+
userSelect: 'none',
3754
},
3855
}))
3956

@@ -60,6 +77,7 @@ const ResizeHandle = ({
6077
}: {
6178
onResize: (sizeDelta: number) => void
6279
}) => {
80+
const { classes } = useStyles()
6381
const mouseMove = useCallback(
6482
(event: MouseEvent) => {
6583
event.stopPropagation()
@@ -92,13 +110,7 @@ const ResizeHandle = ({
92110
e.stopPropagation()
93111
e.preventDefault()
94112
}}
95-
style={{
96-
width: '100%',
97-
height: '4px',
98-
position: 'absolute',
99-
cursor: 'row-resize',
100-
zIndex: 100,
101-
}}
113+
className={classes.resizeHandle}
102114
/>
103115
)
104116
}
@@ -117,18 +129,18 @@ const AccordionControl = observer(function AccordionControl({
117129
const { classes } = useStyles()
118130
return (
119131
<div className={classes.accordionRoot}>
132+
{open && onResize ? <ResizeHandle onResize={onResize} /> : null}
120133
{/* TODO: a11y */}
121134
{/* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */}
122135
<div className={classes.accordionControl} onClick={onClick}>
123-
{open && onResize ? <ResizeHandle onResize={onResize} /> : null}
124136
{open ? (
125-
<ExpandLessIcon sx={{ position: 'relative', top: -4 }} />
137+
<ExpandLessIcon className={classes.expandIcon} />
126138
) : (
127-
<ExpandMoreIcon sx={{ position: 'relative', top: -4 }} />
139+
<ExpandMoreIcon className={classes.expandIcon} />
128140
)}
129141
{title ? (
130142
<Typography
131-
sx={{ position: 'relative', top: -11, userSelect: 'none' }}
143+
className={classes.title}
132144
variant="caption"
133145
component="span"
134146
>
@@ -150,11 +162,15 @@ export const DisplayComponent = observer(function DisplayComponent({
150162

151163
const {
152164
height: overallHeight,
165+
heightPreConfig,
153166
isShown,
154167
selectedFeature,
155168
tabularEditor,
156169
toggleShown,
157170
} = model
171+
if (!heightPreConfig) {
172+
model.setHeight(500)
173+
}
158174
const detailsHeight = tabularEditor.isShown ? model.detailsHeight : 0
159175
const featureAreaHeight = isShown
160176
? overallHeight - detailsHeight - accordionControlHeight * 2
@@ -169,14 +185,8 @@ export const DisplayComponent = observer(function DisplayComponent({
169185
() => scrollSelectedFeatureIntoView(model, canvasScrollContainerRef),
170186
[model, selectedFeature],
171187
)
172-
const headerStyle = {
173-
display: 'flex',
174-
justifyContent: 'center',
175-
alignItems: 'center',
176-
background: 'turquoise',
177-
}
178188
return (
179-
<div style={{ height: overallHeight }}>
189+
<div className={classes.details} style={{ height: overallHeight }}>
180190
<AccordionControl
181191
open={isShown}
182192
title="Graphical"
@@ -189,15 +199,13 @@ export const DisplayComponent = observer(function DisplayComponent({
189199
>
190200
<LinearApolloDisplay model={model} {...other} />
191201
</div>
192-
<div style={headerStyle}>
193-
<AccordionControl
194-
title="Table"
195-
open={tabularEditor.isShown}
196-
onClick={tabularEditor.togglePane}
197-
onResize={onDetailsResize}
198-
/>
199-
</div>
200-
<div className={classes.details} style={{ height: detailsHeight }}>
202+
<AccordionControl
203+
title="Table"
204+
open={tabularEditor.isShown}
205+
onClick={tabularEditor.togglePane}
206+
onResize={onDetailsResize}
207+
/>
208+
<div style={{ height: detailsHeight }}>
201209
<TabularEditorPane model={model} />
202210
</div>
203211
</div>

0 commit comments

Comments
 (0)