Skip to content

Commit 98915b3

Browse files
committed
fix register, stage-zero onboarding, shared modules
1 parent c7cd1ae commit 98915b3

22 files changed

Lines changed: 214 additions & 103 deletions

File tree

projects/core/src/consts/list-years.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,6 @@ export const yearList = [
164164
{
165165
value: 2025,
166166
id: 25,
167-
label: "настоящее время",
167+
label: "по наст. вр.",
168168
},
169169
];

projects/core/src/lib/services/validation.service.ts

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,49 @@ export class ValidationService {
140140
useAgeValidator(age = 14): ValidatorFn {
141141
return control => {
142142
const value = dayjs(control.value, "DD.MM.YYYY", true);
143+
const difference = dayjs().diff(value, "year");
144+
145+
const isInvalidDate = !value.isValid() || value.year() < 1900;
146+
const isTooYoung = difference < age;
147+
const isTooOld = difference > 100;
148+
149+
return isInvalidDate
150+
? { invalidDateFormat: { requiredAge: 100 } }
151+
: isTooYoung
152+
? { tooYoung: { requiredAge: age } }
153+
: isTooOld
154+
? { tooOld: { requiredAge: 100 } }
155+
: null;
156+
};
157+
}
143158

144-
if (value.isValid()) {
145-
const difference = dayjs().diff(value, "year");
146-
return difference >= age ? null : { tooYoung: { requiredAge: age } };
159+
/**
160+
* Создает валидатор для проверки валидности полного email
161+
* @returns ValidatorFn для проверки возраста
162+
*
163+
* Применение:
164+
* - Проверка валидности
165+
* - Валидация полного email
166+
*
167+
* Логика:
168+
* 1. Создаем регулрку для email
169+
* 2. Тестируем подходит ли она нам
170+
*
171+
* Пример использования:
172+
* email: ['', [
173+
* Validators.required,
174+
* this.validationService.useEmailValidator()
175+
* ]]
176+
*/
177+
useEmailValidator(): ValidatorFn {
178+
return control => {
179+
const value = control.value;
180+
const regex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
181+
if (regex.test(value)) {
182+
return null;
183+
} else {
184+
return { invalidEmail: {} };
147185
}
148-
149-
return null;
150186
};
151187
}
152188

projects/skills/src/app/shared/sidebar-profile/sidebar-profile.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020
<div class="text-bold-body-14 user__name">{{ user()?.firstName }} {{ user()?.lastName }}</div>
2121
</div>
2222
<div class="user__row">
23-
@if (user()?.verificationDate; as verificationDate) {
23+
<!-- @if (user()?.verificationDate; as verificationDate) {
2424
<div class="text-body-12 user__verified">
2525
Подтвержден с {{ verificationDate | dayjs: "format":"DD.MM.YY" }}
2626
</div>
2727
} @else {
2828
<div class="text-body-12 user__not-verified">Ожидает подтверждения</div>
29-
}
29+
} -->
3030
<a href="https://app.procollab.ru/office" (click)="$event.stopPropagation()">
3131
<button class="user__logout text-bold-body-14" (click)="logout.emit()">
3232
<span>Вернуться</span>

projects/social_platform/src/app/auth/register/register.component.html

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,12 @@ <h3 class="auth__title auth__title--register">
217217
{{ errorMessage.MINIMAL_AGE }}
218218
{{ birthday.errors["tooYoung"]["requiredAge"] }} лет }
219219
</div>
220+
} @if (birthday | controlError: "tooOld") {
221+
<div class="text-body-14 error">
222+
@if (birthday.errors) {
223+
{{ errorMessage.MAXIMAL_AGE }}
224+
{{ birthday.errors["tooOld"]["requiredAge"] }} лет }
225+
</div>
220226
} @if (birthday | controlError: "invalidDateFormat") {
221227
<div class="text-body-14 error">
222228
{{ errorMessage.INVALID_DATE }}
@@ -251,7 +257,16 @@ <h3 class="auth__title auth__title--register">
251257
>Нажимая на кнопку подтверждаете, что вам больше 14 лет</span
252258
>
253259
</div>
254-
<app-button type="submit" class="auth__button" customTypographyClass="auth__button-typography">
260+
<app-button
261+
type="submit"
262+
class="auth__button"
263+
[disabled]="!(ageAgreement && registerAgreement)"
264+
[ngStyle]="{
265+
opacity: !(ageAgreement && registerAgreement) ? '0.6' : '1',
266+
cursor: !(ageAgreement && registerAgreement) ? 'not-allowed' : 'pointer'
267+
}"
268+
customTypographyClass="auth__button-typography"
269+
>
255270
Далее
256271
</app-button>
257272
} @else if (step === "info") {

projects/social_platform/src/app/auth/register/register.component.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,10 @@ export class RegisterComponent implements OnInit {
6969
this.validationService.useAgeValidator(),
7070
],
7171
],
72-
email: ["", [Validators.required, Validators.email]],
72+
email: [
73+
"",
74+
[Validators.required, Validators.email, this.validationService.useEmailValidator()],
75+
],
7376
password: ["", [Validators.required, Validators.minLength(6)]],
7477
repeatedPassword: ["", [Validators.required]],
7578
},

projects/social_platform/src/app/error/models/error-message.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export enum ErrorMessage {
3030
VALIDATION_TOO_SHORT = "Минимальная длина:",
3131
VALIDATION_REQUIRED = "Обязательное поле",
3232
MINIMAL_AGE = "Минимальный возраст",
33+
MAXIMAL_AGE = "Максимальный возраст",
3334
INVALID_DATE = "Неправильный формат даты",
3435
VALIDATION_LANGUAGE = "Используйте символы кириллического алфавита",
3536
VALIDATION_EMAIL = "Введенное значение не соответствует формату email",

projects/social_platform/src/app/office/onboarding/stage-two/stage-two.component.scss

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@use "styles/responsive";
2+
@use "styles/typography";
23

34
.auth {
45
&__greeting {
@@ -80,6 +81,16 @@
8081
&__skills {
8182
display: flex;
8283
flex-direction: column;
84+
85+
::ng-deep {
86+
app-autocomplete-input {
87+
.field__input {
88+
padding: 12px 20px;
89+
90+
@include typography.body-16;
91+
}
92+
}
93+
}
8394
}
8495

8596
&__left {

projects/social_platform/src/app/office/onboarding/stage-zero/stage-zero.component.html

Lines changed: 43 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ <h3 class="auth__title">Привет, {{ profile.firstName }} {{ profile.lastNam
135135
<app-select
136136
formControlName="completionYear"
137137
placeholder="2023 год"
138-
[options]="yearListEducation.slice(5)"
138+
[options]="yearListEducation"
139139
>
140140
<i appIcon icon="arrow-no-body" appSquare="32"></i>
141141
</app-select>
@@ -166,7 +166,7 @@ <h3 class="auth__title">Привет, {{ profile.firstName }} {{ profile.lastNam
166166
</fieldset>
167167
} @if (stageForm.get("educationStatus"); as educationStatus) {
168168
<fieldset>
169-
<label for="educationStatus" class="field-label">Должность</label>
169+
<label for="educationStatus" class="field-label">Статус</label>
170170
<app-select
171171
[selectedId]="selectedEducationStatusId()"
172172
formControlName="educationStatus"
@@ -248,7 +248,7 @@ <h3 class="auth__title">Привет, {{ profile.firstName }} {{ profile.lastNam
248248
class="edit"
249249
appIcon
250250
icon="edit-pen"
251-
appSquare="20"
251+
appSquare="24"
252252
(click)="editEducation($index)"
253253
></i>
254254
</div>
@@ -525,43 +525,48 @@ <h3 class="auth__title">Привет, {{ profile.firstName }} {{ profile.lastNam
525525
>{{ tooltipLanguageText }}</span
526526
>
527527
</div>
528-
<div class="page__years">
529-
@if (stageForm.get("language"); as language) {
530-
<fieldset class="years__left">
531-
<label for="language" class="field-label">Уровень</label>
532-
<app-select
533-
[selectedId]="selectedLanguageId()"
534-
formControlName="language"
535-
placeholder="Английский"
536-
[options]="languageList"
537-
>
538-
<i appIcon icon="arrow-no-body" appSquare="32" class="arrow-list__end"></i>
539-
</app-select>
528+
<div class="page__years--wrapper">
529+
<div class="page__years">
530+
@if (stageForm.get("language"); as language) {
531+
<fieldset class="years__left">
532+
<label for="language" class="field-label">Уровень</label>
533+
<app-select
534+
[selectedId]="selectedLanguageId()"
535+
formControlName="language"
536+
placeholder="Английский"
537+
[options]="languageList"
538+
>
539+
<i appIcon icon="arrow-no-body" appSquare="32" class="arrow-list__end"></i>
540+
</app-select>
540541

541-
@if (language | controlError: "required") {
542-
<div class="text-body-14 error">
543-
{{ errorMessage.VALIDATION_REQUIRED }}
544-
</div>
545-
}
546-
</fieldset>
547-
} @if (stageForm.get("languageLevel"); as languageLevel) {
548-
<fieldset class="years__right" style="margin-top: 26px">
549-
<app-select
550-
[selectedId]="selectedLanguageLevelId()"
551-
formControlName="languageLevel"
552-
placeholder="B1"
553-
[options]="languageLevelList"
554-
>
555-
<i appIcon icon="arrow-no-body" appSquare="32" class="arrow-list__end"></i>
556-
</app-select>
542+
@if (language | controlError: "required") {
543+
<div class="text-body-14 error">
544+
{{ errorMessage.VALIDATION_REQUIRED }}
545+
</div>
546+
}
547+
</fieldset>
548+
} @if (stageForm.get("languageLevel"); as languageLevel) {
549+
<fieldset class="years__right" style="margin-top: 26px">
550+
<app-select
551+
[selectedId]="selectedLanguageLevelId()"
552+
formControlName="languageLevel"
553+
placeholder="B1"
554+
[options]="languageLevelList"
555+
>
556+
<i appIcon icon="arrow-no-body" appSquare="32" class="arrow-list__end"></i>
557+
</app-select>
557558

558-
@if (languageLevel | controlError: "required") {
559-
<div class="text-body-14 error">
560-
{{ errorMessage.VALIDATION_REQUIRED }}
561-
</div>
559+
@if (languageLevel | controlError: "required") {
560+
<div class="text-body-14 error">
561+
{{ errorMessage.VALIDATION_REQUIRED }}
562+
</div>
563+
}
564+
</fieldset>
562565
}
563-
</fieldset>
564-
}
566+
</div>
567+
<span class="text-body-12 page__years--attention"
568+
>Количество добавляемых языков не более 4-х</span
569+
>
565570
</div>
566571

567572
<app-button
@@ -642,7 +647,7 @@ <h3 class="auth__title">Привет, {{ profile.firstName }} {{ profile.lastNam
642647
<div class="cancel">
643648
<div class="cancel__top">
644649
<i (click)="isModalErrorYear.set(false)" appIcon icon="cross" class="cancel__cross"></i>
645-
<p class="cancel__title text-bold-body-16">Произошла ошибка при редактировании!</p>
650+
<p class="cancel__title text-bold-body-16">Произошла ошибка при отправке данных!</p>
646651
</div>
647652
<p class="text-body-14 cancel__text">{{ isModalErrorYearText() }}.</p>
648653
</div>

projects/social_platform/src/app/office/onboarding/stage-zero/stage-zero.component.scss

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,17 @@
4747
display: flex;
4848
gap: 20px;
4949
align-items: center;
50+
margin-bottom: 10px;
51+
margin-top: 10px;
5052

5153
.years__left,
5254
.years__right {
5355
width: 50%;
5456
}
57+
58+
&--attention {
59+
color: var(--dark-grey);
60+
}
5561
}
5662
}
5763

@@ -82,7 +88,7 @@
8288
position: absolute;
8389
top: 65%;
8490
left: 38%;
85-
z-index: 100;
91+
z-index: 10;
8692
display: none;
8793
width: 250px;
8894
padding: 12px;
@@ -125,15 +131,16 @@
125131
gap: 20px;
126132
align-items: center;
127133
justify-content: space-between;
128-
width: 90%;
129134
padding: 12px;
130135
overflow: hidden;
131136
border: 1px solid var(--medium-grey-for-outline);
132137
border-radius: 15px;
138+
width: 100%;
133139
}
134140

135141
&__text {
136142
color: var(--dark-grey);
143+
width: 90%;
137144
}
138145

139146
&__remove {
@@ -163,7 +170,6 @@
163170
}
164171

165172
.edit {
166-
width: 10%;
167173
color: var(--dark-grey);
168174
cursor: pointer;
169175
}
@@ -172,6 +178,10 @@
172178
color: var(--red);
173179
}
174180

181+
i {
182+
width: 24px;
183+
}
184+
175185
.cancel {
176186
display: flex;
177187
flex-direction: column;

0 commit comments

Comments
 (0)