Skip to content

Commit

Permalink
fix: Clear console errors
Browse files Browse the repository at this point in the history
  • Loading branch information
acezard committed Dec 16, 2021
1 parent db30b49 commit e078471
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 17 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"dependencies": {
"@atlaskit/icon": "21.1.0",
"@atlaskit/media-core": "32.2.0",
"@material-ui/core": "4.12.3",
"@material-ui/core": "4.11.4",
"@material-ui/styles": "4.11.4",
"classnames": "2.3.1",
"cozy-bar": "7.16.0",
Expand Down
11 changes: 10 additions & 1 deletion src/components/notes/EditorCorner.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,22 @@ import { useI18n } from 'cozy-ui/transpiled/react/I18n'

import SharingWidget from 'components/notes/sharing'

// https://mui.com/components/tooltips/#custom-child-element
const ForwardedIcon = React.forwardRef(function ForwardedIcon(props, ref) {
return (
<div ref={ref}>
<Icon {...props} />
</div>
)
})

const EditorCorner = ({ doc, isPublic, isReadOnly, title }) => {
const { t } = useI18n()
if (!isPublic) return <SharingWidget file={doc.file} title={title} />
else if (isReadOnly) {
return (
<Tooltip title={t('Notes.Editor.read_only')}>
<Icon icon="lock" color="var(--primaryTextColor)" />
<ForwardedIcon icon="lock" color="var(--primaryTextColor)" />
</Tooltip>
)
} else return null
Expand Down
3 changes: 1 addition & 2 deletions src/components/notes/EditorCorner.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,9 @@ describe('EditorCorner', () => {
<WithStyles(ForwardRef(Tooltip))
title="This note is in read-only mode."
>
<Icon
<ForwardRef(ForwardedIcon)
color="var(--primaryTextColor)"
icon="lock"
spin={false}
/>
</WithStyles(ForwardRef(Tooltip))>
`)
Expand Down
14 changes: 8 additions & 6 deletions src/components/notes/editor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,13 @@ export default function Editor(props) {
headerMenu={
<HeaderMenu
backFromEditing={
<BackFromEditing
returnUrl={returnUrl}
file={doc.file}
requestToLeave={requestToLeave}
/>
returnUrl ? (
<BackFromEditing
returnUrl={returnUrl}
file={doc.file}
requestToLeave={requestToLeave}
/>
) : null
}
editorCorner={
<EditorCorner
Expand Down Expand Up @@ -151,5 +153,5 @@ Editor.propTypes = {
noteId: PropTypes.string.isRequired,
readOnly: PropTypes.bool.isRequired,
userName: PropTypes.string,
returnUrl: PropTypes.string
returnUrl: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]).isRequired
}
2 changes: 1 addition & 1 deletion src/targets/browser/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export const initApp = () => {

const shareCode = getPublicSharecode()
const token = shareCode || data.token
const isPublic = shareCode || !token || token == ''
const isPublic = Boolean(shareCode || !token || token == '')

// initialize the client to interact with the cozy stack
const client = new CozyClient({
Expand Down
12 changes: 6 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3098,14 +3098,14 @@
"@kenjiuno/decompressrtf" "^0.1.3"
"@kenjiuno/iconvlite-wrapper-with-iso2022jp" "^0.1.0"

"@material-ui/core@4.12.3":
version "4.12.3"
resolved "https://registry.yarnpkg.com/@material-ui/core/-/core-4.12.3.tgz#80d665caf0f1f034e52355c5450c0e38b099d3ca"
integrity sha512-sdpgI/PL56QVsEJldwEe4FFaFTLUqN+rd7sSZiRCdx2E/C7z5yK0y/khAWVBH24tXwto7I1hCzNWfJGZIYJKnw==
"@material-ui/core@4.11.4":
version "4.11.4"
resolved "https://registry.yarnpkg.com/@material-ui/core/-/core-4.11.4.tgz#4fb9fe5dec5dcf780b687e3a40cff78b2b9640a4"
integrity sha512-oqb+lJ2Dl9HXI9orc6/aN8ZIAMkeThufA5iZELf2LQeBn2NtjVilF5D2w7e9RpntAzDb4jK5DsVhkfOvFY/8fg==
dependencies:
"@babel/runtime" "^7.4.4"
"@material-ui/styles" "^4.11.4"
"@material-ui/system" "^4.12.1"
"@material-ui/system" "^4.11.3"
"@material-ui/types" "5.1.0"
"@material-ui/utils" "^4.11.2"
"@types/react-transition-group" "^4.2.0"
Expand Down Expand Up @@ -3138,7 +3138,7 @@
jss-plugin-vendor-prefixer "^10.5.1"
prop-types "^15.7.2"

"@material-ui/system@^4.12.1":
"@material-ui/system@^4.11.3":
version "4.12.1"
resolved "https://registry.yarnpkg.com/@material-ui/system/-/system-4.12.1.tgz#2dd96c243f8c0a331b2bb6d46efd7771a399707c"
integrity sha512-lUdzs4q9kEXZGhbN7BptyiS1rLNHe6kG9o8Y307HCvF4sQxbCgpL2qi+gUk+yI8a2DNk48gISEQxoxpgph0xIw==
Expand Down

0 comments on commit e078471

Please sign in to comment.