Skip to content

Commit

Permalink
Update PoC
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalwengerter committed Dec 28, 2022
1 parent fff34d0 commit f25e7af
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 21 deletions.
7 changes: 7 additions & 0 deletions changelog/unreleased/enhancement-tiles-view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Enhancement: Add tiles view for resource display

We've added a switch to change from the known resource table to a tiles view.
The change gets saved to the route and persisted across resource navigation.

https://github.com/owncloud/web/pull/7991
https://github.com/owncloud/web/issues/6378
6 changes: 5 additions & 1 deletion packages/web-app-files/src/components/AppBar/AppBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,11 @@ export default defineComponent({
if (!this.displayViewModeSwitch) {
return []
}
return [ViewModeConstants.condensedTable, ViewModeConstants.default]
return [
ViewModeConstants.tilesView,
ViewModeConstants.condensedTable,
ViewModeConstants.default
]
}
},
mounted() {
Expand Down
45 changes: 26 additions & 19 deletions packages/web-app-files/src/components/FilesList/ResourceTable.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<template>
<oc-table
<component
:is="displayMode"
:class="[
hoverableQuickActions && 'hoverable-quick-actions',
{ condensed: viewMode === ViewModeConstants.condensedTable.name }
Expand Down Expand Up @@ -192,40 +193,40 @@
<!-- @slot Footer of the files table -->
<slot name="footer" />
</template>
</oc-table>
</component>
</template>

<script lang="ts">
import { eventBus } from 'web-pkg/src/services/eventBus'
import maxSize from 'popper-max-size-modifier'
import { basename, dirname } from 'path'
import { defineComponent, PropType, computed } from 'vue'
import { mapGetters, mapActions, mapState } from 'vuex'
import { EVENT_TROW_MOUNTED, EVENT_FILE_DROPPED } from '../../constants'
import { SortDir } from '../../composables'
import { determineSortFields } from '../../helpers/ui/resourceTable'
import { useWindowSize } from '@vueuse/core'
import { Resource } from 'web-client'
import { buildShareSpaceResource, extractDomSelector, SpaceResource } from 'web-client/src/helpers'
import { ShareTypes } from 'web-client/src/helpers/share'
import {
useCapabilityFilesTags,
useCapabilityProjectSpacesEnabled,
useCapabilityShareJailEnabled,
useStore,
useUserContext
} from 'web-pkg/src/composables'
import { ViewModeConstants } from 'web-app-files/src/composables/viewMode'
import { configurationManager } from 'web-pkg/src/configuration'
import { formatDateFromJSDate, formatRelativeDateFromJSDate } from 'web-pkg/src/helpers'
import { createFileRouteOptions } from 'web-pkg/src/helpers/router'
import { eventBus } from 'web-pkg/src/services/eventBus'
import Rename from '../../mixins/actions/rename'
import { defineComponent, PropType, computed } from 'vue'
import { Resource } from 'web-client'
import { EVENT_TROW_MOUNTED, EVENT_FILE_DROPPED } from '../../constants'
import { SortDir, ViewModeConstants } from '../../composables'
import { SideBarEventTopics } from '../../composables/sideBar'
import { ClipboardActions } from '../../helpers/clipboardActions'
import { CreateTargetRouteOptions } from '../../helpers/folderLink'
import { isResourceTxtFileAlmostEmpty } from '../../helpers/resources'
import { ShareTypes } from 'web-client/src/helpers/share'
import { determineSortFields } from '../../helpers/ui/resourceTable'
import Rename from '../../mixins/actions/rename'
import { createLocationSpaces, createLocationShares, createLocationCommon } from '../../router'
import { formatDateFromJSDate, formatRelativeDateFromJSDate } from 'web-pkg/src/helpers'
import { SideBarEventTopics } from '../../composables/sideBar'
import { buildShareSpaceResource, extractDomSelector, SpaceResource } from 'web-client/src/helpers'
import { configurationManager } from 'web-pkg/src/configuration'
import { CreateTargetRouteOptions } from '../../helpers/folderLink'
import { createFileRouteOptions } from 'web-pkg/src/helpers/router'
import { basename, dirname } from 'path'
import { useWindowSize } from '@vueuse/core'
const TAGS_MINIMUM_SCREEN_WIDTH = 850
Expand Down Expand Up @@ -434,6 +435,12 @@ export default defineComponent({
'clipboardAction'
]),
...mapState('runtime/spaces', ['spaces']),
displayMode() {
if (this.viewMode === 'resource-tiles') {
return 'oc-tiles'
}
return 'oc-table'
},
popperOptions() {
return {
modifiers: [
Expand Down
8 changes: 8 additions & 0 deletions packages/web-app-files/src/composables/viewMode/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,13 @@ export abstract class ViewModeConstants {
fillType: 'none'
}
}
static readonly tilesView: ViewMode = {
name: 'resource-tiles',
label: $gettext('Switch to tiles view'),
icon: {
name: 'apps-2',
fillType: 'line'
}
}
static readonly queryName: string = 'view-mode'
}
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ exports[`AppBar component renders viewoptions and sidebartoggle passes viewModes
<!---->
<!---->
<div class="oc-flex">
<view-options-stub viewmodes="[object Object],[object Object]"></view-options-stub>
<view-options-stub viewmodes="[object Object],[object Object],[object Object]"></view-options-stub>
<sidebar-toggle-stub></sidebar-toggle-stub>
</div>
</div>
Expand Down

0 comments on commit f25e7af

Please sign in to comment.