mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 21:27:05 +00:00
Board adapted to the new state container
This commit is contained in:
parent
f4ac1797ea
commit
d0446c790f
2 changed files with 12 additions and 12 deletions
|
|
@ -23,15 +23,15 @@ const Board = () => {
|
|||
<div className={styles['board-container']}>
|
||||
<MainNavBar className={styles['nav-bar']} />
|
||||
<div className={styles['board-content']}>
|
||||
{catalogs.map(([request, response], index) => {
|
||||
switch (response.type) {
|
||||
{catalogs.map(({ req, content }, index) => {
|
||||
switch (content.type) {
|
||||
case 'Ready':
|
||||
return (
|
||||
<BoardRow
|
||||
key={`${index}${request.transport_url}${response.type}`}
|
||||
key={`${index}${req.base}${content.type}`}
|
||||
className={styles['board-row']}
|
||||
title={`${request.resource_ref.id} - ${request.resource_ref.type_name}`}
|
||||
items={response.content.map((item) => ({
|
||||
title={`${req.path.id} - ${req.path.type_name}`}
|
||||
items={content.content.map((item) => ({
|
||||
...item,
|
||||
posterShape: item.posterShape || 'poster'
|
||||
}))}
|
||||
|
|
@ -40,16 +40,16 @@ const Board = () => {
|
|||
case 'Message':
|
||||
return (
|
||||
<BoardRow
|
||||
key={`${index}${request.transport_url}${response.type}`}
|
||||
key={`${index}${req.base}${content.type}`}
|
||||
className={styles['board-row']}
|
||||
title={`${request.resource_ref.id} - ${request.resource_ref.type_name}`}
|
||||
message={response.content}
|
||||
title={`${req.path.id} - ${req.path.type_name}`}
|
||||
message={content.content}
|
||||
/>
|
||||
);
|
||||
case 'Loading':
|
||||
return (
|
||||
<BoardRowPlaceholder
|
||||
key={`${index}${request.transport_url}${response.type}`}
|
||||
key={`${index}${req.base}${content.type}`}
|
||||
className={classnames(styles['board-row-placeholder'], placeholderStyles['placeholder-container'])}
|
||||
/>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@ const useCatalogs = () => {
|
|||
React.useEffect(() => {
|
||||
const onNewState = () => {
|
||||
const state = window.stateContainer.getState();
|
||||
setCatalogs(state.groups);
|
||||
setCatalogs(state.catalogs.groups);
|
||||
};
|
||||
window.stateContainer.on('NewState', onNewState);
|
||||
window.stateContainer.on('NewModel', onNewState);
|
||||
window.stateContainer.dispatch({
|
||||
action: 'Load',
|
||||
args: {
|
||||
|
|
@ -16,7 +16,7 @@ const useCatalogs = () => {
|
|||
}
|
||||
});
|
||||
return () => {
|
||||
window.stateContainer.off('NewState', onNewState);
|
||||
window.stateContainer.off('NewModel', onNewState);
|
||||
};
|
||||
}, []);
|
||||
return catalogs;
|
||||
|
|
|
|||
Loading…
Reference in a new issue