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