Skip to content

Commit b926871

Browse files
committed
chore: update internal toasts to 3.0 usage
1 parent 2b1ef0c commit b926871

23 files changed

Lines changed: 94 additions & 117 deletions

‎src/base/chat/context.js‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import each from 'src/utils/each.js';
77
import * as fnUser from 'src/utils/user.js';
88
import ignoreUser from 'src/utils/ignoreUser.js';
99
import decode from 'src/utils/decode.js';
10-
import { buttonCSS, window } from 'src/utils/1.variables.js';
10+
import { window } from 'src/utils/1.variables.js';
1111
import Translation from 'src/structures/constants/translation.ts';
1212
import isCtrl from 'src/utils/isCtrl';
1313
import styles from './context.css';
@@ -119,19 +119,14 @@ eventManager.on('jQuery', () => {
119119
if (!settings.value(key)) {
120120
simpleToast({
121121
text: Translation.IGNORED.translate(name),
122-
css: {
123-
'background-color': 'rgba(208, 0, 0, 0.6)',
124-
},
125122
buttons: [{
126-
css: buttonCSS,
127123
text: Translation.UNDO,
128-
className: 'dismiss',
129124
onclick: () => {
130125
settings.remove(key);
131126
updateIgnoreText(id);
132127
},
133128
}],
134-
className: 'dismissable',
129+
className: ['dismissable', 'underscript-toast-danger'],
135130
});
136131
ignoreUser(name, key, true);
137132
} else {

‎src/base/chat/largeIconMode.js‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import Translation from 'src/structures/constants/translation.ts';
2-
import { buttonCSS as css } from 'src/utils/1.variables.js';
32
import { infoToast } from 'src/utils/2.toasts.js';
43
import eventManager from 'src/utils/eventManager.js';
54
import * as settings from 'src/utils/settings/index.js';
@@ -34,8 +33,6 @@ eventManager.on('ChatDetected', () => {
3433
const value = setting.value();
3534
const buttons = {
3635
text: value ? 'Revert it!' : 'Enable it!',
37-
className: 'dismiss',
38-
css,
3936
onclick: (e) => {
4037
setting.set(!value);
4138
},

‎src/base/chat/legend.js‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ eventManager.on('preChat:getMessageAuto', function legend(data) {
5454
}
5555
toast({
5656
text: global('translateFromServerJson')(data.message),
57-
css: {
58-
color: 'yellow',
59-
footer: { color: 'white' },
60-
},
57+
className: 'underscript-toast-highlight',
6158
});
6259
});

‎src/base/chat/legendary.js‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,7 @@ eventManager.on('preChat:getMessageAuto', function drawAnnouncement(data) {
6161

6262
const toast = SimpleToast({
6363
text: translateFromServerJson(data.message),
64-
css: {
65-
color: 'yellow',
66-
footer: {
67-
color: 'white',
68-
},
69-
},
64+
className: 'underscript-toast-highlight',
7065
});
7166
toast.cards = [card];
7267
toast.owner = user;

‎src/base/chat/notify.new.js‎

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { global, globalSet } from 'src/utils/global.js';
44
import pendingIgnore from 'src/utils/pendingIgnore.js';
55
import pingRegex from 'src/utils/pingRegex.js';
66
import { infoToast } from 'src/utils/2.toasts.js';
7-
import { buttonCSS } from 'src/utils/1.variables.js';
87
import Translation from 'src/structures/constants/translation.js';
98
import style from 'src/utils/style.js';
109

@@ -62,27 +61,18 @@ function notify() {
6261
text: Translation.Toast('ping'),
6362
buttons: [{
6463
text: Translation.Toast('ping.settings'),
65-
className: 'dismiss',
6664
onclick() {
6765
pingExtras.show(true);
6866
},
6967
}, {
7068
text: Translation.Toast('ping.remove'),
71-
className: 'dismiss',
7269
onclick() {
7370
const words = pingExtras.value();
7471
pingExtras.set(words.filter((word) => word !== '@underscript'));
7572
},
7673
}, {
7774
text: Translation.DISMISS,
78-
className: 'dismiss',
7975
}],
80-
className: 'dismissable',
81-
css: {
82-
button: {
83-
...buttonCSS,
84-
'white-space': 'normal',
85-
},
86-
},
76+
className: ['dismissable', 'underscript-toast-wrap'],
8777
}, 'underscript.alert.ping');
8878
}

‎src/base/chat/winstreak.js‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,7 @@ eventManager.on('preChat:getMessageAuto', function winstreaks(data) {
5959
const toast = toasts.add(SimpleToast({
6060
text: global('translateFromServerJson')(data.message),
6161
// timeout: 10000,
62-
css: {
63-
color: 'yellow',
64-
footer: { color: 'white' },
65-
},
62+
className: 'underscript-toast-highlight',
6663
}));
6764
toast.time = Date.now();
6865
});

‎src/base/friends/requests.js‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,16 @@ eventManager.on('Friends:requests', (friends) => {
1818
each(friends, (friend, id) => {
1919
const key = `underscript.request.${id}`;
2020
if (sessionStorage.getItem(key)) return;
21-
const css = {
22-
background: 'inherit',
23-
}; // I need to add a way to clear all styles
2421
toast({
2522
title: Translation.Toast('friend.request'),
2623
text: friend,
2724
buttons: [{
28-
css,
2925
text: ' ',
30-
className: 'glyphicon glyphicon-ok green',
26+
className: 'glyphicon glyphicon-ok green underscript-icon-button',
3127
onclick: post.bind(null, id),
3228
}, {
33-
css,
3429
text: ' ',
35-
className: 'glyphicon glyphicon-remove red',
30+
className: 'glyphicon glyphicon-remove red underscript-icon-button',
3631
onclick: post.bind(null, id, false),
3732
}],
3833
});

‎src/base/friendship/magic.js‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import eventManager from 'src/utils/eventManager.js';
33
import * as settings from 'src/utils/settings/index.js';
44
import { toast } from 'src/utils/2.toasts.js';
55
import getLevel from 'src/utils/getFriendshipLevel.js';
6-
import { buttonCSS as css } from 'src/utils/1.variables.js';
76
import Translation from 'src/structures/constants/translation.ts';
87

98
const setting = settings.register({
@@ -32,8 +31,6 @@ function getFriendship() {
3231
className: 'dismissable',
3332
buttons: {
3433
text: Translation.General('go!'),
35-
className: 'dismiss',
36-
css,
3734
onclick: (e) => {
3835
location.href = '/Friendship';
3936
},

‎src/base/game/hotkeys/endTurn.js‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as settings from 'src/utils/settings/index.js';
33
import { global } from 'src/utils/global.js';
44
import { infoToast } from 'src/utils/2.toasts.js';
55
import Hotkey from 'src/utils/hotkey.class.js';
6-
import { buttonCSS as css, hotkeys } from 'src/utils/1.variables.js';
6+
import { hotkeys } from 'src/utils/1.variables.js';
77
import { BUTTON as MOUSE_BUTTON } from 'src/utils/mouse.js';
88
import Translation from 'src/structures/constants/translation.ts';
99

@@ -53,8 +53,6 @@ eventManager.on('PlayingGame', function bindHotkeys() {
5353
className: 'dismissable',
5454
buttons: {
5555
text: Translation.General('settings'),
56-
className: 'dismiss',
57-
css,
5856
onclick: (_) => {
5957
fullDisable.show(true);
6058
},

‎src/base/game/resultToast.js‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@ eventManager.on('getResult:before', function resultToast() {
2323
className: 'skiptranslate',
2424
text: '🏠',
2525
},
26-
css: {
27-
'font-family': 'inherit',
28-
button: { background: 'rgb(0, 0, 20)' },
29-
},
26+
className: 'underscript-toast-result',
3027
onClose: () => {
3128
document.location.href = '/';
3229
},

0 commit comments

Comments
 (0)