Skip to content

Commit 5ebbc38

Browse files
committed
WIP study infinite creation
1 parent 71bf166 commit 5ebbc38

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/components/utils/renderers/name-cell-renderer.tsx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,17 @@ const isElementCaseOrStudy = (objectType: ElementType) => {
1919
return objectType === ElementType.STUDY || objectType === ElementType.CASE;
2020
};
2121

22+
const creating = (
23+
elementUuid: UUID,
24+
childrenMetadata: Record<UUID, ElementAttributes>
25+
) => {
26+
return (
27+
!childrenMetadata[elementUuid] ||
28+
(childrenMetadata[elementUuid].type === ElementType.STUDY &&
29+
!childrenMetadata[elementUuid].specificMetadata.caseFormat)
30+
);
31+
};
32+
2233
const getDisplayedElementName = (
2334
data: ElementAttributes,
2435
childrenMetadata: Record<UUID, ElementAttributes>,
@@ -29,7 +40,7 @@ const getDisplayedElementName = (
2940
if (uploading) {
3041
return elementName + '\n' + formatMessage({ id: 'uploading' });
3142
}
32-
if (!childrenMetadata[elementUuid]) {
43+
if (creating(elementUuid, childrenMetadata)) {
3344
return elementName + '\n' + formatMessage({ id: 'creationInProgress' });
3445
}
3546
return childrenMetadata[elementUuid].elementName;
@@ -72,11 +83,11 @@ export const NameCellRenderer = ({
7283
return (
7384
<Box sx={styles.tableCell}>
7485
{/* Icon */}
75-
{!childrenMetadata[data.elementUuid] &&
86+
{creating(data.elementUuid, childrenMetadata) &&
7687
isElementCaseOrStudy(data.type) && (
7788
<CircularProgress size={18} sx={styles.circularRoot} />
7889
)}
79-
{childrenMetadata[data.elementUuid] &&
90+
{!creating(data.elementUuid, childrenMetadata) &&
8091
getFileIcon(data.type, styles.icon)}
8192
{/* Name */}
8293
<OverflowableText

0 commit comments

Comments
 (0)