From e3cadcb4e387b0cfecc15d4a4b3b5a8e7c9aa9f1 Mon Sep 17 00:00:00 2001 From: alexsparkes Date: Mon, 1 Aug 2022 18:28:02 +0100 Subject: [PATCH] feat: new collection design, improvements Co-authored-by: David Ralph Co-authored-by: Isaac --- src/components/modals/main/Main.jsx | 2 +- .../modals/main/marketplace/Collection.jsx | 28 +++++++++++++ .../modals/main/marketplace/Item.jsx | 20 +++++++++- .../modals/main/marketplace/Items.jsx | 23 +++++++---- .../main/marketplace/sections/Marketplace.jsx | 39 +++++++++++++------ src/components/modals/main/scss/index.scss | 8 ++++ .../modals/main/scss/marketplace/_main.scss | 28 ++++++++++--- .../main/scss/modules/_tab-content.scss | 6 ++- .../modals/main/tabs/Marketplace.jsx | 3 ++ .../modals/main/tabs/backend/Tab.jsx | 4 ++ 10 files changed, 133 insertions(+), 28 deletions(-) create mode 100644 src/components/modals/main/marketplace/Collection.jsx diff --git a/src/components/modals/main/Main.jsx b/src/components/modals/main/Main.jsx index bf222bc8..2045ef6b 100644 --- a/src/components/modals/main/Main.jsx +++ b/src/components/modals/main/Main.jsx @@ -17,7 +17,7 @@ const getMessage = (text) => variables.language.getMessage(variables.languagecod const renderLoader = (current) => ( -
+
diff --git a/src/components/modals/main/marketplace/Collection.jsx b/src/components/modals/main/marketplace/Collection.jsx new file mode 100644 index 00000000..e52dc804 --- /dev/null +++ b/src/components/modals/main/marketplace/Collection.jsx @@ -0,0 +1,28 @@ +import variables from 'modules/variables'; + +export default function Collection({ + items, +}) { + const getMessage = (text) => variables.language.getMessage(variables.languagecode, text); + + return ( + <> +
+ {items.slice(0, 99).map((item) => ( +
toggleFunction(item)} key={item.name}> + icon +
+ {item.display_name || item.name} + {item.author} +
+
+ ))} +
+
+ + ); +} diff --git a/src/components/modals/main/marketplace/Item.jsx b/src/components/modals/main/marketplace/Item.jsx index 3b2fc097..dc375d35 100644 --- a/src/components/modals/main/marketplace/Item.jsx +++ b/src/components/modals/main/marketplace/Item.jsx @@ -159,7 +159,7 @@ export default class Item extends PureComponent { {this.props.data.version} )}
-
+
@@ -208,8 +208,24 @@ export default class Item extends PureComponent { {getMessage('modals.main.marketplace.product.shares')} 324
-
*/} +
*/}
+ {this.props.data.data.quotes ? ( + <> + + + + + + {this.props.data.data.quotes.map((quote, index) => ( + + + + + ))} +
QuoteAuthor
{quote.quote}{quote.author}
+ + ) : null}
variables.language.getMessage(variables.languagecode, text); + return ( <> - {type === 'all' && !onCollection ? ( + {(type === 'all' && !onCollection) || (type ==='collections') ? ( <> {collections.map((collection, index) => ( -
+
{collection.display_name} {collection.description} -
+
))} ) : null} +
- {items.map((item) => ( + {items.slice(0, 99).map((item) => (
toggleFunction(item)} key={item.name}> icon ))}
+
{type === 'all' && !onCollection ? (
diff --git a/src/components/modals/main/marketplace/sections/Marketplace.jsx b/src/components/modals/main/marketplace/sections/Marketplace.jsx index bf8b7395..0d174f19 100644 --- a/src/components/modals/main/marketplace/sections/Marketplace.jsx +++ b/src/components/modals/main/marketplace/sections/Marketplace.jsx @@ -1,7 +1,7 @@ import variables from 'modules/variables'; import { PureComponent } from 'react'; import { toast } from 'react-toastify'; -import { MdWifiOff, MdLocalMall, MdOutlineKeyboardArrowRight } from 'react-icons/md'; +import { MdWifiOff, MdLocalMall, MdOutlineKeyboardArrowRight, MdRefresh } from 'react-icons/md'; import Item from '../Item'; import Items from '../Items'; @@ -204,6 +204,14 @@ export default class Marketplace extends PureComponent { }); } + reloadItems() { + this.setState({ + done: false, + }); + + this.getItems(); + } + componentDidMount() { if (navigator.onLine === false || localStorage.getItem('offlineMode') === 'true') { return; @@ -306,18 +314,25 @@ export default class Marketplace extends PureComponent {
) : ( - {this.getMessage('modals.main.navbar.marketplace')} + <> +
+ {this.getMessage('modals.main.navbar.marketplace')} +
+
+ this.reloadItems()}> + Refresh + + this.sortMarketplace(value)} + > + + + +
+ )} -
- this.sortMarketplace(value)} - > - - - -
+
+ +
); } diff --git a/src/components/modals/main/tabs/backend/Tab.jsx b/src/components/modals/main/tabs/backend/Tab.jsx index 9fb1b5b3..204c4cd7 100644 --- a/src/components/modals/main/tabs/backend/Tab.jsx +++ b/src/components/modals/main/tabs/backend/Tab.jsx @@ -28,6 +28,7 @@ import { MdAddCircleOutline as Added, MdAddCircleOutline as Create, MdViewAgenda as Overview, + MdCollectionsBookmark as Collections, } from 'react-icons/md'; function Tab({ label, currentTab, onClick, navbarTab }) { @@ -146,6 +147,9 @@ function Tab({ label, currentTab, onClick, navbarTab }) { case getMessage('modals.main.marketplace.preset_settings'): icon = ; break; + case 'Collections': + icon = ; + break; default: break;