Add new tools to pre-select players

Selecting all present players can be tedious,
especially if they are many or when multiple
messagess need to be sent.

Add two new buttons to the toolbar that allow
pre-filling the form with all connected players,
or all players.

Add translations and icons for those new tools.
This commit is contained in:
trotFunky 2025-05-28 19:06:48 +01:00
parent 16e1eab24b
commit e30a97d036
6 changed files with 46 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 330 B

View file

@ -3,6 +3,8 @@
"UI": {
"ToolbarCategory": "Message controls",
"ToolbarSendMessage": "Send message",
"ToolbarSendMessageToConnected": "Send message to all connected players",
"ToolbarSendMessageToAll": "Send message to all players",
"HistoryJournalTitle": "Messages for {name}"
},
"Dialogs": {

View file

@ -3,6 +3,8 @@
"UI": {
"ToolbarCategory": "Contrôles messages",
"ToolbarSendMessage": "Envoyer des messages",
"ToolbarSendMessageToConnected": "Envoyer un message à tous les joueurs connectés",
"ToolbarSendMessageToAll": "Envoyer des messages à tous les joueurs",
"HistoryJournalTitle": "Messages pour {name}"
},
"Dialogs": {

View file

@ -332,6 +332,28 @@ function main() {
title: "MM.UI.ToolbarCategory",
icon: "mm-chat-bubble",
tools: [{
name: "send-message-to-all",
title: "MM.UI.ToolbarSendMessageToAll",
button: true,
visible: true,
icon: "mm-bubble-above-three-players",
onClick: () => send_message_dialog({
recipients: game.users.players.map((user) => user.id)
})
},
{
name: "send-message-to-connected",
title: "MM.UI.ToolbarSendMessageToConnected",
button: true,
visible: true,
icon: "mm-bubble-above-two-players",
onClick: () => send_message_dialog({
recipients: game.users.players
.filter((user) => user.active)
.map((user) => user.id)
})
},
{
name: "send-message",
title: "MM.UI.ToolbarSendMessage",
button: true,

View file

@ -9,6 +9,26 @@
background-image: url("/modules/the-mills-messages/assets/chat_bubble.webp");
}
.mm-bubble-above-two-players {
display: inline-block;
width: 32px;
height: 32px;
background-size: cover;
cursor: pointer;
image-rendering: pixelated;
background-image: url("/modules/the-mills-messages/assets/bubble_above_two_players.webp");
}
.mm-bubble-above-three-players {
display: inline-block;
width: 32px;
height: 32px;
background-size: cover;
cursor: pointer;
image-rendering: pixelated;
background-image: url("/modules/the-mills-messages/assets/bubble_above_three_players.webp");
}
/*
* Override Foundry's `.application .scrollable`, whose right margin does not work
* with ProseMirror's editor internal divs which need a 0 right margin.