diff --git a/projects/demo/src/environments/environment.prod.ts b/projects/demo/src/environments/environment.prod.ts index 4717a8800c0b..23493a6baa18 100644 --- a/projects/demo/src/environments/environment.prod.ts +++ b/projects/demo/src/environments/environment.prod.ts @@ -1,4 +1,5 @@ export const environment = { + github: 'https://api.github.com/repos/taiga-family/taiga-ui', production: true, ym: 87890624, }; diff --git a/projects/demo/src/modules/app/app.component.ts b/projects/demo/src/modules/app/app.component.ts index 7a148c9cca5c..158228a99eac 100644 --- a/projects/demo/src/modules/app/app.component.ts +++ b/projects/demo/src/modules/app/app.component.ts @@ -1,13 +1,22 @@ +import {HttpClient, HttpClientModule} from '@angular/common/http'; import type {OnInit} from '@angular/core'; -import {Component, DestroyRef, inject, ViewEncapsulation} from '@angular/core'; +import {Component, DestroyRef, inject, signal, ViewEncapsulation} from '@angular/core'; import {takeUntilDestroyed, toSignal} from '@angular/core/rxjs-interop'; import {NavigationEnd, Router} from '@angular/router'; import {changeDetection} from '@demo/emulate/change-detection'; +import {environment} from '@demo/environments/environment'; import {DemoRoute} from '@demo/routes'; import {TuiDemo} from '@demo/utils'; import {WA_LOCAL_STORAGE} from '@ng-web-apis/common'; import {ResizeObserverService} from '@ng-web-apis/resize-observer'; -import {TuiButton, TuiDataList, TuiDropdown} from '@taiga-ui/core'; +import { + TuiButton, + TuiDataList, + TuiDropdown, + tuiFormatNumber, + TuiIcon, +} from '@taiga-ui/core'; +import {TuiBadge, TuiBadgedContent} from '@taiga-ui/kit'; import {TuiSheetModule, TuiTextfieldControllerModule} from '@taiga-ui/legacy'; import {distinctUntilChanged, filter, map, startWith} from 'rxjs'; @@ -23,11 +32,15 @@ import {TUI_VERSION_MANAGER_PROVIDERS} from './version-manager/version-manager.p selector: 'app', imports: [ CustomHost, + HttpClientModule, TuiAlgoliaSearch, + TuiBadge, + TuiBadgedContent, TuiButton, TuiDataList, TuiDemo, TuiDropdown, + TuiIcon, TuiSheetModule, TuiTextfieldControllerModule, VersionManager, @@ -55,10 +68,12 @@ import {TUI_VERSION_MANAGER_PROVIDERS} from './version-manager/version-manager.p }) export class App extends AbstractDemo implements OnInit { private readonly destroyRef = inject(DestroyRef); + private readonly http = inject(HttpClient); private readonly ym = inject(YaMetrikaService); protected readonly router = inject(Router); protected readonly storage = inject(WA_LOCAL_STORAGE); protected readonly routes = DemoRoute; + protected readonly stars = signal(''); protected readonly isLanding = toSignal( this.router.events.pipe( @@ -73,6 +88,13 @@ export class App extends AbstractDemo implements OnInit { public override async ngOnInit(): Promise { await super.ngOnInit(); this.enableYandexMetrika(); + + this.http + .get>(environment.github) + .pipe(takeUntilDestroyed(this.destroyRef)) + .subscribe((response) => + this.stars.set(tuiFormatNumber(response['stargazers_count'])), + ); } private enableYandexMetrika(): void { diff --git a/projects/demo/src/modules/app/app.template.html b/projects/demo/src/modules/app/app.template.html index 5808c7639a1e..5a1a97ba419f 100644 --- a/projects/demo/src/modules/app/app.template.html +++ b/projects/demo/src/modules/app/app.template.html @@ -71,16 +71,37 @@ - + + + + + + +