From bd0741dcf0c23489bf710249ab8fd9ba647db843 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Thu, 25 May 2023 08:54:29 -0300 Subject: Revert "contracts: initial commit" This reverts commit 4280c6240b88dadc8e5ea187b78c10aca9dfc163. --- src/content/dependencies/generateAlbumSidebar.js | 46 ++++++++---------------- 1 file changed, 14 insertions(+), 32 deletions(-) (limited to 'src/content/dependencies/generateAlbumSidebar.js') diff --git a/src/content/dependencies/generateAlbumSidebar.js b/src/content/dependencies/generateAlbumSidebar.js index 4eef62b2..bf6b091a 100644 --- a/src/content/dependencies/generateAlbumSidebar.js +++ b/src/content/dependencies/generateAlbumSidebar.js @@ -7,44 +7,26 @@ export default { extraDependencies: ['html'], - contracts: { - relations: { - hook(contract, [relation, album, track]) { - contract.provide({ - relation, album, track, - groups: contract.selectProperty(album, 'groups'), - trackSections: contract.selectProperty(album, 'trackSections'), - }); - }, + relations(relation, album, track) { + const relations = {}; - compute({relation, album, track, groups, trackSections}) { - const relations = {}; + relations.albumLink = + relation('linkAlbum', album); - relations.albumLink = - relation('linkAlbum', album); + relations.groupBoxes = + album.groups.map(group => + relation('generateAlbumSidebarGroupBox', album, group)); - relations.groupBoxes = - groups.map(group => - relation('generateAlbumSidebarGroupBox', album, group)); + relations.trackSections = + album.trackSections.map(trackSection => + relation('generateAlbumSidebarTrackSection', album, track, trackSection)); - relations.trackSections = - trackSections.map(trackSection => - relation('generateAlbumSidebarTrackSection', album, track, trackSection)); - - return relations; - }, - }, - - data: { - hook(contract, [album, track]) { - contract.provide({track}); - }, + return relations; + }, - compute({track}) { - return {isAlbumPage: !track}; - }, - }, + data(album, track) { + return {isAlbumPage: !track}; }, generate(data, relations, {html}) { -- cgit 1.3.0-6-gf8a5