1
0
Fork 0
mirror of https://gitlab.com/Alamantus/Readlebee.git synced 2025-07-03 06:34:18 +02:00
Readlebee/app/views/shelves/index.js
Robbie Antenesse 3bfaf5f3df Convert import/export to require/module.exports;Window conditions
Add conditions for whether to use certain things if run from server
2020-09-20 17:19:22 -06:00

21 lines
759 B
JavaScript

const html = require('choo/html');
const { ShelvesController } = require('./controller'); // The controller for this view, where processing should happen.
const { shelfView } = require('./shelf');
const { userShelvesView } = require('./userShelves');
// This is the view function that is exported and used in the view manager.
const shelvesView = (state, emit, i18n) => {
const controller = new ShelvesController(state, i18n);
// Returning an array in a view allows non-shared parent HTML elements.
// This one doesn't have the problem right now, but it's good to remember.
return [
(controller.targetShelf !== null
? shelfView(controller, emit)
: userShelvesView(controller, emit)
),
];
}
module.exports = { shelvesView };