<commit_before>import {EventEmitter, Injectable} from 'angular2/core';

import {TranslateService} from 'ng2-translate/ng2-translate';
import {Observable} from 'rxjs/Observable';

export const PAGES:Array<PageComponent> = [
  {key: 'BETS', pathStart: 'bets', linkParams: ['Bets']},
  {key: 'TABLES', pathStart: 'table', linkParams: ['Table']},
  {key: 'LEAGUES', pathStart: 'leagues', linkParams: ['Leagues']}
];

export interface PageComponent {
  key: string;
  title?: string;
  pathStart: string;
  linkParams: Array<string>;
}

export enum Page {
  BETS,
  TABLE,
  LEAGUES
}

@Injectable()
export class Pages {

  private page$:EventEmitter<string> = new EventEmitter<string>();

  constructor(private translate:TranslateService) {
  }

  getPage(pageComponent:PageComponent) {
    return this.translate.get('SIDENAV.PAGES')
      .map((translations) => {
        return translations[pageComponent.key];
      });
  }

  getPages():Observable<Array<PageComponent>> {
    console.log('pages @ get pages');

    return this.translate.get('SIDENAV.PAGES')
      .map((translations) => {
        return PAGES.map((page:PageComponent) => {
          page.title = translations[page.key];

          return page;
        });
      });
  }

  emit(page:Page) {
    this.getPage(PAGES[page])
      .subscribe((pageTitle:string) => {
        this.emitPageTitle(pageTitle);
      });
  }

  emitPageTitle(pageTitle:string) {
    this.page$.emit(pageTitle);
  }
<commit_msg>chore(navigation): force scroll to 0,0 when changing page<commit_after>import {EventEmitter, Injectable} from 'angular2/core';

import {TranslateService} from 'ng2-translate/ng2-translate';
import {Observable} from 'rxjs/Observable';

export const PAGES:Array<PageComponent> = [
  {key: 'BETS', pathStart: 'bets', linkParams: ['Bets']},
  {key: 'TABLES', pathStart: 'table', linkParams: ['Table']},
  {key: 'LEAGUES', pathStart: 'leagues', linkParams: ['Leagues']}
];

export interface PageComponent {
  key: string;
  title?: string;
  pathStart: string;
  linkParams: Array<string>;
}

export enum Page {
  BETS,
  TABLE,
  LEAGUES
}

@Injectable()
export class Pages {

  private page$:EventEmitter<string> = new EventEmitter<string>();

  constructor(private translate:TranslateService) {
  }

  getPage(pageComponent:PageComponent) {
    return this.translate.get('SIDENAV.PAGES')
      .map((translations) => {
        return translations[pageComponent.key];
      });
  }

  getPages():Observable<Array<PageComponent>> {
    console.log('pages @ get pages');

    return this.translate.get('SIDENAV.PAGES')
      .map((translations) => {
        return PAGES.map((page:PageComponent) => {
          page.title = translations[page.key];

          return page;
        });
      });
  }

  emit(page:Page) {
    this.getPage(PAGES[page])
      .subscribe((pageTitle:string) => {
        this.emitPageTitle(pageTitle);
      });
  }

  emitPageTitle(pageTitle:string) {
    this.page$.emit(pageTitle);

    if (window.pageYOffset > 0) {
      console.log('pages @ scroll to (0, 0)');
      window.scrollTo(0, 0);
    }
  }

{'fraction_non_alphanumeric': 0.15476575121163166, 'fraction_numerical': 0.00420032310177706, 'mean_word_length': 3.7195121951219514, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 24, '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': '4036603', 'n_tokens_mistral': 1042, 'n_tokens_neox': 1008, 'n_words': 189}