Skip to content

Commit 8510cc4

Browse files
lethemanhlethemanh
authored andcommitted
fix: Hide summarize button in public view 🐛
1 parent 0325125 commit 8510cc4

File tree

5 files changed

+18
-8
lines changed

5 files changed

+18
-8
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
"cozy-stack-client": "^60.19.0",
105105
"cozy-ui": "^135.6.0",
106106
"cozy-ui-plus": "^4.4.0",
107-
"cozy-viewer": "^26.6.0",
107+
"cozy-viewer": "^26.6.1",
108108
"date-fns": "2.30.0",
109109
"diacritics": "1.3.0",
110110
"filesize": "10.1.6",

src/modules/actions/summariseByAI.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const makeComponent = (label, icon) => {
2525
return Component
2626
}
2727

28-
export const summariseByAI = ({ t, hasWriteAccess, navigate }) => {
28+
export const summariseByAI = ({ t, hasWriteAccess, navigate, isPublic }) => {
2929
const label = t('actions.summariseByAI')
3030
const icon = ArticleIcon
3131

@@ -36,7 +36,8 @@ export const summariseByAI = ({ t, hasWriteAccess, navigate }) => {
3636
displayCondition: files =>
3737
flag('ai.available') &&
3838
isFileSummaryCompatible(files[0]) &&
39-
hasWriteAccess,
39+
hasWriteAccess &&
40+
!isPublic,
4041
action: files => {
4142
const file = files[0]
4243
navigate(`file/${file._id}`, {

src/modules/public/LightFileViewer.jsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,11 @@ const LightFileViewer = ({ files, isPublic }) => {
7878
isEnabled: isOfficeEnabled(isDesktop),
7979
opener: onlyOfficeOpener
8080
},
81-
toolbarProps: { showToolbar: isDesktop, showClose: false }
81+
toolbarProps: {
82+
showToolbar: isDesktop,
83+
showClose: false,
84+
hideSummarizeBtn: true
85+
}
8286
}}
8387
>
8488
<FooterActionButtons>

src/modules/views/Public/PublicFileViewer.jsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@ const PublicFileViewer = () => {
8888
isPublic={true}
8989
onChangeRequest={handleChange}
9090
onCloseRequest={handleClose}
91+
componentsProps={{
92+
toolbarProps: {
93+
hideSummarizeBtn: true
94+
}
95+
}}
9196
>
9297
<FooterActionButtons>
9398
<ForwardOrDownloadButton />

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5922,10 +5922,10 @@ cozy-ui@^135.6.0:
59225922
react-virtuoso "^4.13.0"
59235923
rooks "7.14.1"
59245924

5925-
cozy-viewer@^26.6.0:
5926-
version "26.6.0"
5927-
resolved "https://registry.yarnpkg.com/cozy-viewer/-/cozy-viewer-26.6.0.tgz#520e3050599e6ce3a5d2770b2b2e93ced3a8eb7a"
5928-
integrity sha512-AUVBGPTRNu5mFvMIo6os1qxrkMUoRNd7outtPMdvwFkp6lgumExML8Vy4mgUsI1hCjtbVOaL48+gvyl2M/iPoA==
5925+
cozy-viewer@^26.6.1:
5926+
version "26.6.1"
5927+
resolved "https://registry.yarnpkg.com/cozy-viewer/-/cozy-viewer-26.6.1.tgz#c79ff3d55de63a5927a49d6525fafebba0deb438"
5928+
integrity sha512-RB0/25X/8YWq6RXYLjKaTzZJAY57dIWE0yFhfW/kkazZTPQMUIei22CSbtSQL+rfGHYMN9wLefwRNDLSwqq4GA==
59295929
dependencies:
59305930
classnames "^2.5.1"
59315931
hammerjs "^2.0.8"

0 commit comments

Comments
 (0)