Skip to content

Commit

Permalink
Merge branch 'main' into feature/pdct-1722-fix-corpus-import-id-gener…
Browse files Browse the repository at this point in the history
…ator
  • Loading branch information
katybaulch committed Jan 8, 2025
2 parents d6a7139 + 6d5185b commit bb3304c
Show file tree
Hide file tree
Showing 6 changed files with 129 additions and 89 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"@testing-library/jest-dom": "^6.2.0",
"@testing-library/react": "^14.1.2",
"@testing-library/user-event": "^14.5.2",
"@types/draft-js": "^0.11.14",
"@types/draft-js": "^0.11.18",
"@types/draftjs-to-html": "^0.8.3",
"@types/html-to-draftjs": "^1.4.2",
"@types/jwt-decode": "^3.1.0",
Expand All @@ -48,7 +48,7 @@
"@types/react-dom": "^18.2.6",
"@types/react-draft-wysiwyg": "^1.13.6",
"@typescript-eslint/eslint-plugin": "^7.1.1",
"@typescript-eslint/parser": "^7.1.1",
"@typescript-eslint/parser": "^7.18.0",
"@vitejs/plugin-react": "^4.3.1",
"eslint": "^8.44.0",
"eslint-config-prettier": "^9.1.0",
Expand All @@ -57,7 +57,7 @@
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-react-refresh": "^0.4.11",
"jwt-encode": "^1.0.1",
"markdownlint-cli": "^0.41.0",
"markdownlint-cli": "^0.43.0",
"prettier": "^3.4.1",
"react-icons": "^4.10.1",
"ts-node": "^10.9.2",
Expand Down
4 changes: 3 additions & 1 deletion src/components/forms/FamilyForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,8 @@ export const FamilyForm = ({ family: loadedFamily }: TProps) => {
...metadataValues, // add the values for any metadata fields for the given family corpora type
})

setLoadedAndReset(true)
} else {
setLoadedAndReset(true)
}
}, [config, loadedFamily, reset, isMCFCorpus, collections, corpusInfo])
Expand Down Expand Up @@ -544,7 +546,7 @@ export const FamilyForm = ({ family: loadedFamily }: TProps) => {
/>
) : null}

{loadedFamily && corpusInfo && loadedAndReset && (
{corpusInfo && loadedAndReset && (
<>
<MetadataSection
corpusInfo={corpusInfo}
Expand Down
1 change: 1 addition & 0 deletions src/components/forms/fields/TextField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export const TextField = <T extends FieldValues>({
bg='white'
type={type}
placeholder={placeholder ?? `Enter ${name}`}
value={field.value ?? ''} // this prevents the component changing from a controlled to uncontrolled component
/>
{showHelperText && isDisabled && (
<FormHelperText>You cannot edit this</FormHelperText>
Expand Down
6 changes: 1 addition & 5 deletions src/routes/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { createBrowserRouter, RouterProvider } from 'react-router-dom'

import { useAuth } from '@/hooks/useAuth'

import { ProtectedRoute } from './ProtectedRoute'
import Root from '@/Root'
import Login from '@/views/auth/Login'
Expand Down Expand Up @@ -91,10 +89,8 @@ const unauthenticatedRoutes = [
]

const Routes = () => {
const { token } = useAuth()

const router = createBrowserRouter([
...(!token ? unauthenticatedRoutes : []),
...unauthenticatedRoutes,
...authenticatedRoutes,
])

Expand Down
2 changes: 2 additions & 0 deletions src/views/auth/Login.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { LoginForm } from '@/components/forms/LoginForm'

export default function Login() {
// TODO: redirect user to the index page if they are already authenticated
// const { token } = useAuth()
return (
<>
<LoginForm />
Expand Down
Loading

0 comments on commit bb3304c

Please sign in to comment.