All files / player-ui/src/components decide-screen.ts

14.28% Statements 1/7
0% Branches 0/8
0% Functions 0/3
16.66% Lines 1/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50            48x                                                                                      
import { css, html, nothing, type CSSResultGroup, type TemplateResult } from 'lit';
import type { BeMusicDOMDecideFrame } from '@be-music/player-skin-sdk';
import { FrameElement } from '../base.ts';
import { screenStyles } from '../styles/screen.ts';
 
export class BeMusicDecideScreenElement extends FrameElement<BeMusicDOMDecideFrame> {
  static override styles: CSSResultGroup = [
    screenStyles,
    css`
      .center {
        max-width: 36rem;
        gap: 24px;
      }
      .actions .btn {
        min-height: 44px;
      }
      .title-image {
        display: block;
        max-inline-size: 100%;
        max-block-size: 30vh;
        object-fit: contain;
      }
    `,
  ];
  protected override render(): TemplateResult | typeof nothing {
    const f = this.frame;
    if (!f) return nothing;
    return html`<section class="screen" part="screen">
      <div class="center">
        <div class="heading" part="header">
          <p class="eyebrow" part="eyebrow"><slot name="eyebrow">Up next</slot></p>
          <h1 part="title">
            ${f.titleImage ? html`<img class="title-image" src=${f.titleImage} alt=${f.chart.title} />` : f.chart.title}
          </h1>
          <p class="muted">${f.chart.artist ?? ''}</p>
        </div>
        <progress part="progress" max="1" .value=${f.progress ?? 0} aria-label="Chart loading"></progress>
        <div class="actions" part="actions">
          <button class="btn" ?disabled=${!f.inputReady} @click=${() => this.emit('continue-request', undefined)}>
            Start</button
          ><button class="btn" data-variant="outline" @click=${() => this.emit('cancel-request', undefined)}>
            Back
          </button>
        </div>
        <slot></slot>
      </div>
    </section>`;
  }
}