From f330813ff01e321a9e39822b183c49805bff16a5 Mon Sep 17 00:00:00 2001
From: John Molakvoæ <skjnldsv@protonmail.com>
Date: Wed, 22 Mar 2023 11:45:59 +0100
Subject: feat(files): custom columns
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
---
 apps/files/src/components/FilesListHeader.vue | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

(limited to 'apps/files/src/components/FilesListHeader.vue')

diff --git a/apps/files/src/components/FilesListHeader.vue b/apps/files/src/components/FilesListHeader.vue
index b09feae04f2..81b56331f9c 100644
--- a/apps/files/src/components/FilesListHeader.vue
+++ b/apps/files/src/components/FilesListHeader.vue
@@ -40,6 +40,13 @@
 
 		<!-- Actions -->
 		<th class="files-list__row-actions" />
+
+		<!-- Custom views columns -->
+		<th v-for="column in columns"
+			:key="column.id"
+			:class="`files-list__row-column--custom files-list__row-${currentView.id}-${column.id}`">
+			{{ column.title }}
+		</th>
 	</tr>
 </template>
 
@@ -56,6 +63,7 @@ import { useFilesStore } from '../store/files'
 import { useSelectionStore } from '../store/selection'
 import { useSortingStore } from '../store/sorting'
 import logger from '../logger.js'
+import Navigation from '../services/Navigation'
 
 export default Vue.extend({
 	name: 'FilesListHeader',
@@ -87,6 +95,15 @@ export default Vue.extend({
 	computed: {
 		...mapState(useSortingStore, ['defaultFileSorting', 'defaultFileSortingDirection']),
 
+		/** @return {Navigation} */
+		currentView() {
+			return this.$navigation.active
+		},
+
+		columns() {
+			return this.currentView?.columns || []
+		},
+
 		dir() {
 			// Remove any trailing slash but leave root slash
 			return (this.$route?.query?.dir || '/').replace(/^(.+)\/$/, '$1')
-- 
cgit v1.2.3

