2019-12-22 04:16:52 +01:00
|
|
|
import html from 'choo/html';
|
|
|
|
|
|
|
|
import { ShelvesController } from './controller'; // The controller for this view, where processing should happen.
|
|
|
|
import { shelfView } from './shelf';
|
2019-12-24 00:39:03 +01:00
|
|
|
import { userShelvesView } from './userShelves';
|
2019-12-22 04:16:52 +01:00
|
|
|
|
|
|
|
// This is the view function that is exported and used in the view manager.
|
|
|
|
export 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)
|
2019-12-24 00:39:03 +01:00
|
|
|
: userShelvesView(controller, emit)
|
2019-12-22 04:16:52 +01:00
|
|
|
),
|
|
|
|
];
|
|
|
|
}
|