From f41152358799037744b0feef0c7f1cabd5db9b70 Mon Sep 17 00:00:00 2001 From: gsd Date: Sat, 29 Mar 2025 15:57:53 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B2=D0=BE=D0=BE=D0=BE=20=D0=BA=D1=80=D1=83?= =?UTF-8?q?=D1=82=D0=BE=D0=BE=D0=BE=205?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/app-routing.module.ts | 4 +- src/app/app.module.ts | 8 +- src/app/entities/ShityPaginator.ts | 13 +++ src/app/entities/ban/Ban.ts | 19 +++++ .../banlist-page/banlist-page.component.html | 25 ++++++ .../banlist-page/banlist-page.component.scss | 0 .../banlist-page/banlist-page.component.ts | 36 +++++++++ .../internal-components/NeedAuthToContinue.ts | 2 +- .../pages/main-page/main-page.component.html | 4 +- .../pages/main-page/main-page.component.ts | 4 + src/app/services/auth.service.ts | 9 ++- src/app/services/ban.service.ts | 19 +++++ src/styles.scss | 81 ++++++++++++++++++- 13 files changed, 216 insertions(+), 8 deletions(-) create mode 100644 src/app/entities/ShityPaginator.ts create mode 100644 src/app/entities/ban/Ban.ts create mode 100644 src/app/pages/banlist-page/banlist-page.component.html create mode 100644 src/app/pages/banlist-page/banlist-page.component.scss create mode 100644 src/app/pages/banlist-page/banlist-page.component.ts create mode 100644 src/app/services/ban.service.ts diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 2a4029a..4bddeea 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -4,12 +4,14 @@ import {MainPageComponent} from "./pages/main-page/main-page.component"; import {ServersPageComponent} from "./pages/servers-page/servers-page.component"; import {ProfilePageComponent} from "./pages/profile-page/profile-page.component"; import {RulesPageComponent} from "./pages/rules-page/rules-page.component"; +import {BanlistPageComponent} from "./pages/banlist-page/banlist-page.component"; const routes: Routes = [ { path: "", component: MainPageComponent}, { path: "servers", component: ServersPageComponent }, { path: "profile/:steam64", component: ProfilePageComponent }, - { path: "rules", component: RulesPageComponent } + { path: "rules", component: RulesPageComponent }, + { path: "banlist", component: BanlistPageComponent } ]; @NgModule({ diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 92325f3..d8ac838 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -22,6 +22,8 @@ import {HttpClientModule} from "@angular/common/http"; import {PlayerServiceService} from "./services/player-service.service"; import {MatSnackBarModule} from "@angular/material/snack-bar"; import { RulesPageComponent } from './pages/rules-page/rules-page.component'; +import { BanlistPageComponent } from './pages/banlist-page/banlist-page.component'; +import {BanService} from "./services/ban.service"; @NgModule({ declarations: [ @@ -30,7 +32,8 @@ import { RulesPageComponent } from './pages/rules-page/rules-page.component'; ServersPageComponent, ProfilePageComponent, NeedAuthToContinue, - RulesPageComponent + RulesPageComponent, + BanlistPageComponent ], imports: [ BrowserModule, @@ -50,7 +53,8 @@ import { RulesPageComponent } from './pages/rules-page/rules-page.component'; ], providers: [ AnnonceService, - PlayerServiceService + PlayerServiceService, + BanService ], bootstrap: [AppComponent] }) diff --git a/src/app/entities/ShityPaginator.ts b/src/app/entities/ShityPaginator.ts new file mode 100644 index 0000000..08e2aa0 --- /dev/null +++ b/src/app/entities/ShityPaginator.ts @@ -0,0 +1,13 @@ +export class ShityPaginator { + data: T[] = []; + count: number = 0; + fromData(data:any, field: string): ShityPaginator { + this.count = data.count; + this.data = data[field]; + return this; + } + + static newObj():ShityPaginator { + return new ShityPaginator() + } +} diff --git a/src/app/entities/ban/Ban.ts b/src/app/entities/ban/Ban.ts new file mode 100644 index 0000000..1bf3e23 --- /dev/null +++ b/src/app/entities/ban/Ban.ts @@ -0,0 +1,19 @@ +export interface Ban { + id: number; + steam_id: string; + account_id: number; + player_name: string; + ban_length: number; + ban_length_seconds: number; + ban_reason: string; + banned_by: string; + banned_by_id: string; + ip: string; + timestamp: Date; + ban_utime: number; + active: boolean; + unbanned_by_id: string; + unbanned_timestamp: Date; + admin_info: any; + unbanned_admin_info: any; +} diff --git a/src/app/pages/banlist-page/banlist-page.component.html b/src/app/pages/banlist-page/banlist-page.component.html new file mode 100644 index 0000000..0e4259b --- /dev/null +++ b/src/app/pages/banlist-page/banlist-page.component.html @@ -0,0 +1,25 @@ +
+

Бан лист

+

Скоро и ты сюда попадешь браток{{total==0?'':'как и остальные ' + total + ' карликов'}}

+
+ +
+
+ +
+ + + + +

#{{ban.id}} {{ban.player_name}}

+
+ +

{{ban.timestamp | date:'dd/MM/YYYY hh:mm:ss'}}

+
+
+

А хуй знает я еще не приудмал

+
+
+
+
+
diff --git a/src/app/pages/banlist-page/banlist-page.component.scss b/src/app/pages/banlist-page/banlist-page.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/pages/banlist-page/banlist-page.component.ts b/src/app/pages/banlist-page/banlist-page.component.ts new file mode 100644 index 0000000..dd6176b --- /dev/null +++ b/src/app/pages/banlist-page/banlist-page.component.ts @@ -0,0 +1,36 @@ +import { Component, OnInit } from '@angular/core'; +import {AuthService} from "../../services/auth.service"; +import {BanService} from "../../services/ban.service"; +import {Ban} from "../../entities/ban/Ban"; + +@Component({ + selector: 'app-banlist-page', + templateUrl: './banlist-page.component.html', + styleUrls: ['./banlist-page.component.scss'] +}) +export class BanlistPageComponent implements OnInit { + loading: boolean | null = null; + bans: Ban[] = []; + total: number = 0; + + constructor(public authService: AuthService, + private banService: BanService) { + } + + ngOnInit(): void { + if (this.authService.isAuth()) { + this.getBanList(); + } + } + + getBanList() { + this.loading = true; + this.banService.getBanList().subscribe( + (res) => { + this.bans = res.data; + this.total = res.count; + }, () => {}, () => this.loading = false + ) + } + +} diff --git a/src/app/pages/internal-components/NeedAuthToContinue.ts b/src/app/pages/internal-components/NeedAuthToContinue.ts index 070e667..8f7e8ae 100644 --- a/src/app/pages/internal-components/NeedAuthToContinue.ts +++ b/src/app/pages/internal-components/NeedAuthToContinue.ts @@ -7,7 +7,7 @@ import {AuthService} from "../../services/auth.service";
-

Нужно сначала авторизоваться

+

Нужно сначала авторизоваться

diff --git a/src/app/pages/main-page/main-page.component.html b/src/app/pages/main-page/main-page.component.html index 72be172..da0a6ad 100644 --- a/src/app/pages/main-page/main-page.component.html +++ b/src/app/pages/main-page/main-page.component.html @@ -41,8 +41,8 @@
- Введите ник... - + {{authService.isAuth()?'Введите ник...':'Войди в свой профиль для поиска'}} +
diff --git a/src/app/pages/main-page/main-page.component.ts b/src/app/pages/main-page/main-page.component.ts index bced15b..39e93f2 100644 --- a/src/app/pages/main-page/main-page.component.ts +++ b/src/app/pages/main-page/main-page.component.ts @@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core'; import {AnnonceService} from "../../services/AnnonceService"; import {Annonce} from "../../entities/Annonce"; import {Router} from "@angular/router"; +import {AuthService} from "../../services/auth.service"; @Component({ selector: 'app-main-page', @@ -20,7 +21,10 @@ export class MainPageComponent implements OnInit { {ico: 'live_help', name: 'О нас', url: 'abot'} ] + search: string|null = null; + constructor(private annoncesService: AnnonceService, + protected authService: AuthService, private router: Router) { } ngOnInit(): void { diff --git a/src/app/services/auth.service.ts b/src/app/services/auth.service.ts index 0c92c2b..e01fee5 100644 --- a/src/app/services/auth.service.ts +++ b/src/app/services/auth.service.ts @@ -8,7 +8,7 @@ import {SteamIDs} from "../entities/profile/SteamIDs"; providedIn: 'root' }) export class AuthService { - static KEY: string = "steam_data"; + static KEY: string = "steam_ids"; steamdata: SteamData | null = null; steamIds: SteamIDs | null = null; @@ -17,14 +17,21 @@ export class AuthService { .subscribe((res) => { this.steamdata = res.steam_data; this.steamIds = res.steamids + sessionStorage.setItem(AuthService.KEY, JSON.stringify(res.steamids)) }) } login() { + sessionStorage.removeItem(AuthService.KEY); window.open("api/auth/login?subdomain=tf2") } logout() { + sessionStorage.removeItem(AuthService.KEY); window.open("api/auth/logout") } + + isAuth() { + return sessionStorage.getItem(AuthService.KEY) != null; + } } diff --git a/src/app/services/ban.service.ts b/src/app/services/ban.service.ts new file mode 100644 index 0000000..1654a96 --- /dev/null +++ b/src/app/services/ban.service.ts @@ -0,0 +1,19 @@ +import { Injectable } from '@angular/core'; +import {HttpClient} from "@angular/common/http"; +import {ShityPaginator} from "../entities/ShityPaginator"; +import {Ban} from "../entities/ban/Ban"; +import {map, Observable} from "rxjs"; + +@Injectable({ + providedIn: 'root' +}) +export class BanService { + + constructor(private http: HttpClient) { } + + getBanList(): Observable> { + return this.http.get("api/web/banlist").pipe( + map((res) => ShityPaginator.newObj().fromData(res, "bans")) + ) + } +} diff --git a/src/styles.scss b/src/styles.scss index 1ea08ee..6252715 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -87,14 +87,93 @@ span { color: #5e7edf; } +//размеры говна начало + .content-in-center { width: 66%; margin: 0 auto } .content-in-center-header { - display: flex; width: 66%; padding-left: calc((100% - 66%)/2); padding-right: calc((100% - 66%)/2); margin: 0 auto; background: linear-gradient(to top, #f2a998, #e65e11); + display: flex; + width: 66%; + padding-left: calc((100% - 66%)/2); + padding-right: calc((100% - 66%)/2); + margin: 0 auto; + background: linear-gradient(to top, #f2a998, #e65e11); +} + +@media only screen and (max-width: 600px) { + $screen-width: 95%; + + .content-in-center { + width: $screen-width; + } + + .content-in-center-header { + width: $screen-width; + padding-left: calc((100% - $screen-width)/2); + padding-right: calc((100% - $screen-width)/2); + } +} + +@media only screen and (min-width: 600px) { + $screen-width: 90%; + + .content-in-center { + width: $screen-width; + } + + .content-in-center-header { + width: $screen-width; + padding-left: calc((100% - $screen-width)/2); + padding-right: calc((100% - $screen-width)/2); + } +} + +@media only screen and (min-width: 768px) { + $screen-width: 80%; + + .content-in-center { + width: $screen-width; + } + + .content-in-center-header { + width: $screen-width; + padding-left: calc((100% - $screen-width)/2); + padding-right: calc((100% - $screen-width)/2); + } +} + +@media only screen and (min-width: 992px) { + $screen-width: 70%; + + .content-in-center { + width: $screen-width; + } + + .content-in-center-header { + width: $screen-width; + padding-left: calc((100% - $screen-width)/2); + padding-right: calc((100% - $screen-width)/2); + } } +@media only screen and (min-width: 1200px) { + $screen-width: 66%; + + .content-in-center { + width: $screen-width; + } + + .content-in-center-header { + width: $screen-width; + padding-left: calc((100% - $screen-width)/2); + padding-right: calc((100% - $screen-width)/2); + } +} + +//размеры говна конец + .content-in-border { border-radius: 15px; background-color: #f5f5f5;