From 0721977bb608b487c42f4c10da1e9e924c97df2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Geonizeli?= Date: Mon, 17 Oct 2022 11:17:09 -0300 Subject: [PATCH] remove dashboard filter disclousere --- app/javascript/pages/dashboard/Filters.tsx | 130 +++++++----------- .../pages/dashboard/components/charts/Pie.tsx | 4 +- 2 files changed, 53 insertions(+), 81 deletions(-) diff --git a/app/javascript/pages/dashboard/Filters.tsx b/app/javascript/pages/dashboard/Filters.tsx index 3ba3ea2..92fabf4 100644 --- a/app/javascript/pages/dashboard/Filters.tsx +++ b/app/javascript/pages/dashboard/Filters.tsx @@ -1,12 +1,12 @@ -import React, {FC, Fragment} from 'react' -import {Disclosure, Transition} from "@headlessui/react" -import {ChevronDownIcon, XIcon} from "@heroicons/react/outline" -import {useForm} from "react-hook-form" +import React, { FC, Fragment } from 'react' +import { Disclosure, Transition } from "@headlessui/react" +import { ChevronDownIcon, XIcon } from "@heroicons/react/outline" +import { useForm } from "react-hook-form" -import {QuestionWhereInput} from "../../__generated__/graphql-schema" -import {useDashboardContext, whereDefaultState} from "./DashboardContext" -import {useCurrentUser} from "../../contexts" -import {Button, Input} from "../../components" +import { QuestionWhereInput } from "../../__generated__/graphql-schema" +import { useDashboardContext, whereDefaultState } from "./DashboardContext" +import { useCurrentUser } from "../../contexts" +import { Button, Input } from "../../components" type FilterBarForm = { fromOtherUsers?: boolean @@ -36,12 +36,12 @@ const mapFilter = (values: FilterBarForm, userId?: string): QuestionWhereInput = }) const FiltersForm: FC = () => { - const {register, handleSubmit, reset, getValues, formState} = useForm({ + const { register, handleSubmit, reset, getValues, formState } = useForm({ defaultValues: formDefaultValues, }) - const {setWhere} = useDashboardContext() + const { setWhere } = useDashboardContext() const userContext = useCurrentUser() - const {user, isOnlyTeacher} = userContext + const { user, isOnlyTeacher } = userContext const onSubmit = (values: FilterBarForm) => { reset(getValues()) @@ -58,50 +58,50 @@ const FiltersForm: FC = () => { onSubmit={handleSubmit(onSubmit)} className={"flex justify-between"} > - - -
- - -
-
+ + +
+ + +
+
{!isOnlyTeacher && ( - +