Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

X1056 unit visible on visium qc table #374

Merged
merged 2 commits into from
Aug 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions cypress/e2e/pages/visiumQC.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,14 +333,14 @@ describe('Visium QC Page', () => {
cy.findByText('STAN-5100').should('be.visible');
});

it('shows measurementType dropdown with fields when Library concentration option is selected', () => {
it('shows Library concentration table with unit name in lower case when Library concentration option is selected', () => {
selectOption('measurementType', 'Library concentration');
cy.findByRole('table').get('th').eq(1).should('have.text', 'Library concentration (pl/ul)');
cy.findByRole('table').get('th').eq(1).should('have.text', 'LIBRARY CONCENTRATION (pl/\u00B5l)');
});

it('shows measurementType dropdown with fields when cDNA concentration option is selected', () => {
it('shows cDNA concentration table with unit name in lower when cDNA concentration option is selected', () => {
selectOption('measurementType', 'cDNA concentration');
cy.findByRole('table').get('th').eq(1).should('have.text', 'cDNA concentration (pl/ul)');
cy.findByRole('table').get('th').eq(1).should('have.text', 'CDNA CONCENTRATION (pl/\u00B5l)');
});

it('display text boxes to enter concentration value for all slots with samples', () => {
Expand Down
8 changes: 7 additions & 1 deletion src/components/DataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import { Column, PluginHook, SortingRule, TableState, useSortBy, useTable } from
import Table, { TableBody, TableCell, TableHead, TableHeader } from './Table';
import { motion } from 'framer-motion';

type ColumnWithAllCapitalProp<T extends object = {}> = Column<T> & {
allCapital?: boolean;
};
interface DataTableProps<T extends object> {
columns: Column<T>[];
data: T[];
Expand Down Expand Up @@ -87,7 +90,10 @@ const DataTableComponent = <T extends Object>(
{headerGroups.map((headerGroup) => (
<tr {...headerGroup.getHeaderGroupProps()}>
{headerGroup.headers.map((column) => (
<TableHeader {...column.getHeaderProps(sortable ? column.getSortByToggleProps() : undefined)}>
<TableHeader
allCapital={(column as ColumnWithAllCapitalProp).allCapital}
{...column.getHeaderProps(sortable ? column.getSortByToggleProps() : undefined)}
>
{column.render('Header')}
{column.isSorted ? (
column.isSortedDesc ? (
Expand Down
7 changes: 5 additions & 2 deletions src/components/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export type SortProps = {
interface TableHeaderProps {
sortProps?: SortProps;
children?: ReactNode | ReactNode[];
allCapital?: boolean;
}
/**
* @example
Expand Down Expand Up @@ -57,7 +58,7 @@ export const TableHead = ({ children, fixed = false }: TableHeadProps) => {
return <thead className={`${fixed ? 'sticky top-0 z-20' : ''}`}>{children}</thead>;
};

export const TableHeader = ({ children, sortProps, ...rest }: TableHeaderProps) => {
export const TableHeader = ({ children, sortProps, allCapital = true, ...rest }: TableHeaderProps) => {
return (
<th className="px-6 py-3 bg-gray-50 text-left select-none" {...rest}>
<>
Expand All @@ -71,7 +72,9 @@ export const TableHeader = ({ children, sortProps, ...rest }: TableHeaderProps)
>
{
<span
className={'bg-gray-50 text-left text-xs leading-4 font-medium text-gray-500 tracking-wider uppercase'}
className={`bg-gray-50 text-left text-xs leading-4 font-medium text-gray-500 tracking-wide ${
allCapital ? 'uppercase' : ''
}`}
>
{children}
</span>
Expand Down
5 changes: 3 additions & 2 deletions src/components/slotMeasurement/SlotMeasurements.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ type SlotMeasurementProps = {

const setMeasurementNameTableTitle = (measurementName: string): string => {
return measurementName === 'cDNA concentration' || measurementName === 'Library concentration'
? `${measurementName} (pl/ul)`
: measurementName;
? `${measurementName.toUpperCase()} (pl/\u00B5l)`
: measurementName.toUpperCase();
};

/**
Expand Down Expand Up @@ -51,6 +51,7 @@ const SlotMeasurements = ({
{
Header: setMeasurementNameTableTitle(measurementName),
id: measurementName,
allCapital: false,
Cell: ({ row }: { row: Row<SlotMeasurementRequest> }) => {
return (
<FormikInput
Expand Down
Loading