2021-10-12 21:18:47 +00:00
|
|
|
import variables from 'modules/variables';
|
2022-11-03 18:10:13 +00:00
|
|
|
import React, { memo } from 'react';
|
2022-11-06 11:59:59 +00:00
|
|
|
import { MdAutoFixHigh, MdOutlineArrowForward, MdOutlineOpenInNew } from 'react-icons/md';
|
2021-10-12 21:18:47 +00:00
|
|
|
|
2022-10-30 16:56:26 +00:00
|
|
|
function Items({
|
2022-04-08 13:48:36 +00:00
|
|
|
type,
|
|
|
|
items,
|
2022-09-05 12:59:16 +00:00
|
|
|
collection,
|
2022-04-08 13:48:36 +00:00
|
|
|
toggleFunction,
|
|
|
|
collectionFunction,
|
|
|
|
onCollection,
|
2022-10-21 21:33:30 +00:00
|
|
|
filter,
|
2022-04-08 13:48:36 +00:00
|
|
|
}) {
|
2021-03-17 13:01:53 +00:00
|
|
|
return (
|
2022-04-08 13:48:36 +00:00
|
|
|
<>
|
2022-11-06 11:59:59 +00:00
|
|
|
{(type === 'all' && !onCollection && (filter === null || filter === '')) ||
|
|
|
|
(type === 'collections' && !onCollection && (filter === null || filter === '')) ? (
|
2022-04-08 13:48:36 +00:00
|
|
|
<>
|
2022-08-03 09:42:04 +00:00
|
|
|
<div
|
|
|
|
className="collection"
|
2022-08-21 11:41:05 +00:00
|
|
|
style={
|
|
|
|
collection.news
|
|
|
|
? { backgroundColor: collection.background_colour }
|
|
|
|
: {
|
|
|
|
backgroundImage: `linear-gradient(to left, #000, transparent, #000), url('${collection.img}')`,
|
|
|
|
}
|
|
|
|
}
|
2022-08-03 09:42:04 +00:00
|
|
|
>
|
|
|
|
<div className="content">
|
|
|
|
<span className="title">{collection.display_name}</span>
|
|
|
|
<span className="subtitle">{collection.description}</span>
|
2022-04-08 13:48:36 +00:00
|
|
|
</div>
|
2022-08-08 14:21:35 +00:00
|
|
|
{collection.news === true ? (
|
2022-09-11 16:45:14 +00:00
|
|
|
<a
|
|
|
|
className="collectionButton"
|
|
|
|
href={collection.news_link}
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
>
|
2022-08-29 20:07:52 +00:00
|
|
|
{variables.getMessage('modals.main.marketplace.learn_more')} <MdOutlineOpenInNew />
|
2022-08-08 14:21:35 +00:00
|
|
|
</a>
|
|
|
|
) : (
|
2022-09-11 16:45:14 +00:00
|
|
|
<button
|
|
|
|
className="collectionButton"
|
|
|
|
onClick={() => collectionFunction(collection.name)}
|
|
|
|
>
|
2022-11-03 18:10:13 +00:00
|
|
|
<MdOutlineArrowForward />
|
2022-08-26 09:45:32 +00:00
|
|
|
{variables.getMessage('modals.main.marketplace.explore_collection')}
|
2022-08-08 14:21:35 +00:00
|
|
|
</button>
|
|
|
|
)}
|
2022-08-03 09:42:04 +00:00
|
|
|
</div>
|
2022-04-08 13:48:36 +00:00
|
|
|
</>
|
|
|
|
) : null}
|
2022-10-18 17:11:23 +00:00
|
|
|
<div className="items">
|
2022-11-06 11:59:59 +00:00
|
|
|
{items
|
|
|
|
?.filter(
|
2022-10-18 17:11:23 +00:00
|
|
|
(item) =>
|
|
|
|
item.name.toLowerCase().includes(filter.toLowerCase()) ||
|
|
|
|
filter === '' ||
|
|
|
|
item.author.toLowerCase().includes(filter.toLowerCase()) ||
|
2022-11-03 18:10:13 +00:00
|
|
|
item.type.toLowerCase().includes(filter.toLowerCase()),
|
2022-10-18 17:11:23 +00:00
|
|
|
)
|
|
|
|
.map((item) => (
|
|
|
|
<div className="item" onClick={() => toggleFunction(item)} key={item.name}>
|
|
|
|
<img
|
|
|
|
alt="icon"
|
|
|
|
draggable="false"
|
|
|
|
src={variables.constants.DDG_IMAGE_PROXY + item.icon_url}
|
|
|
|
/>
|
|
|
|
<div className="card-details">
|
|
|
|
<span className="card-title">{item.display_name || item.name}</span>
|
|
|
|
<span className="card-subtitle">{item.author}</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
))}
|
|
|
|
</div>
|
2022-08-01 17:28:02 +00:00
|
|
|
<div className="loader"></div>
|
2022-04-27 15:30:54 +00:00
|
|
|
{type === 'all' && !onCollection ? (
|
2022-04-24 20:12:49 +00:00
|
|
|
<div className="createYourOwn">
|
|
|
|
<MdAutoFixHigh />
|
2022-08-26 09:45:32 +00:00
|
|
|
<span className="title">{variables.getMessage('modals.main.marketplace.cant_find')}</span>
|
2022-04-24 20:12:49 +00:00
|
|
|
<span className="subtitle">
|
2022-11-03 18:10:13 +00:00
|
|
|
{variables.getMessage('modals.main.marketplace.knowledgebase_one')}
|
2022-07-28 12:12:13 +00:00
|
|
|
<a
|
|
|
|
className="link"
|
|
|
|
target="_blank"
|
|
|
|
href={variables.constants.KNOWLEDGEBASE}
|
|
|
|
rel="noreferrer"
|
|
|
|
>
|
2022-08-26 09:45:32 +00:00
|
|
|
{variables.getMessage('modals.main.marketplace.knowledgebase_two')}
|
2022-11-03 18:10:13 +00:00
|
|
|
</a>
|
2022-08-26 09:45:32 +00:00
|
|
|
{variables.getMessage('modals.main.marketplace.knowledgebase_three')}
|
2022-04-24 20:12:49 +00:00
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
) : null}
|
2022-04-08 13:48:36 +00:00
|
|
|
</>
|
2021-03-17 13:01:53 +00:00
|
|
|
);
|
|
|
|
}
|
2022-10-30 16:56:26 +00:00
|
|
|
|
2022-11-06 11:59:59 +00:00
|
|
|
export default memo(Items);
|