2023-09-22 04:25:16 -07:00
|
|
|
import type { ICellRendererParams } from '@ag-grid-community/core';
|
|
|
|
|
import { Skeleton } from '/@/renderer/components/skeleton';
|
|
|
|
|
import { CellContainer } from '/@/renderer/components/virtual-table/cells/generic-cell';
|
|
|
|
|
import { useMemo } from 'react';
|
|
|
|
|
import { Text } from '/@/renderer/components/text';
|
2024-01-15 20:46:06 -08:00
|
|
|
import { replaceURLWithHTMLLinks } from '/@/renderer/utils/linkify';
|
2023-09-22 04:25:16 -07:00
|
|
|
|
|
|
|
|
export const NoteCell = ({ value }: ICellRendererParams) => {
|
|
|
|
|
const formattedValue = useMemo(() => {
|
|
|
|
|
if (!value) {
|
|
|
|
|
return '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return replaceURLWithHTMLLinks(value);
|
|
|
|
|
}, [value]);
|
|
|
|
|
|
|
|
|
|
if (value === undefined) {
|
|
|
|
|
return (
|
|
|
|
|
<CellContainer $position="left">
|
|
|
|
|
<Skeleton
|
|
|
|
|
height="1rem"
|
|
|
|
|
width="80%"
|
|
|
|
|
/>
|
|
|
|
|
</CellContainer>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<CellContainer $position="left">
|
|
|
|
|
<Text
|
|
|
|
|
$secondary
|
|
|
|
|
overflow="hidden"
|
2024-01-15 20:46:06 -08:00
|
|
|
>
|
|
|
|
|
{formattedValue}
|
|
|
|
|
</Text>
|
2023-09-22 04:25:16 -07:00
|
|
|
</CellContainer>
|
|
|
|
|
);
|
|
|
|
|
};
|