diff options
author | Chocobozzz <me@florianbigard.com> | 2022-07-08 10:32:33 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-07-08 10:58:05 +0200 |
commit | c0e3d9ff9019fc3af9791bd20e1430724b2a043a (patch) | |
tree | c43204bf44440eda4775fd1c3355f69bfeecb76e /client/src/app/+page-not-found | |
parent | c482d2b7a6c59867973291f3ea3eca7d2db87d2a (diff) | |
download | PeerTube-c0e3d9ff9019fc3af9791bd20e1430724b2a043a.tar.gz PeerTube-c0e3d9ff9019fc3af9791bd20e1430724b2a043a.tar.zst PeerTube-c0e3d9ff9019fc3af9791bd20e1430724b2a043a.zip |
Rename not fount page to error page
Diffstat (limited to 'client/src/app/+page-not-found')
5 files changed, 0 insertions, 211 deletions
diff --git a/client/src/app/+page-not-found/page-not-found-routing.module.ts b/client/src/app/+page-not-found/page-not-found-routing.module.ts deleted file mode 100644 index 84f400bb6..000000000 --- a/client/src/app/+page-not-found/page-not-found-routing.module.ts +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | import { NgModule } from '@angular/core' | ||
2 | import { RouterModule, Routes } from '@angular/router' | ||
3 | import { PageNotFoundComponent } from './page-not-found.component' | ||
4 | import { MenuGuards } from '@app/core' | ||
5 | |||
6 | const pageNotFoundRoutes: Routes = [ | ||
7 | { | ||
8 | path: '', | ||
9 | component: PageNotFoundComponent, | ||
10 | canActivate: [ MenuGuards.close(true) ], | ||
11 | canDeactivate: [ MenuGuards.open(true) ], | ||
12 | data: { | ||
13 | meta: { | ||
14 | title: $localize`Not found` | ||
15 | } | ||
16 | } | ||
17 | } | ||
18 | ] | ||
19 | |||
20 | @NgModule({ | ||
21 | imports: [ RouterModule.forChild(pageNotFoundRoutes) ], | ||
22 | exports: [ RouterModule ] | ||
23 | }) | ||
24 | export class PageNotFoundRoutingModule {} | ||
diff --git a/client/src/app/+page-not-found/page-not-found.component.html b/client/src/app/+page-not-found/page-not-found.component.html deleted file mode 100644 index b950b8640..000000000 --- a/client/src/app/+page-not-found/page-not-found.component.html +++ /dev/null | |||
@@ -1,61 +0,0 @@ | |||
1 | <div class="root"> | ||
2 | <div *ngIf="status !== 401 && status !== 403 && status !== 418" class="box"> | ||
3 | <strong>{{ status }}.</strong> | ||
4 | <span class="ms-1 muted" i18n>That's an error.</span> | ||
5 | |||
6 | <div class="text mt-4"> | ||
7 | <ng-container *ngIf="type === 'video'" i18n>We couldn't find any video tied to the URL {{ pathname }} you were looking for.</ng-container> | ||
8 | <ng-container *ngIf="type !== 'video'" i18n>We couldn't find any resource tied to the URL {{ pathname }} you were looking for.</ng-container> | ||
9 | </div> | ||
10 | |||
11 | <div class="muted mt-4"> | ||
12 | <span i18n="Possible reasons preceding a list of reasons a `Not Found` error page may occur">Possible reasons:</span> | ||
13 | |||
14 | <ul> | ||
15 | <li i18n>You may have used an outdated or broken link</li> | ||
16 | <li> | ||
17 | <ng-container *ngIf="type === 'video'" i18n>The video may have been moved or deleted</ng-container> | ||
18 | <ng-container *ngIf="type !== 'video'" i18n>The resource may have been moved or deleted</ng-container> | ||
19 | </li> | ||
20 | <li i18n>You may have typed the address or URL incorrectly</li> | ||
21 | </ul> | ||
22 | </div> | ||
23 | </div> | ||
24 | |||
25 | <div *ngIf="status === 401" class="box"> | ||
26 | <strong>{{ status }}.</strong> | ||
27 | <span class="ms-1 muted" i18n>You are not authorized here.</span> | ||
28 | |||
29 | <div class="text mt-4"> | ||
30 | <ng-container *ngIf="type === 'video'" i18n>You might need to login to see the video.</ng-container> | ||
31 | <ng-container *ngIf="type !== 'video'" i18n>You might need to login to see the resource.</ng-container> | ||
32 | </div> | ||
33 | |||
34 | <a class="peertube-button-link orange-button mt-5" i18n routerLink="/login"> | ||
35 | Login | ||
36 | </a> | ||
37 | |||
38 | </div> | ||
39 | |||
40 | <div *ngIf="status === 403" class="box"> | ||
41 | <strong>{{ status }}.</strong> | ||
42 | <span class="ms-1 muted" i18n>You are not authorized here.</span> | ||
43 | |||
44 | <div class="text mt-4"> | ||
45 | <ng-container *ngIf="type === 'video'" i18n>You might need to check your account is allowed by the video or instance owner.</ng-container> | ||
46 | <ng-container *ngIf="type !== 'video'" i18n>You might need to check your account is allowed by the resource or instance owner.</ng-container> | ||
47 | </div> | ||
48 | </div> | ||
49 | |||
50 | <div *ngIf="status === 418" class="box"> | ||
51 | <strong>{{ status }}.</strong> | ||
52 | <span class="ms-1 muted">I'm a teapot.</span> | ||
53 | |||
54 | <div class="text mt-4" i18n="Description of a tea flavour, keeping the 'requested entity body' as a technical expression referring to a web request"> | ||
55 | The requested entity body blends sweet bits with a mellow earthiness. | ||
56 | </div> | ||
57 | <div class="muted" i18n="This is about Sepia's tea">Sepia seems to like it.</div> | ||
58 | </div> | ||
59 | |||
60 | <img src='/client/assets/images/mascot/{{ getMascotName() }}.svg' alt='{{ status }} mascot' class="mb-4"> | ||
61 | </div> | ||
diff --git a/client/src/app/+page-not-found/page-not-found.component.scss b/client/src/app/+page-not-found/page-not-found.component.scss deleted file mode 100644 index efb81ff00..000000000 --- a/client/src/app/+page-not-found/page-not-found.component.scss +++ /dev/null | |||
@@ -1,57 +0,0 @@ | |||
1 | @use '_variables' as *; | ||
2 | @use '_mixins' as *; | ||
3 | |||
4 | .root { | ||
5 | @include margin-left(auto); | ||
6 | @include margin-right(auto); | ||
7 | |||
8 | height: 100%; | ||
9 | text-align: center; | ||
10 | padding-top: 150px; | ||
11 | display: flex; | ||
12 | justify-content: center; | ||
13 | flex-direction: column-reverse; | ||
14 | |||
15 | .box { | ||
16 | text-align: start; | ||
17 | font-size: 120%; | ||
18 | padding: 0 15px; | ||
19 | } | ||
20 | |||
21 | img { | ||
22 | @include margin-left(auto); | ||
23 | |||
24 | width: 220px; | ||
25 | height: auto; | ||
26 | } | ||
27 | |||
28 | @media screen and (max-width: $mobile-view) { | ||
29 | img { | ||
30 | @include margin-right(auto); | ||
31 | } | ||
32 | } | ||
33 | |||
34 | @media screen and (min-width: $mobile-view) { | ||
35 | width: 400px; | ||
36 | } | ||
37 | |||
38 | @media screen and (min-width: #{breakpoint(lg)}) { | ||
39 | width: 600px; | ||
40 | } | ||
41 | |||
42 | @media screen and (min-width: #{breakpoint(xl)}) { | ||
43 | width: 700px; | ||
44 | } | ||
45 | |||
46 | @media screen and (min-width: #{breakpoint(xxl)}) { | ||
47 | width: 800px; | ||
48 | } | ||
49 | |||
50 | @media screen and (max-height: 600px) { | ||
51 | padding-top: 50px; | ||
52 | |||
53 | img { | ||
54 | width: 160px; | ||
55 | } | ||
56 | } | ||
57 | } | ||
diff --git a/client/src/app/+page-not-found/page-not-found.component.ts b/client/src/app/+page-not-found/page-not-found.component.ts deleted file mode 100644 index 10645a634..000000000 --- a/client/src/app/+page-not-found/page-not-found.component.ts +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | ||
2 | import { Title } from '@angular/platform-browser' | ||
3 | import { Router } from '@angular/router' | ||
4 | import { HttpStatusCode } from '@shared/models' | ||
5 | |||
6 | @Component({ | ||
7 | selector: 'my-page-not-found', | ||
8 | templateUrl: './page-not-found.component.html', | ||
9 | styleUrls: [ './page-not-found.component.scss' ] | ||
10 | }) | ||
11 | export class PageNotFoundComponent implements OnInit { | ||
12 | status = HttpStatusCode.NOT_FOUND_404 | ||
13 | type: 'video' | 'other' = 'other' | ||
14 | |||
15 | public constructor ( | ||
16 | private titleService: Title, | ||
17 | private router: Router | ||
18 | ) { | ||
19 | const state = this.router.getCurrentNavigation()?.extras.state | ||
20 | this.type = state?.type || this.type | ||
21 | this.status = state?.obj.status || this.status | ||
22 | } | ||
23 | |||
24 | ngOnInit () { | ||
25 | if (this.pathname.includes('teapot')) { | ||
26 | this.status = HttpStatusCode.I_AM_A_TEAPOT_418 | ||
27 | this.titleService.setTitle($localize`I'm a teapot` + ' - PeerTube') | ||
28 | } | ||
29 | } | ||
30 | |||
31 | get pathname () { | ||
32 | return window.location.pathname | ||
33 | } | ||
34 | |||
35 | getMascotName () { | ||
36 | switch (this.status) { | ||
37 | case HttpStatusCode.I_AM_A_TEAPOT_418: | ||
38 | return 'happy' | ||
39 | case HttpStatusCode.FORBIDDEN_403: | ||
40 | return 'arguing' | ||
41 | case HttpStatusCode.NOT_FOUND_404: | ||
42 | default: | ||
43 | return 'defeated' | ||
44 | } | ||
45 | } | ||
46 | } | ||
diff --git a/client/src/app/+page-not-found/page-not-found.module.ts b/client/src/app/+page-not-found/page-not-found.module.ts deleted file mode 100644 index 2e09ab299..000000000 --- a/client/src/app/+page-not-found/page-not-found.module.ts +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | import { CommonModule } from '@angular/common' | ||
2 | import { NgModule } from '@angular/core' | ||
3 | import { PageNotFoundRoutingModule } from './page-not-found-routing.module' | ||
4 | import { PageNotFoundComponent } from './page-not-found.component' | ||
5 | |||
6 | @NgModule({ | ||
7 | imports: [ | ||
8 | CommonModule, | ||
9 | |||
10 | PageNotFoundRoutingModule | ||
11 | ], | ||
12 | |||
13 | declarations: [ | ||
14 | PageNotFoundComponent | ||
15 | ], | ||
16 | |||
17 | exports: [ | ||
18 | PageNotFoundComponent | ||
19 | ], | ||
20 | |||
21 | providers: [] | ||
22 | }) | ||
23 | export class PageNotFoundModule { } | ||