Fix search scroll.

Add bot badge.
This commit is contained in:
Paul committed 2021-08-12 12:16:24 +01:00
1 parent 65d44c72bd
commit 8137409dae
5 files changed
+90 -57

No files matched your search

+31
View File
@@ -1,6 +1,7 @@
import { observer } from "mobx-react-lite";
import { useParams } from "react-router-dom";
import { User } from "revolt.js/dist/maps/Users";
import styled from "styled-components";
import { Text } from "preact-i18n";
@@ -9,6 +10,21 @@ import { useClient } from "../../../context/revoltjs/RevoltClient";
import UserIcon from "./UserIcon";
const BotBadge = styled.div`
display: inline-block;
height: 1.4em;
padding: 0 4px;
font-size: 0.6em;
user-select: none;
margin-inline-start: 2px;
text-transform: uppercase;
color: var(--foreground);
background: var(--accent);
border-radius: calc(var(--border-radius) / 2);
`;
export const Username = observer(
({
user,
@@ -51,6 +67,21 @@ export const Username = observer(
}
}
if (user?.bot) {
return (
<>
<span {...otherProps} style={{ color }}>
{username ?? (
<Text id="app.main.channel.unknown_user" />
)}
</span>
<BotBadge>
<Text id="app.main.channel.bot" />
</BotBadge>
</>
);
}
return (
<span {...otherProps} style={{ color }}>
{username ?? <Text id="app.main.channel.unknown_user" />}