Skip to content

Commit

Permalink
feat: Add the file type to shared files info as a column in a nested …
Browse files Browse the repository at this point in the history
…grid.
  • Loading branch information
knipec committed Mar 19, 2024
1 parent a3cad26 commit f3ec8e2
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 17 deletions.
35 changes: 19 additions & 16 deletions src/sharedData/components/SharedDataEntryBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ const SharedDataEntryBase = props => {
EntryTypeIcon,
DownloadComponent,
ShareComponent,
info,
fileSize,
resourceType,
deleteTooltip,
} = props;
const [isEditingName, setIsEditingName] = useState(false);
Expand Down Expand Up @@ -203,26 +204,28 @@ const SharedDataEntryBase = props => {
/>
</Restricted>
</Grid>
<Grid item xs={1} order={{ xs: 5 }} display={{ md: 'none' }} />
<Grid
item
xs={11}
md={1}
order={{ xs: 6, md: 4 }}
sx={{ wordWrap: 'break-word' }}
>
{info}
</Grid>
<Grid item xs={1} order={{ xs: 7 }} display={{ md: 'none' }} />
<Grid item xs={11} md={3} order={{ xs: 8, md: 4 }}>
{formatDate(i18n.resolvedLanguage, dataEntry.createdAt)}, by{' '}
{t('user.full_name', { user: dataEntry.createdBy })}

<Grid item xs={12} md={4} order={{ xs: 5, md: 3 }}>
<Grid container>
<Grid item xs={11} md={2} sx={{ wordWrap: 'break-word' }}>
{resourceType}
</Grid>
<Grid item xs={11} md={2} sx={{ wordWrap: 'break-word' }}>
{fileSize}
</Grid>
<Grid item xs={1} order={{ xs: 7 }} display={{ md: 'none' }} />
<Grid item xs={11} md={8}>
{formatDate(i18n.resolvedLanguage, dataEntry.createdAt)}, by{' '}
{t('user.full_name', { user: dataEntry.createdBy })}
</Grid>
</Grid>
</Grid>

<Grid
item
xs={4}
md={2}
order={{ xs: 3, md: 4 }}
order={{ xs: 3, md: 6 }}
component={StackRow}
justifyContent="flex-end"
display={isEditingName ? 'none' : 'inherit'}
Expand Down
8 changes: 7 additions & 1 deletion src/sharedData/components/SharedDataEntryFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,13 @@ const SharedDataEntryFile = props => {
EntryTypeIcon={SharedFileIcon}
DownloadComponent={DownloadComponent}
ShareComponent={ShareComponent}
info={filesize(sharedResource.dataEntry.size, { round: 0 })}
fileSize={filesize(sharedResource.dataEntry.size, { round: 0 })}
resourceType={sharedResource.dataEntry.resourceType.toUpperCase()}
// TODO-cknipe: Just add resourceType to info, maybe?
// Hmm but Base does have to know about info regardless I guess
// we want it to be another
// Could just be info1 and info2 I guess
// but iono
>
<Visualizations file={sharedResource.dataEntry} />
</SharedDataEntryBase>
Expand Down

0 comments on commit f3ec8e2

Please sign in to comment.