]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Improve account username copy button
authorChocobozzz <me@florianbigard.com>
Wed, 19 Jun 2019 13:14:13 +0000 (15:14 +0200)
committerChocobozzz <me@florianbigard.com>
Wed, 19 Jun 2019 13:14:13 +0000 (15:14 +0200)
client/src/app/+accounts/accounts.component.html
client/src/app/+accounts/accounts.component.scss
client/src/app/+accounts/accounts.component.ts

index 1172f7ba72c874dbb07276675e6de9c81af48d5b..0e9719dcf86ae1ea1d251dc4cb8d8162f618ce13 100644 (file)
@@ -8,9 +8,13 @@
         <div class="actor-names">
           <div class="actor-display-name">{{ account.displayName }}</div>
           <div class="actor-name">{{ account.nameWithHost }}
-          <button ngxClipboard [cbContent]="account.nameWithHostForced" type="button" class="btn btn-outline-secondary btn-sm">
+
+          <button ngxClipboard [cbContent]="account.nameWithHostForced" (click)="activateCopiedMessage()"
+                  class="btn btn-outline-secondary btn-sm copy-button"
+          >
             <span class="glyphicon glyphicon-copy"></span>
           </button>
+
           </div>
           <span *ngIf="user?.blocked" [ngbTooltip]="user.blockedReason" class="badge badge-danger" i18n>Banned</span>
           <span *ngIf="account.mutedByUser" class="badge badge-danger" i18n>Muted</span>
index 3cedda889de1f5db897e71d5e0d5e4a4c951b382..273e5c43a2665f02aec439b819e6f9150e1d0d2a 100644 (file)
@@ -15,4 +15,10 @@ my-user-moderation-dropdown,
 
 .badge {
   font-size: 13px;
-}
\ No newline at end of file
+}
+
+.copy-button {
+  border: none;
+  padding: 5px;
+  margin-top: -2px;
+}
index d9786fb5cb2052749958d4eae0eef12d133ba232..3118d7562d657b8804a121daf780661314dbc653 100644 (file)
@@ -7,6 +7,7 @@ import { catchError, distinctUntilChanged, map, switchMap, tap } from 'rxjs/oper
 import { Subscription } from 'rxjs'
 import { AuthService, Notifier, RedirectService } from '@app/core'
 import { User, UserRight } from '../../../../shared'
+import { I18n } from '@ngx-translate/i18n-polyfill'
 
 @Component({
   templateUrl: './accounts.component.html',
@@ -25,7 +26,8 @@ export class AccountsComponent implements OnInit, OnDestroy {
     private notifier: Notifier,
     private restExtractor: RestExtractor,
     private redirectService: RedirectService,
-    private authService: AuthService
+    private authService: AuthService,
+    private i18n: I18n
   ) {}
 
   ngOnInit () {
@@ -56,6 +58,10 @@ export class AccountsComponent implements OnInit, OnDestroy {
     this.redirectService.redirectToHomepage()
   }
 
+  activateCopiedMessage () {
+    this.notifier.success(this.i18n('Username copied'))
+  }
+
   private getUserIfNeeded (account: Account) {
     if (!account.userId) return
     if (!this.authService.isLoggedIn()) return