compute catalog title in rust

This commit is contained in:
nklhrstv 2020-10-30 09:20:23 +02:00
parent 6f80583917
commit 2f0aeb1f38
2 changed files with 8 additions and 18 deletions

View file

@ -26,18 +26,13 @@ const Board = () => {
null
}
{board.catalogs.map((catalog, index) => {
const title = `${catalog.addonName} - ${catalog.request.path.id} ${catalog.request.path.type}`;
switch (catalog.content.type) {
case 'Ready': {
const posterShape = catalog.content.content.length > 0 ?
catalog.content.content[0].posterShape
:
'';
return (
<MetaRow
key={index}
className={classnames(styles['board-row'], styles['board-row-poster'], { [styles[`board-row-${posterShape}`]]: typeof posterShape === 'string' })}
title={title}
className={classnames(styles['board-row'], styles[`board-row-${catalog.content.content[0].posterShape}`])}
title={catalog.title}
items={catalog.content.content}
itemComponent={MetaItem}
deepLinks={catalog.deepLinks}
@ -58,7 +53,7 @@ const Board = () => {
<MetaRow
key={index}
className={styles['board-row']}
title={title}
title={catalog.title}
message={message}
deepLinks={catalog.deepLinks}
/>
@ -69,7 +64,7 @@ const Board = () => {
<MetaRow.Placeholder
key={index}
className={classnames(styles['board-row'], styles['board-row-poster'])}
title={title}
title={catalog.title}
deepLinks={catalog.deepLinks}
/>
);

View file

@ -49,18 +49,13 @@ const Search = ({ queryParams }) => {
</div>
:
search.catalogs.map((catalog, index) => {
const title = `${catalog.addonName} - ${catalog.request.path.id} ${catalog.request.path.type}`;
switch (catalog.content.type) {
case 'Ready': {
const posterShape = catalog.content.content.length > 0 ?
catalog.content.content[0].posterShape
:
null;
return (
<MetaRow
key={index}
className={classnames(styles['search-row'], styles['search-row-poster'], { [styles[`search-row-${posterShape}`]]: typeof posterShape === 'string' })}
title={title}
className={classnames(styles['search-row'], styles[`search-row-${catalog.content.content[0].posterShape}`])}
title={catalog.title}
items={catalog.content.content}
itemComponent={MetaItem}
deepLinks={catalog.deepLinks}
@ -81,7 +76,7 @@ const Search = ({ queryParams }) => {
<MetaRow
key={index}
className={styles['search-row']}
title={title}
title={catalog.title}
message={message}
deepLinks={catalog.deepLinks}
/>
@ -92,7 +87,7 @@ const Search = ({ queryParams }) => {
<MetaRow.Placeholder
key={index}
className={classnames(styles['search-row'], styles['search-row-poster'])}
title={title}
title={catalog.title}
deepLinks={catalog.deepLinks}
/>
);