diff options
Diffstat (limited to 'src/content/dependencies/generateAlbumTrackList.js')
-rw-r--r-- | src/content/dependencies/generateAlbumTrackList.js | 103 |
1 files changed, 0 insertions, 103 deletions
diff --git a/src/content/dependencies/generateAlbumTrackList.js b/src/content/dependencies/generateAlbumTrackList.js index a0fad460..f2f2279d 100644 --- a/src/content/dependencies/generateAlbumTrackList.js +++ b/src/content/dependencies/generateAlbumTrackList.js @@ -44,109 +44,6 @@ export default { 'language', ], - contracts: { - length: { - hook(contract, [array]) { - contract.provide({ - length: contract.selectProperty(array, 'length'), - }); - }, - - compute({length}) { - return length; - }, - }, - - isDefault: { - hook(contract, [trackSection]) { - contract.provide({ - isDefault: contract.selectProperty(trackSection, 'isDefaultTrackSection', false), - }); - }, - - compute({isDefault}) { - return isDefault; - }, - }, - - firstIsDefault: { - hook(contract, [trackSections]) { - contract.provide({ - isDefault: contract.subcontract('#isDefault', contract.selectProperty(trackSections, '0')), - }); - }, - - compute({isDefault}) { - return isDefault; - }, - }, - - displayTrackSections: { - hook(contract, [album]) { - contract.provide({ - numTrackSections: contract.subcontract('#length', contract.selectProperty(album, 'trackSections')), - firstIsDefault: contract.subcontract('#firstIsDefault', contract.selectProperty(album, 'trackSections')), - }); - }, - - compute({numTrackSections, firstIsDefault}) { - return numTrackSections >= 2 || firstIsDefault; - }, - }, - - displayTracks: { - hook(contract, [album]) { - contract.provide({ - numTracks: contract.subcontract('#length', contract.selectProperty(album, 'tracks')), - }); - }, - - compute({numTracks}) { - return numTracks >= 1; - }, - }, - - displayMode: { - hook(contract, [album]) { - contract.provide({ - displayTrackSections: contract.subcontract('#displayTrackSections', album), - displayTracks: contract.subcontract('#displayTracks', album), - }); - }, - - compute({displayTrackSections, displayTracks}) { - if (displayTrackSections) { - return 'trackSections'; - } else if (displayTracks) { - return 'tracks'; - } else { - return 'none'; - } - }, - }, - - relations: { - hook(contract, [relation, album]) { - contract.branch({ - subcontract: ['#displayMode', album], - branches: { - trackSections() { - contract.provide({ - trackSections: contract.selectProperty(album, 'trackSections'), - }); - }, - - tracks() { - contract.provide({ - tracks: contract.selectProperty(album, 'tracks'), - }); - }, - }, - }); - }, - }, - }, - relations(relation, album) { const relations = {}; |