Fix #55 - shrink system messages
Signed-off-by: James Ketrenos <james_eikona@ketrenos.com>
This commit is contained in:
parent
1562658798
commit
6361074703
@ -256,6 +256,12 @@
|
|||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ChatList .System {
|
||||||
|
background-color: #f0f0f0;
|
||||||
|
transform: scale(0.8);
|
||||||
|
border-radius: 0.25em;
|
||||||
|
}
|
||||||
|
|
||||||
.ChatInput {
|
.ChatInput {
|
||||||
flex-grow: 0;
|
flex-grow: 0;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
@ -269,6 +275,10 @@
|
|||||||
font-size: 0.8rem;
|
font-size: 0.8rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ChatList .System .MuiTypography-body1 {
|
||||||
|
margin-left: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
.ChatList .MuiTypography-body2 {
|
.ChatList .MuiTypography-body2 {
|
||||||
font-size: 0.7rem;
|
font-size: 0.7rem;
|
||||||
}
|
}
|
||||||
@ -283,7 +293,8 @@
|
|||||||
width: 1em;
|
width: 1em;
|
||||||
height: 1em;
|
height: 1em;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin-top: 4px;
|
margin-top: 6px;
|
||||||
|
align-self: flex-start;
|
||||||
}
|
}
|
||||||
|
|
||||||
.Players {
|
.Players {
|
||||||
|
@ -187,10 +187,8 @@ const Chat = ({ table }) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const messages = table.game && table.game.chat.map((item, index) => {
|
const messages = table.game && table.game.chat.map((item, index) => {
|
||||||
/* If the date is in the future, set it to now */
|
|
||||||
const name = item.from ? item.from : item.color,
|
|
||||||
from = name ? `${name}, ` : '';
|
|
||||||
let message;
|
let message;
|
||||||
|
/* If the date is in the future, set it to now */
|
||||||
const dice = item.message.match(/^(.*rolled )([1-6])(, ([1-6]))?(.*)$/);
|
const dice = item.message.match(/^(.*rolled )([1-6])(, ([1-6]))?(.*)$/);
|
||||||
if (dice) {
|
if (dice) {
|
||||||
if (dice[4]) {
|
if (dice[4]) {
|
||||||
@ -202,12 +200,13 @@ const Chat = ({ table }) => {
|
|||||||
message = item.message;
|
message = item.message;
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<ListItem key={`msg-${item.date}`}>
|
<ListItem key={`msg-${item.date}`} className={item.color ? '' : 'System'}>
|
||||||
|
{ item.color &&
|
||||||
<PlayerColor color={item.color}/>
|
<PlayerColor color={item.color}/>
|
||||||
|
}
|
||||||
<ListItemText primary={message}
|
<ListItemText primary={message}
|
||||||
secondary={(<>{from}
|
secondary={item.color && <Moment fromNow date={item.date > Date.now() ?
|
||||||
<Moment fromNow date={item.date > Date.now() ?
|
Date.now() : item.date} interval={1000}/>} />
|
||||||
Date.now() : item.date} interval={1000}/></>)} />
|
|
||||||
</ListItem>
|
</ListItem>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -276,7 +276,7 @@ const roll = (game, session) => {
|
|||||||
return error;
|
return error;
|
||||||
};
|
};
|
||||||
|
|
||||||
const distributeResources = (game, roll) => {
|
const distributeResources = (session, game, roll) => {
|
||||||
console.log(`Roll: ${roll}`);
|
console.log(`Roll: ${roll}`);
|
||||||
/* Find which tiles have this roll */
|
/* Find which tiles have this roll */
|
||||||
let tiles = [];
|
let tiles = [];
|
||||||
@ -326,7 +326,7 @@ const distributeResources = (game, roll) => {
|
|||||||
message.push(`${receives[color][type]} ${type}`);
|
message.push(`${receives[color][type]} ${type}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
addChatMessage(game, null, `${playerNameFromColor(game, color)} receives ${message.join(', ')}.`);
|
addChatMessage(game, session, `${playerNameFromColor(game, color)} receives ${message.join(', ')}.`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -395,7 +395,7 @@ const processRoll = (game, dice) => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
distributeResources(game, game.turn.roll);
|
distributeResources(session, game, game.turn.roll);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2437,10 +2437,10 @@ router.put("/:id/:action/:value?", async (req, res) => {
|
|||||||
player[type] += receives[type];
|
player[type] += receives[type];
|
||||||
message.push(`${receives[type]} ${type}`);
|
message.push(`${receives[type]} ${type}`);
|
||||||
}
|
}
|
||||||
addChatMessage(game, null, `${session.name} receives ${message.join(', ')}.`);
|
addChatMessage(game, session, `${session.name} receives ${message.join(', ')}.`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
addChatMessage(game, null, `It is ${name}'s turn.`);
|
addChatMessage(game, session, `It is ${name}'s turn.`);
|
||||||
game.state = 'normal';
|
game.state = 'normal';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user