/
githubmirror
/
tabby
Обзор
Документация
Войти
/
githubmirror
/
tabby
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
tabby-core/src/components/transfersMenu.component.ts
67 строк
2 KB
mouse
fix: improve menu readability and Chinese localization (#11272)
17 май 2026, 13:01
Не верифицирован
17 май 2026, 13:01
3832a9d
Код
Авторство
О чём код?
import { Component, Input, Output, EventEmitter, HostBinding } from '@angular/core' import { TranslateService } from '@ngx-translate/core' import { ConfigService } from '../services/config.service' import { FileDownload, FileTransfer, PlatformService } from '../api/platform' /** @hidden */ @Component({ selector: 'transfers-menu', templateUrl: './transfersMenu.component.pug', styleUrls: ['./transfersMenu.component.scss'], }) export class TransfersMenuComponent { @Input() transfers: FileTransfer[] @Output() transfersChange = new EventEmitter<FileTransfer[]>() @HostBinding('class.vibrant') get isVibrant (): boolean { return this.config.store.appearance.vibrancy } constructor ( private config: ConfigService, private platform: PlatformService, private translate: TranslateService, ) { } isDownload (transfer: FileTransfer): boolean { return transfer instanceof FileDownload } getProgress (transfer: FileTransfer): number { return Math.round(100 * transfer.getCompletedBytes() / transfer.getSize()) } showTransfer (transfer: FileTransfer): void { const fp = transfer['filePath'] if (fp) { this.platform.showItemInFolder(fp) } } removeTransfer (transfer: FileTransfer): void { if (!transfer.isComplete()) { transfer.cancel() } this.transfers = this.transfers.filter(x => x !== transfer) this.transfersChange.emit(this.transfers) } async removeAll (): Promise<void> { if (this.transfers.some(x => !x.isComplete())) { if ((await this.platform.showMessageBox({ type: 'warning', message: this.translate.instant('There are active file transfers'), buttons: [ this.translate.instant('Abort all'), this.translate.instant('Do not abort'), ], defaultId: 1, cancelId: 1, })).response === 1) { return } } for (const t of this.transfers) { this.removeTransfer(t) } } }