cozy-ui 75.2.0 → 75.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/package.json +1 -1
- package/react/FileImageLoader/index.jsx +1 -1
- package/react/FileImageLoader/index.spec.jsx +1 -1
- package/react/Viewer/Footer/DownloadButton.jsx +1 -1
- package/react/Viewer/Footer/ForwardButton.jsx +1 -1
- package/react/Viewer/NoViewer/DownloadButton.jsx +1 -1
- package/react/Viewer/NoViewer/NoViewer.jsx +1 -1
- package/react/Viewer/NoViewer/__snapshots__/NoViewer.spec.jsx.snap +4 -4
- package/react/Viewer/Panel/ActionMenuWrapper.jsx +2 -2
- package/react/Viewer/Panel/Certifications.jsx +1 -1
- package/react/Viewer/Panel/PanelContent.jsx +1 -1
- package/react/Viewer/Panel/Qualification.jsx +5 -5
- package/react/Viewer/Panel/{QualificationListItemNumber.jsx → QualificationListItemInformation.jsx} +5 -5
- package/react/Viewer/Viewer.jsx +2 -2
- package/react/Viewer/ViewerContainer.jsx +11 -6
- package/react/Viewer/ViewerInformationsWrapper.jsx +2 -2
- package/react/Viewer/ViewerInformationsWrapper.spec.jsx +2 -2
- package/react/Viewer/ViewerWithCustomPanelAndFooter.jsx +11 -6
- package/react/Viewer/{AudioViewer.jsx → ViewersByFile/AudioViewer.jsx} +6 -5
- package/react/Viewer/{AudioViewer.spec.jsx → ViewersByFile/AudioViewer.spec.jsx} +3 -2
- package/react/Viewer/{ImageViewer.jsx → ViewersByFile/ImageViewer.jsx} +2 -2
- package/react/Viewer/{ImageViewer.spec.jsx → ViewersByFile/ImageViewer.spec.jsx} +7 -6
- package/react/Viewer/{NoNetworkViewer.jsx → ViewersByFile/NoNetworkViewer.jsx} +5 -4
- package/react/Viewer/{OnlyOfficeViewer.jsx → ViewersByFile/OnlyOfficeViewer.jsx} +4 -4
- package/react/Viewer/{PdfJsViewer.jsx → ViewersByFile/PdfJsViewer.jsx} +5 -5
- package/react/Viewer/{PdfJsViewer.spec.jsx → ViewersByFile/PdfJsViewer.spec.jsx} +1 -0
- package/react/Viewer/{PdfMobileViewer.jsx → ViewersByFile/PdfMobileViewer.jsx} +7 -7
- package/react/Viewer/{PdfMobileViewer.spec.jsx → ViewersByFile/PdfMobileViewer.spec.jsx} +2 -2
- package/react/Viewer/{ShortcutViewer.jsx → ViewersByFile/ShortcutViewer.jsx} +6 -5
- package/react/Viewer/{ShortcutViewer.spec.jsx → ViewersByFile/ShortcutViewer.spec.jsx} +3 -3
- package/react/Viewer/{TextViewer.jsx → ViewersByFile/TextViewer.jsx} +5 -5
- package/react/Viewer/{TextViewer.spec.jsx → ViewersByFile/TextViewer.spec.jsx} +2 -1
- package/react/Viewer/{VideoViewer.jsx → ViewersByFile/VideoViewer.jsx} +2 -1
- package/react/Viewer/{VideoViewer.spec.jsx → ViewersByFile/VideoViewer.spec.jsx} +2 -2
- package/react/Viewer/{__snapshots__ → ViewersByFile/__snapshots__}/AudioViewer.spec.jsx.snap +2 -2
- package/react/Viewer/{__snapshots__ → ViewersByFile/__snapshots__}/ShortcutViewer.spec.jsx.snap +2 -2
- package/react/Viewer/{__snapshots__ → ViewersByFile/__snapshots__}/TextViewer.spec.jsx.snap +11 -11
- package/react/Viewer/{__snapshots__ → ViewersByFile/__snapshots__}/VideoViewer.spec.jsx.snap +2 -2
- package/react/Viewer/ViewersByFile/styles.styl +89 -0
- package/react/Viewer/{Footer.jsx → components/Footer.jsx} +1 -1
- package/react/Viewer/{InformationPanel.jsx → components/InformationPanel.jsx} +0 -0
- package/react/Viewer/{Navigation.jsx → components/Navigation.jsx} +2 -2
- package/react/Viewer/{PdfToolbarButton.jsx → components/PdfToolbarButton.jsx} +2 -1
- package/react/Viewer/{Toolbar.jsx → components/Toolbar.jsx} +11 -10
- package/react/Viewer/{ViewerByFile.jsx → components/ViewerByFile.jsx} +13 -13
- package/react/Viewer/{ViewerByFile.spec.jsx → components/ViewerByFile.spec.jsx} +10 -10
- package/react/Viewer/{ViewerControls.jsx → components/ViewerControls.jsx} +2 -2
- package/react/Viewer/{ViewerSpinner.jsx → components/ViewerSpinner.jsx} +2 -2
- package/react/Viewer/{controls.styl → components/styles.styl} +14 -15
- package/react/Viewer/helpers.js +6 -4
- package/react/Viewer/helpers.spec.js +2 -2
- package/react/Viewer/{withFileUrl.jsx → hoc/withFileUrl.jsx} +3 -3
- package/react/Viewer/hoc/withViewerLocales.jsx +11 -0
- package/react/Viewer/locales/en.json +4 -2
- package/react/Viewer/locales/fr.json +4 -2
- package/react/Viewer/{Panel → providers}/ActionMenuProvider.jsx +0 -0
- package/react/Viewer/{EncryptedProvider.jsx → providers/EncryptedProvider.jsx} +0 -0
- package/react/Viewer/{snackbar → providers}/ViewerSnackbarProvider.jsx +0 -0
- package/react/Viewer/snackbar/ViewerSnackbar.jsx +1 -1
- package/react/Viewer/styles.styl +1 -89
- package/react/Viewer/vars.styl +6 -0
- package/transpiled/react/FileImageLoader/index.js +1 -1
- package/transpiled/react/Viewer/Footer/DownloadButton.js +1 -1
- package/transpiled/react/Viewer/Footer/ForwardButton.js +1 -1
- package/transpiled/react/Viewer/NoViewer/DownloadButton.js +1 -1
- package/transpiled/react/Viewer/NoViewer/NoViewer.js +16 -28
- package/transpiled/react/Viewer/Panel/ActionMenuWrapper.js +2 -2
- package/transpiled/react/Viewer/Panel/Certifications.js +1 -1
- package/transpiled/react/Viewer/Panel/PanelContent.js +1 -1
- package/transpiled/react/Viewer/Panel/Qualification.js +5 -5
- package/transpiled/react/Viewer/Panel/{QualificationListItemNumber.js → QualificationListItemInformation.js} +5 -5
- package/transpiled/react/Viewer/Viewer.js +2 -2
- package/transpiled/react/Viewer/ViewerContainer.js +13 -6
- package/transpiled/react/Viewer/ViewerInformationsWrapper.js +2 -2
- package/transpiled/react/Viewer/ViewerWithCustomPanelAndFooter.js +15 -5
- package/transpiled/react/Viewer/ViewersByFile/AudioViewer.js +43 -0
- package/transpiled/react/Viewer/{ImageViewer.js → ViewersByFile/ImageViewer.js} +18 -30
- package/transpiled/react/Viewer/ViewersByFile/NoNetworkViewer.js +40 -0
- package/transpiled/react/Viewer/{OnlyOfficeViewer.js → ViewersByFile/OnlyOfficeViewer.js} +1 -1
- package/transpiled/react/Viewer/{PdfJsViewer.js → ViewersByFile/PdfJsViewer.js} +20 -32
- package/transpiled/react/Viewer/{PdfMobileViewer.js → ViewersByFile/PdfMobileViewer.js} +17 -29
- package/transpiled/react/Viewer/{ShortcutViewer.js → ViewersByFile/ShortcutViewer.js} +2 -2
- package/transpiled/react/Viewer/{TextViewer.js → ViewersByFile/TextViewer.js} +19 -31
- package/transpiled/react/Viewer/ViewersByFile/VideoViewer.js +35 -0
- package/transpiled/react/Viewer/components/Footer.js +30 -0
- package/transpiled/react/Viewer/{InformationPanel.js → components/InformationPanel.js} +0 -0
- package/transpiled/react/Viewer/components/Navigation.js +48 -0
- package/transpiled/react/Viewer/{PdfToolbarButton.js → components/PdfToolbarButton.js} +0 -0
- package/transpiled/react/Viewer/{Toolbar.js → components/Toolbar.js} +14 -30
- package/transpiled/react/Viewer/{ViewerByFile.js → components/ViewerByFile.js} +9 -9
- package/transpiled/react/Viewer/{ViewerControls.js → components/ViewerControls.js} +15 -31
- package/transpiled/react/Viewer/{ViewerSpinner.js → components/ViewerSpinner.js} +0 -0
- package/transpiled/react/Viewer/helpers.js +4 -4
- package/transpiled/react/Viewer/{withFileUrl.js → hoc/withFileUrl.js} +2 -2
- package/transpiled/react/Viewer/{withViewerLocales.js → hoc/withViewerLocales.js} +8 -4
- package/transpiled/react/Viewer/{Panel → providers}/ActionMenuProvider.js +0 -0
- package/transpiled/react/Viewer/{EncryptedProvider.js → providers/EncryptedProvider.js} +0 -0
- package/transpiled/react/Viewer/{snackbar → providers}/ViewerSnackbarProvider.js +0 -0
- package/transpiled/react/Viewer/snackbar/ViewerSnackbar.js +1 -1
- package/transpiled/react/stylesheet.css +1 -1
- package/react/Viewer/ViewerWrapper.jsx +0 -18
- package/react/Viewer/withViewerLocales.jsx +0 -11
- package/transpiled/react/Viewer/AudioViewer.js +0 -55
- package/transpiled/react/Viewer/Footer.js +0 -46
- package/transpiled/react/Viewer/Navigation.js +0 -64
- package/transpiled/react/Viewer/NoNetworkViewer.js +0 -52
- package/transpiled/react/Viewer/VideoViewer.js +0 -47
- package/transpiled/react/Viewer/ViewerWrapper.js +0 -48
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [75.3.0](https://github.com/cozy/cozy-ui/compare/v75.2.0...v75.3.0) (2022-09-22)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **Viewer:** Add metadata for stranger driver license ([95ba1f5](https://github.com/cozy/cozy-ui/commit/95ba1f5))
|
|
7
|
+
|
|
1
8
|
# [75.2.0](https://github.com/cozy/cozy-ui/compare/v75.1.0...v75.2.0) (2022-09-22)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@ const GET_LINK = 'GET_LINK'
|
|
|
12
12
|
|
|
13
13
|
import { checkImageSource } from './checkImageSource'
|
|
14
14
|
import { isFileEncrypted } from '../Viewer/helpers'
|
|
15
|
-
import { EncryptedContext } from '../Viewer/EncryptedProvider'
|
|
15
|
+
import { EncryptedContext } from '../Viewer/providers/EncryptedProvider'
|
|
16
16
|
|
|
17
17
|
export class FileImageLoader extends Component {
|
|
18
18
|
state = {
|
|
@@ -6,7 +6,7 @@ import logger from 'cozy-logger'
|
|
|
6
6
|
|
|
7
7
|
import { FileImageLoader } from '.'
|
|
8
8
|
import { checkImageSource } from './checkImageSource'
|
|
9
|
-
import EncryptedProvider from '../Viewer/EncryptedProvider'
|
|
9
|
+
import EncryptedProvider from '../Viewer/providers/EncryptedProvider'
|
|
10
10
|
|
|
11
11
|
jest.mock('./checkImageSource', () => ({
|
|
12
12
|
...jest.requireActual('./checkImageSource'),
|
|
@@ -7,7 +7,7 @@ import Icon from '../../Icon'
|
|
|
7
7
|
import DownloadIcon from '../../Icons/Download'
|
|
8
8
|
import Button from '../../Buttons'
|
|
9
9
|
import Alerter from '../../Alerter'
|
|
10
|
-
import { withViewerLocales } from '../withViewerLocales'
|
|
10
|
+
import { withViewerLocales } from '../hoc/withViewerLocales'
|
|
11
11
|
|
|
12
12
|
const DownloadButton = ({ file, t }) => {
|
|
13
13
|
const client = useClient()
|
|
@@ -10,7 +10,7 @@ import ReplyIcon from '../../Icons/Reply'
|
|
|
10
10
|
import ShareIosIcon from '../../Icons/ShareIos'
|
|
11
11
|
import Button from '../../Buttons'
|
|
12
12
|
import Alerter from '../../Alerter'
|
|
13
|
-
import { withViewerLocales } from '../withViewerLocales'
|
|
13
|
+
import { withViewerLocales } from '../hoc/withViewerLocales'
|
|
14
14
|
import { exportFilesNative } from './helpers'
|
|
15
15
|
|
|
16
16
|
const {
|
|
@@ -7,7 +7,7 @@ import { withClient } from 'cozy-client'
|
|
|
7
7
|
import { FileDoctype } from '../../proptypes'
|
|
8
8
|
import Button from '../../Button'
|
|
9
9
|
|
|
10
|
-
import { withViewerLocales } from '../withViewerLocales'
|
|
10
|
+
import { withViewerLocales } from '../hoc/withViewerLocales'
|
|
11
11
|
import { downloadFile } from '../helpers'
|
|
12
12
|
|
|
13
13
|
const DownloadButton = ({ t, client, file, url }) => (
|
|
@@ -2,7 +2,7 @@ import React from 'react'
|
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
3
|
import FileIcon from './FileIcon'
|
|
4
4
|
import DownloadButton from './DownloadButton'
|
|
5
|
-
import styles from '../styles.styl'
|
|
5
|
+
import styles from '../ViewersByFile/styles.styl'
|
|
6
6
|
import { FileDoctype } from '../../proptypes'
|
|
7
7
|
|
|
8
8
|
const NoViewer = ({ file, url, renderFallbackExtraContent }) => (
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
exports[`NoViewer should render the viewer 1`] = `
|
|
4
4
|
<div>
|
|
5
5
|
<div
|
|
6
|
-
class="styles__viewer-
|
|
6
|
+
class="styles__viewer-noviewer___auG-6"
|
|
7
7
|
>
|
|
8
8
|
<svg
|
|
9
9
|
class="styles__icon___23x3R"
|
|
@@ -26,7 +26,7 @@ exports[`NoViewer should render the viewer 1`] = `
|
|
|
26
26
|
</g>
|
|
27
27
|
</svg>
|
|
28
28
|
<p
|
|
29
|
-
class="styles__viewer-
|
|
29
|
+
class="styles__viewer-filename___3jZCt"
|
|
30
30
|
>
|
|
31
31
|
notSupported.xyz
|
|
32
32
|
</p>
|
|
@@ -47,7 +47,7 @@ exports[`NoViewer should render the viewer 1`] = `
|
|
|
47
47
|
exports[`NoViewer should render the viewer with specific extra content 1`] = `
|
|
48
48
|
<div>
|
|
49
49
|
<div
|
|
50
|
-
class="styles__viewer-
|
|
50
|
+
class="styles__viewer-noviewer___auG-6"
|
|
51
51
|
>
|
|
52
52
|
<svg
|
|
53
53
|
class="styles__icon___23x3R"
|
|
@@ -70,7 +70,7 @@ exports[`NoViewer should render the viewer with specific extra content 1`] = `
|
|
|
70
70
|
</g>
|
|
71
71
|
</svg>
|
|
72
72
|
<p
|
|
73
|
-
class="styles__viewer-
|
|
73
|
+
class="styles__viewer-filename___3jZCt"
|
|
74
74
|
>
|
|
75
75
|
notSupported.xyz
|
|
76
76
|
</p>
|
|
@@ -5,9 +5,9 @@ import { useAppLinkWithStoreFallback, useClient } from 'cozy-client'
|
|
|
5
5
|
|
|
6
6
|
import useBreakpoints from '../../hooks/useBreakpoints'
|
|
7
7
|
import { useI18n } from '../../I18n'
|
|
8
|
-
import useViewerSnackbar from '../
|
|
8
|
+
import useViewerSnackbar from '../providers/ViewerSnackbarProvider'
|
|
9
9
|
import { buildEditAttributePath, getCurrentModel } from '../helpers'
|
|
10
|
-
import useActionMenuContext from '
|
|
10
|
+
import useActionMenuContext from '../providers/ActionMenuProvider'
|
|
11
11
|
import ActionMenuMobile from './ActionMenuMobile'
|
|
12
12
|
import ActionMenuDesktop from './ActionMenuDesktop'
|
|
13
13
|
|
|
@@ -7,7 +7,7 @@ import { Media, Img, Bd } from '../../Media'
|
|
|
7
7
|
import Icon, { iconPropType } from '../../Icon'
|
|
8
8
|
import CarbonCopyIcon from '../../Icons/CarbonCopy'
|
|
9
9
|
import SafeIcon from '../../Icons/Safe'
|
|
10
|
-
import { withViewerLocales } from '../withViewerLocales'
|
|
10
|
+
import { withViewerLocales } from '../hoc/withViewerLocales'
|
|
11
11
|
|
|
12
12
|
const Certification = ({ icon, title, caption }) => {
|
|
13
13
|
return (
|
|
@@ -5,7 +5,7 @@ import cx from 'classnames'
|
|
|
5
5
|
import Stack from '../../Stack'
|
|
6
6
|
import Paper from '../../Paper'
|
|
7
7
|
import Typography from '../../Typography'
|
|
8
|
-
import { withViewerLocales } from '../withViewerLocales'
|
|
8
|
+
import { withViewerLocales } from '../hoc/withViewerLocales'
|
|
9
9
|
|
|
10
10
|
import getPanelBlocks, { panelBlocksSpecs } from './getPanelBlocks'
|
|
11
11
|
|
|
@@ -2,17 +2,17 @@ import React, { useRef, useState, createRef, useMemo, useEffect } from 'react'
|
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
3
|
|
|
4
4
|
import List from '../../MuiCozyTheme/List'
|
|
5
|
-
import { withViewerLocales } from '../withViewerLocales'
|
|
5
|
+
import { withViewerLocales } from '../hoc/withViewerLocales'
|
|
6
6
|
import {
|
|
7
7
|
formatMetadataQualification,
|
|
8
8
|
knownDateMetadataNames,
|
|
9
|
-
|
|
9
|
+
knowInformationMetadataNames,
|
|
10
10
|
knowOtherMetadataNames
|
|
11
11
|
} from '../helpers'
|
|
12
12
|
import QualificationListItemContact from './QualificationListItemContact'
|
|
13
13
|
import ActionMenuWrapper from './ActionMenuWrapper'
|
|
14
14
|
import QualificationListItemDate from './QualificationListItemDate'
|
|
15
|
-
import
|
|
15
|
+
import QualificationListItemInformation from './QualificationListItemInformation'
|
|
16
16
|
import QualificationListItemOther from './QualificationListItemOther'
|
|
17
17
|
|
|
18
18
|
const Qualification = ({ file = {} }) => {
|
|
@@ -61,9 +61,9 @@ const Qualification = ({ file = {} }) => {
|
|
|
61
61
|
)
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
if (
|
|
64
|
+
if (knowInformationMetadataNames.includes(name)) {
|
|
65
65
|
return (
|
|
66
|
-
<
|
|
66
|
+
<QualificationListItemInformation
|
|
67
67
|
key={idx}
|
|
68
68
|
ref={actionBtnRef.current[idx]}
|
|
69
69
|
metadataComputed={meta}
|
package/react/Viewer/Panel/{QualificationListItemNumber.jsx → QualificationListItemInformation.jsx}
RENAMED
|
@@ -9,7 +9,7 @@ import Dots from '../../Icons/Dots'
|
|
|
9
9
|
import QualificationListItemText from './QualificationListItemText'
|
|
10
10
|
import { useI18n } from '../../I18n'
|
|
11
11
|
|
|
12
|
-
const
|
|
12
|
+
const QualificationListItemInformation = forwardRef(
|
|
13
13
|
({ metadataComputed, toggleActionsMenu }, ref) => {
|
|
14
14
|
const { t } = useI18n()
|
|
15
15
|
const { name, value } = metadataComputed
|
|
@@ -17,7 +17,7 @@ const QualificationListItemNumber = forwardRef(
|
|
|
17
17
|
return (
|
|
18
18
|
<ListItem className={'u-pl-2 u-pr-3'}>
|
|
19
19
|
<QualificationListItemText
|
|
20
|
-
primary={t(`Viewer.panel.qualification.
|
|
20
|
+
primary={t(`Viewer.panel.qualification.information.title.${name}`)}
|
|
21
21
|
secondary={value}
|
|
22
22
|
/>
|
|
23
23
|
<ListItemSecondaryAction>
|
|
@@ -29,9 +29,9 @@ const QualificationListItemNumber = forwardRef(
|
|
|
29
29
|
)
|
|
30
30
|
}
|
|
31
31
|
)
|
|
32
|
-
|
|
32
|
+
QualificationListItemInformation.displayName = 'QualificationListItemNumber'
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
QualificationListItemInformation.propTypes = {
|
|
35
35
|
metadataComputed: PropTypes.shape({
|
|
36
36
|
name: PropTypes.string,
|
|
37
37
|
value: PropTypes.string
|
|
@@ -39,4 +39,4 @@ QualificationListItemNumber.propTypes = {
|
|
|
39
39
|
toggleActionsMenu: PropTypes.func.isRequired
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
export default
|
|
42
|
+
export default QualificationListItemInformation
|
package/react/Viewer/Viewer.jsx
CHANGED
|
@@ -3,8 +3,8 @@ import PropTypes from 'prop-types'
|
|
|
3
3
|
|
|
4
4
|
import { FileDoctype } from '../proptypes'
|
|
5
5
|
|
|
6
|
-
import ViewerControls from './ViewerControls'
|
|
7
|
-
import ViewerByFile from './ViewerByFile'
|
|
6
|
+
import ViewerControls from './components/ViewerControls'
|
|
7
|
+
import ViewerByFile from './components/ViewerByFile'
|
|
8
8
|
import { toolbarPropsPropType } from './index'
|
|
9
9
|
|
|
10
10
|
const KEY_CODE_LEFT = 37
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import React, { createRef } from 'react'
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
|
+
import cx from 'classnames'
|
|
3
4
|
|
|
4
5
|
import useBreakpoints from '../hooks/useBreakpoints'
|
|
5
6
|
import { FileDoctype } from '../proptypes'
|
|
6
7
|
|
|
7
8
|
import { toolbarPropsPropType } from './proptypes'
|
|
8
9
|
import { isValidForPanel } from './helpers'
|
|
9
|
-
import ViewerWrapper from './ViewerWrapper'
|
|
10
10
|
import Viewer from './Viewer'
|
|
11
11
|
import ViewerInformationsWrapper from './ViewerInformationsWrapper'
|
|
12
|
-
import EncryptedProvider from './EncryptedProvider'
|
|
13
|
-
import { ViewerSnackbarProvider } from './
|
|
12
|
+
import EncryptedProvider from './providers/EncryptedProvider'
|
|
13
|
+
import { ViewerSnackbarProvider } from './providers/ViewerSnackbarProvider'
|
|
14
14
|
import ViewerSnackbar from './snackbar/ViewerSnackbar'
|
|
15
|
-
import { ActionMenuProvider } from './
|
|
15
|
+
import { ActionMenuProvider } from './providers/ActionMenuProvider'
|
|
16
|
+
|
|
17
|
+
import styles from './styles.styl'
|
|
16
18
|
|
|
17
19
|
const ViewerContainer = props => {
|
|
18
20
|
const {
|
|
@@ -36,7 +38,10 @@ const ViewerContainer = props => {
|
|
|
36
38
|
return (
|
|
37
39
|
<ViewerSnackbarProvider>
|
|
38
40
|
<ActionMenuProvider editPathByModelProps={editPathByModelProps}>
|
|
39
|
-
<
|
|
41
|
+
<div
|
|
42
|
+
id="viewer-wrapper"
|
|
43
|
+
className={cx(styles['viewer-wrapper'], className)}
|
|
44
|
+
>
|
|
40
45
|
<EncryptedProvider url={currentURL}>
|
|
41
46
|
<Viewer
|
|
42
47
|
{...rest}
|
|
@@ -55,7 +60,7 @@ const ViewerContainer = props => {
|
|
|
55
60
|
>
|
|
56
61
|
{children}
|
|
57
62
|
</ViewerInformationsWrapper>
|
|
58
|
-
</
|
|
63
|
+
</div>
|
|
59
64
|
<ViewerSnackbar />
|
|
60
65
|
</ActionMenuProvider>
|
|
61
66
|
</ViewerSnackbarProvider>
|
|
@@ -4,8 +4,8 @@ import { useTheme } from '@material-ui/core'
|
|
|
4
4
|
|
|
5
5
|
import { FileDoctype } from '../proptypes'
|
|
6
6
|
|
|
7
|
-
import InformationPanel from './InformationPanel'
|
|
8
|
-
import Footer from './Footer'
|
|
7
|
+
import InformationPanel from './components/InformationPanel'
|
|
8
|
+
import Footer from './components/Footer'
|
|
9
9
|
import PanelContent from './Panel/PanelContent'
|
|
10
10
|
import FooterContent from './Footer/FooterContent'
|
|
11
11
|
import { useSetFlagshipUI } from '../hooks/useSetFlagshipUi/useSetFlagshipUI'
|
|
@@ -4,10 +4,10 @@ import { render } from '@testing-library/react'
|
|
|
4
4
|
import ViewerInformationsWrapper from './ViewerInformationsWrapper'
|
|
5
5
|
|
|
6
6
|
/* eslint-disable react/display-name */
|
|
7
|
-
jest.mock('./Footer', () => ({ children }) => (
|
|
7
|
+
jest.mock('./components/Footer', () => ({ children }) => (
|
|
8
8
|
<div data-testid="Footer">{children}</div>
|
|
9
9
|
))
|
|
10
|
-
jest.mock('./InformationPanel', () => ({ children }) => (
|
|
10
|
+
jest.mock('./components/InformationPanel', () => ({ children }) => (
|
|
11
11
|
<div data-testid="InformationPanel">{children}</div>
|
|
12
12
|
))
|
|
13
13
|
jest.mock('./Panel/PanelContent', () => () => (
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import React, { createRef } from 'react'
|
|
2
|
+
import cx from 'classnames'
|
|
2
3
|
|
|
3
4
|
import useBreakpoints from '../hooks/useBreakpoints'
|
|
4
5
|
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import Footer from './Footer'
|
|
6
|
+
import InformationPanel from './components/InformationPanel'
|
|
7
|
+
import Footer from './components/Footer'
|
|
8
8
|
import Viewer from './Viewer'
|
|
9
9
|
|
|
10
|
+
import styles from './styles.styl'
|
|
11
|
+
|
|
10
12
|
const ViewerWithCustomPanelAndFooter = props => {
|
|
11
13
|
console.warn(
|
|
12
14
|
'Warning: Please do not use the "ViewerWithCustomPanelAndFooter" Component, replace it with the default export component'
|
|
13
15
|
)
|
|
14
|
-
const { footerProps, panelInfoProps, ...rest } = props
|
|
16
|
+
const { footerProps, panelInfoProps, className, ...rest } = props
|
|
15
17
|
const { files, currentIndex } = props
|
|
16
18
|
const fileCount = files.length
|
|
17
19
|
const hasPrevious = currentIndex > 0
|
|
@@ -26,7 +28,10 @@ const ViewerWithCustomPanelAndFooter = props => {
|
|
|
26
28
|
panelInfoProps.showPanel({ file: currentFile })
|
|
27
29
|
|
|
28
30
|
return (
|
|
29
|
-
<
|
|
31
|
+
<div
|
|
32
|
+
id="viewer-wrapper"
|
|
33
|
+
className={cx(styles['viewer-wrapper'], className)}
|
|
34
|
+
>
|
|
30
35
|
<Viewer
|
|
31
36
|
{...rest}
|
|
32
37
|
disablePanel={true}
|
|
@@ -45,7 +50,7 @@ const ViewerWithCustomPanelAndFooter = props => {
|
|
|
45
50
|
<panelInfoProps.PanelContent file={currentFile} />
|
|
46
51
|
</InformationPanel>
|
|
47
52
|
)}
|
|
48
|
-
</
|
|
53
|
+
</div>
|
|
49
54
|
)
|
|
50
55
|
}
|
|
51
56
|
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import Icon from '../Icon'
|
|
3
|
-
import FileTypeAudioIcon from '../Icons/FileTypeAudio'
|
|
4
2
|
|
|
5
|
-
import
|
|
6
|
-
import
|
|
3
|
+
import Icon from '../../Icon'
|
|
4
|
+
import FileTypeAudioIcon from '../../Icons/FileTypeAudio'
|
|
5
|
+
import isTesting from '../../helpers/isTesting'
|
|
6
|
+
|
|
7
|
+
import withFileUrl from '../hoc/withFileUrl'
|
|
7
8
|
|
|
8
|
-
import
|
|
9
|
+
import styles from './styles.styl'
|
|
9
10
|
|
|
10
11
|
const AudioViewer = ({ file, url }) => (
|
|
11
12
|
<div className={styles['viewer-audioviewer']}>
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { render, waitFor } from '@testing-library/react'
|
|
3
3
|
|
|
4
|
-
import { BreakpointsProvider } from '
|
|
5
|
-
|
|
4
|
+
import { BreakpointsProvider } from '../../hooks/useBreakpoints'
|
|
5
|
+
|
|
6
|
+
import DemoProvider from '../docs/DemoProvider'
|
|
6
7
|
|
|
7
8
|
import AudioViewer from './AudioViewer'
|
|
8
9
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React, { Component } from 'react'
|
|
2
2
|
import Hammer from 'hammerjs'
|
|
3
3
|
|
|
4
|
-
import FileImageLoader from '
|
|
4
|
+
import FileImageLoader from '../../FileImageLoader'
|
|
5
5
|
|
|
6
|
-
import ViewerSpinner from '
|
|
6
|
+
import ViewerSpinner from '../components/ViewerSpinner'
|
|
7
7
|
import NoNetworkViewer from './NoNetworkViewer'
|
|
8
8
|
|
|
9
9
|
import styles from './styles.styl'
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { render, waitFor } from '@testing-library/react'
|
|
3
3
|
|
|
4
|
-
import { BreakpointsProvider } from '
|
|
4
|
+
import { BreakpointsProvider } from '../../hooks/useBreakpoints'
|
|
5
|
+
import { checkImageSource } from '../../FileImageLoader/checkImageSource'
|
|
6
|
+
|
|
7
|
+
import DemoProvider from '../docs/DemoProvider'
|
|
8
|
+
import EncryptedProvider from '../providers/EncryptedProvider'
|
|
5
9
|
|
|
6
|
-
import DemoProvider from './docs/DemoProvider'
|
|
7
|
-
import { checkImageSource } from '../FileImageLoader/checkImageSource'
|
|
8
10
|
import ImageViewer from './ImageViewer'
|
|
9
|
-
import EncryptedProvider from './EncryptedProvider'
|
|
10
11
|
|
|
11
|
-
jest.mock('
|
|
12
|
-
...jest.requireActual('
|
|
12
|
+
jest.mock('../../FileImageLoader/checkImageSource', () => ({
|
|
13
|
+
...jest.requireActual('../../FileImageLoader/checkImageSource'),
|
|
13
14
|
checkImageSource: jest.fn()
|
|
14
15
|
}))
|
|
15
16
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
|
|
3
|
-
import Icon from '
|
|
4
|
-
import CloudBrokenIcon from '
|
|
5
|
-
import Button from '
|
|
3
|
+
import Icon from '../../Icon'
|
|
4
|
+
import CloudBrokenIcon from '../../Icons/CloudBroken'
|
|
5
|
+
import Button from '../../Button'
|
|
6
|
+
|
|
7
|
+
import { withViewerLocales } from '../hoc/withViewerLocales'
|
|
6
8
|
|
|
7
|
-
import { withViewerLocales } from './withViewerLocales'
|
|
8
9
|
import styles from './styles.styl'
|
|
9
10
|
|
|
10
11
|
const NoNetworkViewer = ({ t, onReload }) => (
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
3
|
|
|
4
|
-
import Button from '
|
|
5
|
-
import { FileDoctype } from '
|
|
4
|
+
import Button from '../../Button'
|
|
5
|
+
import { FileDoctype } from '../../proptypes'
|
|
6
6
|
|
|
7
|
-
import { withViewerLocales } from '
|
|
8
|
-
import NoViewer from '
|
|
7
|
+
import { withViewerLocales } from '../hoc/withViewerLocales'
|
|
8
|
+
import NoViewer from '../NoViewer'
|
|
9
9
|
|
|
10
10
|
const OnlyOfficeViewer = ({ file, onlyOfficeOpener, t }) => {
|
|
11
11
|
return (
|
|
@@ -5,11 +5,11 @@ import cx from 'classnames'
|
|
|
5
5
|
import throttle from 'lodash/throttle'
|
|
6
6
|
import flow from 'lodash/flow'
|
|
7
7
|
|
|
8
|
-
import ViewerSpinner from '
|
|
9
|
-
import { withViewerLocales } from '
|
|
10
|
-
import withFileUrl from '
|
|
11
|
-
import ToolbarButton from '
|
|
12
|
-
import NoViewer from '
|
|
8
|
+
import ViewerSpinner from '../components/ViewerSpinner'
|
|
9
|
+
import { withViewerLocales } from '../hoc/withViewerLocales'
|
|
10
|
+
import withFileUrl from '../hoc/withFileUrl'
|
|
11
|
+
import ToolbarButton from '../components/PdfToolbarButton'
|
|
12
|
+
import NoViewer from '../NoViewer'
|
|
13
13
|
|
|
14
14
|
import styles from './styles.styl'
|
|
15
15
|
|
|
@@ -4,14 +4,14 @@ import { useClient } from 'cozy-client'
|
|
|
4
4
|
import { openFileWith } from 'cozy-client/dist/models/fsnative'
|
|
5
5
|
import { isMobileApp } from 'cozy-device-helper'
|
|
6
6
|
|
|
7
|
-
import Alerter from '
|
|
8
|
-
import Spinner from '
|
|
9
|
-
import Button from '
|
|
10
|
-
import FileImageLoader from '
|
|
7
|
+
import Alerter from '../../Alerter'
|
|
8
|
+
import Spinner from '../../Spinner'
|
|
9
|
+
import Button from '../../Button'
|
|
10
|
+
import FileImageLoader from '../../FileImageLoader'
|
|
11
11
|
|
|
12
|
-
import { withViewerLocales } from '
|
|
13
|
-
import DownloadButton from '
|
|
14
|
-
import NoViewer from '
|
|
12
|
+
import { withViewerLocales } from '../hoc/withViewerLocales'
|
|
13
|
+
import DownloadButton from '../NoViewer/DownloadButton'
|
|
14
|
+
import NoViewer from '../NoViewer'
|
|
15
15
|
|
|
16
16
|
import styles from './styles.styl'
|
|
17
17
|
|
|
@@ -5,10 +5,10 @@ import { CozyProvider, createMockClient } from 'cozy-client'
|
|
|
5
5
|
import { isMobileApp } from 'cozy-device-helper'
|
|
6
6
|
import logger from 'cozy-logger'
|
|
7
7
|
|
|
8
|
-
import { I18n } from '
|
|
8
|
+
import { I18n } from '../../I18n'
|
|
9
9
|
|
|
10
|
+
import EncryptedProvider from '../providers/EncryptedProvider'
|
|
10
11
|
import { PdfMobileViewer } from './PdfMobileViewer'
|
|
11
|
-
import EncryptedProvider from './EncryptedProvider'
|
|
12
12
|
|
|
13
13
|
logger.error = logger.warn = jest.fn()
|
|
14
14
|
|
|
@@ -2,11 +2,12 @@ import React from 'react'
|
|
|
2
2
|
import { useClient, useFetchShortcut } from 'cozy-client'
|
|
3
3
|
import get from 'lodash/get'
|
|
4
4
|
|
|
5
|
-
import { withViewerLocales } from '
|
|
6
|
-
import { ButtonLink } from '
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
|
|
5
|
+
import { withViewerLocales } from '../hoc/withViewerLocales'
|
|
6
|
+
import { ButtonLink } from '../../Button'
|
|
7
|
+
import { FileDoctype } from '../../proptypes'
|
|
8
|
+
import OpenwithIcon from '../../Icons/Openwith'
|
|
9
|
+
|
|
10
|
+
import NoViewer from '../NoViewer'
|
|
10
11
|
|
|
11
12
|
const ShortcutViewer = ({ t, file }) => {
|
|
12
13
|
const client = useClient()
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
|
|
3
3
|
import CozyClient, { CozyProvider } from 'cozy-client'
|
|
4
|
-
import I18n from '../I18n'
|
|
5
4
|
import { render, waitFor } from '@testing-library/react'
|
|
5
|
+
import I18n from '../../I18n'
|
|
6
6
|
|
|
7
|
-
import
|
|
7
|
+
import en from '../locales/en.json'
|
|
8
8
|
|
|
9
|
-
import
|
|
9
|
+
import ShortcutViewer from './ShortcutViewer'
|
|
10
10
|
|
|
11
11
|
export const locales = {
|
|
12
12
|
en
|
|
@@ -5,14 +5,14 @@ import cx from 'classnames'
|
|
|
5
5
|
|
|
6
6
|
import { withClient, models } from 'cozy-client'
|
|
7
7
|
|
|
8
|
-
import
|
|
9
|
-
import { FileDoctype } from '../proptypes'
|
|
8
|
+
import { FileDoctype } from '../../proptypes'
|
|
10
9
|
|
|
11
|
-
import
|
|
12
|
-
import
|
|
10
|
+
import ViewerSpinner from '../components/ViewerSpinner'
|
|
11
|
+
import withFileUrl from '../hoc/withFileUrl'
|
|
12
|
+
import NoViewer from '../NoViewer'
|
|
13
|
+
import { isFileEncrypted } from '../helpers'
|
|
13
14
|
|
|
14
15
|
import styles from './styles.styl'
|
|
15
|
-
import { isFileEncrypted } from './helpers'
|
|
16
16
|
|
|
17
17
|
const MarkdownRenderer = ({ text }) => (
|
|
18
18
|
<ReactMarkdown
|
|
@@ -4,7 +4,8 @@ import renderer from 'react-test-renderer'
|
|
|
4
4
|
|
|
5
5
|
import { createMockClient } from 'cozy-client'
|
|
6
6
|
|
|
7
|
-
import { BreakpointsProvider } from '
|
|
7
|
+
import { BreakpointsProvider } from '../../hooks/useBreakpoints'
|
|
8
|
+
|
|
8
9
|
import { TextViewer, isMarkdown } from './TextViewer'
|
|
9
10
|
|
|
10
11
|
const client = createMockClient({})
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { render, waitFor } from '@testing-library/react'
|
|
3
3
|
|
|
4
|
-
import { BreakpointsProvider } from '
|
|
5
|
-
import DemoProvider from '
|
|
4
|
+
import { BreakpointsProvider } from '../../hooks/useBreakpoints'
|
|
5
|
+
import DemoProvider from '../docs/DemoProvider'
|
|
6
6
|
|
|
7
7
|
import VideoViewer from './VideoViewer'
|
|
8
8
|
|
package/react/Viewer/{__snapshots__ → ViewersByFile/__snapshots__}/AudioViewer.spec.jsx.snap
RENAMED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
exports[`AudioViewer should render a spinner then the audio viewer 1`] = `
|
|
4
4
|
<div>
|
|
5
5
|
<div
|
|
6
|
-
class="styles__viewer-
|
|
6
|
+
class="styles__viewer-audioviewer___1OQPB"
|
|
7
7
|
>
|
|
8
8
|
<svg
|
|
9
9
|
class="styles__icon___23x3R"
|
|
@@ -29,7 +29,7 @@ exports[`AudioViewer should render a spinner then the audio viewer 1`] = `
|
|
|
29
29
|
</g>
|
|
30
30
|
</svg>
|
|
31
31
|
<p
|
|
32
|
-
class="styles__viewer-
|
|
32
|
+
class="styles__viewer-filename___3jZCt"
|
|
33
33
|
>
|
|
34
34
|
sample.mp3
|
|
35
35
|
</p>
|