Fix lack of keys in chat
Signed-off-by: James Ketrenos <james_eikona@ketrenos.com>
This commit is contained in:
parent
395f31aae3
commit
39c74a7e8d
@ -81,19 +81,25 @@ const Chat = ({ table }) => {
|
||||
}
|
||||
|
||||
const messages = table.game && table.game.chat.map((item, index) => {
|
||||
const punctuation = item.message.match(/(\.+$)/);
|
||||
let period;
|
||||
if (punctuation) {
|
||||
period = punctuation[1];
|
||||
} else {
|
||||
period = '';
|
||||
}
|
||||
let lines = item.message.split('.');
|
||||
const message = lines.map((line, index) => {
|
||||
if (line.trim() === '') {
|
||||
return <></>;
|
||||
}
|
||||
const message = lines
|
||||
.filter(line => line.trim() !== '')
|
||||
.map((line, index) => {
|
||||
/* If the date is in the future, set it to now */
|
||||
const dice = line.match(/^(.*rolled )([1-6])(, ([1-6]))?(.*)$/);
|
||||
if (dice) {
|
||||
if (dice[4]) {
|
||||
return <div key={`line-${index}`}>{dice[1]}<Dice pips={dice[2]}/>,
|
||||
<Dice pips={dice[4]}/>{dice[5]}.</div>;
|
||||
<Dice pips={dice[4]}/>{dice[5]}{ period }</div>;
|
||||
} else {
|
||||
return <div key={`line-${index}`}>{dice[1]}<Dice pips={dice[2]}/>{dice[5]}.</div>;
|
||||
return <div key={`line-${index}`}>{dice[1]}<Dice pips={dice[2]}/>{dice[5]}{ period }</div>;
|
||||
}
|
||||
}
|
||||
|
||||
@ -109,7 +115,7 @@ const Chat = ({ table }) => {
|
||||
start = '';
|
||||
}
|
||||
}
|
||||
return <div key={`line-${index}`}>{ message }.</div>;
|
||||
return <div key={`line-${index}`}>{ message }{ period }</div>;
|
||||
});
|
||||
|
||||
return (
|
||||
|
Loading…
x
Reference in New Issue
Block a user