Skip to content

Commit 2b2165c

Browse files
committed
fix approves in profile & button in projetcs
1 parent 651a3e8 commit 2b2165c

7 files changed

Lines changed: 50 additions & 32 deletions

File tree

projects/social_platform/src/app/office/profile/detail/main/main.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ <h3 class="text-heading-3 about__title">Обо мне</h3>
9898
}
9999
</ul>
100100

101-
<p class="approves__text">
101+
<p class="approves__text text-body-14">
102102
Нажимая на <strong>плюс</strong>, вы подтверждаете, что {{ user.firstName }} владеет этим
103103
навыком
104104
</p>

projects/social_platform/src/app/office/profile/detail/main/main.component.scss

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,15 @@ $section-padding: 24px;
500500
margin-top: 24px;
501501
margin-bottom: 24px;
502502

503+
// &__text {
504+
// color: var(--black);
505+
// @include typography.body-12;
506+
507+
// @include responsive.apply-desktop {
508+
// @include typography.body-14;
509+
// }
510+
// }
511+
503512
&__info {
504513
display: flex;
505514
gap: 80px;
@@ -516,14 +525,6 @@ $section-padding: 24px;
516525
&__speciality {
517526
color: var(--dark-grey);
518527
}
519-
520-
&__text {
521-
@include typography.body-12;
522-
523-
@include responsive.apply-desktop {
524-
@include typography.body-14;
525-
}
526-
}
527528
}
528529

529530
&__more {

projects/social_platform/src/app/office/profile/detail/main/main.component.ts

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,17 @@ import { ActivatedRoute, RouterLink } from "@angular/router";
1616
import { User } from "@auth/models/user.model";
1717
import { AuthService } from "@auth/services";
1818
import { expandElement } from "@utils/expand-element";
19-
import { BehaviorSubject, concatMap, map, noop, Observable, Subscription, tap } from "rxjs";
19+
import {
20+
BehaviorSubject,
21+
concatMap,
22+
map,
23+
noop,
24+
Observable,
25+
of,
26+
Subscription,
27+
switchMap,
28+
tap,
29+
} from "rxjs";
2030
import { ProfileNewsService } from "../services/profile-news.service";
2131
import { NewsFormComponent } from "@office/shared/news-form/news-form.component";
2232
import { ProfileNews } from "../models/profile-news.model";
@@ -175,14 +185,28 @@ export class ProfileMainComponent implements OnInit, AfterViewInit, OnDestroy {
175185

176186
if (skill.approves.length > 0) {
177187
this.profileApproveSkillService.unApproveSkill(userId, skillId).subscribe(() => {
178-
skill.approves.pop();
188+
skill.approves = skill.approves.slice(0, -1);
189+
this.cdRef.markForCheck();
179190
});
180191
} else {
181-
this.profileApproveSkillService.approveSkill(userId, skillId).subscribe(() => {
182-
this.authService.profile.subscribe(response => {
183-
skill.approves.push({ confirmedBy: response });
192+
this.profileApproveSkillService
193+
.approveSkill(userId, skillId)
194+
.pipe(
195+
switchMap(newApprove =>
196+
newApprove.confirmedBy
197+
? of(newApprove)
198+
: this.authService.profile.pipe(
199+
map(profile => ({
200+
...newApprove,
201+
confirmedBy: profile,
202+
}))
203+
)
204+
)
205+
)
206+
.subscribe(updatedApprove => {
207+
skill.approves = [...skill.approves, updatedApprove];
208+
this.cdRef.markForCheck();
184209
});
185-
});
186210
}
187211
}
188212

projects/social_platform/src/app/office/projects/list/list.component.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@
115115
justify-content: space-between;
116116
padding: 15px 10px;
117117
cursor: pointer;
118+
border: 1px solid var(--medium-medium-grey-for-outline);
119+
border-radius: 15px;
118120
background-color: var(--white);
119121

120122
@include responsive.apply-desktop {

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,10 @@
3232
</app-bar>
3333
<div class="bar__right">
3434
@if (isMy) {
35-
<div>
36-
<button (click)="addProject()" class="text-body-14 bar__add-project">
37-
<span class="bar__add-project-text">Добавить проект</span>
38-
<i appIcon icon="plus" appSquare="18"></i>
39-
</button>
40-
</div>
35+
<app-button (click)="addProject()" customTypographyClass="ext-body-14 bar__add-project">
36+
<span class="bar__add-project-text">Добавить проект</span>
37+
<i appIcon icon="plus" appSquare="18"></i>
38+
</app-button>
4139
} @else if (isAll) {
4240
<div class="bar__bottom">
4341
<form [formGroup]="searchForm">

projects/social_platform/src/app/office/projects/projects.component.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
}
1717

1818
.bar__bottom {
19+
width: 100%;
1920
padding: 20px 0;
2021
background-color: var(--white);
2122
border: 1px solid var(--medium-grey-for-outline);

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

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,13 @@
22

33
import { Component, OnDestroy, OnInit } from "@angular/core";
44
import { NavService } from "@services/nav.service";
5-
import {
6-
ActivatedRoute,
7-
NavigationEnd,
8-
Router,
9-
RouterLink,
10-
RouterLinkActive,
11-
RouterOutlet,
12-
} from "@angular/router";
5+
import { ActivatedRoute, NavigationEnd, Router, RouterOutlet } from "@angular/router";
136
import { map, Subscription } from "rxjs";
147
import { ProjectCount } from "@models/project.model";
158
import { ProjectService } from "@services/project.service";
169
import { FormBuilder, FormGroup, ReactiveFormsModule } from "@angular/forms";
1710
import { SearchComponent } from "@ui/components/search/search.component";
18-
import { BarComponent, IconComponent } from "@ui/components";
11+
import { BarComponent, ButtonComponent, IconComponent } from "@ui/components";
1912
import { AsyncPipe } from "@angular/common";
2013

2114
@Component({
@@ -24,11 +17,10 @@ import { AsyncPipe } from "@angular/common";
2417
styleUrl: "./projects.component.scss",
2518
standalone: true,
2619
imports: [
27-
RouterLink,
28-
RouterLinkActive,
2920
IconComponent,
3021
ReactiveFormsModule,
3122
SearchComponent,
23+
ButtonComponent,
3224
RouterOutlet,
3325
AsyncPipe,
3426
BarComponent,

0 commit comments

Comments
 (0)