-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support Plates with other coordinate systems then 96 wells (#281)
BREAKING CHANGE: require explicit coordinate system value and type instead of implicit 96 well
- Loading branch information
Showing
13 changed files
with
327 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,27 @@ | ||
import { Maybe } from '@mll-lab/js-utils'; | ||
import React from 'react'; | ||
|
||
import { EmptyWell } from './EmptyWell'; | ||
import { FilledWell } from './FilledWell'; | ||
import { PlateWell } from './types'; | ||
import { CoordinateSystem, PlateWell } from './types'; | ||
|
||
export function Well(props: { | ||
export function Well<TCoordinateSystem extends CoordinateSystem>(props: { | ||
position: number; | ||
well?: PlateWell; | ||
well: Maybe<PlateWell<TCoordinateSystem>>; | ||
coordinateSystem: TCoordinateSystem; | ||
isDraggable: boolean; | ||
}) { | ||
return props.well?.content ? ( | ||
<FilledWell | ||
well={props.well} | ||
coordinateSystem={props.coordinateSystem} | ||
position={props.position} | ||
isDraggable={props.isDraggable} | ||
/> | ||
) : ( | ||
<EmptyWell position={props.position} /> | ||
<EmptyWell | ||
position={props.position} | ||
coordinateSystem={props.coordinateSystem} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,4 @@ | ||
import { range } from 'lodash'; | ||
import { FlowDirection } from './types'; | ||
|
||
import { Coordinates, FlowDirection } from './types'; | ||
|
||
const TUBE_COUNT = 96; | ||
export const WELLS = range(1, TUBE_COUNT + 1); | ||
export const COORDINATES_COLUMNS = [ | ||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, | ||
] as const satisfies ReadonlyArray<Coordinates['column']>; | ||
export const COORDINATES_ROWS = [ | ||
'A', | ||
'B', | ||
'C', | ||
'D', | ||
'E', | ||
'F', | ||
'G', | ||
'H', | ||
] as const satisfies ReadonlyArray<Coordinates['row']>; | ||
/** Used internally when rendering the Plate component. */ | ||
export const PLATE_FLOW = 'row' as const satisfies FlowDirection; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { CoordinateSystem } from './types'; | ||
|
||
export const COORDINATE_SYSTEM_96_WELL = { | ||
rows: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'], | ||
columns: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], | ||
} as const satisfies CoordinateSystem; | ||
|
||
export type CoordinateSystem96Well = typeof COORDINATE_SYSTEM_96_WELL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
import { render } from '@testing-library/react'; | ||
import React from 'react'; | ||
|
||
import { COORDINATE_SYSTEM_96_WELL } from './coordinateSystem96Well'; | ||
|
||
import { Plate } from './index'; | ||
|
||
describe('Plate', () => { | ||
it('renders without data', () => { | ||
render(<Plate data={null} />); | ||
render(<Plate data={null} coordinateSystem={COORDINATE_SYSTEM_96_WELL} />); | ||
}); | ||
}); |
Oops, something went wrong.