<commit_before>import { Component, ChangeDetectionStrategy, ViewChild, ElementRef, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { RpService } from '../services/rp.service';
import { Observable,  combineLatest } from 'rxjs';
import { map } from 'rxjs/operators';
import { MainMenuService } from '../services/main-menu.service';
import { OptionsService } from '../services/options.service';
import { RpMessage, RpMessageId } from '../models/rp-message';

@Component({
  selector: 'rpn-archive',
  template: `
    <rpn-title-bar [title]="'Page '+(pageNum$|async)+', '+rp.title" [desc]="rp.desc" (clickMenu)="openMenu()" style="z-index:1"></rpn-title-bar>

    <rpn-paginator [pageNum]="pageNum$|async" [pageCount]="pageCount$|async" (pageNumChange)="pageNumChange($event)"></rpn-paginator>

      <rpn-message-list class="flex-scroll-container" #messageContainer
        [messages]="messages$|async"
        [charas]="rp.charas$|async"
        [challenge]="(options.challenge$|async).hash"
        [showMessageDetails]="options.showMessageDetails$|async"
        [pressEnterToSend]="options.pressEnterToSend$|async"
        (editMessageContent)="editMessageContent($event[0], $event[1])"
      ></rpn-message-list>
  `,
  styles: [`
    :host {
      flex: 1;
      display: flex;
      flex-direction: column;
      box-sizing: border-box;
    }
  `],
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class ArchiveComponent implements OnInit {

  @ViewChild('messageContainer', { read: ElementRef }) messageContainer: ElementRef;

  public readonly size: number = 20;

  public pageNum$: Observable<number>;
  public pageCount$: Observable<number>;
  public messages$: Observable<RpMessage[]>;

  constructor(
    public rp: RpService,
    public options: OptionsService,
    public mainMenuService: MainMenuService,
    private route: ActivatedRoute,
    private router: Router
  ) { }

  ngOnInit() {
    this.pageNum$ = this.route.paramMap.pipe(
      map(params => +params.get('page'))
    );

    this.pageCount$ = this.rp.messages$.pipe(
      map(msgs => Math.ceil(msgs.length / this.size))
    );

    this.messages$ = combineLatest(
      this.rp.messages$,
      this.pageNum$,
      (msgs, page) => msgs.slice((page - 1) * this.size, page * this.size)
    );
  }

  pageNumChange(page: number) {
    this.router.navigate(['../', page], { relativeTo: this.route });
    (this.messageContainer.nativeElement as HTMLElement).scrollTop = 0;
  }

  openMenu() {
    this.mainMenuService.menu.open();
  }

  editMessageContent(id: RpMessageId, content: string) {
    this.rp.editMessage(id, content);
  }

}
<commit_msg>remove redundant "Page N" in title bar in archive page<commit_after>import { Component, ChangeDetectionStrategy, ViewChild, ElementRef, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { RpService } from '../services/rp.service';
import { Observable,  combineLatest } from 'rxjs';
import { map } from 'rxjs/operators';
import { MainMenuService } from '../services/main-menu.service';
import { OptionsService } from '../services/options.service';
import { RpMessage, RpMessageId } from '../models/rp-message';

@Component({
  selector: 'rpn-archive',
  template: `
    <rpn-title-bar [title]="rp.title" [desc]="rp.desc" (clickMenu)="openMenu()" style="z-index:1"></rpn-title-bar>

    <rpn-paginator [pageNum]="pageNum$|async" [pageCount]="pageCount$|async" (pageNumChange)="pageNumChange($event)"></rpn-paginator>

    <rpn-message-list class="flex-scroll-container" #messageContainer
      [messages]="messages$|async"
      [charas]="rp.charas$|async"
      [challenge]="(options.challenge$|async).hash"
      [showMessageDetails]="options.showMessageDetails$|async"
      [pressEnterToSend]="options.pressEnterToSend$|async"
      (editMessageContent)="editMessageContent($event[0], $event[1])"
    ></rpn-message-list>
  `,
  styles: [`
    :host {
      flex: 1;
      display: flex;
      flex-direction: column;
      box-sizing: border-box;
    }
  `],
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class ArchiveComponent implements OnInit {

  @ViewChild('messageContainer', { read: ElementRef }) messageContainer: ElementRef;

  public readonly size: number = 20;

  public pageNum$: Observable<number>;
  public pageCount$: Observable<number>;
  public messages$: Observable<RpMessage[]>;

  constructor(
    public rp: RpService,
    public options: OptionsService,
    public mainMenuService: MainMenuService,
    private route: ActivatedRoute,
    private router: Router
  ) { }

  ngOnInit() {
    this.pageNum$ = this.route.paramMap.pipe(
      map(params => +params.get('page'))
    );

    this.pageCount$ = this.rp.messages$.pipe(
      map(msgs => Math.ceil(msgs.length / this.size))
    );

    this.messages$ = combineLatest(
      this.rp.messages$,
      this.pageNum$,
      (msgs, page) => msgs.slice((page - 1) * this.size, page * this.size)
    );
  }

  pageNumChange(page: number) {
    this.router.navigate(['../', page], { relativeTo: this.route });
    (this.messageContainer.nativeElement as HTMLElement).scrollTop = 0;
  }

  openMenu() {
    this.mainMenuService.menu.open();
  }

  editMessageContent(id: RpMessageId, content: string) {
    this.rp.editMessage(id, content);
  }

}

{'fraction_non_alphanumeric': 0.15768872320596458, 'fraction_numerical': 0.0029822926374650513, 'mean_word_length': 3.9593345656192236, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '121681', 'n_tokens_mistral': 1747, 'n_tokens_neox': 1696, 'n_words': 319}