add: added pfps and user profile modification

This commit is contained in:
Lukian 2025-04-18 15:42:55 +02:00
parent 56d171439e
commit 7781e6b8a1
20 changed files with 404 additions and 36 deletions

View file

@ -13,20 +13,24 @@ export default function MessageComponent({ message, user, channel, deleteMessage
return (
<div key={message.id} className="message">
<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>
}
return <span key={index}>{word} </span>;
})}
<img src={`/api/users/${message.username}/pfp`} alt="" className="message-user-pfp" />
<div className="message-content-right">
<span><Link to={`/u/${message.username}`}>{message.username}</Link> {new Date(message.date * 1000).toLocaleString()}</span>
<div className="message-text">
{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>
}
return <span key={index}>{word} </span>;
})}
</div>
</div>
</div>
<p>{new Date(message.date * 1000).toLocaleString()}</p>
<div>
{message.content.toLocaleLowerCase().includes("gros cochon") && (
<img src="/pig.png" alt="Gros cochon" className="pig" />

View file

@ -27,6 +27,7 @@ export default function TopBar({ user }: { user: User | undefined }) {
}}>
Logout
</button>
<img src={`/api/users/${user.username}/pfp`} alt="pfp" className="topbar-user-pfp" />
</div>
) : (
<div className="topbar-right">