Skip to content

Commit 206ed94

Browse files
authored
Merge pull request #452 from topcoder-platform/TCA-845
TCA-845 clean /account page > dev
2 parents 6847d1d + f05ed1f commit 206ed94

14 files changed

+40
-409
lines changed

src-ts/config/environments/environment.default.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export const EnvironmentConfigDefault: EnvironmentConfigModel = {
4444
THRIVE_PAGE: `${COMMUNITY_WEBSITE}/thrive`,
4545
USER_PROFILE: `${COMMUNITY_WEBSITE}/members`,
4646
WP_CONTENT: `${COMMUNITY_WEBSITE}/wp-content`,
47+
ACCOUNT_SETTINGS: `${COMMUNITY_WEBSITE}/settings/profile`,
4748
},
4849
UNIVERSAL_NAV: {
4950
URL: 'https://uni-nav.topcoder-dev.com/v1/tc-universal-nav.js',

src-ts/config/environments/environment.prod.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export const EnvironmentConfigProd: EnvironmentConfigModel = {
4242
THRIVE_PAGE: `${COMMUNITY_WEBSITE}/thrive`,
4343
USER_PROFILE: `${COMMUNITY_WEBSITE}/members`,
4444
WP_CONTENT: `${COMMUNITY_WEBSITE}/wp-content`,
45+
ACCOUNT_SETTINGS: `${COMMUNITY_WEBSITE}/settings/profile`,
4546
},
4647
UNIVERSAL_NAV: {
4748
URL: 'https://uni-nav.topcoder.com/v1/tc-universal-nav.js',

src-ts/lib/global-config.model.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export interface GlobalConfig {
3737
THRIVE_PAGE: string
3838
USER_PROFILE: string
3939
WP_CONTENT: string
40+
ACCOUNT_SETTINGS: string
4041
}
4142
UNIVERSAL_NAV: {
4243
URL: string

src-ts/utils/settings/Settings.tsx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
11
import { FC, useContext } from 'react'
22
import { Outlet, Routes } from 'react-router-dom'
33

4-
import { ContentLayout, profileContext, ProfileContextData, routeContext, RouteContextData } from '../../lib'
4+
import { ContentLayout, routeContext, RouteContextData } from '../../lib'
55

66
export const toolTitle: string = 'Account Settings'
77

8+
/**
9+
* DEPRECATED
10+
* TODO: Remove after some time, when clear no one links to here...
11+
*/
812
const Settings: FC<{}> = () => {
913

1014
const { getChildRoutes }: RouteContextData = useContext(routeContext)
1115

12-
const profileContextData: ProfileContextData = useContext(profileContext)
13-
const { profile }: ProfileContextData = profileContextData
14-
15-
// if we don't have a profile, don't show the page
16-
if (!profile) {
17-
return <></>
18-
}
19-
2016
return (
2117
<ContentLayout title={toolTitle}>
2218
<>
Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,15 @@
1-
@import '../../../lib/styles/includes';
2-
3-
:global(.account-settings-modal) {
4-
h2 {
5-
margin-bottom: $space-xxl;
6-
padding: 0 0 $space-xxl;
7-
border-bottom: 1px solid $black-10;
8-
}
9-
10-
}
11-
1+
/**
2+
* DEPRECATED
3+
* TODO: Remove after some time, when no used...
4+
*/
125
.cards {
13-
display: grid;
14-
grid-template-columns: repeat(3, 1fr);
15-
column-gap: $space-xxl;
16-
margin: $space-xxl 0 0;
17-
18-
@include ltemd {
19-
grid-template-columns: 1fr;
20-
row-gap: $space-xxl;
6+
flex: 1;
7+
display: flex;
8+
flex-direction: column;
9+
align-items: center;
10+
justify-content: center;
11+
12+
h3 {
13+
margin-bottom: 32px;
2114
}
2215
}

src-ts/utils/settings/account/Account.tsx

Lines changed: 16 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -1,112 +1,27 @@
1-
/* eslint-disable jsx-a11y/tabindex-no-positive */
2-
import { Dispatch, FC, SetStateAction, useCallback, useContext, useState } from 'react'
3-
import Modal from 'react-responsive-modal'
4-
5-
import {
6-
Button,
7-
Card,
8-
formGetInputFields,
9-
FormInputModel,
10-
formOnReset,
11-
profileContext,
12-
ProfileContextData,
13-
} from '../../../lib'
14-
15-
import { ChangePassword } from './change-password'
16-
import { EditName, editNameFormDef } from './edit-name'
1+
import { FC, useEffect } from 'react'
2+
import { Button } from '../../../lib'
173
import styles from './Account.module.scss'
4+
import { EnvironmentConfig } from '../../../config'
185

6+
/**
7+
* DEPRECTED
8+
* TODO: Remove after some time, when clear no one links to here...
9+
*/
1910
const Account: FC<{}> = () => {
2011

21-
const profileContextData: ProfileContextData = useContext(profileContext)
22-
const { profile }: ProfileContextData = profileContextData
23-
24-
const [editProfileOpen, setEditNameOpen]: [boolean, Dispatch<SetStateAction<boolean>>]
25-
= useState<boolean>(false)
26-
const [changePasswordOpen, setChangePasswordOpen]: [boolean, Dispatch<SetStateAction<boolean>>]
27-
= useState<boolean>(false)
28-
29-
const toggleEditName = useCallback((): void => {
30-
const inputs: Array<FormInputModel> = formGetInputFields(editNameFormDef.groups || [])
31-
formOnReset(inputs)
32-
setEditNameOpen(!editProfileOpen)
33-
}, [editProfileOpen])
34-
35-
const toggleChangePassword = useCallback((): void => {
36-
const inputs: Array<FormInputModel> = formGetInputFields(editNameFormDef.groups || [])
37-
formOnReset(inputs)
38-
setChangePasswordOpen(!changePasswordOpen)
39-
}, [changePasswordOpen])
40-
41-
// if we don't have a profile, don't show the page
42-
if (!profile) {
43-
return <></>
44-
}
12+
// setup auto redirect in 5sec.
13+
useEffect(() => {
14+
setTimeout(() => {
15+
window.location.href = EnvironmentConfig.TOPCODER_URLS.ACCOUNT_SETTINGS
16+
}, 5000)
17+
}, [])
4518

4619
return (
4720
<div className={styles.cards}>
4821

49-
<Card title='Account'>
50-
<p>
51-
<strong>Email:</strong>
52-
{' '}
53-
{profile.email}
54-
</p>
55-
<p>
56-
<strong>Username:</strong>
57-
{' '}
58-
{profile.handle}
59-
</p>
60-
</Card>
61-
62-
<Card
63-
title='Name'
64-
onClick={toggleEditName}
65-
>
66-
<p>
67-
{profile.firstName}
68-
{' '}
69-
{profile.lastName}
70-
</p>
71-
<Button
72-
label='edit name'
73-
onClick={toggleEditName}
74-
tabIndex={1}
75-
buttonStyle='secondary'
76-
/>
77-
</Card>
78-
79-
<Modal
80-
open={editProfileOpen}
81-
onClose={toggleEditName}
82-
classNames={{ modal: 'account-settings-modal' }}
83-
>
84-
<EditName onClose={toggleEditName} />
85-
</Modal>
86-
87-
<Card
88-
onClick={toggleChangePassword}
89-
title='Password'
90-
>
91-
<p>
92-
*******************
93-
</p>
94-
<Button
95-
label='change password'
96-
onClick={toggleChangePassword}
97-
tabIndex={2}
98-
buttonStyle='secondary'
99-
/>
100-
</Card>
101-
102-
<Modal
103-
open={changePasswordOpen}
104-
onClose={toggleChangePassword}
105-
classNames={{ modal: 'account-settings-modal' }}
106-
>
107-
<ChangePassword onClose={toggleChangePassword} />
108-
</Modal>
109-
22+
<h3>This page has moved.</h3>
23+
<Button label='Navigate to Account Settings' url={`${EnvironmentConfig.TOPCODER_URLS.ACCOUNT_SETTINGS}`} />
24+
<p>We will automatically redirect you in 5 seconds...</p>
11025
</div>
11126
)
11227
}

src-ts/utils/settings/account/change-password/ChangePassword.tsx

Lines changed: 0 additions & 58 deletions
This file was deleted.

src-ts/utils/settings/account/change-password/change-password-form.config.ts

Lines changed: 0 additions & 98 deletions
This file was deleted.

src-ts/utils/settings/account/change-password/index.ts

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)