Skip to content

Commit 67aa884

Browse files
Merge pull request #48 from Typext/develop
Develop
2 parents fea7aa9 + 1342e22 commit 67aa884

File tree

33 files changed

+437
-202
lines changed

33 files changed

+437
-202
lines changed

public/app_logo.svg

Lines changed: 4 additions & 2 deletions
Loading

src/DTOs/Auth.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { StringifyOptions } from 'node:querystring';
21
import { ReactNode } from 'react';
32

43
export interface AuthState {
@@ -43,8 +42,9 @@ export interface RecoveryCredentials {
4342
}
4443

4544
export interface ResetCredentials {
45+
email: string;
4646
password: string;
47-
confirmPassword: string;
47+
password_confirmation: string;
4848
}
4949

5050
interface InvitationData {
@@ -65,6 +65,7 @@ interface RecoveryPassowordData {
6565
interface ResetPasswordData {
6666
error: String;
6767
loader: boolean;
68+
success: boolean;
6869
}
6970

7071
export interface AuthContextData {

src/components/BoxInformation/styles.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const StyledBoxInformation = styled.div`
2727
justify-content: flex-end;
2828
2929
color: #fff;
30-
font-size: 1.5rem;
30+
font-size: 1rem;
3131
font-weight: 900;
3232
margin: 0;
3333

src/components/Button/styles.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ const StyledButton = styled.button<StyledButtonProps>`
1414
width: ${props => props.size || '17.313rem'};
1515
height: 4.063rem;
1616
border-radius: 1.25rem;
17-
border: none;
18-
outline: none;
17+
border: 0.063rem;
18+
outline: 0.063rem;
1919
2020
font-family: Roboto;
2121
font-style: normal;
2222
font-weight: bold;
23-
font-size: 1.5rem;
23+
font-size: 2rem;
2424
2525
color: ${props => props.colorText || '#fff'};
2626
background: ${props => props.color || '#F60846'};

src/components/FormUpdate/index.tsx

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ import { Form } from '@unform/web';
55

66
import InputForm from 'components/InputForm';
77
import Button from 'components/Button/Button';
8+
import Input from 'components/Input/Input';
89

910
import { Container } from './styles';
1011

1112
interface FormUpdateProps {
13+
emailIsNotAllowed?: boolean;
1214
handleSubmit: any;
1315
formRef: any;
1416
hasPasswordField?: boolean;
@@ -30,6 +32,7 @@ interface ParamsProps {
3032
email: string;
3133
}
3234
function FormUpdate({
35+
emailIsNotAllowed,
3336
handleSubmit,
3437
formRef,
3538
inviteInfo,
@@ -64,12 +67,24 @@ function FormUpdate({
6467
title="Empresa"
6568
/>
6669

67-
<InputForm
68-
name="email"
69-
title="E-mail"
70-
defaultValue={paramsEmail || user?.email || ''}
71-
readOnly={!!paramsEmail}
72-
/>
70+
{emailIsNotAllowed ? (
71+
<Input
72+
name="email"
73+
title="E-mail"
74+
styleWidth="40rem"
75+
color="var(--black);"
76+
weight="bold"
77+
defaultValue={paramsEmail || user?.email || ''}
78+
readOnly={!!paramsEmail}
79+
/>
80+
) : (
81+
<InputForm
82+
name="email"
83+
title="E-mail"
84+
defaultValue={paramsEmail || user?.email || ''}
85+
readOnly={!!paramsEmail}
86+
/>
87+
)}
7388

7489
<InputForm defaultValue={user?.phone} name="phone" title="Telefone" />
7590

@@ -98,6 +113,7 @@ function FormUpdate({
98113
}
99114

100115
FormUpdate.defaultProps = {
116+
emailIsNotAllowed: false,
101117
hasPasswordField: false,
102118
user: {
103119
name: '',

src/components/Header/index.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ const Header = () => {
3131
history.push('/minute');
3232
}, [history]);
3333

34+
const handleNavigateToUserUpdate = useCallback(() => {
35+
history.push('/user/update');
36+
}, [history]);
37+
3438
return (
3539
<StyledHeader>
3640
<section className="shortOptions">
@@ -48,7 +52,9 @@ const Header = () => {
4852
</figure>
4953

5054
<section className="usernameAndLogout">
51-
<h1>{user?.name || 'Nome do usuário'}</h1>
55+
<button type="button" onClick={handleNavigateToUserUpdate}>
56+
<h1>{user?.name || 'Nome do usuário'}</h1>
57+
</button>
5258

5359
<button type="button" onClick={handleLogout}>
5460
<img src={logoutIcon} alt="logout" />

src/components/Header/styles.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,13 @@ export const StyledHeader = styled.header`
6161
border: none;
6262
background: none;
6363
}
64+
65+
@media (max-width: 960px) {
66+
zoom: 70%;
67+
height: 6rem;
68+
69+
img {
70+
zoom: 135%;
71+
}
72+
}
6473
`;

src/components/Input/Input.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { StyledInput } from './styles';
44
interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
55
title: string;
66
color?: string;
7+
weight?: string;
78
Size?: string;
89
styleWidth?: string;
910
Type?: string;
@@ -14,6 +15,7 @@ const Input: React.FC<InputProps> = ({
1415
color,
1516
Size,
1617
styleWidth,
18+
weight,
1719
Type,
1820
...rest
1921
}: InputProps) => {
@@ -22,6 +24,7 @@ const Input: React.FC<InputProps> = ({
2224
InputWidth={styleWidth || '23.75rem'}
2325
Color={color || 'var(--black)'}
2426
Size={Size || '1.5rem'}
27+
weight={weight}
2528
className="input-styled"
2629
>
2730
<h3>{title}</h3>
@@ -34,8 +37,9 @@ const Input: React.FC<InputProps> = ({
3437
Input.defaultProps = {
3538
Type: '',
3639
Size: '',
40+
weight: '',
3741
styleWidth: '23.75rem',
38-
color: '',
42+
color: 'var(--black)',
3943
};
4044

4145
export default Input;

src/components/Input/styles.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ interface Props {
44
InputWidth: string;
55
Color: string;
66
Size: string;
7+
weight?: string;
78
}
89

910
export const StyledInput = styled.div<Props>`
@@ -16,7 +17,7 @@ export const StyledInput = styled.div<Props>`
1617
margin: 0;
1718
1819
h3 {
19-
font-weight: bold;
20+
font-weight: 500;
2021
font-size: ${props => props.Size || '1.5rem'};
2122
color: ${props => props.Color || 'var(--black)'};
2223
@@ -33,12 +34,13 @@ export const StyledInput = styled.div<Props>`
3334
font-family: Roboto;
3435
font-size: 1.3rem;
3536
font-style: normal;
36-
font-weight: bold;
37+
font-weight: ${props => props.weight || '400'};
3738
3839
outline: none;
3940
border: 0;
4041
border-radius: 1.25rem;
4142
43+
color: ${props => props.Color || 'var(--black)'};
4244
max-width: ${props => props.InputWidth || '23.75rem'};
4345
width: 100%;
4446
}

src/components/Route/index.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { Route as ReactRoute } from 'react-router-dom';
2+
import { Route as ReactRoute, Redirect } from 'react-router-dom';
33

44
import { useAuth } from 'contexts/auth';
55
import Header from 'components/Header';
@@ -11,15 +11,26 @@ interface RouteProps {
1111
path: string;
1212
exact?: boolean;
1313
isPrivate?: boolean;
14+
onlyAdmin?: boolean;
1415
}
1516

16-
const Route = ({ component: Component, isPrivate, ...rest }: RouteProps) => {
17+
const Route = ({
18+
component: Component,
19+
isPrivate,
20+
onlyAdmin,
21+
...rest
22+
}: RouteProps) => {
1723
const { user: userContext } = useAuth();
1824
const user = getUser();
25+
const userIsAdmin = user?.type === 'Admin';
1926
const userToken = getUserToken();
2027

2128
const userIsAuthenticated = !!user && !!userToken;
2229

30+
if (onlyAdmin && !userIsAdmin) {
31+
return <Redirect to="404" />;
32+
}
33+
2334
return (
2435
<ReactRoute
2536
{...rest}
@@ -49,6 +60,7 @@ const Route = ({ component: Component, isPrivate, ...rest }: RouteProps) => {
4960

5061
Route.defaultProps = {
5162
exact: false,
63+
onlyAdmin: false,
5264
isPrivate: false,
5365
};
5466

0 commit comments

Comments
 (0)