Skip to content

Commit b5ac15a

Browse files
committed
feat: Implement user sign-up component with form validation and API integration.
1 parent 3d43317 commit b5ac15a

2 files changed

Lines changed: 58 additions & 16 deletions

File tree

timeless-api/src/main/webui/src/app/pages/sign/sign-up/sign-up.component.html

Lines changed: 56 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,79 @@ <h1 class="text-xl font-thin my-2 text-center">
22
Olá, <span class="font-bold">Timeless</span> 🕰
33
</h1>
44

5-
<form [formGroup]="form" (ngSubmit)="onSubmit()" class="flex flex-col w-[300px] gap-2">
5+
<form
6+
[formGroup]="form"
7+
(ngSubmit)="onSubmit()"
8+
class="flex flex-col w-[300px] gap-2"
9+
>
610
<p-float-label variant="in">
7-
<input id="first_name" class="w-full text-center font-medium" type="text" pSize="small" pInputText
8-
formControlName="firstName" autocomplete="false" />
11+
<input
12+
id="first_name"
13+
class="w-full text-center font-medium"
14+
type="text"
15+
pSize="small"
16+
pInputText
17+
formControlName="firstName"
18+
autocomplete="false"
19+
/>
920
<label for="first_name">Seu primeiro nome</label>
1021
</p-float-label>
1122
<p-float-label variant="in">
12-
<input id="last_name" class="w-full text-center font-medium" type="text" pSize="small" pInputText
13-
formControlName="lastName" autocomplete="false" />
23+
<input
24+
id="last_name"
25+
class="w-full text-center font-medium"
26+
type="text"
27+
pSize="small"
28+
pInputText
29+
formControlName="lastName"
30+
autocomplete="false"
31+
/>
1432
<label for="last_name">Seu último nome</label>
1533
</p-float-label>
1634
<p-float-label variant="in">
17-
<input id="email" class="w-full text-center font-medium" type="text" pSize="small" pInputText
18-
formControlName="email" autocomplete="false" />
35+
<input
36+
id="email"
37+
class="w-full text-center font-medium"
38+
type="text"
39+
pSize="small"
40+
pInputText
41+
formControlName="email"
42+
autocomplete="false"
43+
/>
1944
<label for="email">Seu melhor e-mail</label>
2045
</p-float-label>
2146
<p-float-label variant="in">
22-
<p-inputMask id="phone_number" styleClass="w-full text-center font-medium" mask="(99) 99999-9999"
23-
formControlName="phoneNumber" autocomplete="off" [showClear]="true" />
47+
<p-inputMask
48+
id="phone_number"
49+
styleClass="w-full text-center font-medium"
50+
mask="(99) 99999-9999"
51+
formControlName="phoneNumber"
52+
autocomplete="off"
53+
/>
2454
<label for="phone_number">Seu número de telefone</label>
2555
</p-float-label>
2656
<p-float-label variant="in">
27-
<input id="password" class="w-full text-center font-medium" type="password" pSize="small" pInputText
28-
formControlName="password" autocomplete="false" />
57+
<input
58+
id="password"
59+
class="w-full text-center font-medium"
60+
type="password"
61+
pSize="small"
62+
pInputText
63+
formControlName="password"
64+
autocomplete="false"
65+
/>
2966
<label for="password">Sua senha</label>
3067
</p-float-label>
31-
<p-button type="submit" [style]="{ width: '100%' }" label="Cadastrar" severity="primary" size="small"></p-button>
68+
<p-button
69+
type="submit"
70+
[style]="{ width: '100%' }"
71+
label="Cadastrar"
72+
severity="primary"
73+
size="small"
74+
></p-button>
3275
<p class="text-xs text-center font-extralight">
3376
Já possui uma conta? Clique
3477
<a [routerLink]="['']" class="primary-emphasis font-normal">aqui</a>
3578
para acessar.
3679
</p>
37-
</form>
80+
</form>

timeless-api/src/main/webui/src/app/pages/sign/sign-up/sign-up.component.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import { InputMask } from 'primeng/inputmask';
3131
})
3232
export class SignUpComponent {
3333
formBuilder = inject(FormBuilder);
34-
regex = /^\+?\d{1,3}?[\s-]?\(?\d{1,4}\)?([\s-]?\d{2,4}){1,3}$/;
3534
form: FormGroup = this.formBuilder.group({
3635
email: ['', [Validators.email, Validators.required]],
3736
password: [
@@ -40,14 +39,14 @@ export class SignUpComponent {
4039
],
4140
firstName: ['', [Validators.required, Validators.minLength(1)]],
4241
lastName: ['', [Validators.required, Validators.minLength(1)]],
43-
phoneNumber: ['', [Validators.required, Validators.pattern(this.regex)]],
42+
phoneNumber: ['', [Validators.required]],
4443
});
4544

4645
constructor(
4746
private readonly timelessApiService: TimelessApiService,
4847
private readonly router: Router,
4948
private readonly toast: ToastService,
50-
) { }
49+
) {}
5150

5251
onSubmit() {
5352
if (this.form.valid) {

0 commit comments

Comments
 (0)