Skip to content

Commit 5e4a608

Browse files
committed
Make use of the new snackbar notifications
1 parent aae64af commit 5e4a608

File tree

68 files changed

+155
-178
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+155
-178
lines changed

ts/WoltLabSuite/Core/Acp/Component/Cache/Clear.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
import { prepareRequest } from "WoltLabSuite/Core/Ajax/Backend";
1111
import { confirmationFactory } from "WoltLabSuite/Core/Component/Confirmation";
12+
import { showDefaultSuccessSnackbar } from "WoltLabSuite/Core/Component/Snackbar";
1213
import { getPhrase } from "WoltLabSuite/Core/Language";
13-
import * as UiNotification from "WoltLabSuite/Core/Ui/Notification";
1414

1515
function initButton(button: HTMLButtonElement): void {
1616
button.addEventListener("click", () => {
@@ -22,7 +22,7 @@ async function clearCache(endpoint: string): Promise<void> {
2222
const result = await confirmationFactory().custom(getPhrase("wcf.acp.cache.clear.sure")).withoutMessage();
2323
if (result) {
2424
await prepareRequest(endpoint).post().fetchAsResponse();
25-
UiNotification.show();
25+
showDefaultSuccessSnackbar();
2626
}
2727
}
2828

ts/WoltLabSuite/Core/Acp/Controller/Dashboard/Configure.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
*/
99

1010
import { dialogFactory } from "WoltLabSuite/Core/Component/Dialog";
11+
import { showDefaultSuccessSnackbar } from "WoltLabSuite/Core/Component/Snackbar";
1112
import { promiseMutex } from "WoltLabSuite/Core/Helper/PromiseMutex";
12-
import { show as showNotification } from "WoltLabSuite/Core/Ui/Notification";
1313

1414
async function showDialog(url: string): Promise<void> {
1515
const { ok } = await dialogFactory().usingFormBuilder().fromEndpoint<Response>(url);
1616

1717
if (ok) {
18-
showNotification(undefined, () => {
18+
showDefaultSuccessSnackbar().addEventListener("snackbar:close", () => {
1919
window.location.reload();
2020
});
2121
}

ts/WoltLabSuite/Core/Acp/Controller/User/List.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
import * as EventHandler from "../../../Event/Handler";
1010
import { ClipboardActionData } from "WoltLabSuite/Core/Controller/Clipboard/Data";
1111
import { dboAction } from "WoltLabSuite/Core/Ajax";
12-
import { show as showNotification } from "WoltLabSuite/Core/Ui/Notification";
1312
import UiDropdownSimple from "WoltLabSuite/Core/Ui/Dropdown/Simple";
1413
import BanHandler from "WoltLabSuite/Core/Acp/Ui/User/Action/Handler/Ban";
1514
import SendNewPassword from "WoltLabSuite/Core/Acp/Ui/User/Action/Handler/SendNewPassword";
1615
import { setup as setupClipboard, unmark as unmarkClipboard } from "WoltLabSuite/Core/Controller/Clipboard";
1716
import AcpUiUserList from "WoltLabSuite/Core/Acp/Ui/User/Editor";
1817
import { AcpUserContentRemoveClipboard } from "WoltLabSuite/Core/Acp/Ui/User/Content/Remove/Clipboard";
18+
import { showDefaultSuccessSnackbar } from "WoltLabSuite/Core/Component/Snackbar";
1919

2020
function getUserElements(userIDs: number[]): HTMLElement[] {
2121
return Array.from(document.querySelectorAll<HTMLElement>(".jsUserRow")).filter((userRow) =>
@@ -32,7 +32,7 @@ function getDropdownMenu(userRow: HTMLElement): HTMLElement {
3232
function refresh(userIDs: number[]) {
3333
unmarkClipboard("com.woltlab.wcf.user", userIDs);
3434

35-
showNotification();
35+
showDefaultSuccessSnackbar();
3636

3737
EventHandler.fire("com.woltlab.wcf.acp.user", "refresh", {
3838
userIds: userIDs,

ts/WoltLabSuite/Core/Acp/Controller/VersionTracker/VersionList.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import { revertVersion } from "WoltLabSuite/Core/Api/VersionTrackers/RevertVersion";
1111
import { confirmationFactory } from "WoltLabSuite/Core/Component/Confirmation";
12-
import * as UiNotification from "WoltLabSuite/Core/Ui/Notification";
12+
import { showDefaultSuccessSnackbar } from "WoltLabSuite/Core/Component/Snackbar";
1313

1414
function initRevertButtons(container: HTMLElement, objectType: string, objectId: number): void {
1515
container.querySelectorAll<HTMLButtonElement>(".jsRevertButton").forEach((button) => {
@@ -21,7 +21,7 @@ function initRevertButtons(container: HTMLElement, objectType: string, objectId:
2121

2222
const response = await revertVersion(objectType, objectId, parseInt(button.dataset.objectId!));
2323
if (response.ok) {
24-
UiNotification.show(undefined, () => {
24+
showDefaultSuccessSnackbar().addEventListener("snackbar:close", () => {
2525
window.location.reload();
2626
});
2727
}

ts/WoltLabSuite/Core/Acp/Ui/Article/InlineEditor.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
77
*/
88

9+
import { showDefaultSuccessSnackbar } from "WoltLabSuite/Core/Component/Snackbar";
910
import * as Ajax from "../../../Ajax";
1011
import { AjaxCallbackSetup, DatabaseObjectActionResponse } from "../../../Ajax/Data";
1112
import { confirmationFactory } from "../../../Component/Confirmation";
@@ -100,7 +101,7 @@ class AcpUiArticleInlineEditor {
100101
if (triggerFunction) {
101102
actionData.responseData.objectIDs.forEach((objectId) => triggerFunction(objectId));
102103

103-
UiNotification.show();
104+
showDefaultSuccessSnackbar();
104105
}
105106
} else if (actionData.data.actionName === "com.woltlab.wcf.article.setCategory") {
106107
const dialog = UiDialog.openStatic("articleCategoryDialog", actionData.data.internalData.template, {

ts/WoltLabSuite/Core/Acp/Ui/Devtools/Project/Pip/Entry/List.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
import * as Ajax from "../../../../../../Ajax";
1010
import * as Language from "../../../../../../Language";
1111
import { ConfirmationCallbackParameters, show as showConfirmation } from "../../../../../../Ui/Confirmation";
12-
import * as UiNotification from "../../../../../../Ui/Notification";
1312
import { AjaxCallbackSetup } from "../../../../../../Ajax/Data";
13+
import { showDefaultSuccessSnackbar } from "WoltLabSuite/Core/Component/Snackbar";
1414

1515
interface AjaxResponse {
1616
returnValues: {
@@ -63,7 +63,7 @@ class DevtoolsProjectPipEntryList {
6363
* Handles successful AJAX request.
6464
*/
6565
_ajaxSuccess(data: AjaxResponse): void {
66-
UiNotification.show();
66+
showDefaultSuccessSnackbar();
6767

6868
this.table.querySelectorAll("tbody > tr").forEach((pipEntry: HTMLTableRowElement) => {
6969
if (pipEntry.dataset.identifier === data.returnValues.identifier) {

ts/WoltLabSuite/Core/Acp/Ui/Devtools/Project/QuickSetup.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import * as Ajax from "../../../../Ajax";
1010
import DomUtil from "../../../../Dom/Util";
1111
import * as Language from "../../../../Language";
1212
import UiDialog from "../../../../Ui/Dialog";
13-
import * as UiNotification from "../../../../Ui/Notification";
1413
import { AjaxCallbackObject, AjaxCallbackSetup } from "../../../../Ajax/Data";
1514
import { DialogCallbackObject, DialogCallbackSetup } from "../../../../Ui/Dialog/Data";
15+
import { showSuccessSnackbar } from "WoltLabSuite/Core/Component/Snackbar";
1616

1717
interface AjaxResponse {
1818
returnValues: {
@@ -66,7 +66,7 @@ class AcpUiDevtoolsProjectQuickSetup implements AjaxCallbackObject, DialogCallba
6666

6767
UiDialog.close(this);
6868

69-
UiNotification.show(data.returnValues.successMessage, () => {
69+
showSuccessSnackbar(data.returnValues.successMessage).addEventListener("snackbar:close", () => {
7070
window.location.reload();
7171
});
7272
}

ts/WoltLabSuite/Core/Acp/Ui/Devtools/Project/Sync.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import * as Ajax from "../../../../Ajax";
22
import * as Language from "../../../../Language";
3-
import * as UiNotification from "../../../../Ui/Notification";
43
import { AjaxCallbackSetup, AjaxResponseException } from "../../../../Ajax/Data";
54
import { DialogCallbackSetup } from "../../../../Ui/Dialog/Data";
65
import { dialogFactory } from "../../../../Component/Dialog";
6+
import { showDefaultSuccessSnackbar } from "WoltLabSuite/Core/Component/Snackbar";
77

88
interface PipData {
99
dependencies: string[];
@@ -176,7 +176,7 @@ class AcpUiDevtoolsProjectSync {
176176
if (this.queue.length === 0) {
177177
this.buttonSyncAll.classList.remove("disabled");
178178

179-
UiNotification.show();
179+
showDefaultSuccessSnackbar();
180180

181181
return;
182182
}

ts/WoltLabSuite/Core/Acp/Ui/Page/BoxOrder.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import * as Ajax from "../../../Ajax";
1010
import DomChangeListener from "../../../Dom/Change/Listener";
1111
import * as Language from "../../../Language";
1212
import * as UiConfirmation from "../../../Ui/Confirmation";
13-
import * as UiNotification from "../../../Ui/Notification";
1413
import { AjaxCallbackSetup } from "../../../Ajax/Data";
14+
import { showDefaultSuccessSnackbar } from "WoltLabSuite/Core/Component/Snackbar";
1515

1616
interface AjaxResponse {
1717
actionName: string;
@@ -121,11 +121,11 @@ class AcpUiPageBoxOrder {
121121
_ajaxSuccess(data: AjaxResponse): void {
122122
switch (data.actionName) {
123123
case "updatePosition":
124-
UiNotification.show();
124+
showDefaultSuccessSnackbar();
125125
break;
126126

127127
case "resetPosition":
128-
UiNotification.show(undefined, () => {
128+
showDefaultSuccessSnackbar().addEventListener("snackbar:close", () => {
129129
window.location.reload();
130130
});
131131
break;

ts/WoltLabSuite/Core/Acp/Ui/Style/DarkMode.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@
88
* @since 6.0
99
*/
1010

11+
import { showDefaultSuccessSnackbar } from "WoltLabSuite/Core/Component/Snackbar";
1112
import { prepareRequest } from "../../../Ajax/Backend";
1213
import { confirmationFactory } from "../../../Component/Confirmation";
1314
import { getPhrase } from "../../../Language";
14-
import { show as showNotification } from "../../../Ui/Notification";
1515

1616
async function promptConfirmation(endpoint: string, question: string): Promise<void> {
1717
const ok = await confirmationFactory().custom(question).message(getPhrase("wcf.dialog.confirmation.cannotBeUndone"));
1818
if (ok) {
1919
const response = await prepareRequest(endpoint).post().fetchAsResponse();
2020
if (response?.ok) {
21-
showNotification(undefined, () => {
21+
showDefaultSuccessSnackbar().addEventListener("snackbar:close", () => {
2222
window.location.reload();
2323
});
2424
}

0 commit comments

Comments
 (0)