Restore sound-specific rings and refine studio UI

This commit is contained in:
Ninosaurier committed 2026-11-17 17:04:02 +01:00
1 parent 02eb8911e8
commit e7b6c0bb3e
16 files changed
+318 -524

No files matched your search

+11 -18
View File
@@ -1,43 +1,36 @@
import { memo } from 'react';
import { getLoopPositionPercent } from '../domain/timeline';
import { INSTRUMENT_BY_ID, INSTRUMENT_CATEGORY_BY_ID } from '../domain/instruments';
import { INSTRUMENT_BY_ID } from '../domain/instruments';
import type { BeatPoint } from '../domain/sequencer';
import type { InstrumentCategoryId } from '../domain/instruments';
import type { CategoryLabelOverrides } from '../hooks/useCategoryLabels';
import type { InstrumentId } from '../domain/instruments';
interface BeatSelectionHintProps {
selectedBeat: BeatPoint | undefined;
focusedCategoryId: InstrumentCategoryId | null;
categoryLabelById: CategoryLabelOverrides;
colorByCategoryId: Partial<Record<InstrumentCategoryId, string>>;
focusedSoundId: InstrumentId | null;
colorBySoundId: Partial<Record<InstrumentId, string>>;
totalSteps: number;
}
export const BeatSelectionHint = memo(function BeatSelectionHint({
selectedBeat,
focusedCategoryId,
categoryLabelById,
colorByCategoryId,
focusedSoundId,
colorBySoundId,
totalSteps,
}: BeatSelectionHintProps) {
const selectedInstrument = selectedBeat ? INSTRUMENT_BY_ID[selectedBeat.soundId] : undefined;
const categoryId = selectedInstrument?.categoryId ?? focusedCategoryId;
if (!categoryId) return <p className="timeline-hint" aria-live="polite" />;
const soundId = selectedBeat?.soundId ?? focusedSoundId;
if (!soundId) return <p className="timeline-hint" aria-live="polite" />;
const category = INSTRUMENT_CATEGORY_BY_ID[categoryId];
const categoryLabel = categoryLabelById[categoryId] ?? category.label;
const sound = INSTRUMENT_BY_ID[soundId];
return (
<p className="timeline-hint" aria-live="polite">
<span
className="hint-swatch"
style={{ backgroundColor: colorByCategoryId[categoryId] }}
style={{ backgroundColor: colorBySoundId[soundId] }}
/>
{category.letter} · {categoryLabel}
{sound.label}
{selectedBeat && (
<>
<span className="hint-separator">·</span>
{selectedBeat.letter} · {selectedInstrument?.label}
<span className="hint-separator">·</span>
Step {getLoopPositionPercent(selectedBeat.step, totalSteps)}% selected
</>