Skip to content

Commit d13d87c

Browse files
committed
add draft icon in info-card, & assigned button in program detail
1 parent a148198 commit d13d87c

5 files changed

Lines changed: 41 additions & 14 deletions

File tree

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,13 @@
101101
} } @if (isUserMember && !isUserManager && !isUserExpert) {
102102
<app-button
103103
size="medium"
104-
[style.opacity]="registerDateExpired ? '0.5' : '1'"
105-
[disabled]="!!registerDateExpired"
104+
[style.opacity]="registerDateExpired || isProjectAssigned ? '0.5' : '1'"
105+
[disabled]="!!registerDateExpired || isProjectAssigned"
106+
[appearance]="isProjectAssigned ? 'outline' : 'inline'"
106107
(click)="toggleSubmitProjectModal()"
107108
customTypographyClass="text-body-12 bar__add-project"
108109
>
109-
<span>подать проект</span>
110+
<span>{{ isProjectAssigned ? "вы подали проект" : "подать проект" }}</span>
110111
<i appIcon icon="plus" appSquare="10"></i>
111112
</app-button>
112113
} @if ((isUserManager || isUserExpert) && isUserMember) {
@@ -235,7 +236,11 @@
235236
<div class="project__item--info">
236237
<app-avatar [url]="project.imageAddress" [size]="40"></app-avatar>
237238
<p class="text-body-12">
238-
{{ project.name }}
239+
{{
240+
project.name.length > 20
241+
? project.name.slice(0, 16) + "..."
242+
: project.name
243+
}}
239244
</p>
240245
</div>
241246
<app-input

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,10 @@ export class DeatilComponent implements OnInit, OnDestroy {
155155
return type !== undefined && type === 3;
156156
}
157157

158+
get isProjectAssigned() {
159+
return !!this.memberProjects.find(project => project.leader === this.profile?.id);
160+
}
161+
158162
// Методы для управления состоянием ошибок через сервис
159163
setAssignProjectToProgramError(error: { non_field_errors: string[] }): void {
160164
this.projectAdditionalService.setAssignProjectToProgramError(error);
@@ -414,6 +418,7 @@ export class DeatilComponent implements OnInit, OnDestroy {
414418
const profileDataSub$ = this.authService.profile.pipe(filter(user => !!user)).subscribe({
415419
next: user => {
416420
this.userType.set(user!.userType);
421+
this.profile = user;
417422
this.cdRef.detectChanges();
418423
},
419424
});
@@ -444,10 +449,6 @@ export class DeatilComponent implements OnInit, OnDestroy {
444449

445450
this.isInProfileInfo();
446451

447-
this.skillsProfileService.getSubscriptionData().subscribe(r => {
448-
this.isSubscriptionActive.set(r.isSubscribed);
449-
});
450-
451452
this.subscriptions.push(profileDataSub$);
452453
}
453454
}

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

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,21 @@
129129
<div class="card__info">
130130
@if (type === 'projects') {
131131
<div class="card__info--program">
132+
@if (info.partnerProgram || info.draft) { @if (info.partnerProgram && info.draft) {
133+
<div
134+
class="card__info--program-icon"
135+
(mouseenter)="programProjectHovered = true"
136+
(mouseleave)="programProjectHovered = false"
137+
>
138+
<i appIcon icon="program" appSquare="8"></i>
139+
</div>
140+
141+
@if (programProjectHovered) {
142+
<div class="card__info--project-partner">
143+
<p class="text-body-6">проект привязан к программе {{ info.partnerProgram.name }}</p>
144+
</div>
145+
} }
146+
132147
<app-button
133148
[routerLink]="'/office/projects/' + info?.id"
134149
customTypographyClass="text-body-6"
@@ -138,18 +153,21 @@
138153
проект
139154
</app-button>
140155

141-
@if (info.partnerProgram) {
142156
<div
143157
class="card__info--program-icon"
144-
(mouseenter)="programProjectHovered = true"
145-
(mouseleave)="programProjectHovered = false"
158+
(mouseenter)="iconHovered = true"
159+
(mouseleave)="iconHovered = false"
146160
>
147-
<i appIcon icon="program" appSquare="8"></i>
161+
<i appIcon [icon]="info.draft ? 'box' : 'program'" appSquare="8"></i>
148162
</div>
149163

150-
@if (programProjectHovered) {
164+
@if (iconHovered) {
151165
<div class="card__info--project-partner">
152-
<p class="text-body-6">проект привязан к программе {{ info.partnerProgram.name }}</p>
166+
<p class="text-body-6">
167+
@if (info.draft) { проект пока еще не опубликовали. } @else { проект привязан к программе
168+
{{ info.partnerProgram.name }}
169+
}
170+
</p>
153171
</div>
154172
} }
155173
</div>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
top: 63%;
6363
left: 30%;
6464
padding: 3px 5px;
65+
background-color: var(--light-white);
6566
border: 0.5px solid var(--medium-grey-for-outline);
6667
border-radius: var(--rounded-lg);
6768

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
@@ -58,6 +58,8 @@ export class InfoCardComponent implements OnInit {
5858
haveBadge = this.calculateHaveBadge();
5959

6060
programProjectHovered = false;
61+
iconHovered = false;
62+
draftProjectHovered = false;
6163

6264
ngOnInit(): void {}
6365

0 commit comments

Comments
 (0)