diff options
author | Kimsible <1877318+kimsible@users.noreply.github.com> | 2020-11-17 14:04:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-17 14:04:44 +0100 |
commit | f3081d6401b63da41b03376f9f952bf1cca8303d (patch) | |
tree | 90ec91babde1544ca0a3423b031c9e10dfcac596 /client/src/app/+about/about-instance/about-instance.component.ts | |
parent | 901c36d5f44e02436da5f5c2899666329ff2eb5b (diff) | |
download | PeerTube-f3081d6401b63da41b03376f9f952bf1cca8303d.tar.gz PeerTube-f3081d6401b63da41b03376f9f952bf1cca8303d.tar.zst PeerTube-f3081d6401b63da41b03376f9f952bf1cca8303d.zip |
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 <kimsible@users.noreply.github.com>
Diffstat (limited to 'client/src/app/+about/about-instance/about-instance.component.ts')
-rw-r--r-- | client/src/app/+about/about-instance/about-instance.component.ts | 10 |
1 files changed, 9 insertions, 1 deletions
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' | |||
2 | import { AfterViewChecked, Component, OnInit, ViewChild } from '@angular/core' | 2 | import { AfterViewChecked, Component, OnInit, ViewChild } from '@angular/core' |
3 | import { ActivatedRoute } from '@angular/router' | 3 | import { ActivatedRoute } from '@angular/router' |
4 | import { ContactAdminModalComponent } from '@app/+about/about-instance/contact-admin-modal.component' | 4 | import { ContactAdminModalComponent } from '@app/+about/about-instance/contact-admin-modal.component' |
5 | import { ServerService } from '@app/core' | 5 | import { Notifier } from '@app/core' |
6 | import { copyToClipboard } from '../../../assets/player/utils' | ||
6 | import { InstanceService } from '@app/shared/shared-instance' | 7 | import { InstanceService } from '@app/shared/shared-instance' |
7 | import { ServerConfig } from '@shared/models' | 8 | import { ServerConfig } from '@shared/models' |
8 | import { ResolverData } from './about-instance.resolver' | 9 | import { ResolverData } from './about-instance.resolver' |
@@ -42,6 +43,7 @@ export class AboutInstanceComponent implements OnInit, AfterViewChecked { | |||
42 | constructor ( | 43 | constructor ( |
43 | private viewportScroller: ViewportScroller, | 44 | private viewportScroller: ViewportScroller, |
44 | private route: ActivatedRoute, | 45 | private route: ActivatedRoute, |
46 | private notifier: Notifier, | ||
45 | private instanceService: InstanceService | 47 | private instanceService: InstanceService |
46 | ) {} | 48 | ) {} |
47 | 49 | ||
@@ -87,4 +89,10 @@ export class AboutInstanceComponent implements OnInit, AfterViewChecked { | |||
87 | openContactModal () { | 89 | openContactModal () { |
88 | return this.contactAdminModal.show() | 90 | return this.contactAdminModal.show() |
89 | } | 91 | } |
92 | |||
93 | onClickCopyLink (anchor: HTMLAnchorElement) { | ||
94 | const link = anchor.href | ||
95 | copyToClipboard(link) | ||
96 | this.notifier.success(link, $localize `Link copied`) | ||
97 | } | ||
90 | } | 98 | } |