diff options
author | Chocobozzz <me@florianbigard.com> | 2019-06-19 15:14:13 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-06-19 15:14:13 +0200 |
commit | ee1d0dfb6d179d8742b6a3eb6ffce6a08fb16c9f (patch) | |
tree | 8a30a4b24018b3443c1f5c52a15d565189292b75 /client | |
parent | ccfcdb6785111685d4385e345545b6f89520a9a0 (diff) | |
download | PeerTube-ee1d0dfb6d179d8742b6a3eb6ffce6a08fb16c9f.tar.gz PeerTube-ee1d0dfb6d179d8742b6a3eb6ffce6a08fb16c9f.tar.zst PeerTube-ee1d0dfb6d179d8742b6a3eb6ffce6a08fb16c9f.zip |
Improve account username copy button
Diffstat (limited to 'client')
-rw-r--r-- | client/src/app/+accounts/accounts.component.html | 6 | ||||
-rw-r--r-- | client/src/app/+accounts/accounts.component.scss | 8 | ||||
-rw-r--r-- | client/src/app/+accounts/accounts.component.ts | 8 |
3 files changed, 19 insertions, 3 deletions
diff --git a/client/src/app/+accounts/accounts.component.html b/client/src/app/+accounts/accounts.component.html index 1172f7ba7..0e9719dcf 100644 --- a/client/src/app/+accounts/accounts.component.html +++ b/client/src/app/+accounts/accounts.component.html | |||
@@ -8,9 +8,13 @@ | |||
8 | <div class="actor-names"> | 8 | <div class="actor-names"> |
9 | <div class="actor-display-name">{{ account.displayName }}</div> | 9 | <div class="actor-display-name">{{ account.displayName }}</div> |
10 | <div class="actor-name">{{ account.nameWithHost }} | 10 | <div class="actor-name">{{ account.nameWithHost }} |
11 | <button ngxClipboard [cbContent]="account.nameWithHostForced" type="button" class="btn btn-outline-secondary btn-sm"> | 11 | |
12 | <button ngxClipboard [cbContent]="account.nameWithHostForced" (click)="activateCopiedMessage()" | ||
13 | class="btn btn-outline-secondary btn-sm copy-button" | ||
14 | > | ||
12 | <span class="glyphicon glyphicon-copy"></span> | 15 | <span class="glyphicon glyphicon-copy"></span> |
13 | </button> | 16 | </button> |
17 | |||
14 | </div> | 18 | </div> |
15 | <span *ngIf="user?.blocked" [ngbTooltip]="user.blockedReason" class="badge badge-danger" i18n>Banned</span> | 19 | <span *ngIf="user?.blocked" [ngbTooltip]="user.blockedReason" class="badge badge-danger" i18n>Banned</span> |
16 | <span *ngIf="account.mutedByUser" class="badge badge-danger" i18n>Muted</span> | 20 | <span *ngIf="account.mutedByUser" class="badge badge-danger" i18n>Muted</span> |
diff --git a/client/src/app/+accounts/accounts.component.scss b/client/src/app/+accounts/accounts.component.scss index 3cedda889..273e5c43a 100644 --- a/client/src/app/+accounts/accounts.component.scss +++ b/client/src/app/+accounts/accounts.component.scss | |||
@@ -15,4 +15,10 @@ my-user-moderation-dropdown, | |||
15 | 15 | ||
16 | .badge { | 16 | .badge { |
17 | font-size: 13px; | 17 | font-size: 13px; |
18 | } \ No newline at end of file | 18 | } |
19 | |||
20 | .copy-button { | ||
21 | border: none; | ||
22 | padding: 5px; | ||
23 | margin-top: -2px; | ||
24 | } | ||
diff --git a/client/src/app/+accounts/accounts.component.ts b/client/src/app/+accounts/accounts.component.ts index d9786fb5c..3118d7562 100644 --- a/client/src/app/+accounts/accounts.component.ts +++ b/client/src/app/+accounts/accounts.component.ts | |||
@@ -7,6 +7,7 @@ import { catchError, distinctUntilChanged, map, switchMap, tap } from 'rxjs/oper | |||
7 | import { Subscription } from 'rxjs' | 7 | import { Subscription } from 'rxjs' |
8 | import { AuthService, Notifier, RedirectService } from '@app/core' | 8 | import { AuthService, Notifier, RedirectService } from '@app/core' |
9 | import { User, UserRight } from '../../../../shared' | 9 | import { User, UserRight } from '../../../../shared' |
10 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
10 | 11 | ||
11 | @Component({ | 12 | @Component({ |
12 | templateUrl: './accounts.component.html', | 13 | templateUrl: './accounts.component.html', |
@@ -25,7 +26,8 @@ export class AccountsComponent implements OnInit, OnDestroy { | |||
25 | private notifier: Notifier, | 26 | private notifier: Notifier, |
26 | private restExtractor: RestExtractor, | 27 | private restExtractor: RestExtractor, |
27 | private redirectService: RedirectService, | 28 | private redirectService: RedirectService, |
28 | private authService: AuthService | 29 | private authService: AuthService, |
30 | private i18n: I18n | ||
29 | ) {} | 31 | ) {} |
30 | 32 | ||
31 | ngOnInit () { | 33 | ngOnInit () { |
@@ -56,6 +58,10 @@ export class AccountsComponent implements OnInit, OnDestroy { | |||
56 | this.redirectService.redirectToHomepage() | 58 | this.redirectService.redirectToHomepage() |
57 | } | 59 | } |
58 | 60 | ||
61 | activateCopiedMessage () { | ||
62 | this.notifier.success(this.i18n('Username copied')) | ||
63 | } | ||
64 | |||
59 | private getUserIfNeeded (account: Account) { | 65 | private getUserIfNeeded (account: Account) { |
60 | if (!account.userId) return | 66 | if (!account.userId) return |
61 | if (!this.authService.isLoggedIn()) return | 67 | if (!this.authService.isLoggedIn()) return |