From f51398a04be25f12deda9985269368b4dafb5e4e Mon Sep 17 00:00:00 2001 From: "maxim.gorbatyuk" Date: Thu, 6 Jun 2024 17:48:59 +0500 Subject: [PATCH] uwu added --- .../home/components/home/home.component.html | 46 +++++++++++++------ .../home/components/home/home.component.scss | 10 ++++ .../home/components/home/home.component.ts | 40 ++++++++++++++-- .../shared/routes/activated-route-extended.ts | 8 ++++ src/index.html | 6 +++ 5 files changed, 94 insertions(+), 16 deletions(-) diff --git a/src/app/modules/home/components/home/home.component.html b/src/app/modules/home/components/home/home.component.html index 7ca80a0a..78f1a813 100644 --- a/src/app/modules/home/components/home/home.component.html +++ b/src/app/modules/home/components/home/home.component.html @@ -1,20 +1,20 @@
-
-
-
-
Tech.Interview
-
Зарплаты в IT
-
Заметки к техническим интервью
+ +
+
+
+ UwU
-
-
- Interviewer +
Зарплаты в IT
+ +
@@ -123,3 +123,23 @@
+ + +
+ +
+
+
Tech.Interview
+
Зарплаты в IT
+
Заметки к техническим интервью
+
+
+
+ Interviewer +
+
+
\ No newline at end of file diff --git a/src/app/modules/home/components/home/home.component.scss b/src/app/modules/home/components/home/home.component.scss index 5f0f10e9..dd16e4e1 100644 --- a/src/app/modules/home/components/home/home.component.scss +++ b/src/app/modules/home/components/home/home.component.scss @@ -31,3 +31,13 @@ .bg-white { background-color: #fff; } + +.uwu-image { + max-width: 50%; + height: auto; +} + +.uwu-title { + color: #130e38; + font-weight: bolder; +} \ No newline at end of file diff --git a/src/app/modules/home/components/home/home.component.ts b/src/app/modules/home/components/home/home.component.ts index d64fb581..cddd7a5f 100644 --- a/src/app/modules/home/components/home/home.component.ts +++ b/src/app/modules/home/components/home/home.component.ts @@ -1,13 +1,47 @@ -import { Component } from "@angular/core"; +import { Component, OnDestroy, OnInit } from "@angular/core"; +import { ActivatedRoute } from "@angular/router"; import { TitleService } from "@services/title.service"; +import { ActivatedRouteExtended } from "@shared/routes/activated-route-extended"; +import { untilDestroyed } from "@shared/subscriptions/until-destroyed"; @Component({ selector: "app-home", templateUrl: "./home.component.html", styleUrls: ["./home.component.scss"], }) -export class HomeComponent { - constructor(titleService: TitleService) { +export class HomeComponent implements OnInit, OnDestroy { + + private readonly activatedRoute: ActivatedRouteExtended; + + readonly uwuLinkLight = "https://techinterview.fra1.cdn.digitaloceanspaces.com/images/uwu_light_1000.png"; + readonly uwuLinkDark = "https://techinterview.fra1.cdn.digitaloceanspaces.com/images/uwu_dark_1000.png"; + + showUwu = false; + + constructor( + titleService: TitleService, + activatedRoute: ActivatedRoute + ) { titleService.resetTitle(); + this.activatedRoute = new ActivatedRouteExtended(activatedRoute); + } + + getUwuLink(): string { + const date = new Date(Date.now()); + return date.getSeconds() % 2 === 0 + ? this.uwuLinkLight + : this.uwuLinkDark; + } + + ngOnInit(): void { + this.activatedRoute.getQueryParam("uwu") + .pipe(untilDestroyed(this)) + .subscribe((uwu) => { + this.showUwu = uwu === "true"; + }); + } + + ngOnDestroy(): void { + // Do nothing } } diff --git a/src/app/shared/routes/activated-route-extended.ts b/src/app/shared/routes/activated-route-extended.ts index 3867a731..ce8a56c6 100644 --- a/src/app/shared/routes/activated-route-extended.ts +++ b/src/app/shared/routes/activated-route-extended.ts @@ -29,6 +29,14 @@ export class ActivatedRouteExtended { ); } + getQueryParam(paramName: string): Observable { + return this.activatedRoute.queryParams.pipe( + map((params) => { + return params[paramName] ?? null; + }) + ); + } + getParam(paramName: string): Observable { return this.activatedRoute.paramMap.pipe( map((params) => { diff --git a/src/index.html b/src/index.html index 31e195f3..9f5ca884 100644 --- a/src/index.html +++ b/src/index.html @@ -88,6 +88,12 @@ >Пользовательское соглашение +
  • + + UwU? + +