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 51 52 | 28x 13x 20x 20x | import type { ChartExcerpt } from './chart-excerpt.ts';
/**
* What a play's share card shows. The score page hands it to the client script as JSON; client/score-card.ts draws
* the card from it. Kept free of DOM and Worker types, so both sides can import it.
*/
export interface ScoreCardData {
genre: string | null;
title: string;
subtitle: string | null;
artist: string | null;
playerName: string;
handle: string;
avatarUrl: string;
/** The ruleset the play was played under and scored with, e.g. "LR2 rules". */
rulesetLabel: string;
lamp: { label: string; color: string };
exScore: number;
maxExScore: number;
/** "77.88%" */
rate: string;
djRank: string;
bp: number;
maxCombo: number;
judges: { pgreat: number; great: number; good: number; bad: number; poor: number };
/** "GROOVE 100.0%" */
gauge: string;
/** Epoch ms. */
playedAt: number;
/**
* The chart's densest two measures for the playfield on the right; absent when the card is not to be drawn here or
* the chart's document is not at hand, and the card keeps its decorative notes.
*/
excerpt?: ChartExcerpt;
}
/** The text of a share: chart, lamp, DJ Rank, EX-Score and rate, ruleset. */
export function shareText(
data: Pick<ScoreCardData, 'title' | 'lamp' | 'djRank' | 'exScore' | 'maxExScore' | 'rate' | 'rulesetLabel'>,
): string {
return `${data.title} — ${data.lamp.label} · ${data.djRank} · EX ${data.exScore}/${data.maxExScore} (${data.rate}) [${data.rulesetLabel}]`;
}
/** The share hashtag (docs/leaderboard.md). */
export const SHARE_HASHTAG = 'bemusic';
/** A post on X with the text, the page and the hashtag filled in. */
export function xIntentURL(text: string, url: string): string {
const params = new URLSearchParams({ text, url, hashtags: SHARE_HASHTAG });
return `https://x.com/intent/post?${params.toString()}`;
}
|