Add app info and instrument controls
This commit is contained in:
1 parent
e23825cdb1
commit
9d8f277971
38 files changed
+4001
-257
No files matched your search
+31
-39
@@ -1,57 +1,49 @@
|
||||
import { useState } from 'react';
|
||||
import { IonApp, IonContent, IonPage } from '@ionic/react';
|
||||
import { BeatLoopPanel } from './components/BeatLoopPanel';
|
||||
import { BeatTemplateSelector } from './components/BeatTemplateSelector';
|
||||
import { AppHeader } from './components/AppHeader';
|
||||
import { TransportBar } from './components/TransportBar';
|
||||
import { useBeatStudio } from './hooks/useBeatStudio';
|
||||
import { AboutView } from './views/AboutView';
|
||||
import { StudioView } from './views/StudioView';
|
||||
import type { AppView } from './views/viewTypes';
|
||||
|
||||
function App() {
|
||||
const studio = useBeatStudio();
|
||||
const [activeView, setActiveView] = useState<AppView>('studio');
|
||||
const isStudioView = activeView === 'studio';
|
||||
|
||||
function navigateTo(view: AppView): void {
|
||||
if (view === 'about' && studio.sequencer.isPlaying) {
|
||||
void studio.sequencer.togglePlayback();
|
||||
}
|
||||
setActiveView(view);
|
||||
}
|
||||
|
||||
return (
|
||||
<IonApp>
|
||||
<IonPage>
|
||||
<IonContent fullscreen className="app-content">
|
||||
<div className="app-shell">
|
||||
<header className="app-header">
|
||||
<a className="brand" href="#studio" aria-label="BeatHound home">
|
||||
<img
|
||||
className="brand-logo"
|
||||
src="/logo/logo-horizontal-dark-notagline.svg"
|
||||
alt=""
|
||||
/>
|
||||
</a>
|
||||
<span className="header-tag">Sharpen your sense of rhythm</span>
|
||||
</header>
|
||||
|
||||
<main id="studio" className="studio">
|
||||
<div className="studio-heading">
|
||||
<h1>Build a beat.</h1>
|
||||
<p className="template-prompt">Choose a dance template</p>
|
||||
<BeatTemplateSelector onSelectTemplate={studio.applyTemplate} />
|
||||
<p
|
||||
className={`intro-copy${studio.sequencer.beats.length > 0 ? ' is-hidden' : ''}`}
|
||||
aria-hidden={studio.sequencer.beats.length > 0}
|
||||
>
|
||||
Add a sound, then move it around the loop.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<BeatLoopPanel sequencer={studio.sequencer} soundPalette={studio.soundPalette} />
|
||||
|
||||
{studio.sequencer.audioError && (
|
||||
<p className="audio-error" role="alert">{studio.sequencer.audioError}</p>
|
||||
)}
|
||||
</main>
|
||||
<AppHeader activeView={activeView} onNavigate={navigateTo} />
|
||||
{isStudioView ? (
|
||||
<StudioView studio={studio} />
|
||||
) : (
|
||||
<AboutView onReturnToStudio={() => navigateTo('studio')} />
|
||||
)}
|
||||
</div>
|
||||
</IonContent>
|
||||
|
||||
<TransportBar
|
||||
isPlaying={studio.sequencer.isPlaying}
|
||||
isStarting={studio.sequencer.isStarting}
|
||||
hasBeats={studio.sequencer.beats.length > 0}
|
||||
onTogglePlayback={studio.sequencer.togglePlayback}
|
||||
onAddSound={studio.addSound}
|
||||
/>
|
||||
{isStudioView && (
|
||||
<TransportBar
|
||||
isPlaying={studio.sequencer.isPlaying}
|
||||
isStarting={studio.sequencer.isStarting}
|
||||
hasBeats={studio.sequencer.beats.length > 0}
|
||||
selectedBeat={studio.sequencer.selectedBeat}
|
||||
onTogglePlayback={studio.sequencer.togglePlayback}
|
||||
onAddInstrument={studio.addSound}
|
||||
onChangeBeatPitch={studio.sequencer.changeBeatPitch}
|
||||
/>
|
||||
)}
|
||||
</IonPage>
|
||||
</IonApp>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user