Display user card even if no moderation history exists
This commit is contained in:
parent
c72e33dad6
commit
5c9d09d717
@ -1,6 +1,4 @@
|
||||
import {
|
||||
Alert,
|
||||
AlertIcon,
|
||||
Box,
|
||||
Button,
|
||||
Card,
|
||||
@ -63,7 +61,6 @@ export default function () {
|
||||
const [avatarUrl, setAvatarUrl] = useState("");
|
||||
const [ticketLink, setTicketLink] = useState("");
|
||||
const [history, setHistory] = useState([] as ReactElement[]);
|
||||
const [hasResults, setHasResults] = useState(true);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const { isOpen, onClose, onOpen } = useDisclosure();
|
||||
const toast = useToast();
|
||||
@ -111,25 +108,13 @@ export default function () {
|
||||
};
|
||||
} = await historyResp.json();
|
||||
|
||||
if (!history.length) {
|
||||
setLoading(false);
|
||||
setHasResults(false);
|
||||
setStatus("");
|
||||
return toast({
|
||||
title: "Nothing Found",
|
||||
description: "This user doesn't have any moderation history.",
|
||||
status: "info",
|
||||
});
|
||||
}
|
||||
|
||||
setHasResults(true);
|
||||
const cardList = [];
|
||||
|
||||
setAvatarUrl(user.avatar ?? "https://i.hep.gg/floppa");
|
||||
setUid(user.id.toString());
|
||||
setUsername(user.name);
|
||||
setStatus(user.current_status);
|
||||
|
||||
const cardList = [];
|
||||
|
||||
for (const entry of history) {
|
||||
const url = entry.entity.properties.evidence.stringValue;
|
||||
const isUrl = () => {
|
||||
@ -287,13 +272,6 @@ export default function () {
|
||||
</Modal>
|
||||
<Heading>User Lookup</Heading>
|
||||
<Text>Look up a user's punishment history here.</Text>
|
||||
{!hasResults ? (
|
||||
<Alert status="warning" mt={2}>
|
||||
<AlertIcon />
|
||||
No information was found for this user. Perhaps you misspelt their
|
||||
name?
|
||||
</Alert>
|
||||
) : null}
|
||||
<HStack mt={5}>
|
||||
<Input
|
||||
id="username"
|
||||
|
Loading…
x
Reference in New Issue
Block a user