Skip to content

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

Merged
merged 26 commits into from
Jun 18, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
228b71f
Deploy this branch
jmgasper Apr 15, 2025
2d59f23
permission-submit
stevenfrog Apr 27, 2025
11232bd
review and billing account update
stevenfrog Apr 27, 2025
774a8f5
Merge branch 'dev' into permission-update
stevenfrog Apr 27, 2025
580617f
Merge pull request #1053 from stevenfrog/permission-update
jmgasper Apr 27, 2025
af68445
Fix typo
jmgasper Apr 27, 2025
88fe2bf
Topcoder Admin App - Misc Update 0505
suppermancool May 7, 2025
2be1b57
Merge pull request #1070 from topcoder-platform/diazz-admin-f2f-30376773
jmgasper May 8, 2025
59d8bc6
fix unapprove challenge id
stevenfrog May 13, 2025
9510de9
Merge pull request #1073 from stevenfrog/fix-unapprove-challenge-id
jmgasper May 14, 2025
d558ca8
Topcoder Admin App - Misc Update 0518
suppermancool May 22, 2025
a9b4b2b
Topcoder Admin App - Marathon Match Functionality
suppermancool May 25, 2025
f3d3e67
Merge pull request #1085 from topcoder-platform/diazz-admin-f2f-30376861
jmgasper May 27, 2025
366c806
Merge branch 'feat/system-admin' into diazz-admin-code-30376878
suppermancool Jun 1, 2025
21fad4a
Marathon match functionality - final fix
suppermancool Jun 2, 2025
07ac31d
Topcoder Admin App - Misc Update 0601
suppermancool Jun 3, 2025
b261088
Merge pull request #1092 from topcoder-platform/diazz-admin-code-3037…
jmgasper Jun 4, 2025
9204d86
Merge branch 'feat/system-admin' into diazz-admin-f2f-30376988
suppermancool Jun 4, 2025
a82243b
Merge pull request #1093 from topcoder-platform/diazz-admin-f2f-30376988
jmgasper Jun 5, 2025
6f686e3
admin billing accounts: always set payment_terms_id = 1 when send upd…
suppermancool Jun 6, 2025
5ddb252
Merge branch 'dev' into feat/system-admin
suppermancool Jun 6, 2025
538deb9
fix lint after merging
suppermancool Jun 6, 2025
5fd7ac7
Merge pull request #1095 from topcoder-platform/diazz-admin-f2f-30376988
jmgasper Jun 8, 2025
a8a6f0a
Topcoder Admin App - Misc Update 0610
suppermancool Jun 10, 2025
58b5490
fix lint
suppermancool Jun 13, 2025
c367efe
Merge pull request #1105 from topcoder-platform/diazz-admin-f2f-30377050
jmgasper Jun 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
review and billing account update
  • Loading branch information
stevenfrog committed Apr 27, 2025
commit 11232bd5a924d86ad2287b158f43de9b58e43fbf
Original file line number Diff line number Diff line change
Expand Up @@ -67,22 +67,22 @@ const MobileListView: FC<MobileListViewProps<ReviewSummary>> = props => {
<div className={styles.mobileListViewItemContainer} key={d.legacyChallengeId}>
<div className={styles.rows}>
<div className={styles.row1}>
{/* Title */ propertyElements[1]}
{/* Status */ propertyElements[4]}
{/* Title */ propertyElements[0]}
{/* Status */ propertyElements[2]}
</div>
<div className={styles.row2}>
{/* Legacy ID */ propertyElements[2]}
{/* Legacy ID */ propertyElements[1]}
</div>
<div className={styles.row3}>
{propertyElementLabels[5]}
{/* Open Review Opp' */ propertyElements[5]}
{/* propertyElementLabels[5] */}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment propertyElementLabels[5] is now commented out. If this was intentional, ensure that it is not needed elsewhere. If it was an accidental comment, consider uncommenting it.

{/* Open Review Opp' */ propertyElements[3]}
</div>
<div className={styles.row4}>
{propertyElementLabels[6]}
{/* Review Applications */ propertyElements[6]}
{propertyElementLabels[4]}
{/* Review Applications */ propertyElements[4]}
</div>
<div className={styles.row5}>
{/* Action */ propertyElements[7]}
{/* Action */ propertyElements[5]}
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,12 @@ const ChallengeTitle: FC<{
const ReviewSummaryList: FC<ReviewListProps> = props => {
const columns = useMemo<TableColumn<ReviewSummary>[]>(
() => [
{
label: 'Challenge type',
propertyName: '',
type: 'text',
},
// Hide the columns temporary, we do not have these data now
// {
// label: 'Challenge type',
// propertyName: '',
// type: 'text',
// },
{
label: 'Challenge Title',
propertyName: 'challengeName',
Expand All @@ -76,11 +77,11 @@ const ReviewSummaryList: FC<ReviewListProps> = props => {
propertyName: 'legacyChallengeId',
type: 'text',
},
{
label: 'Current phase',
propertyName: '',
type: 'text',
},
// {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commented-out code for 'Current phase' should either be removed if it's not needed or implemented if it is required. Leaving commented-out code can lead to confusion.

// label: 'Current phase',
// propertyName: '',
// type: 'text',
// },
{ label: 'Status', propertyName: 'challengeStatus', type: 'text' },
// I think this column is important, and it exits in `admin-app`
// but resp does not have it, so I just comment it here
Expand Down
32 changes: 28 additions & 4 deletions src/apps/admin/src/lib/components/ReviewerList/ReviewerList.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FC, useMemo } from 'react'
import { format } from 'date-fns'

import { CheckIcon } from '@heroicons/react/solid'
import { CheckIcon, XIcon } from '@heroicons/react/solid'
import { useWindowSize, WindowSize } from '~/libs/shared'
import {
Button,
Expand All @@ -27,6 +27,7 @@ export interface ReviewerListProps {
approvingReviewerId: number
onPageChange: (page: number) => void
onApproveApplication: (reviewer: Reviewer) => void
onUnapproveApplication: (reviewer: Reviewer) => void
onToggleSort: (sort: Sort) => void
}

Expand All @@ -35,15 +36,22 @@ const ApproveButton: FC<{
openReviews: number
approvingReviewerId: number
onApproveApplication: ReviewerListProps['onApproveApplication']
onUnapproveApplication: ReviewerListProps['onUnapproveApplication']
}> = props => {
const handleApprove = useEventCallback((): void => {
props.onApproveApplication(props.reviewer)
})

const handleRemove = useEventCallback((): void => {
props.onUnapproveApplication(props.reviewer)
})

const isApproving = props.approvingReviewerId === props.reviewer.userId
const isOtherApproving = props.approvingReviewerId > 0
const hideApproveButton
= props.openReviews < 1 || props.reviewer.applicationStatus !== 'Pending'
const showRemoveButton
= props.reviewer.applicationStatus === 'Approved'

return (
<>
Expand All @@ -53,7 +61,19 @@ const ApproveButton: FC<{
className={styles.approvingLoadingSpinner}
/>
) : (
!hideApproveButton && (
hideApproveButton ? (
showRemoveButton && (
<Button
primary
variant='danger'
onClick={handleRemove}
>
<XIcon className='icon icon-fill' />
{' '}
Remove Reviewer
</Button>
)
) : (
<Button
primary
onClick={handleApprove}
Expand Down Expand Up @@ -105,13 +125,15 @@ const Actions: FC<{
openReviews: number
approvingReviewerId: number
onApproveApplication: ReviewerListProps['onApproveApplication']
onUnapproveApplication: ReviewerListProps['onUnapproveApplication']
}> = props => (
<div className={styles.rowActions}>
<ApproveButton
reviewer={props.reviewer}
openReviews={props.openReviews}
approvingReviewerId={props.approvingReviewerId}
onApproveApplication={props.onApproveApplication}
onUnapproveApplication={props.onUnapproveApplication}
/>
</div>
)
Expand Down Expand Up @@ -155,7 +177,7 @@ const ReviewerList: FC<ReviewerListProps> = props => {
type: 'element',
},
{
label: 'Open Review Opp',
label: 'Open Review',
propertyName: '',
renderer: (reviewer: Reviewer) => (
// eslint-disable-next-line jsx-a11y/anchor-is-valid
Expand All @@ -170,7 +192,8 @@ const ReviewerList: FC<ReviewerListProps> = props => {
propertyName: 'reviewsInPast60Days',
type: 'number',
},
{ label: 'Matching Skills', propertyName: '', type: 'text' },
// Hide the columns temporary, we do not have these data now
// { label: 'Matching Skills', propertyName: '', type: 'text' },
{
label: '',
renderer: (reviewer: Reviewer) => (
Expand All @@ -179,6 +202,7 @@ const ReviewerList: FC<ReviewerListProps> = props => {
openReviews={props.openReviews}
approvingReviewerId={props.approvingReviewerId}
onApproveApplication={props.onApproveApplication}
onUnapproveApplication={props.onUnapproveApplication}
/>
),
type: 'action',
Expand Down
1 change: 1 addition & 0 deletions src/apps/admin/src/lib/hooks/useTableFilterBackend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export function useTableFilterBackend<T>(
fetchDataRef.current.filterCriteria,
() => {
fetchDataRef.current.isLoading = false
window.scrollTo({ left: 0, top: 200 })

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The window.scrollTo function is being used here to scroll the window to a specific position. Consider whether this behavior is necessary and if it should be configurable or conditional based on certain criteria. Hardcoding scroll positions can lead to unexpected user experiences.

},
() => {
fetchDataRef.current.isLoading = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ export interface BillingAccountResource {
id: number
name: string
status: string
mobileType?: 'label' | 'last-value'
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
useRef,
useState,
} from 'react'
import { useParams } from 'react-router-dom'
import { NavigateFunction, useNavigate, useParams } from 'react-router-dom'
import { sortBy } from 'lodash'

import { XIcon } from '@heroicons/react/solid'
Expand Down Expand Up @@ -61,6 +61,7 @@ export const ManageReviewerPage: FC = () => {
const { challengeId = '' }: { challengeId?: string } = useParams<{
challengeId: string
}>()
const navigate: NavigateFunction = useNavigate()
const [filterCriteria, setFilterCriteria]: [
ReviewFilterCriteria,
Dispatch<SetStateAction<ReviewFilterCriteria>>
Expand Down Expand Up @@ -134,6 +135,13 @@ 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`)
})

// Init
useEffect(() => {
search()
Expand Down Expand Up @@ -214,6 +222,7 @@ export const ManageReviewerPage: FC = () => {
reviewers={reviewers}
openReviews={openReviews}
onApproveApplication={approve}
onUnapproveApplication={unapprove}
approvingReviewerId={userId}
paging={{
page: filterCriteria.page,
Expand Down Expand Up @@ -519,8 +528,8 @@ const ApproveActionType = {
type ApproveActionType =
| {
type: // | typeof ApproveActionType.APPROVE_INIT
| typeof ApproveActionType.APPROVE_FAILED
| typeof ApproveActionType.APPROVE_DONE
| typeof ApproveActionType.APPROVE_FAILED
| typeof ApproveActionType.APPROVE_DONE
}
| {
type: typeof ApproveActionType.APPROVE_INIT
Expand Down