aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/src
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files/src')
-rw-r--r--apps/files/src/components/FileEntry/FileEntryPreview.vue14
-rw-r--r--apps/files/src/components/FilesListVirtual.vue16
-rw-r--r--apps/files/src/init.ts8
-rw-r--r--apps/files/src/services/LivePhotos.ts33
-rw-r--r--apps/files/src/views/FilesList.vue5
5 files changed, 72 insertions, 4 deletions
diff --git a/apps/files/src/components/FileEntry/FileEntryPreview.vue b/apps/files/src/components/FileEntry/FileEntryPreview.vue
index cb7cee7054b..147b25e1c9a 100644
--- a/apps/files/src/components/FileEntry/FileEntryPreview.vue
+++ b/apps/files/src/components/FileEntry/FileEntryPreview.vue
@@ -50,6 +50,10 @@
:aria-label="t('files', 'Favorite')">
<FavoriteIcon v-once />
</span>
+
+ <OverlayIcon :is="fileOverlay"
+ v-if="fileOverlay"
+ class="files-list__row-icon-overlay" />
</span>
</template>
@@ -71,9 +75,11 @@ import KeyIcon from 'vue-material-design-icons/Key.vue'
import LinkIcon from 'vue-material-design-icons/Link.vue'
import NetworkIcon from 'vue-material-design-icons/Network.vue'
import TagIcon from 'vue-material-design-icons/Tag.vue'
+import PlayCircleIcon from 'vue-material-design-icons/PlayCircle.vue'
import { useUserConfigStore } from '../../store/userconfig.ts'
import FavoriteIcon from './FavoriteIcon.vue'
+import { isLivePhoto } from '../../services/LivePhotos'
export default Vue.extend({
name: 'FileEntryPreview',
@@ -163,6 +169,14 @@ export default Vue.extend({
}
},
+ fileOverlay() {
+ if (isLivePhoto(this.source)) {
+ return PlayCircleIcon
+ }
+
+ return null
+ },
+
folderOverlay() {
if (this.source.type !== FileType.Folder) {
return null
diff --git a/apps/files/src/components/FilesListVirtual.vue b/apps/files/src/components/FilesListVirtual.vue
index 7ada3e705ee..010e55a87e7 100644
--- a/apps/files/src/components/FilesListVirtual.vue
+++ b/apps/files/src/components/FilesListVirtual.vue
@@ -510,14 +510,26 @@ export default Vue.extend({
right: -10px;
}
- // Folder overlay
+ // File and folder overlay
&-overlay {
position: absolute;
max-height: calc(var(--icon-preview-size) * 0.5);
max-width: calc(var(--icon-preview-size) * 0.5);
- color: var(--color-main-background);
+ color: var(--color-main-text);
// better alignment with the folder icon
margin-top: 2px;
+
+ svg {
+ border-radius: 100%;
+
+ // Sow a border around the icon for better contrast
+ path {
+ stroke: var(--color-main-background);
+ stroke-width: 8px;
+ stroke-linejoin: round;
+ paint-order: stroke;
+ }
+ }
}
}
diff --git a/apps/files/src/init.ts b/apps/files/src/init.ts
index 430b17ae7ae..aa855ed69b2 100644
--- a/apps/files/src/init.ts
+++ b/apps/files/src/init.ts
@@ -20,7 +20,7 @@
*
*/
import MenuIcon from '@mdi/svg/svg/sun-compass.svg?raw'
-import { FileAction, addNewFileMenuEntry, registerFileAction } from '@nextcloud/files'
+import { FileAction, addNewFileMenuEntry, registerDavProperty, registerFileAction } from '@nextcloud/files'
import { action as deleteAction } from './actions/deleteAction'
import { action as downloadAction } from './actions/downloadAction'
@@ -41,6 +41,8 @@ import registerPreviewServiceWorker from './services/ServiceWorker.js'
import './init-templates'
+import { initLivePhotos } from './services/LivePhotos'
+
// Register file actions
registerFileAction(deleteAction)
registerFileAction(downloadAction)
@@ -63,3 +65,7 @@ registerRecentView()
// Register preview service worker
registerPreviewServiceWorker()
+
+registerDavProperty('nc:hidden', { nc: 'http://nextcloud.org/ns' })
+
+initLivePhotos()
diff --git a/apps/files/src/services/LivePhotos.ts b/apps/files/src/services/LivePhotos.ts
new file mode 100644
index 00000000000..ce333f31b0a
--- /dev/null
+++ b/apps/files/src/services/LivePhotos.ts
@@ -0,0 +1,33 @@
+/**
+ * @copyright Copyright (c) 2023 Louis Chmn <louis@chmn.me>
+ *
+ * @author Louis Chmn <louis@chmn.me>
+ *
+ * @license AGPL-3.0-or-later
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+import { Node, registerDavProperty } from '@nextcloud/files'
+
+export function initLivePhotos(): void {
+ registerDavProperty('nc:metadata-files-live-photo', { nc: 'http://nextcloud.org/ns' })
+}
+
+/**
+ * @param {Node} node - The node
+ */
+export function isLivePhoto(node: Node): boolean {
+ return node.attributes['metadata-files-live-photo'] !== undefined
+}
diff --git a/apps/files/src/views/FilesList.vue b/apps/files/src/views/FilesList.vue
index 89ce6aeb7b0..3bc4f27c2a2 100644
--- a/apps/files/src/views/FilesList.vue
+++ b/apps/files/src/views/FilesList.vue
@@ -256,7 +256,10 @@ export default Vue.extend({
},
dirContents(): Node[] {
- return (this.currentFolder?._children || []).map(this.getNode).filter(file => file)
+ return (this.currentFolder?._children || [])
+ .map(this.getNode)
+ .filter(file => file)
+ .filter(file => file?.attributes?.hidden !== true)
},
/**