Skip to content

Commit f7ed8a0

Browse files
Merge branch 'dev' into TCA-883_temp-dev
2 parents d57cf80 + f744f7e commit f7ed8a0

14 files changed

+40
-407
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export const EnvironmentConfigDefault: EnvironmentConfigModel = {
3636
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb2xlcyI6WyJUb3Bjb2RlciBVc2VyIl0sImlzcyI6Imh0dHBzOi8vYXBpLnRvcGNvZGVyLWRldi5jb20iLCJoYW5kbGUiOiJ0ZXN0MSIsImV4cCI6MjU2MzA3NjY4OSwidXNlcklkIjoiNDAwNTEzMzMiLCJpYXQiOjE0NjMwNzYwODksImVtYWlsIjoidGVzdEB0b3Bjb2Rlci5jb20iLCJqdGkiOiJiMzNiNzdjZC1iNTJlLTQwZmUtODM3ZS1iZWI4ZTBhZTZhNGEifQ.jl6Lp_friVNwEP8nfsfmL-vrQFzOFp2IfM_HC7AwGcg',
3737
},
3838
TOPCODER_URLS: {
39+
ACCOUNT_PROFILE: `${COMMUNITY_WEBSITE}/settings/profile`,
3940
ACCOUNT_SETTINGS: `${COMMUNITY_WEBSITE}/settings/account`,
4041
API_BASE: `${COMMUNITY_WEBSITE}/api`,
4142
BLOG_PAGE: `${COMMUNITY_WEBSITE}/blog`,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export const EnvironmentConfigProd: EnvironmentConfigModel = {
3434
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb2xlcyI6WyJUb3Bjb2RlciBVc2VyIl0sImlzcyI6Imh0dHBzOi8vYXBpLnRvcGNvZGVyLWRldi5jb20iLCJoYW5kbGUiOiJ0ZXN0MSIsImV4cCI6MjU2MzA3NjY4OSwidXNlcklkIjoiNDAwNTEzMzMiLCJpYXQiOjE0NjMwNzYwODksImVtYWlsIjoidGVzdEB0b3Bjb2Rlci5jb20iLCJqdGkiOiJiMzNiNzdjZC1iNTJlLTQwZmUtODM3ZS1iZWI4ZTBhZTZhNGEifQ.jl6Lp_friVNwEP8nfsfmL-vrQFzOFp2IfM_HC7AwGcg',
3535
},
3636
TOPCODER_URLS: {
37+
ACCOUNT_PROFILE: `${COMMUNITY_WEBSITE}/settings/profile`,
3738
ACCOUNT_SETTINGS: `${COMMUNITY_WEBSITE}/settings/account`,
3839
API_BASE: `${COMMUNITY_WEBSITE}/api`,
3940
BLOG_PAGE: `${COMMUNITY_WEBSITE}/blog`,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export interface GlobalConfig {
2929
CUSTOMER_TOKEN: string
3030
}
3131
TOPCODER_URLS: {
32+
ACCOUNT_PROFILE: string
3233
ACCOUNT_SETTINGS: string
3334
API_BASE: string
3435
BLOG_PAGE: 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 & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -1,112 +1,29 @@
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'
1+
import { FC, useEffect } from 'react'
42

5-
import {
6-
Button,
7-
Card,
8-
formGetInputFields,
9-
FormInputModel,
10-
formOnReset,
11-
profileContext,
12-
ProfileContextData,
13-
} from '../../../lib'
3+
import { Button } from '../../../lib'
4+
import { EnvironmentConfig } from '../../../config'
145

15-
import { ChangePassword } from './change-password'
16-
import { EditName, editNameFormDef } from './edit-name'
176
import styles from './Account.module.scss'
187

8+
/**
9+
* DEPRECTED
10+
* TODO: Remove after some time, when clear no one links to here...
11+
*/
1912
const Account: FC<{}> = () => {
2013

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-
}
14+
// setup auto redirect in 5sec.
15+
useEffect(() => {
16+
setTimeout(() => {
17+
window.location.href = EnvironmentConfig.TOPCODER_URLS.ACCOUNT_SETTINGS
18+
}, 5000)
19+
}, [])
4520

4621
return (
4722
<div className={styles.cards}>
4823

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-
24+
<h3>This page has moved.</h3>
25+
<Button label='Navigate to Account Settings' url={`${EnvironmentConfig.TOPCODER_URLS.ACCOUNT_PROFILE}`} />
26+
<p>We will automatically redirect you in 5 seconds...</p>
11027
</div>
11128
)
11229
}

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)