-
Notifications
You must be signed in to change notification settings - Fork 14
Feat/system admin #1108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/system admin #1108
Changes from 1 commit
228b71f
2d59f23
11232bd
774a8f5
580617f
af68445
88fe2bf
2be1b57
59d8bc6
9510de9
d558ca8
a9b4b2b
f3d3e67
366c806
21fad4a
07ac31d
b261088
9204d86
a82243b
6f686e3
5ddb252
538deb9
5fd7ac7
a8a6f0a
58b5490
c367efe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { Dispatch, FC, SetStateAction, useMemo, useState } from 'react' | ||
import { Dispatch, FC, SetStateAction, useEffect, useMemo, useState } from 'react' | ||
import { NavigateFunction, useLocation, useNavigate } from 'react-router-dom' | ||
|
||
import { TabsNavbar } from '~/libs/ui' | ||
|
@@ -24,6 +24,14 @@ const SystemAdminTabs: FC = () => { | |
navigate(childTabId) | ||
} | ||
|
||
// If url is changed by navigator on different tabs, we need set activeTab | ||
useEffect(() => { | ||
const pathTabId = getTabIdFromPathName(pathname) | ||
if (pathTabId !== activeTab) { | ||
setActiveTab(pathTabId) | ||
} | ||
}, [pathname]) // eslint-disable-line react-hooks/exhaustive-deps | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider adding |
||
|
||
return ( | ||
<div className={styles.container}> | ||
<TabsNavbar | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,7 @@ import { | |
} from '../../lib/models' | ||
import { | ||
approveApplication, | ||
getChallengeByLegacyId, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The function |
||
getChallengeReviewers, | ||
getChallengeReviewOpportunities, | ||
rejectPending, | ||
|
@@ -61,6 +62,7 @@ export const ManageReviewerPage: FC = () => { | |
const { challengeId = '' }: { challengeId?: string } = useParams<{ | ||
challengeId: string | ||
}>() | ||
const [challengeUuid, setChallengeUuid] = useState('') | ||
const navigate: NavigateFunction = useNavigate() | ||
const [filterCriteria, setFilterCriteria]: [ | ||
ReviewFilterCriteria, | ||
|
@@ -136,17 +138,25 @@ export const ManageReviewerPage: FC = () => { | |
}) | ||
|
||
const unapprove = useEventCallback((): void => { | ||
// how to get challenge Id? | ||
// Now we use one specific challenge id for testing | ||
const realChallengeId = 'c713e250-ecb4-4192-8717-d607ddda8db4' | ||
navigate(`${rootRoute}/challenge-management/${realChallengeId}/manage-user`) | ||
if (challengeUuid) { | ||
navigate(`${rootRoute}/challenge-management/${challengeUuid}/manage-user`) | ||
} | ||
}) | ||
|
||
// Init | ||
useEffect(() => { | ||
search() | ||
}, [challengeId]) // eslint-disable-line react-hooks/exhaustive-deps -- missing dependency: search | ||
|
||
// Gets the challenge details by legacyId | ||
useEffect(() => { | ||
getChallengeByLegacyId(+challengeId) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider adding error handling for the promise returned by |
||
.then(challenge => { | ||
setChallengeUuid(challenge.id) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ensure that |
||
}) | ||
// eslint-disable-next-line react-hooks/exhaustive-deps -- missing dependency: setChallengeUuid | ||
}, [challengeId, getChallengeByLegacyId]) | ||
|
||
// Page change | ||
const [pageChangeEvent, setPageChangeEvent] = useState(false) | ||
const previousPageChangeEvent = useRef(false) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
useEffect
hook has been added to the import statement, but there is no usage ofuseEffect
in the current code diff. Ensure thatuseEffect
is actually needed in this file, otherwise consider removing it to avoid unused imports.