Improve account username copy button
This commit is contained in:
parent
ccfcdb6785
commit
ee1d0dfb6d
|
@ -8,9 +8,13 @@
|
||||||
<div class="actor-names">
|
<div class="actor-names">
|
||||||
<div class="actor-display-name">{{ account.displayName }}</div>
|
<div class="actor-display-name">{{ account.displayName }}</div>
|
||||||
<div class="actor-name">{{ account.nameWithHost }}
|
<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>
|
<span class="glyphicon glyphicon-copy"></span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<span *ngIf="user?.blocked" [ngbTooltip]="user.blockedReason" class="badge badge-danger" i18n>Banned</span>
|
<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>
|
<span *ngIf="account.mutedByUser" class="badge badge-danger" i18n>Muted</span>
|
||||||
|
|
|
@ -15,4 +15,10 @@ my-user-moderation-dropdown,
|
||||||
|
|
||||||
.badge {
|
.badge {
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.copy-button {
|
||||||
|
border: none;
|
||||||
|
padding: 5px;
|
||||||
|
margin-top: -2px;
|
||||||
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import { catchError, distinctUntilChanged, map, switchMap, tap } from 'rxjs/oper
|
||||||
import { Subscription } from 'rxjs'
|
import { Subscription } from 'rxjs'
|
||||||
import { AuthService, Notifier, RedirectService } from '@app/core'
|
import { AuthService, Notifier, RedirectService } from '@app/core'
|
||||||
import { User, UserRight } from '../../../../shared'
|
import { User, UserRight } from '../../../../shared'
|
||||||
|
import { I18n } from '@ngx-translate/i18n-polyfill'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: './accounts.component.html',
|
templateUrl: './accounts.component.html',
|
||||||
|
@ -25,7 +26,8 @@ export class AccountsComponent implements OnInit, OnDestroy {
|
||||||
private notifier: Notifier,
|
private notifier: Notifier,
|
||||||
private restExtractor: RestExtractor,
|
private restExtractor: RestExtractor,
|
||||||
private redirectService: RedirectService,
|
private redirectService: RedirectService,
|
||||||
private authService: AuthService
|
private authService: AuthService,
|
||||||
|
private i18n: I18n
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
ngOnInit () {
|
ngOnInit () {
|
||||||
|
@ -56,6 +58,10 @@ export class AccountsComponent implements OnInit, OnDestroy {
|
||||||
this.redirectService.redirectToHomepage()
|
this.redirectService.redirectToHomepage()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
activateCopiedMessage () {
|
||||||
|
this.notifier.success(this.i18n('Username copied'))
|
||||||
|
}
|
||||||
|
|
||||||
private getUserIfNeeded (account: Account) {
|
private getUserIfNeeded (account: Account) {
|
||||||
if (!account.userId) return
|
if (!account.userId) return
|
||||||
if (!this.authService.isLoggedIn()) return
|
if (!this.authService.isLoggedIn()) return
|
||||||
|
|
Loading…
Reference in New Issue