Skip to content

Commit 6c94bb1

Browse files
PLAT-826 temp dev - dev (#52)
* PLAT-754 #comment remove commented out tests #time 5m * PLAT-802 #comment create profile util; fix padding for content layout; #time 1h * PLAT-825 #comment fix profile styling; create form element and text input; remove profile from content layout; #time 6h * PLAT-825 #comment consolidate font styles; #time 1h * PLAT-828 #comment create button component; migrate existing buttons to component; #time 30m * PLAT-825 Form Text Fields & Profile - PLAT-802_profile-util (#46) * PLAT-536 #comment add logout #time 15m * PLAt-536 #comment fix link hover #time 5m * PLAT-536 #comment fix logo size #time 15m * PLAT-764 #comment convert svgs to components and export from lib #time 30m * PLAT-764 #comment remove styling from SVGs; permit route route for isactive nav #time 1h * PLAT-764 #comment refactor narrow tool selectors so they are not a route; #time 30m * PLAT-764 #comment rename svgs folder #time 5m * PLAT-764 #comment clean up styles and svgs; #time 30m * PLAT-764 #comment clean-up #time 5m * PALT-764 #comment clean-up #time 5m * PLAT-764 #comment clean-up #time 5m * PLAT-764 #comment clean-up #time 5m * PLAT-764 #comment clean-upo #time 5m * PLAT-754 #comment convert url configs to constants; define section routes in section #time 2h * PLAT-754 #comment create and use route provider #time 2.75h * PLAT-745 #comment add child routes; clean up root config dir; clean up tool selectors; #time 1h * PLAT-754 #comment configure sections in content layout; design lib routes and sections #time 1h * PLAT-754 #comment replace route config w/route utils; create *.routes for each tool/util; #time 1h * PLAT-754 #comment hide sections for tools that don't have any #time 10m * PLAT-754 #comment fix styling for expanded narrow tool selectors; #time 15m * PLAT-754 #comment route provider cleanup #time 1h * PLAT-754 #comment tools narrow clean-up; #time 30m * PLAT-764 #comment clean-up #time 5m * PLAT-7584 #comment clean-up #time 10m * POLAT-754 #comment clean-up #time 5m * PLAT-754 #comment clean-up #time 5m * PLAT-754 #comment clean-up #time 5m * PLAT-754 #comment update readme #time 10m * PLAT-754 #comment fix build issues #time 10m * PLAT-754 #comment clean-up #time 5m * PLAT-754 #comment remove commented out tests #time 5m * PLAT-802 #comment create profile util; fix padding for content layout; #time 1h * PLAT-825 #comment fix profile styling; create form element and text input; remove profile from content layout; #time 6h * PLAT-825 #comment consolidate font styles; #time 1h * PLAT-828 #comment use axios for xhr; update button component; remove all service classes; wire up api call to update profile #time 6h * PLAT-828 #comment rename all services to functions; #time 10m * PLAT-828 #comment add update password functions #time 30m * PLAT-828 #comment clean-up #time 5m * PLAT-828 #comment clean-up #time 10m * PLAT-828 #comment use v3 api for pw change #time 45m * PLAT-828 profile api to PLAT-802_profile-util (#50) * PLAT-536 #comment add logout #time 15m * PLAt-536 #comment fix link hover #time 5m * PLAT-536 #comment fix logo size #time 15m * PLAT-764 #comment convert svgs to components and export from lib #time 30m * PLAT-764 #comment remove styling from SVGs; permit route route for isactive nav #time 1h * PLAT-764 #comment refactor narrow tool selectors so they are not a route; #time 30m * PLAT-764 #comment rename svgs folder #time 5m * PLAT-764 #comment clean up styles and svgs; #time 30m * PLAT-764 #comment clean-up #time 5m * PALT-764 #comment clean-up #time 5m * PLAT-764 #comment clean-up #time 5m * PLAT-764 #comment clean-up #time 5m * PLAT-764 #comment clean-upo #time 5m * PLAT-754 #comment convert url configs to constants; define section routes in section #time 2h * PLAT-754 #comment create and use route provider #time 2.75h * PLAT-745 #comment add child routes; clean up root config dir; clean up tool selectors; #time 1h * PLAT-754 #comment configure sections in content layout; design lib routes and sections #time 1h * PLAT-754 #comment replace route config w/route utils; create *.routes for each tool/util; #time 1h * PLAT-754 #comment hide sections for tools that don't have any #time 10m * PLAT-754 #comment fix styling for expanded narrow tool selectors; #time 15m * PLAT-754 #comment route provider cleanup #time 1h * PLAT-754 #comment tools narrow clean-up; #time 30m * PLAT-764 #comment clean-up #time 5m * PLAT-7584 #comment clean-up #time 10m * POLAT-754 #comment clean-up #time 5m * PLAT-754 #comment clean-up #time 5m * PLAT-754 #comment clean-up #time 5m * PLAT-754 #comment update readme #time 10m * PLAT-754 #comment fix build issues #time 10m * PLAT-754 #comment clean-up #time 5m * PLAT-754 #comment remove commented out tests #time 5m * PLAT-802 #comment create profile util; fix padding for content layout; #time 1h * PLAT-825 #comment fix profile styling; create form element and text input; remove profile from content layout; #time 6h * PLAT-825 #comment consolidate font styles; #time 1h * PLAT-828 #comment create button component; migrate existing buttons to component; #time 30m * PLAT-828 #comment use axios for xhr; update button component; remove all service classes; wire up api call to update profile #time 6h * PLAT-828 #comment rename all services to functions; #time 10m * PLAT-828 #comment add update password functions #time 30m * PLAT-828 #comment clean-up #time 5m * PLAT-828 #comment clean-up #time 10m * PLAT-828 #comment use v3 api for pw change #time 45m * PLAT-828 #comment remove obsolete TODO; change password input names to prevent auto-fill; #time 10m * PLAT-826 #comment reset pw fields upon submission #time 10m * PLAT-826 #comment permit buttons that don't have click handlers; add required and email validation for forms; require the form field wrapper for text inputs; #time 4h * PLAT-826 #comment support for fields that are required if an other field is not blank; #time 2h * PLAT-826 #comment clean-up #time 10m * PLAT-826 #comment clean-up #time 5m * PLAT-826 #comment merge dev #time 10m
1 parent 72f153b commit 6c94bb1

File tree

93 files changed

+1121
-454
lines changed

Some content is hidden

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

93 files changed

+1121
-454
lines changed

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"dependencies": {
66
"@datadog/browser-logs": "^4.5.0",
77
"@heroicons/react": "^1.0.6",
8+
"axios": "^0.26.1",
89
"browser-cookies": "^1.2.0",
910
"classnames": "^2.3.1",
1011
"react": "^17.0.2",
@@ -51,6 +52,7 @@
5152
"@testing-library/jest-dom": "^5.14.1",
5253
"@testing-library/react": "^12.0.0",
5354
"@testing-library/user-event": "^13.2.1",
55+
"@types/axios": "^0.14.0",
5456
"@types/jest": "^27.0.1",
5557
"@types/node": "^16.7.13",
5658
"@types/react": "^17.0.20",

src/App.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ import { Route, Routes } from 'react-router-dom'
33

44
import { EnvironmentConfig } from './config'
55
import { Header } from './header'
6-
import { AnalyticsService, LoggingService, ProfileProvider } from './lib'
6+
import { initializeAnalytics, initializeLogger, ProfileProvider } from './lib'
77
import { RouteContext, RouteContextData } from './lib/route-provider'
88

9-
new AnalyticsService().initialize(EnvironmentConfig)
10-
new LoggingService().initialize(EnvironmentConfig)
9+
initializeAnalytics(EnvironmentConfig)
10+
initializeLogger(EnvironmentConfig)
1111

1212
const App: FC<{}> = () => {
1313

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { AppHostEnvironment } from './app-host-environment.enum'
44

55
export const EnvironmentConfigDefault: GlobalConfig = {
66
API: {
7+
V3: 'https://api.topcoder-dev.com/v3',
78
V5: 'https://api.topcoder-dev.com/v5',
89
},
910
ENV: AppHostEnvironment.default,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { EnvironmentConfigDefault } from './environment.default.config'
66
export const EnvironmentConfigProd: GlobalConfig = {
77
...EnvironmentConfigDefault,
88
API: {
9+
V3: 'https://api.topcoder.com/v3',
910
V5: 'https://api.topcoder.com/v5',
1011
},
1112
ENV: AppHostEnvironment.prod,

src/header/utility-selectors/UtilitySelector/ProfileSelector/profile-logged-in/ProfileLoggedIn.module.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
$overlaySquare: calc($pad-xxxxl + 2 * $border);
44

5-
.profile-avater,
5+
.profile-avatar,
66
.overlay {
77
cursor: pointer;
88
}

src/header/utility-selectors/UtilitySelector/ProfileSelector/profile-logged-in/ProfileLoggedIn.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Dispatch, FC, SetStateAction, useContext, useState } from 'react'
22

3-
import { Avatar, IconOutline, LoggingService, ProfileContext, ProfileContextData } from '../../../../../lib'
3+
import { Avatar, IconOutline, logInfo , ProfileContext, ProfileContextData } from '../../../../../lib'
44

55
import { ProfilePanel } from './profile-panel'
66
import styles from './ProfileLoggedIn.module.scss'
@@ -9,10 +9,9 @@ const ProfileLoggedIn: FC<{}> = () => {
99

1010
const { profile }: ProfileContextData = useContext(ProfileContext)
1111
const [profilePanelOpen, setProfilePanelOpen]: [boolean, Dispatch<SetStateAction<boolean>>] = useState<boolean>(false)
12-
const logger: LoggingService = new LoggingService()
1312

1413
if (!profile) {
15-
logger.logInfo('tried to render the logged in profile w/out a profile')
14+
logInfo('tried to render the logged in profile w/out a profile')
1615
return <></>
1716
}
1817

@@ -22,7 +21,7 @@ const ProfileLoggedIn: FC<{}> = () => {
2221

2322
return (
2423
<>
25-
<div className={styles['profile-avater']} onClick={() => toggleProfilePanel()} >
24+
<div className={styles['profile-avatar']} onClick={() => toggleProfilePanel()} >
2625
<Avatar
2726
firstName={profile.firstName}
2827
lastName={profile.lastName}

src/header/utility-selectors/UtilitySelector/ProfileSelector/profile-logged-in/profile-panel/ProfilePanel.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import { FC, useContext } from 'react'
22
import { Link } from 'react-router-dom'
33

44
import {
5-
AuthenticationUrlConfig,
5+
logoutUrl,
66
ProfileContext,
77
ProfileContextData,
8-
ProfileRouteConfig,
8+
profileRoute,
99
} from '../../../../../../lib'
1010

1111
import styles from './ProfilePanel.module.scss'
@@ -31,11 +31,11 @@ const ProfilePanel: FC<ProfilePanelProps> = (props: ProfilePanelProps) => {
3131
<Link
3232
className={styles.profile}
3333
onClick={() => props.toggleProfilePanel()}
34-
to={ProfileRouteConfig.profile}
34+
to={profileRoute}
3535
>
3636
My Profile
3737
</Link>
38-
<a href={AuthenticationUrlConfig.logout} className={styles.logout}>
38+
<a href={logoutUrl} className={styles.logout}>
3939
Log Out
4040
</a>
4141
</div>

src/header/utility-selectors/UtilitySelector/ProfileSelector/profile-not-logged-in/ProfileNotLoggedIn.tsx

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
1-
import classNames from 'classnames'
21
import { FC } from 'react'
32

4-
import { AuthenticationUrlConfig, routeRoot } from '../../../../../lib'
3+
import { Button, loginUrl, routeRoot, signupUrl } from '../../../../../lib'
54
import '../../../../../lib/styles/index.scss'
65

76
import styles from './ProfileNotLoggedIn.module.scss'
87

98
const ProfileNotLoggedIn: FC<{}> = () => {
109

11-
const buttonClass: string = 'button'
12-
1310
return (
1411
<>
15-
<a
16-
className={classNames(buttonClass, styles.login)}
17-
href={AuthenticationUrlConfig.login(routeRoot)}
18-
>
19-
Log In
20-
</a>
21-
<a
22-
className={classNames(buttonClass, 'all-white', styles.signup)}
23-
href={AuthenticationUrlConfig.signup(routeRoot)}
24-
>
25-
Sign Up
26-
</a>
12+
<Button
13+
className={styles.login}
14+
label='Log In'
15+
size='sm'
16+
buttonStyle='text'
17+
url={loginUrl(routeRoot)}
18+
/>
19+
<Button
20+
className={styles.signup}
21+
label='Sign Up'
22+
size='sm'
23+
buttonStyle='tertiary'
24+
url={signupUrl(routeRoot)}
25+
/>
2726
</>
2827
)
2928
}

src/lib/button/Button.tsx

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import classNames from 'classnames'
2+
import { FC } from 'react'
3+
4+
interface ButtonProps {
5+
readonly buttonStyle?: 'primary' | 'secondary' | 'tertiary' | 'text'
6+
readonly className?: string
7+
readonly disable?: boolean
8+
readonly label: string
9+
readonly onClick?: (event?: any) => void
10+
readonly size?: 'sm' | 'md' | 'lg' | 'xl'
11+
readonly type?: 'button' | 'submit'
12+
readonly url?: string
13+
}
14+
15+
const Button: FC<ButtonProps> = (props: ButtonProps) => {
16+
17+
const classes: string = classNames(
18+
'button',
19+
props.className,
20+
props.buttonStyle || 'primary',
21+
`button-${props.size || 'md'}`
22+
)
23+
24+
// if there is a url, this is a link button
25+
if (!!props.url) {
26+
return (
27+
<a
28+
className={classes}
29+
href={props.url}
30+
>
31+
{props.label}
32+
</a>
33+
)
34+
}
35+
36+
// if there is no click handler, the button is prob a submit
37+
// button, so just add a blank click handler
38+
const clickHandler: (event: any) => void = props.onClick || (() => undefined)
39+
40+
return (
41+
<button
42+
className={classes}
43+
disabled={!!props.disable}
44+
onClick={event => clickHandler(event)}
45+
type={props.type || 'button'}
46+
>
47+
{props.label}
48+
</button>
49+
)
50+
}
51+
52+
export default Button

src/lib/button/Buttons.test.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import '@testing-library/jest-dom'
2+
3+
describe('<Button />', () => {
4+
5+
test('it should render the content', () => { })
6+
})

0 commit comments

Comments
 (0)