Skip to content
Merged
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
12 changes: 0 additions & 12 deletions src/app/app.css
Original file line number Diff line number Diff line change
@@ -1,12 +0,0 @@
.private {
padding: 1rem;
container-type: inline-size;
}

.public {
display: flex;
align-items: center;
justify-content: center;
min-height: 100vh;
}

12 changes: 1 addition & 11 deletions src/app/app.html
Original file line number Diff line number Diff line change
@@ -1,11 +1 @@
@if (authStatus()?.authenticated) {
<main class="private">
<app-nav>
<router-outlet/>
</app-nav>
</main>
} @else {
<main class="public">
<router-outlet/>
</main>
}
<ng-container *ngComponentOutlet="getOutlet()"/>
15 changes: 8 additions & 7 deletions src/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ export const routes: Routes = [
{ path: '', redirectTo: 'auth', pathMatch: 'full' },
{ path: 'auth', component: AuthPage, data: { title: 'Authentication' } },
{
path: 'home',
path: 'articles',
loadComponent: async () => {
const c = await import('./pages/home/home-page.component')
return c.HomePage
const c = await import('./pages/articles-page/articles-page')
return c.ArticlesPage
},
canMatch: [authGuard],
},
{
path: 'bookmarks',
loadComponent: async () => {
const c = await import('./pages/bookmarks/bookmarks')
return c.Bookmarks
const c = await import('./pages/bookmarks-page/bookmarks-page')
return c.BookmarksPage
},
canMatch: [authGuard],
},
Expand All @@ -35,7 +35,7 @@ export const routes: Routes = [
{
path: 'subscription/:subscriptionId/article/:articleId',
loadComponent: async () => {
const c = await import('./pages/article-page/article-page.component')
const c = await import('./pages/article-page/article-page')
return c.ArticlePage
},
data: { title: 'Article' },
Expand All @@ -44,7 +44,7 @@ export const routes: Routes = [
{
path: 'tags',
loadComponent: async () => {
const c = await import('./pages/tags/tags-page.component')
const c = await import('./pages/tags-page/tags-page')
return c.TagsPage
},
data: { title: 'Tags' },
Expand All @@ -63,6 +63,7 @@ export const routes: Routes = [
path: 'status',
component: StatusPage,
data: { title: 'Status' },
canMatch: [authGuard],
},
{
path: '**',
Expand Down
13 changes: 9 additions & 4 deletions src/app/app.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
import { Component, inject } from '@angular/core'
import { RouterOutlet } from '@angular/router'
import { NavComponent } from './components/nav/nav.component'
import { AuthService } from './services/auth-service'
import { toSignal } from '@angular/core/rxjs-interop'
import { PrivateOutlet } from './outlet/private-outlet/private-outlet'
import { PublicOutlet } from './outlet/public-outlet/public-outlet'
import { NgComponentOutlet } from '@angular/common'

@Component({
selector: 'app-root',
imports: [RouterOutlet, NavComponent],
imports: [NgComponentOutlet],
templateUrl: './app.html',
styleUrl: './app.css',
})
export class App {
private readonly authService = inject(AuthService)
protected readonly authStatus = toSignal(this.authService.$authStatus)
private readonly authStatus = toSignal(this.authService.$authStatus)

getOutlet() {
return this.authStatus()?.authenticated ? PrivateOutlet : PublicOutlet
}
}
4 changes: 4 additions & 0 deletions src/app/components/login-form/login-form.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@
gap: 1rem;
margin: 1rem 0;
}

.description {
max-width: 30ch;
}
3 changes: 3 additions & 0 deletions src/app/components/login-form/login-form.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<form (ngSubmit)="onSubmit()">
<mat-card-content class="credentials">
<span class="description">
Login with your existing password and login.
</span>
<mat-form-field>
<mat-label>Login</mat-label>
<input
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/login-form/login-form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class LoginForm {
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe((result) => {
if (result) {
this.router.navigate(['/home'])
this.router.navigate(['/articles'])
}
})
}
Expand Down
11 changes: 2 additions & 9 deletions src/app/components/nav/nav.component.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
import {
Component,
DestroyRef,
inject,
OnInit,
signal,
viewChild
} from '@angular/core'
import { Component, DestroyRef, inject, OnInit, signal, viewChild } from '@angular/core'
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout'
import { AsyncPipe } from '@angular/common'
import { MatToolbarModule } from '@angular/material/toolbar'
Expand Down Expand Up @@ -55,7 +48,7 @@ export class NavComponent implements OnInit {
private router = inject(Router)

menuItems: { title: string; icon?: string; url: string }[] = [
{ title: 'Articles', url: '/home', icon: 'library_books' },
{ title: 'Articles', url: '/articles', icon: 'library_books' },
{ title: 'Bookmarks', url: '/bookmarks', icon: 'bookmark' },
{ title: 'Subscriptions', url: '/subscriptions', icon: 'rss_feed' },
{ title: 'Tags', url: '/tags', icon: 'tag' },
Expand Down
16 changes: 10 additions & 6 deletions src/app/components/page-display-toggle/page-display-toggle.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
<mat-button-toggle>
<mat-icon
<button
matIconButton
[class]="(display | async) === PageDisplay.Title ? 'highlighted' : undefined"
(click)="toggleDisplay(PageDisplay.Title)"
>view_day
</mat-icon>
<mat-icon
>
<mat-icon>view_day</mat-icon>
</button>
<button
matIconButton
[class]="(display | async) === PageDisplay.Short ? 'highlighted' : undefined"
(click)="toggleDisplay(PageDisplay.Short)"
>view_agenda
</mat-icon>
>
<mat-icon>view_agenda</mat-icon>
</button>
</mat-button-toggle>
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import { MatButtonToggle } from '@angular/material/button-toggle'
import { MatIcon } from '@angular/material/icon'
import { PageDisplay } from '../../entities/page/page.enums'
import { AsyncPipe } from '@angular/common'
import { MatIconButton } from '@angular/material/button'

@Component({
selector: 'app-page-display-toggle',
imports: [MatButtonToggle, MatIcon, MatButtonToggle, MatIcon, AsyncPipe],
imports: [MatButtonToggle, MatIcon, MatButtonToggle, MatIcon, AsyncPipe, MatIconButton],
templateUrl: './page-display-toggle.html',
styleUrl: './page-display-toggle.css',
})
Expand Down
10 changes: 0 additions & 10 deletions src/app/components/page-title/page-title.css

This file was deleted.

3 changes: 0 additions & 3 deletions src/app/components/page-title/page-title.html

This file was deleted.

36 changes: 0 additions & 36 deletions src/app/components/page-title/page-title.ts

This file was deleted.

4 changes: 4 additions & 0 deletions src/app/outlet/private-outlet/private-outlet.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.private {
padding: 1rem;
container-type: inline-size;
}
5 changes: 5 additions & 0 deletions src/app/outlet/private-outlet/private-outlet.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<main class="private">
<app-nav>
<router-outlet/>
</app-nav>
</main>
11 changes: 11 additions & 0 deletions src/app/outlet/private-outlet/private-outlet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Component } from '@angular/core'
import { NavComponent } from '../../components/nav/nav.component'
import { RouterOutlet } from '@angular/router'

@Component({
selector: 'app-private-outlet',
imports: [NavComponent, RouterOutlet],
templateUrl: './private-outlet.html',
styleUrl: './private-outlet.css',
})
export class PrivateOutlet {}
6 changes: 6 additions & 0 deletions src/app/outlet/public-outlet/public-outlet.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.public {
display: flex;
align-items: center;
justify-content: center;
min-height: 100vh;
}
3 changes: 3 additions & 0 deletions src/app/outlet/public-outlet/public-outlet.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<main class="public">
<router-outlet/>
</main>
10 changes: 10 additions & 0 deletions src/app/outlet/public-outlet/public-outlet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Component } from '@angular/core'
import { RouterOutlet } from '@angular/router'

@Component({
selector: 'app-public',
imports: [RouterOutlet],
templateUrl: './public-outlet.html',
styleUrl: './public-outlet.css',
})
export class PublicOutlet {}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { TitleService } from '../../services/title-service'
import { DomSanitizer, SafeHtml } from '@angular/platform-browser'

@Component({
selector: 'app-article',
selector: 'app-article-page',
imports: [
MatToolbarModule,
MatProgressBarModule,
Expand All @@ -28,8 +28,8 @@ import { DomSanitizer, SafeHtml } from '@angular/platform-browser'
MatIconButton,
MatDivider,
],
templateUrl: './article-page.component.html',
styleUrl: './article-page.component.css',
templateUrl: './article-page.html',
styleUrl: './article-page.css',
})
export class ArticlePage implements OnInit {
feedService = inject(FeedService)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,34 @@
</button>
<app-row-spacer/>
<mat-button-toggle>
<mat-icon
<button
matIconButton
[class]="($dateOrder | async) === SortOrder.Asc ? 'highlighted' : undefined"
(click)="orderHandler('date')"
[title]="($dateOrder | async) === SortOrder.Asc ? 'Older first' : 'Newer first'"
>schedule
</mat-icon>
<mat-icon
>

<mat-icon>schedule</mat-icon>
</button>
<button
matIconButton
[class]="($readFilter | async) ? 'highlighted' : undefined"
(click)="filterHandler('read')"
[title]="($readFilter | async) ? 'Show read' : 'Show unread'"
>{{ ($readFilter | async) ? 'mark_email_unread' : 'mark_email_read' }}
</mat-icon>
<mat-icon
[class]="($favFilter | async) ? 'highlighted' : undefined"
>
<mat-icon>
{{ ($readFilter | async) ? 'mark_email_unread' : 'mark_email_read' }}
</mat-icon>
</button>
<button
matIconButton
(click)="filterHandler('fav')"
[class]="($favFilter | async) ? 'highlighted' : undefined"
[title]="($favFilter | async) ? 'Show favorites' : 'Show all'"
>bookmark
</mat-icon>
[disabled]="$tagFilter | async"
>
<mat-icon>bookmark</mat-icon>
</button>
</mat-button-toggle>
</mat-toolbar-row>

Expand Down
Loading