Skip to content

Commit 808b1d7

Browse files
committed
fix styling, update mode type, fix minor null text ui bug
1 parent 3f1a453 commit 808b1d7

File tree

8 files changed

+44
-27
lines changed

8 files changed

+44
-27
lines changed

src/components/CompareResults/MannWhitneyCompareMetrics.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ export const MannWhitneyCompareMetrics = ({
2828
return {
2929
backgroundColor,
3030
marginBottom: 2,
31-
width: '85%',
31+
maxWidth: '85%',
32+
width: '100%',
3233
borderRadius: '5px',
3334
padding: 2,
3435
'& .test-row-container': {
@@ -170,7 +171,7 @@ export const MannWhitneyCompareMetrics = ({
170171
<td>Kolmogorov-Smirnov Test</td>
171172
<td></td>
172173
<td></td>
173-
<td>{`${result?.ks_test?.interpretation ?? null}`}</td>
174+
<td>{`${result?.ks_test?.interpretation ?? ''}`}</td>
174175
</tr>
175176
<tr className='test-label-row' style={{ marginTop: 2 }}>
176177
<td>Distribution</td>

src/components/CompareResults/ModeInterpretation.tsx

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,28 +34,33 @@ export const ModeInterpretation = ({
3434
}
3535
const mode = useAppSelector((state) => state.theme.mode);
3636

37+
const kdeModes = result.silverman_kde.modes ?? [];
38+
if (kdeModes.length === 0) return null;
39+
3740
return (
3841
<Box sx={getStyles(mode)}>
3942
<table>
4043
<thead>
4144
<tr style={{ textAlign: 'left' }}>
42-
<th style={{ padding: 2, paddingRight: 16 }}></th>
45+
<th style={{ padding: 2, paddingRight: 16 }}>Mode Start </th>
46+
<th style={{ padding: 2, paddingRight: 16 }}>Mode End </th>
4347
<th style={{ padding: 2, paddingRight: 16 }}>Median Shift</th>
4448
<th style={{ padding: 2 }}>Interpretation</th>
4549
</tr>
4650
</thead>
4751
<tbody>
48-
<tr style={{ textAlign: 'left' }}>
49-
<td style={{ padding: 2, paddingRight: 16 }}>
50-
{result.silverman_kde.mode_summary}
51-
</td>
52-
<td style={{ padding: 2, paddingRight: 16 }}>
53-
{result.silverman_kde.shift ?? +0}
54-
</td>
55-
<td style={{ padding: 2 }}>
56-
{result.silverman_kde.shift_summary ?? 'No significant shift'}
57-
</td>
58-
</tr>
52+
{kdeModes?.map(
53+
({ mode_start, mode_end, shift, shift_summary, mode_name }) => (
54+
<tr style={{ textAlign: 'left' }} key={mode_name}>
55+
<td style={{ padding: 2, paddingRight: 16 }}>{mode_start}</td>
56+
<td style={{ padding: 2, paddingRight: 16 }}>{mode_end}</td>
57+
<td style={{ padding: 2, paddingRight: 16 }}>
58+
{shift ?? 'N/A'}
59+
</td>
60+
<td style={{ padding: 2 }}>{shift_summary ?? 'N/A'}</td>
61+
</tr>
62+
),
63+
)}
5964
</tbody>
6065
</table>
6166
</Box>

src/components/CompareResults/ResultsTable.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ export default function ResultsTable() {
182182

183183
const onTestVersionChange = (testVersion: TestVersion): void => {
184184
setTestVersionVal(testVersion);
185-
rawSearchParams.set('test_version', testVersion);
186-
updateRawSearchParams(rawSearchParams);
185+
searchParams.set('test_version', testVersion);
186+
setSearchParams(searchParams);
187187
};
188188

189189
const rowGridTemplateColumns = columnsConfiguration

src/components/CompareResults/StatisticsWarnings.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const StatisticsWarnings = ({
2525
flexWrap: 'wrap',
2626
borderRadius: 1,
2727
padding: 1,
28-
maxWidth: '55%',
28+
width: '55%',
2929
'& .warning-row': {
3030
verticalAlign: 'bottom',
3131
display: 'flex',

src/components/CompareResults/SubtestsResults/SubtestsRevisionRow.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ function determineSign(baseMedianValue: number, newMedianValue: number) {
116116

117117
function SubtestsRevisionRow(props: RevisionRowProps) {
118118
const id = useId();
119-
const { result, gridTemplateColumns, replicates } = props;
119+
const { result, gridTemplateColumns, replicates, testVersion } = props;
120120
const {
121121
test,
122122
base_avg_value: baseAvgValue,
@@ -249,7 +249,7 @@ function SubtestsRevisionRow(props: RevisionRowProps) {
249249
<RevisionRowExpandable
250250
id={id}
251251
result={result}
252-
testVersion={props.testVersion}
252+
testVersion={testVersion}
253253
/>
254254
)}
255255
</>

src/components/CompareResults/TableContent.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ function TableContent({
175175
filteringSearchTerm,
176176
tableFilters,
177177
columnsConfiguration,
178+
testVersion, // trigger refetch for new testVersion selection
178179
]);
179180

180181
const sortedResults = useMemo(() => {

src/components/CompareResults/TableRevisionContent.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ const styles = {
2222
};
2323

2424
function TableRevisionContent(props: Props) {
25-
const { results, view, rowGridTemplateColumns, replicates } = props;
25+
const { results, view, rowGridTemplateColumns, replicates, testVersion } =
26+
props;
2627

2728
if (!results.length) {
2829
return null;
@@ -55,7 +56,7 @@ function TableRevisionContent(props: Props) {
5556
view={view}
5657
gridTemplateColumns={rowGridTemplateColumns}
5758
replicates={replicates}
58-
testVersion={props.testVersion}
59+
testVersion={testVersion}
5960
/>
6061
))}
6162
</div>

src/types/state.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,21 +156,30 @@ export type CLESItem = {
156156
cles_explanation: string;
157157
} | null;
158158

159+
export type ModeItem = {
160+
mode_name: string;
161+
mode_start: number;
162+
mode_end: number;
163+
ci_low: number | null;
164+
ci_high: number | null;
165+
shift: number | null;
166+
shift_summary: string | null;
167+
};
168+
159169
/*
160170
Results from Silverman KDE test for multimodal data.
161171
*/
162172
export type SilvermanKDEItem = {
163173
bandwidth: string;
164174
base_mode_count: number;
165175
new_mode_count: number;
176+
base_location: number;
177+
new_location: number;
178+
base_prominence: number;
179+
new_prominence: number;
166180
mode_comments: string[];
167181
warnings: string[];
168-
mode_summary: string;
169-
median_shift_summary: string[] | null;
170-
ci_low: number | null;
171-
ci_high: number | null;
172-
shift: number | null;
173-
shift_summary: string | null;
182+
modes: ModeItem[];
174183
is_regression: boolean | null;
175184
is_improvement: boolean | null;
176185
ci_warning: string | null;

0 commit comments

Comments
 (0)