Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Display play icon over live photos' previews
Signed-off-by: Louis Chemineau <[email protected]>
  • Loading branch information
artonge committed Nov 9, 2023
commit b180ca9d47176bf487bc0ae26ffcba688a2cbd55
14 changes: 14 additions & 0 deletions apps/files/src/components/FileEntry/FileEntryPreview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand All @@ -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',
Expand Down Expand Up @@ -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
Expand Down
16 changes: 14 additions & 2 deletions apps/files/src/components/FilesListVirtual.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion apps/files/src/services/LivePhotos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ export function initLivePhotos(): void {
* @param {Node} node - The node
*/
export function isLivePhoto(node: Node): boolean {
return node.attributes['metadata-files-live-photo'] !== null
return node.attributes['metadata-files-live-photo'] !== undefined
}