Rename not fount page to error page

This commit is contained in:
Chocobozzz 2022-07-08 10:32:33 +02:00
parent c482d2b7a6
commit c0e3d9ff90
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
11 changed files with 51 additions and 48 deletions

View File

@ -1,12 +1,12 @@
import { NgModule } from '@angular/core'
import { RouterModule, Routes } from '@angular/router'
import { PageNotFoundComponent } from './page-not-found.component'
import { ErrorPageComponent } from './error-page.component'
import { MenuGuards } from '@app/core'
const pageNotFoundRoutes: Routes = [
const errorPageRoutes: Routes = [
{
path: '',
component: PageNotFoundComponent,
component: ErrorPageComponent,
canActivate: [ MenuGuards.close(true) ],
canDeactivate: [ MenuGuards.open(true) ],
data: {
@ -18,7 +18,7 @@ const pageNotFoundRoutes: Routes = [
]
@NgModule({
imports: [ RouterModule.forChild(pageNotFoundRoutes) ],
imports: [ RouterModule.forChild(errorPageRoutes) ],
exports: [ RouterModule ]
})
export class PageNotFoundRoutingModule {}
export class ErrorPageRoutingModule {}

View File

@ -31,7 +31,7 @@
<ng-container *ngIf="type !== 'video'" i18n>You might need to login to see the resource.</ng-container>
</div>
<a class="peertube-button-link orange-button mt-5" i18n routerLink="/login">
<a class="peertube-button-big-link orange-button mt-5" i18n routerLink="/login">
Login
</a>

View File

@ -35,18 +35,6 @@
width: 400px;
}
@media screen and (min-width: #{breakpoint(lg)}) {
width: 600px;
}
@media screen and (min-width: #{breakpoint(xl)}) {
width: 700px;
}
@media screen and (min-width: #{breakpoint(xxl)}) {
width: 800px;
}
@media screen and (max-height: 600px) {
padding-top: 50px;

View File

@ -4,11 +4,11 @@ import { Router } from '@angular/router'
import { HttpStatusCode } from '@shared/models'
@Component({
selector: 'my-page-not-found',
templateUrl: './page-not-found.component.html',
styleUrls: [ './page-not-found.component.scss' ]
selector: 'my-error-page',
templateUrl: './error-page.component.html',
styleUrls: [ './error-page.component.scss' ]
})
export class PageNotFoundComponent implements OnInit {
export class ErrorPageComponent implements OnInit {
status = HttpStatusCode.NOT_FOUND_404
type: 'video' | 'other' = 'other'

View File

@ -0,0 +1,23 @@
import { CommonModule } from '@angular/common'
import { NgModule } from '@angular/core'
import { ErrorPageRoutingModule } from './error-page-routing.module'
import { ErrorPageComponent } from './error-page.component'
@NgModule({
imports: [
CommonModule,
ErrorPageRoutingModule
],
declarations: [
ErrorPageComponent
],
exports: [
ErrorPageComponent
],
providers: []
})
export class ErrorPageModule { }

View File

@ -1,23 +0,0 @@
import { CommonModule } from '@angular/common'
import { NgModule } from '@angular/core'
import { PageNotFoundRoutingModule } from './page-not-found-routing.module'
import { PageNotFoundComponent } from './page-not-found.component'
@NgModule({
imports: [
CommonModule,
PageNotFoundRoutingModule
],
declarations: [
PageNotFoundComponent
],
exports: [
PageNotFoundComponent
],
providers: []
})
export class PageNotFoundModule { }

View File

@ -194,7 +194,7 @@ for (const locale of POSSIBLE_LOCALES) {
routes.push({
path: '**',
loadChildren: () => import('./+page-not-found/page-not-found.module').then(m => m.PageNotFoundModule)
loadChildren: () => import('./+error-page/error-page.module').then(m => m.ErrorPageModule)
})
@NgModule({

View File

@ -46,7 +46,7 @@ export class RedirectService {
this.currentUrl = this.router.url
router.events.subscribe(event => {
if (event instanceof NavigationEnd || event instanceof NavigationCancel) {
if (event.url === '/404') return
if ([ '/401', '/404' ].includes(event.url)) return
this.previousUrl = this.currentUrl
this.currentUrl = event.url

View File

@ -62,7 +62,7 @@ export class AuthInterceptor implements HttpInterceptor {
}
private handleNotAuthenticated (err: HttpErrorResponse): Observable<any> {
this.router.navigate([ '/404' ], { state: { obj: err }, skipLocationChange: true })
this.router.navigate([ '/401' ], { state: { obj: err }, skipLocationChange: true })
return of(err.message)
}
}

View File

@ -27,10 +27,18 @@
@include peertube-button;
}
.peertube-button-big {
@include peertube-button-big;
}
.peertube-button-link {
@include peertube-button-link;
}
.peertube-button-big-link {
@include peertube-button-big-link;
}
.orange-button {
@include orange-button;
}

View File

@ -284,6 +284,13 @@
display: inline-block;
}
@mixin peertube-button-big-link {
@include disable-default-a-behaviour;
@include peertube-button-big;
display: inline-block;
}
@mixin peertube-button-outline {
@include disable-default-a-behaviour;
@include peertube-button;