Skip to content

Commit 44004b0

Browse files
committed
run format
1 parent 1e139cb commit 44004b0

1 file changed

Lines changed: 0 additions & 17 deletions

File tree

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

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/** @format */
2-
32
import {
43
ChangeDetectorRef,
54
Component,
@@ -97,7 +96,6 @@ export class ProgramDetailMainComponent implements OnInit, OnDestroy {
9796
private readonly projectService: ProjectService,
9897
private readonly router: Router,
9998
private readonly route: ActivatedRoute,
100-
private readonly router: Router,
10199
private readonly cdRef: ChangeDetectorRef
102100
) {}
103101

@@ -112,7 +110,6 @@ export class ProgramDetailMainComponent implements OnInit, OnDestroy {
112110
programId?: number;
113111

114112
subscriptions$ = signal<Subscription[]>([]);
115-
116113
ngOnInit(): void {
117114
const programIdSubscription$ = this.route.params
118115
.pipe(
@@ -168,9 +165,7 @@ export class ProgramDetailMainComponent implements OnInit, OnDestroy {
168165
ngAfterViewInit() {
169166
const descElement = this.descEl?.nativeElement;
170167
this.descriptionExpandable = descElement?.clientHeight < descElement?.scrollHeight;
171-
172168
this.cdRef.detectChanges();
173-
174169
const target = document.querySelector(".office__body");
175170
if (target) {
176171
const scrollEvents$ = fromEvent(target, "scroll")
@@ -179,7 +174,6 @@ export class ProgramDetailMainComponent implements OnInit, OnDestroy {
179174
throttleTime(2000)
180175
)
181176
.subscribe();
182-
183177
this.subscriptions$().push(scrollEvents$);
184178
}
185179
}
@@ -204,19 +198,14 @@ export class ProgramDetailMainComponent implements OnInit, OnDestroy {
204198

205199
const target = document.querySelector(".office__body");
206200
if (!target) return of({});
207-
208201
const scrollBottom = target.scrollHeight - target.scrollTop - target.clientHeight;
209-
210202
if (scrollBottom > 0) return of({});
211-
212203
this.fetchPage.update(p => p + 1);
213-
214204
return this.fetchNews(this.fetchPage() * this.fetchLimit(), this.fetchLimit());
215205
}
216206

217207
fetchNews(offset: number, limit: number) {
218208
const programId = this.route.snapshot.params["programId"];
219-
220209
return this.programNewsService.fetchNews(limit, offset, programId).pipe(
221210
tap(({ count, results }) => {
222211
this.totalNewsCount.set(count);
@@ -227,14 +216,12 @@ export class ProgramDetailMainComponent implements OnInit, OnDestroy {
227216

228217
@ViewChild(NewsFormComponent) newsFormComponent?: NewsFormComponent;
229218
@ViewChild("descEl") descEl?: ElementRef;
230-
231219
onNewsInVew(entries: IntersectionObserverEntry[]): void {
232220
const ids = entries.map(e => {
233221
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
234222
// @ts-ignore
235223
return e.target.dataset.id;
236224
});
237-
238225
this.programNewsService.readNews(this.route.snapshot.params["programId"], ids).subscribe(noop);
239226
}
240227

@@ -250,7 +237,6 @@ export class ProgramDetailMainComponent implements OnInit, OnDestroy {
250237
onDelete(newsId: number) {
251238
const item = this.news().find((n: any) => n.id === newsId);
252239
if (!item) return;
253-
254240
this.programNewsService.deleteNews(this.route.snapshot.params["programId"], newsId).subscribe({
255241
next: () => {
256242
const index = this.news().findIndex(news => news.id === newsId);
@@ -262,7 +248,6 @@ export class ProgramDetailMainComponent implements OnInit, OnDestroy {
262248
onLike(newsId: number) {
263249
const item = this.news().find((n: any) => n.id === newsId);
264250
if (!item) return;
265-
266251
this.programNewsService
267252
.toggleLike(this.route.snapshot.params["programId"], newsId, !item.isUserLiked)
268253
.subscribe(() => {
@@ -276,7 +261,6 @@ export class ProgramDetailMainComponent implements OnInit, OnDestroy {
276261
this.readFullDescription = !isExpanded;
277262
}
278263

279-
280264
closeModal(): void {
281265
this.showProgramModal.set(false);
282266
}
@@ -287,7 +271,6 @@ export class ProgramDetailMainComponent implements OnInit, OnDestroy {
287271
...this.projectService.projectsCount.getValue(),
288272
my: this.projectService.projectsCount.getValue().my + 1,
289273
});
290-
291274
this.router
292275
.navigateByUrl(`/office/projects/${project.id}/edit?editingStep=main`)
293276
.then(() => console.debug("Route change from ProjectsComponent"));

0 commit comments

Comments
 (0)