docbrown/app/javascript/packs/readingList.jsx
rhymes 209b0ba607 History and reading list refactoring (#3338)
* Make readingList testable

* Make history and readingList more similar

* Extract ItemListTags component

* Simplify load next page logic

* History and reading list load more should be the same

* Extract ItemListLoadMoreButton component

* Use the same exact CSS for both

* Use empty instead of 0

* Extract ItemListItem component

* Remove unnecessary else

* Same search function

* Use a common module to group related functionality

* Extract loadNextPage and fix load more button presence logic

* Extract toggleTag

* Refactor toggleStatusView and pass page

* Added additional tests
2019-07-02 09:22:21 -04:00

25 lines
599 B
JavaScript

import { h, render } from 'preact';
import { getUserDataAndCsrfToken } from '../chat/util';
import { ReadingList } from '../readingList/readingList';
function loadElement() {
getUserDataAndCsrfToken().then(({ currentUser }) => {
const root = document.getElementById('reading-list');
if (root) {
render(
<ReadingList
availableTags={currentUser.followed_tag_names}
statusView={root.dataset.view}
/>,
root,
root.firstElementChild,
);
}
});
}
window.InstantClick.on('change', () => {
loadElement();
});
loadElement();