Connect any app to Coach Locker

Every app in a suite (basketball, volleyball, baseball, soccer, football, or every sport) talks through the Locker. An app never needs to know about the other apps. It only says what it can send and what it can take.

1. Add one line

Put this right before </body>. That alone gives the app the Locker button, the inbox, voice notes, Hey Sammi texting and the app launcher.

<script src="https://coachlocker.ample.run/locker.js" data-app="your-app-id"></script>

2. Add the app to the registry

Add an entry to apps.json on the Locker under its suite, with the types it accepts and sends. Apps in the all suite show up in every sport.

{ "id": "your-app-id", "name": "Your App", "icon": "🏀", "url": "https://yourapp.ample.run/",
  "adapter": "generic", "accepts": ["roster"], "sends": ["plan"] }

3. Teach it what to send and take (optional)

Locker.provide('play', () => ({ title: 'Horns Flare', summary: '4 step set', data: { name: 'Horns Flare', image: dataUrl } }), 'Send this play');
Locker.receive('drill', item => { openDrill(item.data.drillId); }, 'Open on the court');
Locker.sendTo('practice-planner', { type: 'play', title, data });   // send and open the other app

Put this code in the app, or in an adapter file on the Locker at /adapters/your-app-id.js so it can change without redeploying the app. Apps that keep their data in a global S with save() and render() can use the built in generic adapter for rosters and snapshots.

Shared types

TypeData
drilldrillId (the number from the 1,001 Drills book), name, purpose, setup, steps, points
playname, court, notes, steps, image, drillId, doc (a full Play Designer play)
plantitle, minutes, opponent, blocks [name, minutes, drillId, focus, notes], text
rosterteam, players [name, number, position]
reportopponent, text
gamekind, text, state
notetext
pillarname, text
eventtitle, when, where, notes

Add a new type in apps.json whenever a new kind of thing needs to move. Drill numbers, player names and play IDs are the shared keys that let apps match things up.

How apps connect

Each app keeps the coach's private Locker key. Opening an app from the Locker page, or from another app's Locker button, passes the key along, so the coach connects once and every app after that is already connected.