Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add file extension type column to shared data card for files #1660

Merged
merged 5 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/landscape/components/LandscapeView.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ const baseViewTest = async (
description: `Description ${index}`,
size: 3456,
entryType: 'FILE',
resourceType: 'txt',
visualizations: { edges: [] },
},
},
Expand Down Expand Up @@ -233,6 +234,9 @@ test('LandscapeView: Display data', async () => {
const entriesList = within(sharedDataRegion.getByRole('list'));
const items = entriesList.getAllByRole('listitem');
expect(items.length).toBe(6);
const firstEntry = within(items[0]);
expect(firstEntry.getByText('Data Entry 0')).toBeInTheDocument();
expect(firstEntry.getByText('txt')).toBeInTheDocument();

// Boundary
expect(
Expand Down
29 changes: 21 additions & 8 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 @@ -173,7 +174,7 @@ const SharedDataEntryBase = props => {
<Grid
item
xs={isEditingName ? 12 : 8}
md={6}
md={5}
order={{ xs: 2, md: 2 }}
component={StackRow}
>
Expand Down Expand Up @@ -203,26 +204,38 @@ const SharedDataEntryBase = props => {
/>
</Restricted>
</Grid>
<Grid item xs={1} order={{ xs: 5 }} display={{ md: 'none' }} />

<Grid item xs={1} order={{ xs: 4 }} display={{ md: 'none' }} />
<Grid
item
xs={11}
xs={2}
md={1}
order={{ xs: 6, md: 4 }}
order={{ xs: 5, md: 4 }}
sx={{ wordWrap: 'break-word', textTransform: 'uppercase' }}
>
{resourceType}
</Grid>
<Grid
item
xs={2}
md={1}
order={{ xs: 6, md: 5 }}
sx={{ wordWrap: 'break-word' }}
>
{info}
{fileSize}
</Grid>
<Grid item xs={7} order={{ xs: 7 }} display={{ md: 'none' }} />
<Grid item xs={1} order={{ xs: 7 }} display={{ md: 'none' }} />
<Grid item xs={11} md={3} order={{ xs: 8, md: 4 }}>
<Grid item xs={11} md={3} order={{ xs: 8, md: 6 }}>
{formatDate(i18n.resolvedLanguage, dataEntry.createdAt)}, by{' '}
{t('user.full_name', { user: dataEntry.createdBy })}
</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
3 changes: 2 additions & 1 deletion src/sharedData/components/SharedDataEntryFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,8 @@ 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}
>
<Visualizations file={sharedResource.dataEntry} />
</SharedDataEntryBase>
Expand Down
Loading