Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import { map } from "rxjs/operators";
export const routes: Routes = [
{
path: "",
loadComponent: () => import("./features/chat/chat.component"),
},
{
path: "home",
loadComponent: () => import("./features/article/pages/home/home.component"),
},
{
Expand Down
4 changes: 4 additions & 0 deletions src/app/core/interceptors/api.interceptor.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { HttpInterceptorFn } from "@angular/common/http";

export const apiInterceptor: HttpInterceptorFn = (req, next) => {
// Skip URL transformation for requests that already have a full URL (e.g., localhost)
if (req.url.startsWith("http://") || req.url.startsWith("https://")) {
return next(req);
}
const apiReq = req.clone({ url: `https://api.realworld.show/api${req.url}` });
return next(apiReq);
};
8 changes: 3 additions & 5 deletions src/app/core/layout/footer.component.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
<footer>
<div class="container">
<a class="logo-font" routerLink="/">conduit</a>
<a class="logo-font" routerLink="/">Happy Hour Bot</a>
<span class="attribution">
&copy; {{ today | date: "yyyy" }}. An interactive learning project from
<a href="https://github.com/gothinkster/realworld"
>RealWorld OSS Project</a
>. Code licensed under MIT.
&copy; {{ today | date: "yyyy" }}. Find happy hours in Belmont Shore,
Naples & 2nd & PCH.
</span>
</div>
</footer>
54 changes: 4 additions & 50 deletions src/app/core/layout/header.component.html
Original file line number Diff line number Diff line change
@@ -1,65 +1,19 @@
<nav class="navbar navbar-light">
<div class="container">
<a class="navbar-brand" routerLink="/">conduit</a>
<a class="navbar-brand" routerLink="/">Happy Hour Bot</a>

<!-- Show this for logged out users -->
<ul *ifAuthenticated="false" class="nav navbar-nav pull-xs-right">
<li class="nav-item">
<a class="nav-link" routerLink="/"> Home </a>
</li>

<li class="nav-item">
<a class="nav-link" routerLink="/login" routerLinkActive="active">
Sign in
</a>
</li>

<li class="nav-item">
<a class="nav-link" routerLink="/register" routerLinkActive="active">
Sign up
</a>
</li>
</ul>

<!-- Show this for logged in users -->
<ul *ifAuthenticated="true" class="nav navbar-nav pull-xs-right">
<!-- Show this for all users -->
<ul class="nav navbar-nav pull-xs-right">
<li class="nav-item">
<a
class="nav-link"
routerLink="/"
routerLinkActive="active"
[routerLinkActiveOptions]="{ exact: true }"
>
Home
</a>
</li>

<li class="nav-item">
<a class="nav-link" routerLink="/editor" routerLinkActive="active">
<i class="ion-compose"></i>&nbsp;New Article
Chat
</a>
</li>

<li class="nav-item">
<a class="nav-link" routerLink="/settings" routerLinkActive="active">
<i class="ion-gear-a"></i>&nbsp;Settings
</a>
</li>

@if (currentUser$ | async; as currentUser) {
<li class="nav-item">
<a
class="nav-link"
[routerLink]="['/profile', currentUser.username]"
routerLinkActive="active"
>
@if (currentUser.image) {
<img [src]="currentUser.image" class="user-pic" />
}
{{ currentUser.username }}
</a>
</li>
}
</ul>
</div>
</nav>
11 changes: 3 additions & 8 deletions src/app/core/layout/header.component.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
import { Component, inject } from "@angular/core";
import { UserService } from "../auth/services/user.service";
import { Component } from "@angular/core";
import { RouterLink, RouterLinkActive } from "@angular/router";
import { AsyncPipe } from "@angular/common";
import { IfAuthenticatedDirective } from "../auth/if-authenticated.directive";

@Component({
selector: "app-layout-header",
templateUrl: "./header.component.html",
imports: [RouterLinkActive, RouterLink, AsyncPipe, IfAuthenticatedDirective],
imports: [RouterLinkActive, RouterLink],
})
export class HeaderComponent {
currentUser$ = inject(UserService).currentUser;
}
export class HeaderComponent {}
Loading