diff --git a/app/javascript/application.tsx b/app/javascript/application.tsx index 481b426..9446a6c 100644 --- a/app/javascript/application.tsx +++ b/app/javascript/application.tsx @@ -4,23 +4,24 @@ import { Provider } from "react-redux"; import { BrowserRouter } from "react-router-dom"; import { Appbar } from "./components"; -import { ApolloContext } from "./contexts"; +import { ApolloContext, UserContext } from "./contexts"; import { PrivateRoutes } from "./routes"; import { store } from "./services/store"; export const App = () => { return ( - - - - - - - - + + + + + + + + + + ); -} - +}; const container = document.getElementById("app"); diff --git a/app/javascript/components/List/List.tsx b/app/javascript/components/List/List.tsx index d75c0b8..f0f6981 100644 --- a/app/javascript/components/List/List.tsx +++ b/app/javascript/components/List/List.tsx @@ -43,6 +43,7 @@ export const ListItem: FC = ({ icon, text, children }) => { type ListProps = { className?: string + children: React.ReactNode } export const List: FC = ({ diff --git a/app/javascript/components/Modal/Modal.tsx b/app/javascript/components/Modal/Modal.tsx index 9e2c093..90fcbbe 100644 --- a/app/javascript/components/Modal/Modal.tsx +++ b/app/javascript/components/Modal/Modal.tsx @@ -7,6 +7,7 @@ type Props = { buttons?: any, title: string, className?: string, + children: React.ReactNode } export const Modal: FC = ({ diff --git a/app/javascript/contexts/UserContext.tsx b/app/javascript/contexts/UserContext.tsx index ed2c11a..39e6774 100644 --- a/app/javascript/contexts/UserContext.tsx +++ b/app/javascript/contexts/UserContext.tsx @@ -11,14 +11,12 @@ export type UserContext = { user?: Query['currentUser'] refetch: () => void isOnlyTeacher: boolean - authToken: string } const Context = createContext({ refetch: () => { }, isOnlyTeacher: false, - authToken: '' }) export const useCurrentUser = (): UserContext => { @@ -44,10 +42,9 @@ const CurrentUserQuery = gql` type Props = { children: any - authToken: string } -export const UserContext: FC = ({ children, authToken }) => { +export const UserContext: FC = ({ children }) => { const [user, setUser] = useState(); const isOnlyTeacher = !!(user?.roles.includes(UserRole.Teacher) && user?.roles.length === 1) @@ -67,7 +64,7 @@ export const UserContext: FC = ({ children, authToken }) => { if (!user) return return ( - + {children} ); diff --git a/app/javascript/pages/dashboard/Filters.tsx b/app/javascript/pages/dashboard/Filters.tsx index 42c83bd..3ba3ea2 100644 --- a/app/javascript/pages/dashboard/Filters.tsx +++ b/app/javascript/pages/dashboard/Filters.tsx @@ -44,9 +44,7 @@ const FiltersForm: FC = () => { const {user, isOnlyTeacher} = userContext const onSubmit = (values: FilterBarForm) => { - reset(getValues(), { - isDirty: false - }) + reset(getValues()) setWhere(mapFilter(values, user?.id)) } @@ -66,7 +64,7 @@ const FiltersForm: FC = () => { { @@ -96,8 +93,7 @@ const FiltersForm: FC = () => { id={"fromOtherUsers"} type="checkbox" placeholder="fromOtherUsers" - ref={register} - name={"fromOtherUsers"} + {...register('fromOtherUsers')} /> )} diff --git a/app/javascript/pages/question/Form/Form.tsx b/app/javascript/pages/question/Form/Form.tsx index 35e5824..304815a 100644 --- a/app/javascript/pages/question/Form/Form.tsx +++ b/app/javascript/pages/question/Form/Form.tsx @@ -97,9 +97,7 @@ export const Form: FC = ({question, onSubmit, onDraftSubmit, alert}) => { const handleDraftSave = () => { if (onDraftSubmit) { onDraftSubmit({...getFormattedInputValues(), status: QuestionStatus.Draft} as QuestionCreateInput) - reset(getValues(), { - isDirty: false - }) + reset(getValues()) dispatch(turnOff()) } } @@ -117,9 +115,7 @@ export const Form: FC = ({question, onSubmit, onDraftSubmit, alert}) => { setValidationErrors(errors) } - reset(getValues(), { - isDirty: false - }) + reset(getValues()) } return ( diff --git a/app/javascript/pages/question/Form/components/TextEditor.tsx b/app/javascript/pages/question/Form/components/TextEditor.tsx index 9acba4f..d9a1521 100644 --- a/app/javascript/pages/question/Form/components/TextEditor.tsx +++ b/app/javascript/pages/question/Form/components/TextEditor.tsx @@ -1,7 +1,7 @@ import React, { FC } from "react"; import { Controller } from "react-hook-form"; import CKEditor from "@ckeditor/ckeditor5-react"; -import * as ClassicEditor from "ckeditor5-mathtype/build/ckeditor"; +import ClassicEditor from "ckeditor5-mathtype/build/ckeditor"; import { useFormProvider } from '../FormContext' @@ -37,7 +37,9 @@ export const TextEditor: FC = ({ name, defaultValue }) => { control={control} name={name} defaultValue={defaultValue} - render={({ onChange, value }) => ( + render={({ + field: { onChange, value } + }) => ( {
handleOwnCheck("UNIFESO")} - name="__nonused" />
handleOwnCheck("")} - name="__nonused" />
@@ -90,9 +88,8 @@ export const FeaturesFormStep: FC = () => {
@@ -103,13 +100,12 @@ export const FeaturesFormStep: FC = () => {

Ano

@@ -123,9 +119,8 @@ export const FeaturesFormStep: FC = () => {

Grau de Dificuldade