Suno-style web UI for a self-hosted MiniMax-Music3 inference server
TypeScript ai-musicdiffusersdockerexpressminimaxminimax-musicmusic-generationreactself-hostedsgl-omnisunotailwindcsstext-to-musictypescriptvite
ui: spinner while an armed track waits for its first audio
Adam Benhassen1f72630a7519
diff --git a/web/src/components/Icons.tsx b/web/src/components/Icons.tsxindex 2ec055c..cc60d96 100644--- a/web/src/components/Icons.tsx+++ b/web/src/components/Icons.tsx@@ -19,4 +19,5 @@ export const X = (p: SVGProps<SVGSVGElement>) => <svg {...base(p)}><path d="M6 6export const Chevron = (p: SVGProps<SVGSVGElement>) => <svg {...base(p)}><path d="M9 6l6 6-6 6" /></svg>;export const Alert = (p: SVGProps<SVGSVGElement>) => <svg {...base(p)}><path d="M12 9v4m0 4h.01M10.3 3.9L2.5 18a2 2 0 0 0 1.7 3h15.6a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z" /></svg>;export const Gear = (p: SVGProps<SVGSVGElement>) => <svg {...base(p)}><circle cx="12" cy="12" r="3" /><path d="M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1.1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z" /></svg>;+export const Spinner = (p: SVGProps<SVGSVGElement>) => <svg {...base(p)} className={`animate-spin ${p.className ?? ''}`}><path d="M12 3a9 9 0 1 0 9 9" /></svg>;export const Lock = (p: SVGProps<SVGSVGElement>) => <svg {...base(p)}><rect x="4" y="11" width="16" height="10" rx="2" /><path d="M8 11V7a4 4 0 0 1 8 0v4" /></svg>;diff --git a/web/src/components/Player.tsx b/web/src/components/Player.tsxindex f8d27bb..9039819 100644--- a/web/src/components/Player.tsx+++ b/web/src/components/Player.tsx@@ -4,7 +4,7 @@ import { api } from '../api';import { coverStyle } from '../lib/cover';import { fmtTime } from '../lib/format';import { Waveform } from './Waveform';-import { Download, Next, Pause, Play, Prev } from './Icons';+import { Download, Next, Pause, Play, Prev, Spinner } from './Icons';interface Props {track: Track | null;@@ -122,8 +122,9 @@ export function Player({ track, playing, onPlayingChange, onPrev, onNext, onEndeonClick={() => onPlayingChange(!playing)}disabled={!track}aria-label={playing ? 'Pause' : 'Play'}+ title={starved ? subtitle : undefined}>- {playing ? <Pause width={18} height={18} /> : <Play width={18} height={18} className="translate-x-[1px]" />}+ {playing && starved ? <Spinner width={18} height={18} /> : playing ? <Pause width={18} height={18} /> : <Play width={18} height={18} className="translate-x-[1px]" />}</button><button className="icon-btn" onClick={onNext} disabled={!track} aria-label="Next"><Next width={18} height={18} /></button></div>diff --git a/web/src/components/TrackCard.tsx b/web/src/components/TrackCard.tsxindex 6bacf48..40ade24 100644--- a/web/src/components/TrackCard.tsx+++ b/web/src/components/TrackCard.tsx@@ -3,7 +3,7 @@ import { isInflight, isPlayable, type Track } from '../types';import { coverStyle } from '../lib/cover';import { fmtAgo, fmtTime } from '../lib/format';import { api } from '../api';-import { Alert, Download, Pause, Play, Refresh, Reuse, Trash, X } from './Icons';+import { Alert, Download, Pause, Play, Refresh, Reuse, Spinner, Trash, X } from './Icons';import { ProgressDetail } from './ProgressDetail';interface Props {@@ -22,6 +22,7 @@ export function TrackCard({ track: t, groupSize, active, playing, onPlay, onDeleconst inflight = isInflight(t);const done = t.status === 'done';const playable = isPlayable(t);+ const armed = active && playing && t.status === 'running' && (t.renderedSeconds ?? 0) === 0; // play pressed, no audio yetconst err = t.status === 'error';return (@@ -37,7 +38,7 @@ export function TrackCard({ track: t, groupSize, active, playing, onPlay, onDele{inflight && <span className={`absolute inset-0 bg-black/40 flex items-center justify-center text-[11px] font-mono tabular-nums ${playable ? 'group-hover:opacity-0 transition' : ''}`}>{Math.round(t.progress * 100)}%</span>}{playable && (<span className={`absolute inset-0 flex items-center justify-center bg-black/30 transition ${active ? 'opacity-100' : 'opacity-0 group-hover:opacity-100'}`}>- {active && playing ? <Pause width={22} height={22} /> : <Play width={22} height={22} />}+ {armed ? <Spinner width={22} height={22} /> : active && playing ? <Pause width={22} height={22} /> : <Play width={22} height={22} />}</span>)}{err && <span className="absolute inset-0 bg-black/50 flex items-center justify-center text-red-300"><Alert width={20} height={20} /></span>}