mirror of
https://github.com/9x/sheetmusictrainer.git
synced 2026-09-02 09:34:33 +02:00
Zen mode
This commit is contained in:
46
src/App.css
46
src/App.css
@@ -295,4 +295,50 @@
|
||||
.hint-button:hover {
|
||||
background-color: rgba(var(--hue-primary), 0.1);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
.zen-button {
|
||||
background-color: transparent;
|
||||
border: 2px solid var(--color-text-muted);
|
||||
color: var(--color-text-muted);
|
||||
padding: 0.5rem 1rem;
|
||||
border-radius: 30px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
transition: all 0.2s;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.zen-button:hover {
|
||||
border-color: var(--color-text-main);
|
||||
color: var(--color-text-main);
|
||||
background-color: rgba(128, 128, 128, 0.1);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
.exit-zen-button {
|
||||
position: fixed;
|
||||
bottom: 20px;
|
||||
right: 20px;
|
||||
padding: 10px 20px;
|
||||
background: var(--color-surface);
|
||||
border: 1px solid var(--color-text-muted);
|
||||
border-radius: 20px;
|
||||
color: var(--color-text-muted);
|
||||
cursor: pointer;
|
||||
opacity: 0.5;
|
||||
transition: all 0.2s;
|
||||
z-index: 100;
|
||||
font-weight: 600;
|
||||
box-shadow: var(--shadow-md);
|
||||
}
|
||||
|
||||
.exit-zen-button:hover {
|
||||
opacity: 1;
|
||||
color: var(--color-text-main);
|
||||
border-color: var(--color-text-main);
|
||||
transform: scale(1.05);
|
||||
}
|
||||
143
src/App.tsx
143
src/App.tsx
@@ -40,7 +40,8 @@ function App() {
|
||||
autoAdvance: false,
|
||||
sound: true,
|
||||
volume: 0.5
|
||||
}
|
||||
},
|
||||
zenMode: false
|
||||
});
|
||||
|
||||
const [matchStartTime, setMatchStartTime] = useState<number | null>(null);
|
||||
@@ -173,10 +174,12 @@ function App() {
|
||||
}, [settings.showHint, targetMidi, currentTuning, currentInstrumentDef]);
|
||||
|
||||
return (
|
||||
<div className="app-container">
|
||||
<header className="app-header">
|
||||
<div className="logo">Sheet music trainer</div>
|
||||
</header>
|
||||
<div className={`app-container ${settings.zenMode ? 'zen-mode' : ''}`}>
|
||||
{!settings.zenMode && (
|
||||
<header className="app-header">
|
||||
<div className="logo">Sheet music trainer</div>
|
||||
</header>
|
||||
)}
|
||||
|
||||
<main className="main-stage">
|
||||
<div className="card sheet-music-card">
|
||||
@@ -190,13 +193,15 @@ function App() {
|
||||
height={currentInstrumentDef.clefMode === 'grand' ? 300 : 250}
|
||||
/>
|
||||
|
||||
<div className="feedback-area">
|
||||
{feedbackMessage ? (
|
||||
<div className="success-message animate-pop">{feedbackMessage}</div>
|
||||
) : (
|
||||
<div className="instruction-text">Play the note above</div>
|
||||
)}
|
||||
</div>
|
||||
{!settings.zenMode && (
|
||||
<div className="feedback-area">
|
||||
{feedbackMessage ? (
|
||||
<div className="success-message animate-pop">{feedbackMessage}</div>
|
||||
) : (
|
||||
<div className="instruction-text">Play the note above</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{settings.showHint && (
|
||||
<div className="hint-card">
|
||||
@@ -211,53 +216,81 @@ function App() {
|
||||
|
||||
{error && <div className="error-message">{error}</div>}
|
||||
|
||||
<div className="action-row" style={{ marginTop: '24px', display: 'flex', justifyContent: 'center', gap: '16px' }}>
|
||||
<button
|
||||
className={`hint-button ${settings.showHint ? 'active' : ''}`}
|
||||
onClick={() => setSettings(s => ({ ...s, showHint: !s.showHint }))}
|
||||
>
|
||||
<HelpCircle size={18} />
|
||||
{settings.showHint ? "Hide Hint" : "Show Hint"}
|
||||
</button>
|
||||
<button className="skip-button" onClick={generateNewNote}>
|
||||
<SkipForward size={18} />
|
||||
Skip Note
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="pitch-monitor-bar">
|
||||
<button
|
||||
className={`mic-button ${listening ? 'listening' : ''}`}
|
||||
onClick={() => setListening(!listening)}
|
||||
aria-label={listening ? "Stop Listening" : "Start Listening"}
|
||||
>
|
||||
{listening ? <Mic size={28} /> : <MicOff size={28} />}
|
||||
</button>
|
||||
|
||||
{settings.showTuningMeter && pitchData ? (
|
||||
<TuningMeter cents={pitchData.cents} noteName={pitchData.note} />
|
||||
) : (
|
||||
<div className={`pitch-readout ${pitchData ? 'active' : ''}`}>
|
||||
{pitchData ? (
|
||||
<>
|
||||
<span className={`detected-note ${pitchData.midi === targetMidi ? 'match' : ''}`}>
|
||||
{pitchData.note}
|
||||
</span>
|
||||
<span className="detected-hz">{Math.round(pitchData.frequency)} Hz</span>
|
||||
</>
|
||||
) : (
|
||||
<span className="placeholder">{listening ? "Listening..." : "Mic Off"}</span>
|
||||
)}
|
||||
{!settings.zenMode && (
|
||||
<div className="action-row" style={{ marginTop: '24px', display: 'flex', justifyContent: 'center', gap: '16px' }}>
|
||||
<button
|
||||
className={`hint-button ${settings.showHint ? 'active' : ''}`}
|
||||
onClick={() => setSettings(s => ({ ...s, showHint: !s.showHint }))}
|
||||
>
|
||||
<HelpCircle size={18} />
|
||||
{settings.showHint ? "Hide Hint" : "Show Hint"}
|
||||
</button>
|
||||
<button className="skip-button" onClick={generateNewNote}>
|
||||
<SkipForward size={18} />
|
||||
Skip Note
|
||||
</button>
|
||||
<button
|
||||
className="zen-button"
|
||||
onClick={() => setSettings(s => ({ ...s, zenMode: true }))}
|
||||
title="Zen Mode"
|
||||
>
|
||||
<span>Zen</span>
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<footer className="settings-footer">
|
||||
<Controls settings={settings} onUpdateSettings={setSettings} />
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
{
|
||||
!settings.zenMode && (
|
||||
<div className="pitch-monitor-bar">
|
||||
<button
|
||||
className={`mic-button ${listening ? 'listening' : ''}`}
|
||||
onClick={() => setListening(!listening)}
|
||||
aria-label={listening ? "Stop Listening" : "Start Listening"}
|
||||
>
|
||||
{listening ? <Mic size={28} /> : <MicOff size={28} />}
|
||||
</button>
|
||||
|
||||
{settings.showTuningMeter && pitchData ? (
|
||||
<TuningMeter cents={pitchData.cents} noteName={pitchData.note} />
|
||||
) : (
|
||||
<div className={`pitch-readout ${pitchData ? 'active' : ''}`}>
|
||||
{pitchData ? (
|
||||
<>
|
||||
<span className={`detected-note ${pitchData.midi === targetMidi ? 'match' : ''}`}>
|
||||
{pitchData.note}
|
||||
</span>
|
||||
<span className="detected-hz">{Math.round(pitchData.frequency)} Hz</span>
|
||||
</>
|
||||
) : (
|
||||
<span className="placeholder">{listening ? "Listening..." : "Mic Off"}</span>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
</main >
|
||||
|
||||
{!settings.zenMode && (
|
||||
<footer className="settings-footer">
|
||||
<Controls settings={settings} onUpdateSettings={setSettings} />
|
||||
</footer>
|
||||
)
|
||||
}
|
||||
|
||||
{
|
||||
settings.zenMode && (
|
||||
<button
|
||||
className="exit-zen-button"
|
||||
onClick={() => setSettings(s => ({ ...s, zenMode: false }))}
|
||||
>
|
||||
Exit Zen Mode
|
||||
</button>
|
||||
)
|
||||
}
|
||||
</div >
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ export interface AppSettings {
|
||||
instrument: string;
|
||||
showTuningMeter: boolean;
|
||||
rhythm: RhythmSettings;
|
||||
zenMode: boolean;
|
||||
}
|
||||
|
||||
interface ControlsProps {
|
||||
|
||||
Reference in New Issue
Block a user