diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 74c4289..14a5daf 100755 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -1,7 +1,7 @@ generator client { provider = "prisma-client-js" binaryTargets = ["native", "linux-musl-arm64-openssl-3.0.x"] - output = "../node_modules/.prisma/client" + output = "../node_modules/.prisma/client" } datasource db { @@ -58,6 +58,8 @@ model Ticket { usersInGroup User[] @relation("groupTickets") PersonalQueue PersonalQueue? @relation(fields: [personalQueueName], references: [name]) ticketType TicketType @default(DEBUGGING) + template String @default("") + isOnline Boolean @default(false) helpedByUserId String? createdByUserId String diff --git a/src/components/admin/AdminList.tsx b/src/components/admin/AdminList.tsx index d75af2b..00dbf34 100755 --- a/src/components/admin/AdminList.tsx +++ b/src/components/admin/AdminList.tsx @@ -11,7 +11,7 @@ import { } from "@chakra-ui/react"; import { Assignment, Category, Location } from "@prisma/client"; import { CreatableSelect } from "chakra-react-select"; -import { useState } from "react"; +import { useState, useEffect } from "react"; import { trpc } from "../../utils/trpc"; import AdminCard from "./AdminCard"; @@ -26,7 +26,7 @@ interface AdminListProps { const AdminList = (props: AdminListProps) => { const { assignmentsOrLocationsProps, isAssignment } = props; const [assignmentsOrLocations, setAssignmentsOrLocations] = useState< - Assignment[] | Location[] + (Assignment | Location)[] >(assignmentsOrLocationsProps); const [createText, setCreateText] = useState(""); const [isHiddenVisible, setIsHiddenVisible] = useState(false); @@ -43,9 +43,16 @@ const AdminList = (props: AdminListProps) => { const editLocationMutation = trpc.admin.editLocation.useMutation(); const createCategoryMutation = trpc.admin.createCategory.useMutation(); - const [numVisible, setNumVisible] = useState( - assignmentsOrLocations.filter((a) => !a?.isHidden).length - ); + const [numVisible, setNumVisible] = useState(0); + + useEffect(() => { + const hiddenAssignmentsOrLocations = (assignmentsOrLocations as (Assignment | Location)[]).filter( + (a) => !a?.isHidden + ); + setNumVisible( + (hiddenAssignmentsOrLocations as (Assignment | Location)[]).length + ); + }, [assignmentsOrLocations]); const changeNumVisible = (delta: number) => { setNumVisible(numVisible + delta); diff --git a/src/components/layout/AvatarDropdown.tsx b/src/components/layout/AvatarDropdown.tsx index fe0e918..f71ae40 100755 --- a/src/components/layout/AvatarDropdown.tsx +++ b/src/components/layout/AvatarDropdown.tsx @@ -65,7 +65,7 @@ const AvatarDropdown = () => {
{session?.user?.name || session?.user?.preferredName ? ( { - Include "[this test]" or "[this concept]" as mandatory placeholders for students to fill. + Include "[this test]" or "[this concept]" as mandatory placeholders for students to fill.