-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(app): Untangle labware organisms (#16295)
Another in the vein of the app code reorganization PRs. This time, take the organisms that make up the labware page and move them into an `organisms/Desktop/Labware` directory (which will eventually mirror `organisms/Desktop/Devices`, since there's already `organisms/Devices`) as a new home. Also, get rid of the things they import from `pages/Desktop/Labware` by moving them to a new home: `local-resources`. In the same way that resources/ provides app-specific wrappers around robot api concerns, local-resources/ provides app-specific wrappers around code and handling of other opentrons resources, like (for now) labware.
- Loading branch information
Showing
115 changed files
with
185 additions
and
192 deletions.
There are no files selected for viewing
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Empty file modified
0
app/src/assets/images/labware/tipone_96_tiprack_200ul_side_view.jpg
100755 → 100644
Oops, something went wrong.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
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 @@ | ||
export * from './useAllLabware' |
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,50 @@ | ||
import { useSelector } from 'react-redux' | ||
import { getValidCustomLabware } from '/app/redux/custom-labware' | ||
import { getAllDefinitions } from '../utils' | ||
import type { LabwareSort, LabwareFilter, LabwareDefAndDate } from '../types' | ||
|
||
export function useAllLabware( | ||
sortBy: LabwareSort, | ||
filterBy: LabwareFilter | ||
): LabwareDefAndDate[] { | ||
const fullLabwareList: LabwareDefAndDate[] = [] | ||
const labwareDefinitions = getAllDefinitions() | ||
labwareDefinitions.forEach(def => fullLabwareList.push({ definition: def })) | ||
const customLabwareList = useSelector(getValidCustomLabware) | ||
customLabwareList.forEach(customLabware => | ||
'definition' in customLabware | ||
? fullLabwareList.push({ | ||
modified: customLabware.modified, | ||
definition: customLabware.definition, | ||
filename: customLabware.filename, | ||
}) | ||
: null | ||
) | ||
const sortLabware = (a: LabwareDefAndDate, b: LabwareDefAndDate): number => { | ||
if ( | ||
a.definition.metadata.displayName.toUpperCase() < | ||
b.definition.metadata.displayName.toUpperCase() | ||
) { | ||
return sortBy === 'alphabetical' ? -1 : 1 | ||
} | ||
if ( | ||
a.definition.metadata.displayName.toUpperCase() > | ||
b.definition.metadata.displayName.toUpperCase() | ||
) { | ||
return sortBy === 'alphabetical' ? 1 : -1 | ||
} | ||
return 0 | ||
} | ||
|
||
if (filterBy === 'customLabware') { | ||
return (customLabwareList as LabwareDefAndDate[]).sort(sortLabware) | ||
} | ||
fullLabwareList.sort(sortLabware) | ||
if (filterBy !== 'all') { | ||
return fullLabwareList.filter( | ||
labwareItem => | ||
labwareItem.definition.metadata.displayCategory === filterBy | ||
) | ||
} | ||
return fullLabwareList | ||
} |
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,3 @@ | ||
export * from './hooks' | ||
export * from './utils' | ||
export type * from './types' |
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
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
...es/Desktop/Labware/helpers/definitions.ts → ...ources/labware/utils/getAllDefinitions.ts
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
File renamed without changes.
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 @@ | ||
export * from './getAllDefinitions' |
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
File renamed without changes.
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
File renamed without changes.
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
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 3 additions & 4 deletions
7
...rganisms/LabwareDetails/helpers/labels.ts → .../Labware/LabwareDetails/helpers/labels.ts
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
Oops, something went wrong.