From f3081d6401b63da41b03376f9f952bf1cca8303d Mon Sep 17 00:00:00 2001 From: Kimsible <1877318+kimsible@users.noreply.github.com> Date: Tue, 17 Nov 2020 14:04:44 +0100 Subject: small refactor + clipboard copy on anchor click in instance page (#3318) * Refacto scrollTo top and anchors * Add on click clipboard copy and notifier to anchors about/instance page * Fix margin top anchor middle title about page * Use viewportscroller for scrolltoanchor * Add to Link copied notification on instance page Co-authored-by: kimsible --- .../about-instance/about-instance.component.html | 100 +++++++++++++++++---- .../about-instance/about-instance.component.scss | 4 +- .../about-instance/about-instance.component.ts | 10 ++- 3 files changed, 95 insertions(+), 19 deletions(-) (limited to 'client/src/app/+about') 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 d759c4343..045bb3fbc 100644 --- a/client/src/app/+about/about-instance/about-instance.component.html +++ b/client/src/app/+about/about-instance/about-instance.component.html @@ -23,7 +23,10 @@

ADMINISTRATORS & SUSTAINABILITY @@ -32,7 +35,12 @@
-
+

Who we are

@@ -41,7 +49,12 @@
- +

Why we created this instance

@@ -50,7 +63,12 @@
- +

INFORMATION

@@ -75,7 +104,12 @@
-
+

Description

@@ -85,8 +119,11 @@
+ class="anchor-link" + routerLink="/about/instance" + fragment="moderation" + #anchorLink + (click)="onClickCopyLink(anchorLink)">

MODERATION

@@ -94,7 +131,12 @@
-
+

Moderation information

@@ -103,7 +145,12 @@
- +

Code of conduct

@@ -112,7 +159,12 @@
- +

Terms

@@ -120,7 +172,13 @@
- +

OTHER INFORMATION

@@ -128,7 +186,12 @@
-
+

Hardware information

@@ -143,7 +206,12 @@
- +

STATISTICS

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 2e77ade9b..fe3ce22b0 100644 --- a/client/src/app/+about/about-instance/about-instance.component.scss +++ b/client/src/app/+about/about-instance/about-instance.component.scss @@ -43,12 +43,12 @@ .middle-title { @include in-content-small-title; - margin-top: 45px; + margin-top: 0; margin-bottom: 25px; } .block { - margin-bottom: 30px; + margin-bottom: 75px; font-size: 15px; } 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 bd587fa26..e74b5daeb 100644 --- a/client/src/app/+about/about-instance/about-instance.component.ts +++ b/client/src/app/+about/about-instance/about-instance.component.ts @@ -2,7 +2,8 @@ import { ViewportScroller } from '@angular/common' import { AfterViewChecked, Component, OnInit, ViewChild } from '@angular/core' import { ActivatedRoute } from '@angular/router' import { ContactAdminModalComponent } from '@app/+about/about-instance/contact-admin-modal.component' -import { ServerService } from '@app/core' +import { Notifier } from '@app/core' +import { copyToClipboard } from '../../../assets/player/utils' import { InstanceService } from '@app/shared/shared-instance' import { ServerConfig } from '@shared/models' import { ResolverData } from './about-instance.resolver' @@ -42,6 +43,7 @@ export class AboutInstanceComponent implements OnInit, AfterViewChecked { constructor ( private viewportScroller: ViewportScroller, private route: ActivatedRoute, + private notifier: Notifier, private instanceService: InstanceService ) {} @@ -87,4 +89,10 @@ export class AboutInstanceComponent implements OnInit, AfterViewChecked { openContactModal () { return this.contactAdminModal.show() } + + onClickCopyLink (anchor: HTMLAnchorElement) { + const link = anchor.href + copyToClipboard(link) + this.notifier.success(link, $localize `Link copied`) + } } -- cgit v1.2.3