-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #271 from IQSS/feature/262-file-labels-section-of-…
…the-file-page 262 - File labels section of the File page
- Loading branch information
Showing
17 changed files
with
207 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,12 @@ | ||
import { DatasetVersion } from '../../../dataset/domain/models/Dataset' | ||
|
||
export interface FilePermissions { | ||
canDownloadFile: boolean | ||
} | ||
|
||
export interface File { | ||
name: string | ||
datasetVersion: DatasetVersion | ||
restricted: boolean | ||
permissions: FilePermissions | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 0 additions & 39 deletions
39
...le/file-info/file-info-cell/file-info-data/file-thumbnail/FileThumbnailRestrictedIcon.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
src/sections/file/file-access/FileAccessInfoIcon.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
@import "node_modules/@iqss/dataverse-design-system/src/lib/assets/styles/design-tokens/colors.module"; | ||
|
||
%restricted-icon { | ||
font-size: 20px; | ||
} | ||
|
||
.restricted-icon-restricted { | ||
@extend %restricted-icon; | ||
|
||
color: $dv-danger-color; | ||
} | ||
|
||
.restricted-icon-restrictedWithAccess { | ||
@extend %restricted-icon; | ||
|
||
right: -16px; | ||
color: $dv-success-color; | ||
} |
38 changes: 38 additions & 0 deletions
38
src/sections/file/file-access/FileAccessRestrictedIcon.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { LockFill, UnlockFill } from 'react-bootstrap-icons' | ||
import styles from './FileAccessInfoIcon.module.scss' | ||
import { useTranslation } from 'react-i18next' | ||
import { Tooltip } from '@iqss/dataverse-design-system' | ||
|
||
interface FileAccessInfoIconProps { | ||
restricted: boolean | ||
canDownloadFile: boolean | ||
} | ||
export function FileAccessRestrictedIcon({ restricted, canDownloadFile }: FileAccessInfoIconProps) { | ||
const { t } = useTranslation('file') | ||
|
||
if (!restricted) { | ||
return <></> | ||
} | ||
|
||
if (canDownloadFile) { | ||
return ( | ||
<span className={styles['restricted-icon-restrictedWithAccess']}> | ||
<Tooltip | ||
overlay={`${t('fileAccess.title')}: ${t('fileAccess.restrictedWithAccess.name')}`} | ||
placement="top"> | ||
<UnlockFill role="img" title={t('fileAccess.restrictedWithAccess.icon')} /> | ||
</Tooltip> | ||
</span> | ||
) | ||
} | ||
|
||
return ( | ||
<span className={styles['restricted-icon-restricted']}> | ||
<Tooltip | ||
overlay={`${t('fileAccess.title')}: ${t('fileAccess.restricted.name')}`} | ||
placement="top"> | ||
<LockFill role="img" title={t('fileAccess.restricted.icon')} /> | ||
</Tooltip> | ||
</span> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.