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(Viewer): Display the file path into non-public viewer #2965

Merged
merged 3 commits into from
Aug 28, 2023
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
"cozy-scripts": "^8.1.0",
"cozy-sharing": "8.3.0",
"cozy-stack-client": "^40.0.1",
"cozy-ui": "91.2.0",
"cozy-ui": "92.0.0",
"date-fns": "1.30.1",
"diacritics": "1.3.0",
"fastclick": "1.0.6",
Expand Down
4 changes: 2 additions & 2 deletions src/drive/web/modules/public/LightFileViewer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ const LightFileViewer = ({ files }) => {
OnlyOfficeViewer: {
isEnabled: isOfficeEnabled(isDesktop),
opener: onlyOfficeOpener
}
},
toolbarProps: { showToolbar: isDesktop }
}}
toolbarProps={{ showToolbar: isDesktop }}
>
<FooterActionButtons>
<ForwardOrDownloadButton />
Expand Down
3 changes: 3 additions & 0 deletions src/drive/web/modules/viewer/FilesViewer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,9 @@ const FilesViewer = ({ filesQuery, files, onClose, onChange }) => {
OnlyOfficeViewer: {
isEnabled: isOfficeEnabled(isDesktop),
opener: file => navigate(makeOnlyOfficeFileRoute(file, true))
},
toolbarProps: {
showFilePath: true
}
}}
>
Expand Down
11 changes: 8 additions & 3 deletions src/photos/components/PhotosViewer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ export const TimelinePhotosViewer = () => {
return <PhotosViewer photos={results.data} />
}

export const AlbumPhotosViewer = () => {
export const AlbumPhotosViewer = ({ isPublic }) => {
const { albumId } = useParams()
const albumsQuery = buildAlbumsQuery(albumId)

const results = useQuery(albumsQuery.definition, albumsQuery.options)

if (results.fetchStatus != 'loaded') return null

return <PhotosViewer photos={results.data.photos.data} />
return <PhotosViewer photos={results.data.photos.data} isPublic={isPublic} />
}

const PhotosViewer = ({ photos }) => {
const PhotosViewer = ({ photos, isPublic = false }) => {
const navigate = useNavigate()
let { photoId } = useParams()

Expand All @@ -46,6 +46,11 @@ const PhotosViewer = ({ photos }) => {
currentIndex={currentIndex}
onChangeRequest={nextPhoto => navigate(`../${nextPhoto.id}`)}
onCloseRequest={() => navigate('..')}
componentsProps={{
toolbarProps: {
showFilePath: !isPublic
}
}}
>
<FooterActionButtons>
<SharingButton />
Expand Down
5 changes: 4 additions & 1 deletion src/photos/targets/public/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ async function init() {
<HashRouter>
<Routes>
<Route path="shared/:albumId" element={<App />}>
<Route path=":photoId" element={<AlbumPhotosViewer />} />
<Route
path=":photoId"
element={<AlbumPhotosViewer isPublic={true} />}
/>
</Route>
<Route
path="*"
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6142,10 +6142,10 @@ cozy-stack-client@^40.0.1:
mime "^2.4.0"
qs "^6.7.0"

cozy-ui@91.2.0:
version "91.2.0"
resolved "https://registry.yarnpkg.com/cozy-ui/-/cozy-ui-91.2.0.tgz#26562c02bcc7f0679fa668651a2185351d0f0ca9"
integrity sha512-zOMf68tGZNmABcxRoNrfJ7MOnaS8g1V+zGgwm9fhKhU/jolE/nDFKmsC6rmCeymwU3ubkujBHXGRyNn4W5tvhg==
cozy-ui@92.0.0:
version "92.0.0"
resolved "https://registry.yarnpkg.com/cozy-ui/-/cozy-ui-92.0.0.tgz#ea545222a9bdaa23e316bd72230c383ea9240460"
integrity sha512-ruCnIeUFSgf8pzKrdTqH01TVQHASuPzav+DWpmK65eWHJpPdPITy4FUFMwYkEd/2QU7lwGLWzqhh9oiTo5+yWw==
dependencies:
"@babel/runtime" "^7.3.4"
"@material-ui/core" "4.12.3"
Expand Down
Loading