Skip to content

Commit 4a7ca03

Browse files
authored
Merge pull request #1487 from topcoder-platform/work-manager
New work app to replace work-manager, and v6 projects API usage in copilots app
2 parents 8b852b1 + 6146c97 commit 4a7ca03

592 files changed

Lines changed: 64150 additions & 586 deletions

File tree

Some content is hidden

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

.circleci/config.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ workflows:
226226
branches:
227227
only:
228228
- dev
229-
- PM-4401_stacked-view-for-submitter
230229

231230
- deployQa:
232231
context: org-global

.env.development

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
REACT_APP_GROUPS_API_URL=https://api.topcoder-dev.com/v6/groups
2+
REACT_APP_TERMS_API_URL=https://api.topcoder-dev.com/v5/terms
3+
REACT_APP_RESOURCES_API_URL=https://api.topcoder-dev.com/v6/resources
4+
REACT_APP_MEMBER_API_URL=https://api.topcoder-dev.com/v6/members
5+
REACT_APP_RESOURCE_ROLES_API_URL=https://api.topcoder-dev.com/v6/resource-roles

.env.production

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
REACT_APP_GROUPS_API_URL=https://api.topcoder.com/v6/groups
2+
REACT_APP_TERMS_API_URL=https://api.topcoder.com/v5/terms
3+
REACT_APP_RESOURCES_API_URL=https://api.topcoder.com/v6/resources
4+
REACT_APP_MEMBER_API_URL=https://api.topcoder.com/v6/members
5+
REACT_APP_RESOURCE_ROLES_API_URL=https://api.topcoder.com/v6/resource-roles

package.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@
1919
"sb:build": "storybook build -o build/storybook"
2020
},
2121
"dependencies": {
22+
"@codemirror/autocomplete": "^6.20.1",
23+
"@codemirror/lang-java": "^6.0.2",
24+
"@codemirror/language": "^6.12.2",
25+
"@codemirror/lint": "^6.9.5",
26+
"@codemirror/search": "^6.6.0",
27+
"@codemirror/state": "^6.6.0",
28+
"@codemirror/theme-one-dark": "^6.1.3",
29+
"@codemirror/view": "^6.40.0",
2230
"@datadog/browser-logs": "^4.50.1",
2331
"@hello-pangea/dnd": "^18.0.1",
2432
"@heroicons/react": "^1.0.6",
@@ -31,6 +39,7 @@
3139
"@stripe/stripe-js": "1.54.2",
3240
"@tinymce/tinymce-react": "^6.3.0",
3341
"@types/codemirror": "5.60.17",
42+
"@uiw/react-codemirror": "^4.25.8",
3443
"amazon-s3-uri": "^0.1.1",
3544
"apexcharts": "^3.54.1",
3645
"axios": "^1.13.2",
@@ -51,6 +60,7 @@
5160
"express": "^4.22.1",
5261
"express-fileupload": "^1.5.2",
5362
"express-interceptor": "^1.2.0",
63+
"fflate": "^0.8.2",
5464
"filestack-js": "^3.44.2",
5565
"highcharts": "^10.3.3",
5666
"highcharts-react-official": "^3.2.3",

src/apps/accounts/src/settings/tabs/tools/devices/Devices.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ import {
2424
WearableIcon,
2525
} from '~/apps/accounts/src/lib'
2626

27+
import { shouldUseUpdateTraitAction } from '../trait-action.utils'
28+
2729
import styles from './Devices.module.scss'
2830

2931
interface DevicesProps {
@@ -315,7 +317,9 @@ const Devices: FC<DevicesProps> = (props: DevicesProps) => {
315317
},
316318
}]
317319

318-
const action = props.devicesTrait ? updateMemberTraitsAsync : createMemberTraitsAsync
320+
const action = shouldUseUpdateTraitAction(props.devicesTrait, deviceTypesData)
321+
? updateMemberTraitsAsync
322+
: createMemberTraitsAsync
319323

320324
action(
321325
props.profile.handle,

src/apps/accounts/src/settings/tabs/tools/service-provider/ServiceProvider.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import {
1414
TelevisionServiceProviderIcon,
1515
} from '~/apps/accounts/src/lib'
1616

17+
import { shouldUseUpdateTraitAction } from '../trait-action.utils'
18+
1719
import { serviceProviderTypes } from './service-provider-types.config'
1820
import styles from './ServiceProvider.module.scss'
1921

@@ -216,7 +218,9 @@ const ServiceProvider: FC<ServiceProviderProps> = (props: ServiceProviderProps)
216218
},
217219
}]
218220

219-
const action = props.serviceProviderTrait ? updateMemberTraitsAsync : createMemberTraitsAsync
221+
const action = shouldUseUpdateTraitAction(props.serviceProviderTrait, serviceProviderTypesData)
222+
? updateMemberTraitsAsync
223+
: createMemberTraitsAsync
220224

221225
action(
222226
props.profile.handle,

src/apps/accounts/src/settings/tabs/tools/software/Software.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import { createMemberTraitsAsync, updateMemberTraitsAsync, UserProfile, UserTrai
77
import { Button, Collapsible, ConfirmModal, IconOutline, InputSelect, InputText } from '~/libs/ui'
88
import { SettingSection, SoftwareIcon } from '~/apps/accounts/src/lib'
99

10+
import { shouldUseUpdateTraitAction } from '../trait-action.utils'
11+
1012
import { softwareTypes } from './software-types.config'
1113
import styles from './Software.module.scss'
1214

@@ -170,7 +172,9 @@ const Software: FC<SoftwareProps> = (props: SoftwareProps) => {
170172
},
171173
}]
172174

173-
const action = props.softwareTrait ? updateMemberTraitsAsync : createMemberTraitsAsync
175+
const action = shouldUseUpdateTraitAction(props.softwareTrait, softwareTypesData)
176+
? updateMemberTraitsAsync
177+
: createMemberTraitsAsync
174178

175179
action(
176180
props.profile.handle,

src/apps/accounts/src/settings/tabs/tools/subscriptions/Subscriptions.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import { createMemberTraitsAsync, updateMemberTraitsAsync, UserProfile, UserTrai
77
import { Button, Collapsible, ConfirmModal, IconOutline, InputText } from '~/libs/ui'
88
import { SettingSection, SubscriptionsIcon } from '~/apps/accounts/src/lib'
99

10+
import { shouldUseUpdateTraitAction } from '../trait-action.utils'
11+
1012
import styles from './Subscriptions.module.scss'
1113

1214
interface SubscriptionsProps {
@@ -150,7 +152,9 @@ const Subscriptions: FC<SubscriptionsProps> = (props: SubscriptionsProps) => {
150152
setIsSaving(false)
151153
})
152154
} else {
153-
const action = props.subscriptionsTrait ? updateMemberTraitsAsync : createMemberTraitsAsync
155+
const action = shouldUseUpdateTraitAction(props.subscriptionsTrait, subscriptionsTypesData)
156+
? updateMemberTraitsAsync
157+
: createMemberTraitsAsync
154158
action(
155159
props.profile.handle,
156160
[{
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { shouldUseUpdateTraitAction } from './trait-action.utils'
2+
3+
describe('shouldUseUpdateTraitAction', () => {
4+
it('returns true when the initial trait exists', () => {
5+
expect(shouldUseUpdateTraitAction({ traitId: 'software' }, undefined))
6+
.toBe(true)
7+
})
8+
9+
it('returns true when local traits exist even without the initial trait', () => {
10+
expect(shouldUseUpdateTraitAction(undefined, [{ name: 'Chrome' }]))
11+
.toBe(true)
12+
})
13+
14+
it('returns false when both initial and local traits are missing', () => {
15+
expect(shouldUseUpdateTraitAction(undefined, undefined))
16+
.toBe(false)
17+
})
18+
})
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { UserTrait } from '~/libs/core'
2+
3+
/**
4+
* Determine whether tool traits should use update or create action.
5+
* The initial trait prop can be stale while the user stays on the tab,
6+
* so local list state is also considered to avoid duplicate create calls.
7+
*/
8+
export function shouldUseUpdateTraitAction(
9+
initialTrait: UserTrait | undefined,
10+
localTraitsData: UserTrait[] | undefined,
11+
): boolean {
12+
return Boolean(initialTrait || localTraitsData?.length)
13+
}

0 commit comments

Comments
 (0)