Skip to content

Commit

Permalink
[skip ci] Refactors
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Mar 12, 2024
1 parent 392d182 commit 66f78f6
Show file tree
Hide file tree
Showing 8 changed files with 2,609 additions and 2,967 deletions.
6 changes: 1 addition & 5 deletions packages/core/ReExports/modules.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -364,11 +364,7 @@ const DataGridEntries: Record<string, LazyExoticComponent<any>> = {
default: module.GridPanelWrapper,
})),
),
GridPreferencesPanel: lazy(() =>
import('@mui/x-data-grid').then(module => ({
default: module.GridPreferencesPanel,
})),
),

GridRemoveIcon: lazy(() =>
import('@mui/x-data-grid').then(module => ({
default: module.GridRemoveIcon,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const Translocations = observer(function ({
views[level1],
f1.get('refName'),
c1[LEFT],
assembly
assembly,
)
const x2 = r
const reversed1 = views[level1].pxToBp(x1).reversed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const ImportWizard = observer(({ model }: { model: ImportWizardModel }) => {
const session = getSession(model)
const { classes } = useStyles()
const { assemblyNames, assemblyManager } = session
const { fileType, canCancel, fileSource, fileTypes, error, loading } = model
const { fileType, fileSource, fileTypes, error, loading } = model
const [selected, setSelected] = useState(assemblyNames[0])
const err = assemblyManager.get(selected)?.error || error
const showRowControls = fileType === 'CSV' || fileType === 'TSV'
Expand Down Expand Up @@ -87,30 +87,18 @@ const ImportWizard = observer(({ model }: { model: ImportWizardModel }) => {
onChange={val => setSelected(val)}
/>
</div>
<div>
{canCancel ? (
<Button
variant="contained"
color="secondary"
onClick={() => model.cancelButton()}
disabled={!canCancel}
>
Cancel
</Button>
) : null}
<Button
disabled={!!err}
variant="contained"
data-testid="open_spreadsheet"
color="primary"
onClick={() => {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
model.import(selected)
}}
>
Open
</Button>
</div>
<Button
disabled={!!err}
variant="contained"
data-testid="open_spreadsheet"
color="primary"
onClick={() => {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
model.import(selected)
}}
>
Open
</Button>
</div>
)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const DataTable = observer(function ({ model }: { model: SpreadsheetModel }) {
return (
<div ref={ref}>
{error ? (
<ErrorMessage error={error} clearError={() => setError(undefined)} />
<ErrorMessage error={error} onReset={() => setError(undefined)} />
) : undefined}
<ResizeBar
widths={Object.values(widths).map(f => f ?? 100)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ function stateModelFactory() {
width: 400,
}))
.views(self => ({
/**
* #getter
*/
get assemblyName() {
return self.spreadsheet.assemblyName
},
/**
* #getter
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,9 @@ const SvInspectorView = observer(function ({
CircularViewReactComponent,
spreadsheetView,
circularView,
showCircularView,
} = model
const [initialCircWidth, setInitialCircWidth] = useState(0)
const [initialSpreadsheetWidth, setInitialSpreadsheetWidth] = useState(0)
console.log({ showCircularView })

return (
<div className={classes.container}>
Expand All @@ -59,27 +57,23 @@ const SvInspectorView = observer(function ({
<SpreadsheetViewReactComponent model={spreadsheetView} />
</div>

{showCircularView ? (
<>
<ResizeHandle
onDrag={(_, total) => {
circularView.resizeWidth(initialCircWidth - total)
spreadsheetView.resizeWidth(initialSpreadsheetWidth + total)
}}
onMouseDown={() => {
setInitialSpreadsheetWidth(spreadsheetView.width)
setInitialCircWidth(circularView.width)
}}
vertical
flexbox
className={classes.resizeHandleVert}
/>
<div style={{ width: circularView.width }}>
<CircularViewOptions svInspector={model} />
<CircularViewReactComponent model={circularView} />
</div>
</>
) : null}
<ResizeHandle
onDrag={(_, total) => {
circularView.setWidth(initialCircWidth + total)
spreadsheetView.setWidth(initialSpreadsheetWidth - total)
}}
onMouseDown={() => {
setInitialSpreadsheetWidth(spreadsheetView.width)
setInitialCircWidth(circularView.width)
}}
vertical
flexbox
className={classes.resizeHandleVert}
/>
<div style={{ width: circularView.width }}>
<CircularViewOptions svInspector={model} />
<CircularViewReactComponent model={circularView} />
</div>
</div>
<ResizeHandle
onDrag={model.resizeHeight}
Expand All @@ -89,4 +83,18 @@ const SvInspectorView = observer(function ({
)
})

export default SvInspectorView
const SvInspectorViewContainer = observer(function ({
model,
}: {
model: SvInspectorViewModel
}) {
const { SpreadsheetViewReactComponent, initialized, spreadsheetView } = model

return !initialized ? (
<SpreadsheetViewReactComponent model={spreadsheetView} />
) : (
<SvInspectorView model={model} />
)
})

export default SvInspectorViewContainer
Loading

0 comments on commit 66f78f6

Please sign in to comment.