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

Use more applicable icon for 'Open sidebar' #142

Merged
merged 1 commit into from
Jun 22, 2019
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 cypress/integration/image-small.png.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe('Open image-small.png in viewer', function() {

it('See the share and menu icons and title on the viewer header', function() {
cy.get('#viewer-content .modal-title').should('contain', 'image-small.png')
cy.get('#viewer-content .modal-header button.icon-share-white-forced').should('be.visible')
cy.get('#viewer-content .modal-header button.icon-menu-sidebar-white-forced').should('be.visible')
cy.get('#viewer-content .modal-header button.icon-close').should('be.visible')
})

Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/image.gif.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ describe('Open image.gif in viewer', function() {

it('See the share and menu icons and title on the viewer header', function() {
cy.get('#viewer-content .modal-title').should('contain', 'image.gif')
cy.get('#viewer-content .modal-header button.icon-share-white-forced').should('be.visible')
cy.get('#viewer-content .modal-header button.icon-menu-sidebar-white-forced').should('be.visible')
cy.get('#viewer-content .modal-header button.icon-close').should('be.visible')
})

Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/image.png.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe('Open image.png in viewer', function() {

// it('See the share and menu icons and title on the viewer header', function() {
// cy.get('#viewer-content .modal-title').should('contain', 'image.png')
// cy.get('#viewer-content .modal-header button.icon-share-white-forced').should('be.visible')
// cy.get('#viewer-content .modal-header button.icon-menu-sidebar-white-forced').should('be.visible')
// cy.get('#viewer-content .modal-header button.icon-close').should('be.visible')
// })

Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/image.svg.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ describe('Open image.svg in viewer', function() {

it('See the share and menu icons and title on the viewer header', function() {
cy.get('#viewer-content .modal-title').should('contain', 'image.svg')
cy.get('#viewer-content .modal-header button.icon-share-white-forced').should('be.visible')
cy.get('#viewer-content .modal-header button.icon-menu-sidebar-white-forced').should('be.visible')
cy.get('#viewer-content .modal-header button.icon-close').should('be.visible')
})

Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/images.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ describe('Open images in viewer', function() {

it('See the share and menu icons and title on the viewer header', function() {
cy.get('#viewer-content .modal-title').should('contain', 'image1.jpg')
cy.get('#viewer-content .modal-header button.icon-share-white-forced').should('be.visible')
cy.get('#viewer-content .modal-header button.icon-menu-sidebar-white-forced').should('be.visible')
cy.get('#viewer-content .modal-header button.icon-close').should('be.visible')
})

Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/video.mkv.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe('Open video.mkv in viewer', function() {

it('See the share and menu icons and title on the viewer header', function() {
cy.get('#viewer-content .modal-title').should('contain', 'video.mkv')
cy.get('#viewer-content .modal-header button.icon-share-white-forced').should('be.visible')
cy.get('#viewer-content .modal-header button.icon-menu-sidebar-white-forced').should('be.visible')
cy.get('#viewer-content .modal-header button.icon-close').should('be.visible')
})

Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/video.mp4.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe('Open video1.mp4 in viewer', function() {

it('See the share and menu icons and title on the viewer header', function() {
cy.get('#viewer-content .modal-title').should('contain', 'video1.mp4')
cy.get('#viewer-content .modal-header button.icon-share-white-forced').should('be.visible')
cy.get('#viewer-content .modal-header button.icon-menu-sidebar-white-forced').should('be.visible')
cy.get('#viewer-content .modal-header button.icon-close').should('be.visible')
})

Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/video.ogv.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe('Open video.ogv in viewer', function() {

it('See the share and menu icons and title on the viewer header', function() {
cy.get('#viewer-content .modal-title').should('contain', 'video.ogv')
cy.get('#viewer-content .modal-header button.icon-share-white-forced').should('be.visible')
cy.get('#viewer-content .modal-header button.icon-menu-sidebar-white-forced').should('be.visible')
cy.get('#viewer-content .modal-header button.icon-close').should('be.visible')
})

Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/video.webm.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe('Open video.webm in viewer', function() {

it('See the share and menu icons and title on the viewer header', function() {
cy.get('#viewer-content .modal-title').should('contain', 'video.webm')
cy.get('#viewer-content .modal-header button.icon-share-white-forced').should('be.visible')
cy.get('#viewer-content .modal-header button.icon-menu-sidebar-white-forced').should('be.visible')
cy.get('#viewer-content .modal-header button.icon-close').should('be.visible')
})

Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/videos.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe('Open mp4 videos in viewer', function() {

it('See the share and menu icons and title on the viewer header', function() {
cy.get('#viewer-content .modal-title').should('contain', 'video1.mp4')
cy.get('#viewer-content .modal-header button.icon-share-white-forced').should('be.visible')
cy.get('#viewer-content .modal-header button.icon-menu-sidebar-white-forced').should('be.visible')
cy.get('#viewer-content .modal-header button.icon-close').should('be.visible')
})

Expand Down
22 changes: 11 additions & 11 deletions js/viewer.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/viewer.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/assets/menu-sidebar-white.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion src/assets/share-white.svg

This file was deleted.

25 changes: 12 additions & 13 deletions src/views/Viewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,16 @@
:title="currentFile.name"
:enable-swipe="canSwipe"
:size="isMobile || isFullscreen ? 'full' : 'large'"
:style="{width: showSidebar ? `calc(100% - ${sidebarWidth}px)` : null}"
:style="{width: shownSidebar ? `calc(100% - ${sidebarWidth}px)` : null}"
@close="close"
@previous="previous"
@next="next">
<!-- ACTIONS -->
<template #actions>
<ActionButton
v-if="OCA.Sharing"
icon="icon-share-white-forced"
@click="showSharingSidebar">
{{ t('viewer', 'Share') }}
icon="icon-menu-sidebar-white-forced"
@click="showSidebar">
{{ t('viewer', 'Open sidebar') }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not only opening the sidebar, this is opening the sharing section of the sidebar.
Therefore if sharing is disabled, this button will be hidden. The showSharingSidebar needs to be updated accordingly alongside the v-if="OCA.Sharing" :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For all intents and purposes, this button is the only one in Viewer which opens the sidebar. :) So that’s what it should be called.

Therefore if sharing is disabled, this button will be hidden.

And then there’s also no way to open the sidebar from the viewer, right?

Therefore I think we should merge this and move any further updates to the menu implementation PR → #15

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, that would leave the current state of the viewer in a not optimal one. :)
Please take the time to adjust this pr instead!

#15 is much more work

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh ok. of course it should also be possible to open the sidebar even if sharing is disabled.

Copy link
Member Author

@jancborchardt jancborchardt Jun 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, that would leave the current state of the viewer in a not optimal one. :)

I don’t understand how, because:

  • If Sharing is enabled, the button is shown and it does open the sidebar.
  • If Sharing is not enabled, the icon/button is not shown.

So what about that is not optimal, or less optimal than now?

If it should be changed to not rely on Sharing I would love to do that but need to know how. :) (But even then I don’t understand how that is part of this purely cosmetic change.)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yes, you're right.
My point was that now that we tell the user that the button open the sidebar, s.he might get confused when the button disappear if sharing is disabled. Because there is still other stuff you can do in the sidebar :)

</ActionButton>
</template>

Expand Down Expand Up @@ -82,7 +81,7 @@
:loaded.sync="currentFile.loaded"
:mime="currentFile.mime"
:path="getPreviewIfAny(currentFile)"
:sidebar-shown="showSidebar"
:sidebar-shown="shownSidebar"
class="file-view active"
@error="currentFailed" />
<Error
Expand Down Expand Up @@ -151,7 +150,7 @@ export default {

isLoaded: false,

showSidebar: false,
shownSidebar: false,
sidebarWidth: 0,

canSwipe: true,
Expand Down Expand Up @@ -439,14 +438,14 @@ export default {
* Show the sharing sidebar
*/

showSharingSidebar() {
showSidebar() {
// Open the sidebar sharing tab
OCA.Files.App.fileList.showDetailsView(this.currentFile.name, 'shareTabView')
OCA.Files.App.fileList.showDetailsView(this.currentFile.name)
this.showAppsSidebar()
},

showAppsSidebar() {
this.showSidebar = true
this.shownSidebar = true
const sidebar = document.getElementById('app-sidebar')
if (sidebar) {
sidebar.classList.add('app-sidebar--full')
Expand All @@ -463,7 +462,7 @@ export default {
},

hideAppsSidebar() {
this.showSidebar = false
this.shownSidebar = false
const sidebar = document.getElementById('app-sidebar')
if (sidebar) {
sidebar.classList.remove('app-sidebar--full')
Expand Down Expand Up @@ -516,8 +515,8 @@ export default {
}

// force white icon
.icon-share-white-forced {
background-image: url('~Assets/share-white.svg');
.icon-menu-sidebar-white-forced {
background-image: url('~Assets/menu-sidebar-white.svg');
}

.file-view {
Expand Down