diff options
author | Kimsible <1877318+kimsible@users.noreply.github.com> | 2020-12-07 16:34:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-07 16:34:07 +0100 |
commit | 40360c17d82b33accb34ea974c275e17880c37aa (patch) | |
tree | e0ddac1174e54897b4871daa4dca43dce121f590 /client/src/app/shared/shared-instance/instance-about-accordion.component.ts | |
parent | 10f26f4203b8cef32778bf3435d8112eaea3c093 (diff) | |
download | PeerTube-40360c17d82b33accb34ea974c275e17880c37aa.tar.gz PeerTube-40360c17d82b33accb34ea974c275e17880c37aa.tar.zst PeerTube-40360c17d82b33accb34ea974c275e17880c37aa.zip |
improvements to login and sign-up pages (#3357)
* New login form ui
* Move InstanceAboutAccordion to shared components
* Update closed registration alert text
* Add alert for opened registration and move them bellow login form
* Adjust flex block on signup and login views
* Replace toggle accordion with expand on links in signup and login + scrollTo
* Improve display of login alerts
* Fix missing Component suffix
* Define min-width instance-information block sign-up and login for mobile screens
* Add ability to select specific panels in instanceAboutAccorddion
* Add instance title and short-description to common instanceAboutAccordion
* Clarify title alert in login page
* Add step terms for signup
Co-authored-by: kimsible <kimsible@users.noreply.github.com>
Co-authored-by: Rigel Kent <sendmemail@rigelk.eu>
Diffstat (limited to 'client/src/app/shared/shared-instance/instance-about-accordion.component.ts')
-rw-r--r-- | client/src/app/shared/shared-instance/instance-about-accordion.component.ts | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/client/src/app/shared/shared-instance/instance-about-accordion.component.ts b/client/src/app/shared/shared-instance/instance-about-accordion.component.ts new file mode 100644 index 000000000..ab75c31ae --- /dev/null +++ b/client/src/app/shared/shared-instance/instance-about-accordion.component.ts | |||
@@ -0,0 +1,71 @@ | |||
1 | import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' | ||
2 | import { NgbAccordion } from '@ng-bootstrap/ng-bootstrap' | ||
3 | import { InstanceService } from './instance.service' | ||
4 | import { Notifier } from '@app/core' | ||
5 | import { About } from '@shared/models/server' | ||
6 | |||
7 | @Component({ | ||
8 | selector: 'my-instance-about-accordion', | ||
9 | templateUrl: './instance-about-accordion.component.html', | ||
10 | styleUrls: ['./instance-about-accordion.component.scss'] | ||
11 | }) | ||
12 | export class InstanceAboutAccordionComponent implements OnInit { | ||
13 | @ViewChild('accordion', { static: true }) accordion: NgbAccordion | ||
14 | @Output() init: EventEmitter<InstanceAboutAccordionComponent> = new EventEmitter<InstanceAboutAccordionComponent>() | ||
15 | |||
16 | @Input() panels = { | ||
17 | features: true, | ||
18 | administrators: true, | ||
19 | moderation: true, | ||
20 | codeOfConduct: true, | ||
21 | terms: true | ||
22 | } | ||
23 | |||
24 | about: About | ||
25 | aboutHtml = { | ||
26 | description: '', | ||
27 | terms: '', | ||
28 | codeOfConduct: '', | ||
29 | moderationInformation: '', | ||
30 | administrator: '' | ||
31 | } | ||
32 | |||
33 | constructor ( | ||
34 | private instanceService: InstanceService, | ||
35 | private notifier: Notifier | ||
36 | ) { } | ||
37 | |||
38 | ngOnInit (): void { | ||
39 | this.instanceService.getAbout() | ||
40 | .subscribe( | ||
41 | async about => { | ||
42 | this.about = about | ||
43 | |||
44 | this.aboutHtml = await this.instanceService.buildHtml(about) | ||
45 | |||
46 | this.init.emit(this) | ||
47 | }, | ||
48 | |||
49 | err => this.notifier.error(err.message) | ||
50 | ) | ||
51 | } | ||
52 | |||
53 | getAdministratorsPanel () { | ||
54 | if (!this.about) return false | ||
55 | if (!this.panels.administrators) return false | ||
56 | |||
57 | return !!(this.aboutHtml?.administrator || this.about?.instance.maintenanceLifetime || this.about?.instance.businessModel) | ||
58 | } | ||
59 | |||
60 | get moderationPanel () { | ||
61 | return this.panels.moderation && !!this.aboutHtml.moderationInformation | ||
62 | } | ||
63 | |||
64 | get codeOfConductPanel () { | ||
65 | return this.panels.codeOfConduct && !!this.aboutHtml.codeOfConduct | ||
66 | } | ||
67 | |||
68 | get termsPanel () { | ||
69 | return this.panels.terms && !!this.aboutHtml.terms | ||
70 | } | ||
71 | } | ||