Skip to content

Commit 95bdcb6

Browse files
committed
add partner-project icon to info-card component, fix buttons in onboarding & error class & specs & skills picking groups & detail permisions
1 parent c7af7a5 commit 95bdcb6

20 files changed

Lines changed: 398 additions & 112 deletions

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export enum ErrorMessage {
3535
VALIDATION_LANGUAGE = "Используйте символы кириллического алфавита",
3636
VALIDATION_EMAIL = "Введенное значение не соответствует формату email",
3737
VALIDATION_PASSWORD_UNMATCH = "Пароли не совпадают",
38-
EMPTY_AVATAR = "*Выберите фото для профиля",
38+
EMPTY_AVATAR = "Выберите фото для профиля",
3939
VALIDATION_PATTERN = "Введите корректную ссылку, начинающуюся с http:// или https://",
4040

4141
// Ошибки приглашений в проект

projects/social_platform/src/app/office/features/detail/detail.component.html

Lines changed: 68 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -61,20 +61,43 @@
6161
</div>
6262

6363
<ng-template #programTpl>
64-
@if (!isUserMember && !isUserManager && !registerDateExpired) { @if
65-
(info().name.includes("Кейс-чемпионат MIR")) {
64+
@if (!isUserMember && !isUserManager) { @if (info().name.includes("Кейс-чемпионат MIR")) {
6665
<a href="https://case-champ.ru/corporate#rec1176757836">
67-
<app-button appearance="outline" size="medium" customTypographyClass="text-body-12">
66+
<app-button
67+
[disabled]="!!registerDateExpired"
68+
[style.opacity]="registerDateExpired ? '0.5' : '1'"
69+
appearance="outline"
70+
size="medium"
71+
customTypographyClass="text-body-12"
72+
>
73+
зарегистрироваться
74+
</app-button>
75+
</a>
76+
} @else if (info().registrationLink) {
77+
<a [href]="info().registrationLink">
78+
<app-button
79+
[disabled]="!!registerDateExpired"
80+
[style.opacity]="registerDateExpired ? '0.5' : '1'"
81+
appearance="outline"
82+
size="medium"
83+
customTypographyClass="text-body-12"
84+
>
6885
зарегистрироваться
6986
</app-button>
7087
</a>
7188
} @else {
7289
<a [routerLink]="['/office/program', info().id, 'register']">
73-
<app-button appearance="outline" size="medium" customTypographyClass="text-body-12">
90+
<app-button
91+
[disabled]="!!registerDateExpired"
92+
[style.opacity]="registerDateExpired ? '0.5' : '1'"
93+
appearance="outline"
94+
size="medium"
95+
customTypographyClass="text-body-12"
96+
>
7497
зарегистрироваться
7598
</app-button>
7699
</a>
77-
} } @else if (isUserMember && isUserManager) {
100+
} } @else if (isUserMember && !isUserManager && isUserExpert) {
78101
<app-button
79102
size="medium"
80103
[style.opacity]="registerDateExpired ? '0.5' : '1'"
@@ -85,7 +108,7 @@
85108
<span>подать проект</span>
86109
<i appIcon icon="plus" appSquare="10"></i>
87110
</app-button>
88-
} @else if (isUserManager && !isUserMember) {
111+
} @else if (isUserManager) { @if (isUserMember) {
89112
<a [routerLink]="'/office/program/' + info().id + '/projects-rating'">
90113
<app-button
91114
[appearance]="isProjectsRatingPage ? 'inline' : 'outline'"
@@ -95,7 +118,7 @@
95118
оценка проектов
96119
</app-button>
97120
</a>
98-
}
121+
} }
99122

100123
<a
101124
class="info__presentation"
@@ -140,6 +163,7 @@
140163
<app-button
141164
appearance="outline"
142165
[disabled]="true"
166+
style="opacity: 0.5"
143167
size="medium"
144168
customTypographyClass="text-body-12"
145169
>
@@ -151,6 +175,8 @@
151175
<app-button
152176
[appearance]="isProjectsPage ? 'inline' : 'outline'"
153177
size="medium"
178+
[disabled]="isUserMember ? true : isUserManager ? false : false"
179+
[style.opacity]="isUserMember ? '0.5' : isUserManager ? '1' : '0.5'"
154180
customTypographyClass="text-body-12"
155181
>
156182
проекты-участники
@@ -172,6 +198,8 @@
172198
<app-button
173199
[appearance]="isMembersPage ? 'inline' : 'outline'"
174200
size="medium"
201+
[disabled]="isUserMember || isUserExpert ? true : isUserManager ? false : true"
202+
[style.opacity]="isUserMember || isUserExpert ? '0.5' : isUserManager ? '1' : '1'"
175203
customTypographyClass="text-body-12"
176204
>
177205
участники
@@ -182,10 +210,17 @@
182210
<app-modal [open]="showSubmitProjectModal()" (openChange)="toggleSubmitProjectModal()">
183211
<div class="cancel">
184212
<div class="cancel__top">
185-
<p class="cancel__title text-body-14">выберите проект для подачи</p>
213+
<p class="cancel__title text-body-14">
214+
{{
215+
memberProjects.length > 0 ? "выберите проект для подачи" : "создай свой проект!"
216+
}}
217+
</p>
186218
<p class="cancel__text text-body-10">
187-
после выбора проекта будет создан дубликат данного проекта для заполнения под
188-
конкретный конкурс
219+
{{
220+
memberProjects.length > 0
221+
? "после выбора проекта будет создан дубликат данного проекта для заполнения под конкретный конкурс"
222+
: "создай проект и не забудь вернуться в программу для его подачи"
223+
}}
189224
</p>
190225

191226
<div class="project">
@@ -213,15 +248,29 @@
213248
</div>
214249
</div>
215250

216-
<app-button
217-
size="medium"
218-
class="cancel__button"
219-
customTypographyClass="text-body-12"
220-
[disabled]="!selectedProjectId"
221-
(click)="addProjectModal()"
222-
>
223-
выбрать проект
224-
</app-button>
251+
<div class="cancel__buttons" style="margin: 0">
252+
@if (memberProjects.length > 0) {
253+
<app-button
254+
size="medium"
255+
class="cancel__button"
256+
customTypographyClass="text-body-12"
257+
[disabled]="!selectedProjectId"
258+
(click)="addProjectModal()"
259+
>
260+
выбрать проект
261+
</app-button>
262+
263+
<p class="text-body-12">или</p>
264+
}
265+
266+
<app-button
267+
size="medium"
268+
class="cancel__button"
269+
(click)="addNewProject()"
270+
customTypographyClass="text-body-12"
271+
>создать новый проект</app-button
272+
>
273+
</div>
225274
</div>
226275
</app-modal>
227276

projects/social_platform/src/app/office/features/detail/detail.component.ts

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ import { calculateProfileProgress } from "@utils/calculateProgress";
2424
import { ProfileDataService } from "@office/profile/detail/services/profile-date.service";
2525
import { ProfileService } from "projects/skills/src/app/profile/services/profile.service";
2626
import { SnackbarService } from "@ui/services/snackbar.service";
27-
import { PluralizePipe } from "@corelib";
2827
import { ApproveSkillComponent } from "../approve-skill/approve-skill.component";
28+
import { ProjectsService } from "@office/projects/services/projects.service";
2929

3030
@Component({
3131
selector: "app-detail",
@@ -57,6 +57,7 @@ export class DeatilComponent implements OnInit, OnDestroy {
5757
private readonly location = inject(Location);
5858
private readonly profileDataService = inject(ProfileDataService);
5959
public readonly skillsProfileService = inject(ProfileService);
60+
private readonly projectsService = inject(ProjectsService);
6061
public readonly chatService = inject(ChatService);
6162
private readonly cdRef = inject(ChangeDetectorRef);
6263

@@ -93,6 +94,8 @@ export class DeatilComponent implements OnInit, OnDestroy {
9394
dubplicatedProjectId = 0;
9495
memberProjects: Project[] = [];
9596

97+
userType = 0;
98+
9699
// Сигналы для работы с модальными окнами с текстом
97100
assignProjectToProgramModalMessage = signal<ProjectAssign | null>(null);
98101
errorMessageModal = signal("");
@@ -147,6 +150,10 @@ export class DeatilComponent implements OnInit, OnDestroy {
147150
}
148151
}
149152

153+
get isUserExpert() {
154+
return this.userType !== 1;
155+
}
156+
150157
// Методы для управления состоянием ошибок через сервис
151158
setAssignProjectToProgramError(error: { non_field_errors: string[] }): void {
152159
this.projectAdditionalService.setAssignProjectToProgramError(error);
@@ -200,6 +207,10 @@ export class DeatilComponent implements OnInit, OnDestroy {
200207
this.assignProjectToProgram(selectedProject!);
201208
}
202209

210+
addNewProject(): void {
211+
this.projectsService.addProject();
212+
}
213+
203214
/** Эмитим логику для привязки проекта к программе */
204215
/**
205216
* Привязка проекта к программе выбранной
@@ -385,6 +396,17 @@ export class DeatilComponent implements OnInit, OnDestroy {
385396
)
386397
.subscribe();
387398

399+
const profileDataSub$ = this.profileDataService
400+
.getProfile()
401+
.pipe(filter(user => !!user))
402+
.subscribe({
403+
next: user => {
404+
if (user) {
405+
this.userType = user.userType;
406+
}
407+
},
408+
});
409+
388410
const memeberProjects$ = this.projectService.getMy().subscribe({
389411
next: projects => {
390412
this.memberProjects = projects.results.filter(project => !project.draft);
@@ -393,6 +415,7 @@ export class DeatilComponent implements OnInit, OnDestroy {
393415

394416
this.subscriptions.push(program$);
395417
this.subscriptions.push(memeberProjects$);
418+
this.subscriptions.push(profileDataSub$);
396419
} else {
397420
const profileDataSub$ = this.profileDataService
398421
.getProfile()

projects/social_platform/src/app/office/features/info-card/info-card.component.html

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,31 @@
128128
<ng-template #cardActions>
129129
<div class="card__info">
130130
@if (type === 'projects') {
131-
<app-button
132-
[routerLink]="'/office/projects/' + info?.id"
133-
customTypographyClass="text-body-6"
134-
size="extra-small"
135-
class="card__info--text"
136-
>
137-
проект
138-
</app-button>
131+
<div class="card__info--program">
132+
<app-button
133+
[routerLink]="'/office/projects/' + info?.id"
134+
customTypographyClass="text-body-6"
135+
size="extra-small"
136+
class="card__info--text"
137+
>
138+
проект
139+
</app-button>
140+
141+
@if (info.partnerProgramId) {
142+
<div
143+
class="card__info--program-icon"
144+
(mouseenter)="programProjectHovered = true"
145+
(mouseleave)="programProjectHovered = false"
146+
>
147+
<i appIcon icon="program" appSquare="8"></i>
148+
</div>
149+
150+
@if (programProjectHovered) {
151+
<div class="card__info--project-partner">
152+
<p class="text-body-6">проект привязан к программе</p>
153+
</div>
154+
} }
155+
</div>
139156
} @else if (type === 'members') {
140157
<app-button
141158
[routerLink]="'/office/profile/' + info?.userId"

projects/social_platform/src/app/office/features/info-card/info-card.component.scss

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
height: 170px;
1212
padding: 15px 0 12px;
1313
background-color: var(--light-white);
14-
border: 0.5px solid var(--medium-for-outline);
14+
border: 0.5px solid var(--medium-grey-for-outline);
1515
border-radius: var(--rounded-xl);
1616

1717
&--empty {
@@ -34,6 +34,41 @@
3434
align-items: center;
3535
color: var(--grey-for-text);
3636
}
37+
38+
&--program {
39+
display: flex;
40+
align-items: center;
41+
gap: 5px;
42+
justify-content: center;
43+
44+
&-icon {
45+
width: 16px;
46+
height: 12px;
47+
margin-top: 6px;
48+
display: flex;
49+
align-items: center;
50+
justify-content: center;
51+
border-radius: var(--rounded-lg);
52+
border: 0.5px solid var(--medium-grey-for-outline);
53+
54+
i {
55+
color: var(--accent);
56+
}
57+
}
58+
}
59+
60+
&--project-partner {
61+
position: absolute;
62+
left: 30%;
63+
top: 67%;
64+
padding: 3px 5px;
65+
border: 0.5px solid var(--medium-grey-for-outline);
66+
border-radius: var(--rounded-lg);
67+
68+
p {
69+
color: var(--black);
70+
}
71+
}
3772
}
3873

3974
&__badge {
@@ -66,6 +101,7 @@
66101
padding-top: 40px;
67102
overflow: hidden;
68103
text-align: center;
104+
position: relative;
69105

70106
&--empty {
71107
padding-top: 60px;

projects/social_platform/src/app/office/features/info-card/info-card.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ export class InfoCardComponent implements OnInit {
5757
inviteErrorModal = false;
5858
haveBadge = this.calculateHaveBadge();
5959

60+
programProjectHovered = false;
61+
6062
ngOnInit(): void {}
6163

6264
/**

0 commit comments

Comments
 (0)