Skip to content

Commit c31bb63

Browse files
committed
feat: not found pages
1 parent 889e916 commit c31bb63

16 files changed

+119
-185
lines changed

angular.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@
4646
{
4747
"type": "initial",
4848
"maximumWarning": "500kB",
49-
"maximumError": "2MB"
49+
"maximumError": "5MB"
5050
},
5151
{
5252
"type": "anyComponentStyle",
5353
"maximumWarning": "2kB",
54-
"maximumError": "4kB"
54+
"maximumError": "7kB"
5555
}
5656
],
5757
"outputHashing": "all"

client/app/components/control/control.component.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77
[hideComments]="dependentPageUsing.hideComments" />
88
} @else if (dependentPageUsing.template === 'links') {
99
<app-links [id]="dependentPageUsing.using" />
10+
} @else {
11+
<app-not-found />
1012
}
13+
} @else {
14+
<app-not-found />
1115
}
1216
</div>
1317
</app-layout-using>

client/app/components/control/control.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { LayoutUsingComponent } from '../layout-using/layout-using.component'
33
import { PostContentComponent } from '../post-content/post-content.component'
44
import { Router } from '@angular/router'
55
import { LinksComponent } from '../../pages/links/links.component'
6+
import { NotFoundComponent } from '../../pages/not-found/not-found.component'
67

78
type DependentPage = {
89
name: string
@@ -23,7 +24,7 @@ type DependentPage = {
2324
@Component({
2425
selector: 'app-control',
2526
standalone: true,
26-
imports: [LayoutUsingComponent, PostContentComponent, LinksComponent],
27+
imports: [LayoutUsingComponent, PostContentComponent, LinksComponent, NotFoundComponent],
2728
templateUrl: './control.component.html'
2829
})
2930
export class ControlComponent {

client/app/components/layout-using/layout-using.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ <h1 class="text-8 font-bold font-sans font-350 break-words m-0 mb-4 line-height-
2424
<a target="_blank" href="https://github.com/biyuehu/romichan">biyuehu/romichan</a>,旧博客:<a target="_blank"
2525
href="https://old.hotaru.icu">old.hotaru.icu</a>
2626
</div>
27-
<div class="max-w-[1200px] mx-auto px-4">
27+
<div class="max-w-[1200px] mx-auto px-4 min-h-60vh">
2828
<ng-content select="[main]"></ng-content>
2929
</div>
3030
</div>

client/app/components/layout-using/layout-using.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { CUSTOM_ELEMENTS_SCHEMA, Component, OnInit } from '@angular/core'
2-
import { NavigationStart, Router, RouterLink, RouterOutlet } from '@angular/router'
2+
import { NavigationStart, Router, RouterLink } from '@angular/router'
33
import { HeaderComponent } from '../header/header.component'
44
import { FooterComponent } from '../footer/footer.component'
55
import { NotifyService } from '../../services/notify.service'

client/app/components/not-found/not-found.component.css

Whitespace-only changes.

client/app/components/not-found/not-found.component.html

Lines changed: 0 additions & 1 deletion
This file was deleted.

client/app/components/not-found/not-found.component.spec.ts

Lines changed: 0 additions & 23 deletions
This file was deleted.

client/app/components/not-found/not-found.component.ts

Lines changed: 0 additions & 12 deletions
This file was deleted.

client/app/pages/home/home.component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Component, type OnInit } from '@angular/core'
22
import { ResPostData } from '../../models/api.model'
33
import { PostListComponent } from '../../components/post-list/post-list.component'
44
import { romiComponentFactory } from '../../utils/romi-component-factory'
5+
import { handlePostList } from '../../utils'
56

67
@Component({
78
selector: 'app-home',
@@ -11,6 +12,7 @@ import { romiComponentFactory } from '../../utils/romi-component-factory'
1112
})
1213
export class HomeComponent extends romiComponentFactory<ResPostData[]>('home') implements OnInit {
1314
public ngOnInit(): void {
14-
this.setData((set) => this.apiService.getPosts().subscribe((data) => set(data)))
15+
// TODO: handle posts and posts locked need auth but cache data cannot get
16+
this.setData((set) => this.apiService.getPosts().subscribe((data) => set(handlePostList(data))))
1517
}
1618
}

0 commit comments

Comments
 (0)