Skip to content

Commit c34a372

Browse files
authored
Merge pull request #1206 from topcoder-platform/feat/system-admin
Feat/system admin release for terms, moving gamification admin, and additional features for submissions
2 parents 685ed1b + 88833e8 commit c34a372

File tree

91 files changed

+3968
-159
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+3968
-159
lines changed

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
"@storybook/react": "7.6.10",
2929
"@stripe/react-stripe-js": "1.13.0",
3030
"@stripe/stripe-js": "1.41.0",
31+
"@tinymce/tinymce-react": "^6.2.1",
32+
"@types/codemirror": "5.60.15",
33+
"amazon-s3-uri": "^0.1.1",
3134
"apexcharts": "^3.36.0",
3235
"axios": "^1.7.9",
3336
"browser-cookies": "^1.2.0",
@@ -43,6 +46,7 @@
4346
"draft-js-export-html": "^1.2.0",
4447
"draft-js-markdown-shortcuts-plugin": "^0.3.0",
4548
"draft-js-plugins-editor": "^2.0.3",
49+
"easymde": "2.20.0",
4650
"express": "^4.21.2",
4751
"express-fileupload": "^1.4.0",
4852
"express-interceptor": "^1.2.0",
@@ -101,6 +105,7 @@
101105
"styled-components": "^5.3.6",
102106
"swr": "^1.3.0",
103107
"tc-auth-lib": "topcoder-platform/tc-auth-lib#1.0.27",
108+
"tinymce": "^7.9.1",
104109
"typescript": "^4.8.4",
105110
"universal-navigation": "https://github.com/topcoder-platform/universal-navigation#9fc50d938be7182",
106111
"uuid": "^11.1.0",

src/apps/admin/src/admin-app.routes.tsx

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
permissionManagementRouteId,
1717
platformRouteId,
1818
rootRoute,
19+
termsRouteId,
1920
userManagementRouteId,
2021
} from './config/routes.config'
2122
import { platformSkillRouteId } from './platform/routes.config'
@@ -128,6 +129,22 @@ const BadgeListingPage: LazyLoadedComponent = lazyLoad(
128129
const CreateBadgePage: LazyLoadedComponent = lazyLoad(
129130
() => import('./platform/gamification-admin/src/pages/create-badge/CreateBadgePage'),
130131
)
132+
const TermsListPage: LazyLoadedComponent = lazyLoad(
133+
() => import('./platform/terms/TermsListPage'),
134+
'TermsListPage',
135+
)
136+
const TermsAddPage: LazyLoadedComponent = lazyLoad(
137+
() => import('./platform/terms/TermsAddPage'),
138+
'TermsAddPage',
139+
)
140+
const TermsEditPage: LazyLoadedComponent = lazyLoad(
141+
() => import('./platform/terms/TermsEditPage'),
142+
'TermsEditPage',
143+
)
144+
const TermsUsersPage: LazyLoadedComponent = lazyLoad(
145+
() => import('./platform/terms/TermsUsersPage'),
146+
'TermsUsersPage',
147+
)
131148

132149
export const toolTitle: string = ToolTitle.admin
133150

@@ -310,6 +327,22 @@ export const adminRoutes: ReadonlyArray<PlatformRoute> = [
310327
element: <BadgeDetailPage />,
311328
route: `${gamificationAdminRouteId}${baseDetailPath}/:id`,
312329
},
330+
{
331+
element: <TermsListPage />,
332+
route: termsRouteId,
333+
},
334+
{
335+
element: <TermsAddPage />,
336+
route: `${termsRouteId}/add`,
337+
},
338+
{
339+
element: <TermsUsersPage />,
340+
route: `${termsRouteId}/:id/users`,
341+
},
342+
{
343+
element: <TermsEditPage />,
344+
route: `${termsRouteId}/:id/edit`,
345+
},
313346
],
314347
element: <Platform />,
315348
id: platformRouteId,

src/apps/admin/src/challenge-management/ManageSubmissionPage/ManageSubmissionPage.tsx

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
/**
22
* Manage Submission Page.
33
*/
4-
import { FC } from 'react'
4+
import { FC, useMemo } from 'react'
55
import { useParams } from 'react-router-dom'
66
import classNames from 'classnames'
77

88
import { LinkButton } from '~/libs/ui'
99

1010
import {
11+
useDownloadSubmission,
12+
useDownloadSubmissionProps,
13+
useFetchChallenge,
14+
useFetchChallengeProps,
15+
useManageAVScan,
16+
useManageAVScanProps,
1117
useManageBusEvent,
1218
useManageBusEventProps,
1319
useManageChallengeSubmissions,
@@ -20,6 +26,7 @@ import {
2026
TableLoading,
2127
TableNoRecord,
2228
} from '../../lib'
29+
import { checkIsMM } from '../../lib/utils'
2330

2431
import styles from './ManageSubmissionPage.module.scss'
2532

@@ -35,7 +42,13 @@ export const ManageSubmissionPage: FC<Props> = (props: Props) => {
3542
= useManageBusEvent()
3643

3744
const {
38-
isLoading,
45+
isLoading: isLoadingChallenge,
46+
challengeInfo,
47+
}: useFetchChallengeProps = useFetchChallenge(challengeId)
48+
const isMM = useMemo(() => checkIsMM(challengeInfo), [challengeInfo])
49+
50+
const {
51+
isLoading: isLoadingSubmission,
3952
submissions,
4053
isRemovingSubmission,
4154
isRemovingSubmissionBool,
@@ -48,6 +61,19 @@ export const ManageSubmissionPage: FC<Props> = (props: Props) => {
4861
}: useManageChallengeSubmissionsProps
4962
= useManageChallengeSubmissions(challengeId)
5063

64+
const {
65+
isLoading: isDownloadingSubmission,
66+
isLoadingBool: isDownloadingSubmissionBool,
67+
downloadSubmission,
68+
}: useDownloadSubmissionProps = useDownloadSubmission()
69+
const {
70+
isLoading: isDoingAvScan,
71+
isLoadingBool: isDoingAvScanBool,
72+
doPostBusEvent: doPostBusEventAvScan,
73+
}: useManageAVScanProps = useManageAVScan()
74+
75+
const isLoading = isLoadingSubmission || isLoadingChallenge
76+
5177
return (
5278
<PageWrapper
5379
pageTitle='Submission Management'
@@ -67,6 +93,10 @@ export const ManageSubmissionPage: FC<Props> = (props: Props) => {
6793
) : (
6894
<div className={styles.blockTableContainer}>
6995
<SubmissionTable
96+
isDoingAvScan={isDoingAvScan}
97+
doPostBusEventAvScan={doPostBusEventAvScan}
98+
isDownloading={isDownloadingSubmission}
99+
downloadSubmission={downloadSubmission}
70100
data={submissions}
71101
isRemovingSubmission={isRemovingSubmission}
72102
doRemoveSubmission={doRemoveSubmission}
@@ -80,9 +110,12 @@ export const ManageSubmissionPage: FC<Props> = (props: Props) => {
80110
doPostBusEvent={doPostBusEvent}
81111
showSubmissionHistory={showSubmissionHistory}
82112
setShowSubmissionHistory={setShowSubmissionHistory}
113+
isMM={isMM}
83114
/>
84115

85-
{(isRemovingSubmissionBool
116+
{(isDoingAvScanBool
117+
|| isDownloadingSubmissionBool
118+
|| isRemovingSubmissionBool
86119
|| isRunningTestBool
87120
|| isRemovingReviewSummationsBool) && (
88121
<ActionLoading />

src/apps/admin/src/config/busEvent.config.ts

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@
33
*/
44
import { v4 as uuidv4 } from 'uuid'
55

6-
import { RequestBusAPI } from '../lib/models'
6+
import {
7+
RequestBusAPI,
8+
RequestBusAPIAVScan,
9+
RequestBusAPIAVScanPayload,
10+
} from '../lib/models'
711

812
/**
9-
* Create data for bus event
13+
* Create data for data submission marathon match bus event
1014
* @param submissionId submission id
1115
* @param testType test type
1216
* @returns data for bus event
@@ -27,3 +31,19 @@ export const CREATE_BUS_EVENT_DATA_SUBMISSION_MARATHON_MATCH = (
2731
.toISOString(),
2832
topic: 'submission.notification.score',
2933
})
34+
35+
/**
36+
* Create data for av rescan bus event
37+
* @param payload av rescan payload
38+
* @returns data for bus event
39+
*/
40+
export const CREATE_BUS_EVENT_AV_RESCAN = (
41+
payload: RequestBusAPIAVScanPayload,
42+
): RequestBusAPIAVScan => ({
43+
'mime-type': 'application/json',
44+
originator: 'submission-processor',
45+
payload,
46+
timestamp: new Date()
47+
.toISOString(),
48+
topic: 'avscan.action.scan',
49+
})

src/apps/admin/src/config/routes.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ export const userManagementRouteId = 'user-management'
1414
export const billingAccountRouteId = 'billing-account'
1515
export const permissionManagementRouteId = 'permission-management'
1616
export const gamificationAdminRouteId = 'gamification-admin'
17+
export const termsRouteId = 'terms'
1718
export const platformRouteId = 'platform'

src/apps/admin/src/lib/components/ChallengeList/ChallengeList.tsx

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import {
2121
import { useEventCallback } from '../../hooks'
2222
import { Challenge, ChallengeFilterCriteria, ChallengeType } from '../../models'
2323
import { Paging } from '../../models/challenge-management/Pagination'
24-
import { checkIsMM } from '../../utils'
2524

2625
import { MobileListView } from './MobileListView'
2726
import styles from './ChallengeList.module.scss'
@@ -135,7 +134,6 @@ const Actions: FC<{
135134
challenge: Challenge
136135
currentFilters: ChallengeFilterCriteria
137136
}> = props => {
138-
const isMM = useMemo(() => checkIsMM(props.challenge), [props.challenge])
139137
const [openDropdown, setOpenDropdown] = useState(false)
140138
const navigate = useNavigate()
141139
const goToManageUser = useEventCallback(() => {
@@ -202,16 +200,14 @@ const Actions: FC<{
202200
>
203201
Users
204202
</li>
205-
{isMM && (
206-
<li
207-
onClick={function onClick() {
208-
navigate(`${props.challenge.id}/manage-submission`)
209-
setOpenDropdown(false)
210-
}}
211-
>
212-
Submissions
213-
</li>
214-
)}
203+
<li
204+
onClick={function onClick() {
205+
navigate(`${props.challenge.id}/manage-submission`)
206+
setOpenDropdown(false)
207+
}}
208+
>
209+
Submissions
210+
</li>
215211
</ul>
216212
</DropdownMenu>
217213

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
.container {
2+
display: flex;
3+
flex-direction: column;
4+
gap: 20px;
5+
position: relative;
6+
}
7+
8+
.blockForm {
9+
display: flex;
10+
flex-direction: column;
11+
gap: 20px;
12+
position: relative;
13+
}
14+
15+
.actionButtons {
16+
display: flex;
17+
justify-content: flex-end;
18+
gap: 6px;
19+
}
20+
21+
.dialogLoadingSpinnerContainer {
22+
position: absolute;
23+
width: 64px;
24+
display: flex;
25+
align-items: center;
26+
justify-content: center;
27+
bottom: 0;
28+
height: 64px;
29+
left: 0;
30+
31+
.spinner {
32+
background: none;
33+
}
34+
}

0 commit comments

Comments
 (0)