Skip to content

Commit fe3eed5

Browse files
committed
Improve appearance of the list view footer
1 parent a334145 commit fe3eed5

File tree

6 files changed

+52
-4
lines changed

6 files changed

+52
-4
lines changed

com.woltlab.wcf/templates/shared_listView.tpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@
5454
</div>
5555
</div>
5656

57-
<div class="listView__footer">
57+
<div class="listView__footer" id="{$view->getID()}_footer">
5858
{if $view->hasBulkInteractions()}
5959
<div id="{$view->getID()}_selectionBar" class="listView__selectionBar dropdown" hidden>
60-
<button type="button" id="{$view->getID()}_bulkInteractionButton" class="button listView__bulkInteractionButton dropdownToggle"></button>
60+
<button type="button" id="{$view->getID()}_bulkInteractionButton" class="button small listView__bulkInteractionButton dropdownToggle"></button>
6161
<ul class="dropdownMenu">
6262
<li class="disabled"><span>{lang}wcf.global.loading{/lang}</span></li>
6363
<li class="dropdownDivider"></li>

ts/WoltLabSuite/Core/Component/ListView/Selection.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@ export class Selection extends EventTarget {
168168
return;
169169
}
170170

171+
this.dispatchEvent(new CustomEvent("list-view:update-selection"));
172+
171173
if (selectedIds.length === 0) {
172174
this.#selectionBar.hidden = true;
173175
return;
@@ -284,6 +286,7 @@ export class Selection extends EventTarget {
284286

285287
interface SelectionEventMap {
286288
"list-view:get-bulk-interactions": CustomEvent<{ objectIds: number[] }>;
289+
"list-view:update-selection": CustomEvent<void>;
287290
}
288291

289292
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging

ts/WoltLabSuite/Core/Component/ListView/State.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export class State extends EventTarget {
2424
readonly #pagination: WoltlabCorePaginationElement;
2525
readonly #selection: Selection;
2626
readonly #sorting: Sorting;
27+
readonly #listViewFooter: HTMLElement;
2728
#pageNo: number;
2829

2930
constructor(
@@ -39,6 +40,8 @@ export class State extends EventTarget {
3940
this.#baseUrl = baseUrl;
4041
this.#pageNo = pageNo;
4142

43+
this.#listViewFooter = document.getElementById(`${viewId}_footer`) as HTMLElement;
44+
4245
this.#pagination = document.getElementById(`${viewId}_pagination`) as WoltlabCorePaginationElement;
4346
this.#pagination.addEventListener("switchPage", (event: CustomEvent) => {
4447
void this.#switchPage(event.detail, StateChangeCause.Pagination);
@@ -60,12 +63,16 @@ export class State extends EventTarget {
6063
new CustomEvent("list-view:get-bulk-interactions", { detail: { objectIds: event.detail.objectIds } }),
6164
);
6265
});
66+
this.#selection.addEventListener("list-view:update-selection", () => {
67+
this.#updateListViewFooter();
68+
});
6369

6470
window.addEventListener("popstate", () => {
6571
this.#handlePopState();
6672
});
6773

6874
this.#updatePaginationUrl();
75+
this.#updateListViewFooter();
6976
}
7077

7178
getPageNo(): number {
@@ -97,6 +104,8 @@ export class State extends EventTarget {
97104
if (cause === StateChangeCause.Change || cause === StateChangeCause.Pagination) {
98105
this.#updateQueryString();
99106
}
107+
108+
this.#updateListViewFooter();
100109
}
101110

102111
#switchPage(pageNo: number, source: StateChangeCause): void {
@@ -176,6 +185,10 @@ export class State extends EventTarget {
176185
this.#switchPage(pageNo, StateChangeCause.History);
177186
}
178187

188+
#updateListViewFooter(): void {
189+
this.#listViewFooter.hidden = this.#pagination.count === 0 && this.#selection.getSelectedIds().length === 0;
190+
}
191+
179192
setBulkInteractionContextMenuOptions(options: string): void {
180193
this.#selection.setBulkInteractionContextMenuOptions(options);
181194
}

wcfsetup/install/files/js/WoltLabSuite/Core/Component/ListView/Selection.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

wcfsetup/install/files/js/WoltLabSuite/Core/Component/ListView/State.js

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

wcfsetup/install/files/style/ui/listView.scss

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,38 @@
3636
}
3737

3838
.listView__footer {
39+
align-items: center;
3940
background-color: var(--wcfContentContainerBackground);
4041
bottom: 0;
4142
display: flex;
4243
gap: 10px;
44+
margin-top: 20px;
45+
min-height: 54px;
46+
padding-top: 10px;
47+
padding-bottom: 10px;
4348
position: sticky;
4449
z-index: 2;
4550
}
4651

52+
@include screen-sm-down {
53+
.listView__footer {
54+
margin-left: -10px;
55+
margin-right: -10px;
56+
padding-left: 10px;
57+
padding-right: 10px;
58+
}
59+
}
60+
61+
@include screen-md-up {
62+
.listView__footer {
63+
margin-left: -20px;
64+
margin-right: -20px;
65+
padding-left: 20px;
66+
padding-right: 20px;
67+
}
68+
}
69+
4770
.listView__pagination {
48-
margin-top: 10px;
49-
margin-bottom: 10px;
5071
margin-inline-start: auto;
5172
}
5273

0 commit comments

Comments
 (0)