Skip to content

Commit 71a0ca1

Browse files
committed
add invites to project page & soon-card component, change design of project-card, project-filter, change logic of subscribing to project
1 parent 2caa963 commit 71a0ca1

33 files changed

Lines changed: 583 additions & 415 deletions

projects/social_platform/src/app/office/models/project.model.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export class Project {
5555
partnerProgram!: PartnerProgramInfo | null;
5656
vacancies!: Vacancy[];
5757
isCompany!: boolean;
58+
inviteId!: number;
5859

5960
static default(): Project {
6061
return {
@@ -84,6 +85,7 @@ export class Project {
8485
leader: 0,
8586
vacancies: [],
8687
isCompany: true,
88+
inviteId: 0,
8789
};
8890
}
8991
}

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

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -55,28 +55,6 @@
5555
}
5656
}
5757

58-
.message-modal {
59-
display: flex;
60-
flex-direction: column;
61-
align-items: center;
62-
max-width: 402px;
63-
64-
&__title {
65-
margin: 18px 0;
66-
color: var(--black);
67-
text-align: center;
68-
}
69-
70-
&__text {
71-
color: var(--dark-grey);
72-
text-align: center;
73-
}
74-
75-
&__button {
76-
margin-top: 18px;
77-
}
78-
}
79-
8058
.pro-item {
8159
display: flex;
8260
align-items: center;

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

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -121,26 +121,10 @@
121121
<div class="program__left">
122122
<aside class="program__aside">
123123
@if (program.isUserMember) {
124-
<div class="program__analytics">
125-
<div class="analytics">
126-
<div class="analytics__soon">
127-
<div class="analytics__closed">
128-
<i appIcon icon="lock" appSquare="10"></i>
129-
<span class="text-body-6 analytics__closed--text">пока закрыто</span>
130-
</div>
131-
<app-button customTypographyClass="text-body-6" color="green" size="extra-small"
132-
>скоро</app-button
133-
>
134-
</div>
135-
136-
<div class="analytics__info">
137-
<p class="text-body-12">аналитика</p>
138-
<p class="text-body-6">
139-
уровень включённости студентов, статистика достижения целей в проектах
140-
</p>
141-
</div>
142-
</div>
143-
</div>
124+
<app-soon-card
125+
title="аналитика"
126+
description="уровень включённости студентов, статистика достижения целей в проектах"
127+
></app-soon-card>
144128
}
145129
</aside>
146130
</div>

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

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,6 @@
6161
grid-template-columns: 2fr 5fr 3fr;
6262
grid-gap: 20px;
6363
}
64-
65-
&__analytics {
66-
padding: 12px;
67-
background-color: var(--light-white);
68-
border: 0.5px solid var(--medium-grey-for-outline);
69-
border-radius: var(--rounded-lg);
70-
}
7164
}
7265

7366
.bar__add-project {
@@ -116,55 +109,6 @@
116109
}
117110
}
118111

119-
.analytics {
120-
text-align: center;
121-
122-
&__soon {
123-
position: relative;
124-
margin-bottom: 4px;
125-
border: 0.5px solid var(--medium-grey-for-outline);
126-
border-radius: var(--rounded-lg);
127-
}
128-
129-
&__closed {
130-
display: flex;
131-
flex-direction: column;
132-
gap: 2px;
133-
align-items: center;
134-
justify-content: center;
135-
padding: 24px 37px;
136-
137-
&--text {
138-
color: var(--dark-grey);
139-
}
140-
141-
i {
142-
color: var(--dark-grey);
143-
}
144-
}
145-
146-
app-button {
147-
position: absolute;
148-
top: 82%;
149-
left: 41%;
150-
}
151-
152-
&__info {
153-
display: flex;
154-
flex-direction: column;
155-
gap: 2px;
156-
align-items: center;
157-
justify-content: center;
158-
margin-top: 8px;
159-
160-
p {
161-
width: 60%;
162-
color: var(--accent);
163-
text-align: center;
164-
}
165-
}
166-
}
167-
168112
.about {
169113
padding: 24px;
170114
background-color: var(--light-white);

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import { Project } from "@office/models/project.model";
4242
import { HttpErrorResponse } from "@angular/common/http";
4343
import { ProjectAssign } from "@office/projects/models/project-assign.model";
4444
import { ProjectAdditionalService } from "@office/projects/edit/services/project-additional.service";
45+
import { SoonCardComponent } from "@office/shared/soon-card/soon-card.component";
4546

4647
@Component({
4748
selector: "app-main",
@@ -63,6 +64,7 @@ import { ProjectAdditionalService } from "@office/projects/edit/services/project
6364
ModalComponent,
6465
MatProgressBarModule,
6566
InputComponent,
67+
SoonCardComponent,
6668
],
6769
})
6870
export class ProgramDetailMainComponent implements OnInit, OnDestroy {

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

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -20,46 +20,6 @@
2020
[hasBorder]="true"
2121
[size]="140"
2222
></app-avatar>
23-
<div class="info__subscribe">
24-
<app-button
25-
(click)="onSubscribe(project.id)"
26-
customTypographyClass="text-body-12"
27-
color="white"
28-
>
29-
<p [style]="{ color: isUserSubscribed ? 'var(--green)' : 'var(--accent)' }">
30-
{{ isUserSubscribed ? "Вы подписаны" : "Подписаться" }}
31-
</p>
32-
@if (isUserSubscribed) {
33-
<i
34-
appIcon
35-
appSquare="18"
36-
[style]="{ color: isUserSubscribed ? 'var(--green)' : '' }"
37-
[icon]="isUserSubscribed ? 'check' : ''"
38-
></i>
39-
}
40-
</app-button>
41-
</div>
42-
<app-modal [(open)]="isUnsubscribeModalOpen">
43-
<div class="unsubscribe-modal">
44-
<h3>Вы действительно хотите отписаться от проекта?</h3>
45-
<app-avatar [url]="project.imageAddress" [size]="130"></app-avatar>
46-
<div class="unsubscribe-modal__buttons">
47-
<app-button
48-
color="red"
49-
customTypographyClass="unsubscribe-modal-btn__typography"
50-
(click)="onUnsubscribe(project.id)"
51-
>
52-
Отписаться
53-
</app-button>
54-
<app-button
55-
customTypographyClass="unsubscribe-modal-btn__typography"
56-
(click)="onCloseUnsubscribeModal()"
57-
>
58-
Отменить
59-
</app-button>
60-
</div>
61-
</div>
62-
</app-modal>
6323
</div>
6424
@if (authService.profile | async; as profile) {
6525
<div class="info__body">
@@ -421,28 +381,6 @@ <h4 class="support__title">Редактирование недоступно</h4
421381
>
422382
</div>
423383
</app-modal>
424-
425-
<app-modal [(open)]="isUnsubscribeModalOpen">
426-
<div class="unsubscribe-modal">
427-
<h3>Вы действительно хотите отписаться от проекта?</h3>
428-
<app-avatar [url]="project.imageAddress" [size]="130"></app-avatar>
429-
<div class="unsubscribe-modal__buttons">
430-
<app-button
431-
color="red"
432-
customTypographyClass="unsubscribe-modal-btn__typography"
433-
(click)="onUnsubscribe(project.id)"
434-
>
435-
Отписаться
436-
</app-button>
437-
<app-button
438-
customTypographyClass="unsubscribe-modal-btn__typography"
439-
(click)="onCloseUnsubscribeModal()"
440-
>
441-
Отменить
442-
</app-button>
443-
</div>
444-
</div>
445-
</app-modal>
446384
<router-outlet></router-outlet>
447385
</main>
448386
}

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

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import { Collaborator } from "@office/models/collaborator.model";
2020
import { ProjectNewsService } from "@office/projects/detail/services/project-news.service";
2121
import { FeedNews } from "@office/projects/models/project-news.model";
2222
import { ProjectService } from "@office/services/project.service";
23-
import { SubscriptionService } from "@office/services/subscription.service";
2423
import { NewsCardComponent } from "@office/shared/news-card/news-card.component";
2524
import { NewsFormComponent } from "@office/shared/news-form/news-form.component";
2625
import { IndustryService } from "@services/industry.service";
@@ -101,7 +100,6 @@ export class ProjectInfoComponent implements OnInit, AfterViewInit, OnDestroy {
101100
public readonly authService: AuthService, // Сервис аутентификации
102101
private readonly navService: NavService, // Сервис навигации
103102
private readonly projectNewsService: ProjectNewsService, // Сервис новостей проекта
104-
private readonly subscriptionService: SubscriptionService, // Сервис подписок
105103
private readonly projectService: ProjectService, // Сервис проектов
106104
private readonly cdRef: ChangeDetectorRef // Сервис для ручного запуска обнаружения изменений
107105
) {}
@@ -148,15 +146,6 @@ export class ProjectInfoComponent implements OnInit, AfterViewInit, OnDestroy {
148146
this.profileId = profile.id;
149147
});
150148

151-
// Проверка статуса подписки пользователя на проект
152-
this.projSubscribers$
153-
?.pipe(take(1), withLatestFrom(this.authService.profile))
154-
.subscribe(([projSubs, profile]) => {
155-
projSubs.some(sub => sub.id === profile.id)
156-
? (this.isUserSubscribed = true)
157-
: (this.isUserSubscribed = false);
158-
});
159-
160149
const projectEditSub$ =
161150
this.project$?.subscribe(project => {
162151
if (project.partnerProgram) {
@@ -325,44 +314,10 @@ export class ProjectInfoComponent implements OnInit, AfterViewInit, OnDestroy {
325314
}
326315

327316
// Состояние подписки и модальных окон
328-
isUserSubscribed!: boolean; // Флаг подписки пользователя
329-
isUnsubscribeModalOpen = false; // Флаг модального окна отписки
330317
isLeaveProjectModalOpen = false; // Флаг модального окна выхода
331318
isEditDisable = false; // Флаг недоступности редактирования
332319
isEditDisableModal = false; // Флаг недоступности редактирования для модалки
333320

334-
/**
335-
* Подписка на проект или открытие модального окна отписки
336-
* @param projectId - ID проекта
337-
*/
338-
onSubscribe(projectId: number): void {
339-
if (this.isUserSubscribed) {
340-
this.isUnsubscribeModalOpen = true;
341-
return;
342-
}
343-
this.subscriptionService.addSubscription(projectId).subscribe(() => {
344-
this.isUserSubscribed = true;
345-
});
346-
}
347-
348-
/**
349-
* Отписка от проекта
350-
* @param projectId - ID проекта
351-
*/
352-
onUnsubscribe(projectId: number): void {
353-
this.subscriptionService.deleteSubscription(projectId).subscribe(() => {
354-
this.isUserSubscribed = false;
355-
this.isUnsubscribeModalOpen = false;
356-
});
357-
}
358-
359-
/**
360-
* Закрытие модального окна отписки
361-
*/
362-
onCloseUnsubscribeModal(): void {
363-
this.isUnsubscribeModalOpen = false;
364-
}
365-
366321
/**
367322
* Закрытие модального окна предупреждения лидера
368323
*/
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/** @format */
2+
3+
import { inject } from "@angular/core";
4+
import { ResolveFn } from "@angular/router";
5+
import { Invite } from "@office/models/invite.model";
6+
import { InviteService } from "@office/services/invite.service";
7+
8+
/**
9+
* Резолвер для предзагрузки приглашений пользователя
10+
* Загружает данные о приглашениях перед инициализацией компонента офиса
11+
*
12+
* Принимает:
13+
* - Контекст маршрута (неявно через Angular DI)
14+
*
15+
* Возвращает:
16+
* - Observable<Invite[]> - массив приглашений пользователя
17+
*/
18+
export const ProjectsInvitesResolver: ResolveFn<Invite[]> = () => {
19+
const inviteService = inject(InviteService);
20+
21+
return inviteService.getMy();
22+
};

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

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,38 +13,14 @@
1313
<li>
1414
<app-project-card
1515
[project]="project"
16-
[canDelete]="project.leader === profile?.id"
16+
[type]="isInvites ? 'invite' : 'project'"
1717
[isSubscribed]="profileProjSubsIds?.includes(project.id)"
18-
(remove)="deleteProject($event)"
18+
[profileId]="project.id"
19+
(onAcceptingInvite)="onAcceptInvite($event)"
20+
(onRejectingInvite)="onRejectInvite($event)"
1921
></app-project-card>
2022
</li>
2123
</a>
2224
}
2325
</ul>
24-
@if (isAll) {
25-
<div class="filter page__filter" [class.page__filter--open]="isFilterOpen">
26-
<div class="filter__overlay" (click)="isFilterOpen = false"></div>
27-
<div class="filter__body" #filterBody>
28-
<div
29-
class="filter__bar"
30-
(touchstart)="onSwipeStart($event)"
31-
(touchmove)="onSwipeMove($event)"
32-
(touchend)="onSwipeEnd($event)"
33-
></div>
34-
<app-projects-filter (closeFilter)="closeFilter()"></app-projects-filter>
35-
</div>
36-
</div>
37-
} @else if (!projects.length && isMy) {
38-
<div class="page__empty empty text-body-12">
39-
<button class="empty__action text-body-12" (click)="addProject()">
40-
<i appIcon icon="plus" appSquare="12"></i>
41-
Добавьте свой первый проект
42-
</button>
43-
<span class="empty__or">или</span>
44-
<a class="empty__action" routerLink="/office/projects/all">
45-
<i appIcon icon="search" appSquare="32"></i>
46-
Найдите интересующий проект в списке
47-
</a>
48-
</div>
49-
}
5026
</section>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
display: grid;
3131
flex-grow: 1;
3232
grid-template-columns: 1fr;
33-
row-gap: 20px;
34-
column-gap: 40px;
33+
row-gap: 40px;
34+
column-gap: 20px;
3535
align-items: flex-start;
3636

3737
@include responsive.apply-desktop {

0 commit comments

Comments
 (0)