| 1 |
import { |
| 2 |
CHOICE_PAGES, |
| 3 |
DESCRIPTION_PAGES, |
| 4 |
MODAL_PAGES, |
| 5 |
PROGRESS_PAGES, |
| 6 |
} from './index'; |
| 7 |
import { |
| 8 |
choiceManifests, |
| 9 |
descriptionManifests, |
| 10 |
modalManifests, |
| 11 |
progressManifests, |
| 12 |
} from './manifests'; |
| 13 |
|
| 14 |
/** |
| 15 |
* Every layout a screen can draw, paired with the manifest describing it. |
| 16 |
* |
| 17 |
* Nothing in the flow reads this: the flow draws one layout and asks `index` |
| 18 |
* for it. Importing it here would pull all 15 manifests into the bundle. |
| 19 |
*/ |
| 20 |
const entriesFrom = (pages) => (manifest) => { |
| 21 |
const id = manifest.$id.split('/').pop(); |
| 22 |
return { id, label: manifest.title, Page: pages[id] }; |
| 23 |
}; |
| 24 |
|
| 25 |
export const descriptionTemplates = () => |
| 26 |
descriptionManifests().map(entriesFrom(DESCRIPTION_PAGES)); |
| 27 |
|
| 28 |
export const progressTemplates = () => |
| 29 |
progressManifests().map(entriesFrom(PROGRESS_PAGES)); |
| 30 |
|
| 31 |
export const choiceTemplates = () => |
| 32 |
choiceManifests().map(entriesFrom(CHOICE_PAGES)); |
| 33 |
|
| 34 |
export const modalTemplates = () => |
| 35 |
modalManifests().map(entriesFrom(MODAL_PAGES)); |
| 36 |
|