Skip to content
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
4 changes: 2 additions & 2 deletions apps/files/src/components/CustomElementRender.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--
- @copyright Copyright (c) 2019 Gary Kim <[email protected]>
- @copyright Copyright (c) 2023 John Molakvoæ <[email protected]>
-
- @author Gary Kim <[email protected]>
- @author John Molakvoæ <[email protected]>
-
- @license GNU AGPL version 3 or any later version
-
Expand Down
4 changes: 2 additions & 2 deletions apps/files/src/components/CustomSvgIconRender.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--
- @copyright Copyright (c) 2019 Gary Kim <[email protected]>
- @copyright Copyright (c) 2023 John Molakvoæ <[email protected]>
-
- @author Gary Kim <[email protected]>
- @author John Molakvoæ <[email protected]>
-
- @license GNU AGPL version 3 or any later version
-
Expand Down
26 changes: 18 additions & 8 deletions apps/files/src/components/FileEntry.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--
- @copyright Copyright (c) 2019 Gary Kim <[email protected]>
- @copyright Copyright (c) 2023 John Molakvoæ <[email protected]>
-
- @author Gary Kim <[email protected]>
- @author John Molakvoæ <[email protected]>
-
- @license GNU AGPL version 3 or any later version
-
Expand Down Expand Up @@ -115,6 +115,7 @@ import NcActionButton from '@nextcloud/vue/dist/Components/NcActionButton.js'
import NcActions from '@nextcloud/vue/dist/Components/NcActions.js'
import NcCheckboxRadioSwitch from '@nextcloud/vue/dist/Components/NcCheckboxRadioSwitch.js'
import NcLoadingIcon from '@nextcloud/vue/dist/Components/NcLoadingIcon.js'
import isMobileMixin from '@nextcloud/vue/dist/Mixins/isMobile.js'
import Vue from 'vue'

import { getFileActions } from '../services/FileAction.ts'
Expand Down Expand Up @@ -146,6 +147,10 @@ export default Vue.extend({
NcLoadingIcon,
},

mixins: [
isMobileMixin,
],

props: {
active: {
type: Boolean,
Expand Down Expand Up @@ -295,13 +300,20 @@ export default Vue.extend({
},

enabledInlineActions() {
if (this.isMobile) {
return []
}
return this.enabledActions.filter(action => action?.inline?.(this.source, this.currentView))
},

enabledMenuActions() {
if (this.isMobile) {
return this.enabledActions
}

return [
...this.enabledInlineActions,
...actions.filter(action => !action.inline),
...this.enabledActions.filter(action => !action.inline),
]
},

Expand All @@ -311,10 +323,10 @@ export default Vue.extend({

openedMenu: {
get() {
return this.actionsMenuStore.opened === this
return this.actionsMenuStore.opened === this.uniqueId
},
set(opened) {
this.actionsMenuStore.opened = opened ? this : null
this.actionsMenuStore.opened = opened ? this.uniqueId : null
},
},
},
Expand Down Expand Up @@ -515,7 +527,7 @@ export default Vue.extend({

// If the clicked row is in the selection, open global menu
const isMoreThanOneSelected = this.selectedFiles.length > 1
this.actionsMenuStore.opened = this.isSelected && isMoreThanOneSelected ? 'global' : this
this.actionsMenuStore.opened = this.isSelected && isMoreThanOneSelected ? 'global' : this.uniqueId

// Prevent any browser defaults
event.preventDefault()
Expand All @@ -529,8 +541,6 @@ export default Vue.extend({
</script>

<style scoped lang='scss'>
@import '../mixins/fileslist-row.scss';

/* Hover effect on tbody lines only */
tr {
&:hover,
Expand Down
6 changes: 2 additions & 4 deletions apps/files/src/components/FilesListFooter.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--
- @copyright Copyright (c) 2019 Gary Kim <[email protected]>
- @copyright Copyright (c) 2023 John Molakvoæ <[email protected]>
-
- @author Gary Kim <[email protected]>
- @author John Molakvoæ <[email protected]>
-
- @license GNU AGPL version 3 or any later version
-
Expand Down Expand Up @@ -140,8 +140,6 @@ export default Vue.extend({
</script>

<style scoped lang="scss">
@import '../mixins/fileslist-row.scss';

// Scoped row
tr {
padding-bottom: 300px;
Expand Down
5 changes: 2 additions & 3 deletions apps/files/src/components/FilesListHeader.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--
- @copyright Copyright (c) 2019 Gary Kim <[email protected]>
- @copyright Copyright (c) 2023 John Molakvoæ <[email protected]>
-
- @author Gary Kim <[email protected]>
- @author John Molakvoæ <[email protected]>
-
- @license GNU AGPL version 3 or any later version
-
Expand Down Expand Up @@ -207,7 +207,6 @@ export default Vue.extend({
</script>

<style scoped lang="scss">
@import '../mixins/fileslist-row.scss';
.files-list__column {
user-select: none;
// Make sure the cell colors don't apply to column headers
Expand Down
24 changes: 20 additions & 4 deletions apps/files/src/components/FilesListHeaderActions.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--
- @copyright Copyright (c) 2019 Gary Kim <[email protected]>
- @copyright Copyright (c) 2023 John Molakvoæ <[email protected]>
-
- @author Gary Kim <[email protected]>
- @author John Molakvoæ <[email protected]>
-
- @license GNU AGPL version 3 or any later version
-
Expand All @@ -24,7 +24,8 @@
<NcActions ref="actionsMenu"
:disabled="!!loading || areSomeNodesLoading"
:force-title="true"
:inline="3"
:inline="inlineActions"
:menu-title="inlineActions === 0 ? t('files', 'Actions') : null"
:open.sync="openedMenu">
<NcActionButton v-for="action in enabledActions"
:key="action.id"
Expand All @@ -43,15 +44,16 @@
<script lang="ts">
import { showError, showSuccess } from '@nextcloud/dialogs'
import { translate } from '@nextcloud/l10n'
import NcActions from '@nextcloud/vue/dist/Components/NcActions.js'
import NcActionButton from '@nextcloud/vue/dist/Components/NcActionButton.js'
import NcActions from '@nextcloud/vue/dist/Components/NcActions.js'
import NcLoadingIcon from '@nextcloud/vue/dist/Components/NcLoadingIcon.js'
import Vue from 'vue'

import { getFileActions } from '../services/FileAction.ts'
import { useActionsMenuStore } from '../store/actionsmenu.ts'
import { useFilesStore } from '../store/files.ts'
import { useSelectionStore } from '../store/selection.ts'
import clientWidthMixin from '../mixins/clientWidth.ts'
import CustomSvgIconRender from './CustomSvgIconRender.vue'
import logger from '../logger.js'

Expand All @@ -68,6 +70,10 @@ export default Vue.extend({
NcLoadingIcon,
},

mixins: [
clientWidthMixin,
],

props: {
currentView: {
type: Object,
Expand Down Expand Up @@ -122,6 +128,16 @@ export default Vue.extend({
this.actionsMenuStore.opened = opened ? 'global' : null
},
},

inlineActions() {
if (this.clientWidth < 480) {
return 1
}
if (this.clientWidth < 768) {
return 2
}
Comment on lines +133 to +138
Copy link
Contributor

Choose a reason for hiding this comment

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

How is this behaving with the sidebar opened ?
Could we use the container width instead of the client's width?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, would it make sense to have the hiding logic inside nc/vue instead of here?

Copy link
Member Author

Choose a reason for hiding this comment

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

I used the values files had before.
It's fair to raise the question a bit more widely I think yes :)

When you say sidebar, you mean navigation or sidebar? (because I've seen it being used for both)

  • If Navigation, the sidebar is floating on mobile, so it doesn't affect the main view which takes 100%
  • If you say Sidebar (right), the Sidebar takes the full width on mobile, but we should definitely change those values if the sidebar is opened (see the video below)
Peek.12-04-2023.17-46.mp4

Copy link
Member Author

Choose a reason for hiding this comment

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

I would merge this and improve the sidebar after raising the topic in another PR? :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Contributor

@artonge artonge Apr 12, 2023

Choose a reason for hiding this comment

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

Yes, I meant the right Sidebar. I am asking for the number of displayed actions. The sidebar reduce the width of the container, but the logic is based on the width of the client window, so it might not work as expected.

My advice would be to use a resize observer on the list container instead of the resize event on the window.
https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver

Copy link
Contributor

Choose a reason for hiding this comment

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

As you which, the current behavior is still better than nothing ;)

Copy link
Member Author

@skjnldsv skjnldsv Apr 12, 2023

Choose a reason for hiding this comment

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

After looking around, WOW, you're 100% right Louis, we can do better 👍
I will prepare an issue with RFC and screenshots,

Copy link
Member Author

Choose a reason for hiding this comment

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

return 3
},
},

methods: {
Expand Down
4 changes: 2 additions & 2 deletions apps/files/src/components/FilesListHeaderButton.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--
- @copyright Copyright (c) 2019 Gary Kim <[email protected]>
- @copyright Copyright (c) 2023 John Molakvoæ <[email protected]>
-
- @author Gary Kim <[email protected]>
- @author John Molakvoæ <[email protected]>
-
- @license GNU AGPL version 3 or any later version
-
Expand Down
Loading