Skip to content

Commit

Permalink
feat(navbar): Add environment badge to navbar
Browse files Browse the repository at this point in the history
- Added environment badges to the navbar component HTML file
- The badges display the current environment name (development or preview)
- Updated the navbar component TypeScript file to import the `environment` variable from the correct path
- Injected `AuthService` into the `NavbarComponent` class
  • Loading branch information
SakuraIsayeki committed Feb 23, 2024
1 parent 6c4d301 commit 05eef0b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
14 changes: 12 additions & 2 deletions wowskarma.app/src/app/shared/layout/navbar/navbar.component.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
<nav class="navbar fixed-top navbar-expand-sm navbar-toggleable-sm navbar-dark bg-dark-acrylic box-shadow mb-5 px-3">
<div class="container-fluid ps-0">
<div class="align-content-center mx-3">
<div class="d-flex flex-row align-items-center mx-3">
<a href="/" class='navbar-brand'>WOWS Karma</a>

@switch (environmentName) {
@case ("development") {
<div><strong class="badge rounded-pill text-bg-warning text-uppercase">Dev</strong></div>
}

@case ("preview") {
<div><strong class="badge rounded-pill text-bg-info text-uppercase">Preview</strong></div>
}
}
</div>

<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavContent"
Expand All @@ -19,7 +29,7 @@
</ul>

<ul class="navbar-nav flex-grow 0">
<navbar-auth></navbar-auth>
<navbar-auth />

<!-- TODO: Implement theming
<li class="nav-item ml-3 msl-5">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Component } from "@angular/core";
import { Component, inject } from "@angular/core";
import { AuthService } from "src/app/services/auth.service";
import { environment } from "../../../../environments/environment";

@Component({
selector: "app-navbar",
Expand All @@ -8,7 +9,9 @@ import { AuthService } from "src/app/services/auth.service";
})
export class NavbarComponent {
public isCollapsed = true;
environmentName = environment.name;

authService = inject(AuthService)


constructor(public authService: AuthService) {
}
}

0 comments on commit 05eef0b

Please sign in to comment.