fix: fixed message text wraping

This commit is contained in:
Lukian 2025-04-09 15:50:36 +02:00
parent 4045681913
commit 2795d4686e
2 changed files with 24 additions and 11 deletions

View file

@ -12,18 +12,20 @@ export default function MessageComponent({ message, user, channel, deleteMessage
return (
<div key={message.id} className="message">
<Link to={`/u/${message.username}`}>{message.username}</Link>:{" "}
{message.content.split(" ").map((word, index) => {
if (word.startsWith("@")) {
const mention = message.mentions.find((mention) => `@${mention.username}` === word);
if (mention) {
return <span><Link key={index} to={`/u/${mention.username}`}>{word}</Link> </span>;
<div className="message-content">
<Link to={`/u/${message.username}`}>{message.username}</Link>:{" "}
{message.content.split(" ").map((word, index) => {
if (word.startsWith("@")) {
const mention = message.mentions.find((mention) => `@${mention.username}` === word);
if (mention) {
return <span><Link key={index} to={`/u/${mention.username}`}>{word}</Link> </span>;
}
} else if (word.startsWith("https://") || word.startsWith("http://")) {
return <span><Link to={word}>{word}</Link> </span>
}
} else if (word.startsWith("https://") || word.startsWith("http://")) {
return <span><Link to={word}>{word}</Link> </span>
}
return <span key={index}>{word} </span>;
})}
return <span key={index}>{word} </span>;
})}
</div>
<p>{new Date(message.date * 1000).toLocaleString()}</p>
<div>
{message.content.toLocaleLowerCase().includes("gros cochon") && (