Actually make infraction modal trigger work
This commit is contained in:
parent
120ca1da45
commit
769c47c4c7
@ -12,12 +12,14 @@ import {
|
|||||||
PopoverTrigger,
|
PopoverTrigger,
|
||||||
Select,
|
Select,
|
||||||
useBreakpointValue,
|
useBreakpointValue,
|
||||||
|
useDisclosure,
|
||||||
useToast,
|
useToast,
|
||||||
VStack,
|
VStack,
|
||||||
} from "@chakra-ui/react";
|
} from "@chakra-ui/react";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import AppealCard from "../../components/AppealCard.js";
|
import AppealCard from "../../components/AppealCard.js";
|
||||||
import GameAppealCard from "../../components/GameAppealCard.js";
|
import GameAppealCard from "../../components/GameAppealCard.js";
|
||||||
|
import NewInfractionModal from "../../components/NewInfractionModal.js";
|
||||||
import ReportCard from "../../components/ReportCard.js";
|
import ReportCard from "../../components/ReportCard.js";
|
||||||
import { useLoaderData } from "@remix-run/react";
|
import { useLoaderData } from "@remix-run/react";
|
||||||
|
|
||||||
@ -87,6 +89,7 @@ export function meta() {
|
|||||||
|
|
||||||
export default function () {
|
export default function () {
|
||||||
const pageProps = useLoaderData<typeof loader>();
|
const pageProps = useLoaderData<typeof loader>();
|
||||||
|
const infractionModalDisclosure = useDisclosure();
|
||||||
const isDesktop = useBreakpointValue({ base: false, lg: true });
|
const isDesktop = useBreakpointValue({ base: false, lg: true });
|
||||||
const entryTypes = [];
|
const entryTypes = [];
|
||||||
const [entries, setEntries] = useState([] as JSX.Element[]);
|
const [entries, setEntries] = useState([] as JSX.Element[]);
|
||||||
@ -148,8 +151,27 @@ export default function () {
|
|||||||
setBefore(entryData[entryData.length - 1].created_at);
|
setBefore(entryData[entryData.length - 1].created_at);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const itemModals: {
|
||||||
|
[k: string]: {
|
||||||
|
isOpen: boolean;
|
||||||
|
onOpen: () => void;
|
||||||
|
onClose: () => void;
|
||||||
|
[k: string]: any;
|
||||||
|
};
|
||||||
|
} = {
|
||||||
|
game_ban: useDisclosure(),
|
||||||
|
inactivity: useDisclosure(),
|
||||||
|
infraction: infractionModalDisclosure,
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container maxW="container.lg">
|
<Container maxW="container.lg">
|
||||||
|
<NewInfractionModal
|
||||||
|
isOpen={infractionModalDisclosure.isOpen}
|
||||||
|
onClose={infractionModalDisclosure.onClose}
|
||||||
|
/>
|
||||||
<Flex>
|
<Flex>
|
||||||
<VStack w={isDesktop ? "container.md" : "container.lg"}>
|
<VStack w={isDesktop ? "container.md" : "container.lg"}>
|
||||||
{entries}
|
{entries}
|
||||||
@ -158,13 +180,13 @@ export default function () {
|
|||||||
<Select>{entryTypes}</Select>
|
<Select>{entryTypes}</Select>
|
||||||
</Box>
|
</Box>
|
||||||
</Flex>
|
</Flex>
|
||||||
<Popover>
|
<Popover placement="top">
|
||||||
<PopoverTrigger>
|
<PopoverTrigger>
|
||||||
<Button borderRadius="50%" h="16" w="16">
|
<Button borderRadius="50%" h="16" w="16">
|
||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
width="16"
|
width="32"
|
||||||
height="16"
|
height="32"
|
||||||
fill="currentColor"
|
fill="currentColor"
|
||||||
viewBox="0 0 16 16"
|
viewBox="0 0 16 16"
|
||||||
>
|
>
|
||||||
@ -178,9 +200,15 @@ export default function () {
|
|||||||
<PopoverHeader>Create New</PopoverHeader>
|
<PopoverHeader>Create New</PopoverHeader>
|
||||||
<PopoverBody>
|
<PopoverBody>
|
||||||
<VStack>
|
<VStack>
|
||||||
{pageProps.item_types.map((item) => {
|
{pageProps.item_types.map((item) => (
|
||||||
return <Button w="100%">{item.name}</Button>;
|
<Button
|
||||||
})}
|
key={item.value}
|
||||||
|
onClick={() => itemModals[item.value].onOpen()}
|
||||||
|
w="100%"
|
||||||
|
>
|
||||||
|
{item.name}
|
||||||
|
</Button>
|
||||||
|
))}
|
||||||
</VStack>
|
</VStack>
|
||||||
</PopoverBody>
|
</PopoverBody>
|
||||||
</PopoverContent>
|
</PopoverContent>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user