Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable30] feat: add footer to file list #4021

Merged
merged 1 commit into from
Nov 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
73 changes: 73 additions & 0 deletions src/views/FilesList/FilesListTableFooter.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<!--
- SPDX-FileCopyrightText: 2024 LibreCode coop and LibreCode contributors
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
<template>
<tr v-show="haveFiles">
<th class="files-list__row-checkbox">
<!-- TRANSLATORS Label for a table footer which summarizes the columns of the table -->
<span class="hidden-visually">{{ t('libresign', 'Total rows summary') }}</span>
</th>

<!-- Link to file -->
<td class="files-list__row-name">
<!-- Icon or preview -->
<span class="files-list__row-icon" />

<!-- Summary -->
<span>{{ summary }}</span>
</td>

<!-- Actions -->
<td class="files-list__row-actions" />
</tr>
</template>

<script>
import { useFilesStore } from '../../store/files.js'

export default {
name: 'FilesListTableFooter',
setup() {
const filesStore = useFilesStore()
return {
filesStore,
}
},
computed: {
totalFiles() {
return Object.keys(this.filesStore.files).length
},
summary() {
const fileCount = this.totalFiles
if (fileCount === 1) {
return t('libresign', '1 file')
}
return t('libresign', '{fileCount} files', { fileCount })
},
haveFiles() {
const fileCount = this.totalFiles
if (this.filesStore.loading) {
return false
}
return fileCount > 0
},
},
}
</script>

<style scoped lang="scss">
tr {
margin-bottom: max(25vh, var(--body-container-margin));
border-top: 1px solid var(--color-border);
// Prevent hover effect on the whole row
background-color: transparent !important;
border-bottom: none !important;

td {
user-select: none;
// Make sure the cell colors don't apply to column headers
color: var(--color-text-maxcontrast) !important;
}
}
</style>
5 changes: 5 additions & 0 deletions src/views/FilesList/FilesListVirtual.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@
<FilesListTableHeader ref="thead"
:nodes="nodes" />
</template>
<template #footer>
<FilesListTableFooter />
</template>
</VirtualList>
</template>

<script>
import FileEntry from './FileEntry/FileEntry.vue'
import FileEntryGrid from './FileEntry/FileEntryGrid.vue'
import FileListFilters from './FileListFilters.vue'
import FilesListTableFooter from './FilesListTableFooter.vue'
import FilesListTableHeader from './FilesListTableHeader.vue'
import VirtualList from './VirtualList.vue'

Expand All @@ -32,6 +36,7 @@ export default {
VirtualList,
FileListFilters,
FilesListTableHeader,
FilesListTableFooter,
// eslint-disable-next-line vue/no-unused-components
FileEntry,
// eslint-disable-next-line vue/no-unused-components
Expand Down
6 changes: 5 additions & 1 deletion src/views/FilesList/VirtualList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@
:source="item"
:loading="loading" />
</tbody>
<tfoot ref="endOfList" />
<tfoot ref="endOfList"
class="files-list__tfoot"
data-cy-files-list-tfoot>
<slot name="footer" />
</tfoot>
</table>
</div>
</template>
Expand Down