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 messages = table.game && table.game.chat.map((item, index) => {
|
||||||
let lines = item.message.split('.');
|
const punctuation = item.message.match(/(\.+$)/);
|
||||||
const message = lines.map((line, index) => {
|
let period;
|
||||||
if (line.trim() === '') {
|
if (punctuation) {
|
||||||
return <></>;
|
period = punctuation[1];
|
||||||
|
} else {
|
||||||
|
period = '';
|
||||||
}
|
}
|
||||||
|
let lines = item.message.split('.');
|
||||||
|
const message = lines
|
||||||
|
.filter(line => line.trim() !== '')
|
||||||
|
.map((line, index) => {
|
||||||
/* If the date is in the future, set it to now */
|
/* If the date is in the future, set it to now */
|
||||||
const dice = line.match(/^(.*rolled )([1-6])(, ([1-6]))?(.*)$/);
|
const dice = line.match(/^(.*rolled )([1-6])(, ([1-6]))?(.*)$/);
|
||||||
if (dice) {
|
if (dice) {
|
||||||
if (dice[4]) {
|
if (dice[4]) {
|
||||||
return <div key={`line-${index}`}>{dice[1]}<Dice pips={dice[2]}/>,
|
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 {
|
} 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 = '';
|
start = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return <div key={`line-${index}`}>{ message }.</div>;
|
return <div key={`line-${index}`}>{ message }{ period }</div>;
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user