Solved a problem with the build

This commit is contained in:
Tiago Ribeiro
2023-09-28 12:00:36 +01:00
parent f9cd477114
commit a568950aa9

View File

@@ -10,19 +10,12 @@ import {createColumnHelper, flexRender, getCoreRowModel, useReactTable} from "@t
import axios from "axios"; import axios from "axios";
import clsx from "clsx"; import clsx from "clsx";
import {capitalize} from "lodash"; import {capitalize} from "lodash";
import {useState} from "react"; import {useEffect, useState} from "react";
import {BsDash, BsPlus, BsTrash} from "react-icons/bs"; import {BsDash, BsPlus, BsTrash} from "react-icons/bs";
import {toast} from "react-toastify"; import {toast} from "react-toastify";
import Select from "react-select"; import Select from "react-select";
import {uuidv4} from "@firebase/util"; import {uuidv4} from "@firebase/util";
const CLASSES: {[key in Module]: string} = {
reading: "text-ielts-reading",
listening: "text-ielts-listening",
speaking: "text-ielts-speaking",
writing: "text-ielts-writing",
};
const columnHelper = createColumnHelper<Group>(); const columnHelper = createColumnHelper<Group>();
interface CreateDialogProps { interface CreateDialogProps {
@@ -92,8 +85,16 @@ const CreatePanel = ({user, users, onCreate}: CreateDialogProps) => {
}; };
export default function GroupList({user}: {user: User}) { export default function GroupList({user}: {user: User}) {
const [filterByUser, setFilterByUser] = useState(false);
const {users} = useUsers(); const {users} = useUsers();
const {groups, reload} = useGroups(user.type === "admin" || user.type === "teacher" ? user.id : undefined); const {groups, reload} = useGroups(filterByUser ? user.id : undefined);
useEffect(() => {
if (user && (user.type === "admin" || user.type === "teacher")) {
setFilterByUser(true);
}
}, [user]);
const createGroup = (group: Group) => { const createGroup = (group: Group) => {
return axios return axios