Skip to content

Commit e106b75

Browse files
authored
style(ui): improve duration column representation (#43)
1 parent 1ec122c commit e106b75

File tree

2 files changed

+22
-11
lines changed

2 files changed

+22
-11
lines changed

.changeset/curvy-mails-laugh.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@hyperdx/app': patch
3+
---
4+
5+
style(ui): improve duration column representation

packages/app/src/LogTable.tsx

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,12 @@ import { useHotkeys } from 'react-hotkeys-hook';
2727
type Row = Record<string, any> & { duration: number };
2828
type AccessorFn = (row: Row, column: string) => any;
2929

30+
const SPECIAL_VALUES = {
31+
not_available: 'NULL',
32+
};
3033
const ACCESSOR_MAP: Record<string, AccessorFn> = {
31-
duration: row => (row.duration >= 0 ? row.duration : 'N/A'),
34+
duration: row =>
35+
row.duration >= 0 ? row.duration : SPECIAL_VALUES.not_available,
3236
default: (row, column) => row[column],
3337
};
3438

@@ -367,16 +371,18 @@ export const RawLogTable = memo(
367371
...(displayedColumns.map(column => ({
368372
accessorFn: curry(retrieveColumnValue)(column), // Columns can contain '.' and will not work with accessorKey
369373
header: column,
370-
cell: info => (
371-
<span
372-
// role="button"
373-
// onClick={() =>
374-
// onPropertySearchClick(column, info.getValue<string>())
375-
// }
376-
>
377-
{info.getValue<string>()}
378-
</span>
379-
),
374+
cell: info => {
375+
const value = info.getValue<string>();
376+
return (
377+
<span
378+
className={cx({
379+
'text-muted': value === SPECIAL_VALUES.not_available,
380+
})}
381+
>
382+
{value}
383+
</span>
384+
);
385+
},
380386
size: 150,
381387
})) as ColumnDef<any>[]),
382388
{

0 commit comments

Comments
 (0)