Register inactivity notice modal in mod queue
This commit is contained in:
parent
c057d2eb82
commit
a8f64dddec
@ -16,12 +16,13 @@ import {
|
||||
useToast,
|
||||
VStack,
|
||||
} from "@chakra-ui/react";
|
||||
import { useState } from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
import AppealCard from "../../components/AppealCard.js";
|
||||
import GameAppealCard from "../../components/GameAppealCard.js";
|
||||
import NewInfractionModal from "../../components/NewInfractionModal.js";
|
||||
import ReportCard from "../../components/ReportCard.js";
|
||||
import { useLoaderData } from "@remix-run/react";
|
||||
import NewInactivityNotice from "../../components/NewInactivityNotice.js";
|
||||
|
||||
export async function loader({ context }: { context: RequestContext }) {
|
||||
const { current_user: currentUser } = context.data;
|
||||
@ -31,6 +32,13 @@ export async function loader({ context }: { context: RequestContext }) {
|
||||
status: 401,
|
||||
});
|
||||
|
||||
const departments = {
|
||||
DM: 1 << 2,
|
||||
ET: 1 << 3,
|
||||
FM: 1 << 10,
|
||||
WM: 1 << 9,
|
||||
};
|
||||
|
||||
const newItemPermissions = {
|
||||
game_ban: [1 << 5],
|
||||
inactivity: [1 << 2, 1 << 9, 1 << 10],
|
||||
@ -74,6 +82,9 @@ export async function loader({ context }: { context: RequestContext }) {
|
||||
});
|
||||
|
||||
return {
|
||||
departments: Object.entries(departments)
|
||||
.filter((d) => d[1] & currentUser.permissions)
|
||||
.map((arr) => arr[0]),
|
||||
entry_types: allowedTypes,
|
||||
item_types: allowedNewItems,
|
||||
};
|
||||
@ -89,7 +100,6 @@ export function meta() {
|
||||
|
||||
export default function () {
|
||||
const pageProps = useLoaderData<typeof loader>();
|
||||
const infractionModalDisclosure = useDisclosure();
|
||||
const isDesktop = useBreakpointValue({ base: false, lg: true });
|
||||
const entryTypes = [];
|
||||
const [entries, setEntries] = useState([] as JSX.Element[]);
|
||||
@ -161,16 +171,28 @@ export default function () {
|
||||
} = {
|
||||
game_ban: useDisclosure(),
|
||||
inactivity: useDisclosure(),
|
||||
infraction: infractionModalDisclosure,
|
||||
infraction: useDisclosure(),
|
||||
};
|
||||
|
||||
console.log();
|
||||
useEffect(() => {
|
||||
const searchParams = new URLSearchParams(location.search);
|
||||
const modal = searchParams.get("modal");
|
||||
|
||||
if (!modal || !pageProps.item_types.find((m) => m.value === modal)) return;
|
||||
|
||||
itemModals[modal].onOpen();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Container maxW="container.lg">
|
||||
<NewInactivityNotice
|
||||
departments={pageProps.departments}
|
||||
isOpen={itemModals.inactivity.isOpen}
|
||||
onClose={itemModals.inactivity.onClose}
|
||||
/>
|
||||
<NewInfractionModal
|
||||
isOpen={infractionModalDisclosure.isOpen}
|
||||
onClose={infractionModalDisclosure.onClose}
|
||||
isOpen={itemModals.infraction.isOpen}
|
||||
onClose={itemModals.infraction.onClose}
|
||||
/>
|
||||
<Flex>
|
||||
<VStack w={isDesktop ? "container.md" : "container.lg"}>
|
||||
|
Loading…
x
Reference in New Issue
Block a user