diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2023-09-22 13:45:32 +0200 |
---|---|---|
committer | John Molakvoæ <skjnldsv@protonmail.com> | 2023-09-27 10:39:33 +0200 |
commit | 25e500bbf4c6d6071f7bb262e058479c410c890b (patch) | |
tree | a443171bc86f7674c65ce6596f59ce05ac51058b /apps/files/src/components/FileEntry.vue | |
parent | f134244c90ab4aff3fa7758f8c548ebd89c6a256 (diff) | |
download | nextcloud-server-25e500bbf4c6d6071f7bb262e058479c410c890b.tar.gz nextcloud-server-25e500bbf4c6d6071f7bb262e058479c410c890b.zip |
feat(files): properly format buttons, align mtime to the left and apply opacity based on file last modification
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/files/src/components/FileEntry.vue')
-rw-r--r-- | apps/files/src/components/FileEntry.vue | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/apps/files/src/components/FileEntry.vue b/apps/files/src/components/FileEntry.vue index 2ca02edc5b8..4fd64b89482 100644 --- a/apps/files/src/components/FileEntry.vue +++ b/apps/files/src/components/FileEntry.vue @@ -164,6 +164,7 @@ <!-- Mtime --> <td v-if="isMtimeAvailable" + :style="{ opacity: mtimeOpacity }" class="files-list__row-mtime" data-cy-files-list-row-mtime @click="openDetailsIfAvailable"> @@ -389,6 +390,24 @@ export default Vue.extend({ } return this.t('files_trashbin', 'A long time ago') }, + mtimeOpacity() { + // Whatever theme is active, the contrast will pass WCAG AA + // with color main text over main background and an opacity of 0.7 + const minOpacity = 0.7 + const maxOpacityTime = 31 * 24 * 60 * 60 * 1000 // 31 days + + const mtime = this.source.mtime?.getTime?.() + if (!mtime) { + return minOpacity + } + + // 1 = today, 0 = 31 days ago + const factor = (maxOpacityTime - (Date.now() - mtime)) / maxOpacityTime + if (factor < 0) { + return minOpacity + } + return minOpacity + (1 - minOpacity) * factor + }, mtimeTitle() { if (this.source.mtime) { return moment(this.source.mtime).format('LLL') |