From 5c16e6bc9776ce706bafb198c1c14936674794d5 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 15 Jun 2021 11:57:15 +0200 Subject: Cleanup contact form with URL Parent component still have the responsability to explicitely open the modal Rely on data router param to open or not the modal --- .../about-instance/about-instance.component.html | 4 +- .../about-instance/about-instance.component.scss | 11 ++-- .../about-instance/about-instance.component.ts | 16 +++-- .../contact-admin-modal.component.html | 4 +- .../contact-admin-modal.component.scss | 15 ++--- .../contact-admin-modal.component.ts | 76 ++++++---------------- client/src/app/+about/about-routing.module.ts | 19 ++++-- 7 files changed, 60 insertions(+), 85 deletions(-) (limited to 'client/src/app') diff --git a/client/src/app/+about/about-instance/about-instance.component.html b/client/src/app/+about/about-instance/about-instance.component.html index a42bda845..436d486ab 100644 --- a/client/src/app/+about/about-instance/about-instance.component.html +++ b/client/src/app/+about/about-instance/about-instance.component.html @@ -4,7 +4,7 @@

About {{ instanceName }}

- Contact administrator + Contact administrator
@@ -218,4 +218,4 @@
- + diff --git a/client/src/app/+about/about-instance/about-instance.component.scss b/client/src/app/+about/about-instance/about-instance.component.scss index b7bf10995..6bbb66a58 100644 --- a/client/src/app/+about/about-instance/about-instance.component.scss +++ b/client/src/app/+about/about-instance/about-instance.component.scss @@ -11,15 +11,10 @@ } .contact-admin { - @include peertube-button; + @include peertube-button-link; @include orange-button; height: fit-content; - - &:hover, - &:active { - text-decoration: none; - } } } @@ -59,6 +54,10 @@ font-size: 15px; } +.short-description { + margin-top: 10px; +} + .short-description .dedicated-to-nsfw { margin-top: 20px; font-weight: $font-semibold; diff --git a/client/src/app/+about/about-instance/about-instance.component.ts b/client/src/app/+about/about-instance/about-instance.component.ts index ffb4294ab..f86df5b67 100644 --- a/client/src/app/+about/about-instance/about-instance.component.ts +++ b/client/src/app/+about/about-instance/about-instance.component.ts @@ -1,13 +1,12 @@ import { ViewportScroller } from '@angular/common' import { AfterViewChecked, Component, ElementRef, OnInit, ViewChild } from '@angular/core' import { ActivatedRoute } from '@angular/router' -import { ContactAdminModalComponent } from '@app/+about/about-instance/contact-admin-modal.component' import { Notifier, ServerService } from '@app/core' -import { CustomMarkupService } from '@app/shared/shared-custom-markup' import { InstanceService } from '@app/shared/shared-instance' -import { About, HTMLServerConfig, ServerConfig } from '@shared/models' -import { copyToClipboard } from '../../../root-helpers/utils' +import { copyToClipboard } from '@root-helpers/utils' +import { HTMLServerConfig } from '@shared/models/server' import { ResolverData } from './about-instance.resolver' +import { ContactAdminModalComponent } from './contact-admin-modal.component' @Component({ selector: 'my-about-instance', @@ -16,6 +15,7 @@ import { ResolverData } from './about-instance.resolver' }) export class AboutInstanceComponent implements OnInit, AfterViewChecked { @ViewChild('descriptionWrapper') descriptionWrapper: ElementRef + @ViewChild('contactAdminModal', { static: true }) contactAdminModal: ContactAdminModalComponent shortDescription = '' descriptionContent: string @@ -65,6 +65,14 @@ export class AboutInstanceComponent implements OnInit, AfterViewChecked { this.serverConfig = this.serverService.getHTMLConfig() + this.route.data.subscribe(data => { + if (!data?.isContact) return + + const prefill = this.route.snapshot.queryParams + + this.contactAdminModal.show(prefill) + }) + this.languages = languages this.categories = categories diff --git a/client/src/app/+about/about-instance/contact-admin-modal.component.html b/client/src/app/+about/about-instance/contact-admin-modal.component.html index 343e5d649..8b6b707af 100644 --- a/client/src/app/+about/about-instance/contact-admin-modal.component.html +++ b/client/src/app/+about/about-instance/contact-admin-modal.component.html @@ -6,7 +6,7 @@