Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

1020 B
Raw Blame
import { CommonModule } from '@angular/common'
import { Component, numberAttribute, input, ChangeDetectionStrategy } from '@angular/core'
import { NgbTooltip } from '@ng-bootstrap/ng-bootstrap'

@Component({
  selector: 'my-progress-bar',
  styleUrls: [ './progress-bar.component.scss' ],
  templateUrl: './progress-bar.component.html',
  changeDetection: ChangeDetectionStrategy.Eager,
  imports: [
    CommonModule,
    NgbTooltip
  ]
})
export class ProgressBarComponent {
  readonly value = input.required<number, unknown>({ transform: numberAttribute })
  readonly label = input.required<string>()

  readonly valueFormatted = input.required<string | number>()

  readonly maxFormatted = input<string>(undefined)

  readonly size = input<'normal' | 'small'>('normal')

  readonly max = input(100, { transform: numberAttribute })
  readonly min = input(0, { transform: numberAttribute })

  readonly theme = input<'green' | 'red' | 'main'>('main')

  percentage () {
    return this.value() * 100 / this.max()
  }
}