Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Display user card even if no moderation history exists
  • Loading branch information
regalijan committed Nov 26, 2023
1 parent c72e33d commit 5c9d09d
Showing 1 changed file with 2 additions and 24 deletions.
26 changes: 2 additions & 24 deletions app/routes/hammer.tsx
@@ -1,6 +1,4 @@
import {
Alert,
AlertIcon,
Box,
Button,
Card,
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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 = () => {
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 5c9d09d

Please sign in to comment.