From f38749961b583b3255905724eb927e29196e8389 Mon Sep 17 00:00:00 2001 From: David Ralph Date: Thu, 17 Sep 2020 14:49:27 +0100 Subject: [PATCH] fix things --- src/App.jsx | 1 + src/components/modals/Addons.jsx | 2 +- src/components/modals/Marketplace.jsx | 2 +- src/components/widgets/Quote.jsx | 6 +++++- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index 2f33aed0..2d01f868 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -108,6 +108,7 @@ export default class App extends React.PureComponent { this.setState({ addonsModal: false })} isOpen={this.state.addonsModal} className={modalClassList} overlayClassName='Overlay' ariaHideApp={false}> this.setState({ addonsModal: false })} openSettings={() => this.setState({ addonsModal: false, settingsModal: true })} diff --git a/src/components/modals/Addons.jsx b/src/components/modals/Addons.jsx index e8e7ab89..7d2db947 100644 --- a/src/components/modals/Addons.jsx +++ b/src/components/modals/Addons.jsx @@ -111,7 +111,7 @@ export default class Addons extends React.PureComponent { )} - this.uninstall()}>{this.props.language.product.buttons.remove}} data={this.state.item_data} function={() => this.toggle()} language={this.props.language.product} /> + this.uninstall()}>{this.props.marketplaceLanguage.product.buttons.remove}} data={this.state.item_data} function={() => this.toggle()} language={this.props.marketplaceLanguage.product} /> ; } } diff --git a/src/components/modals/Marketplace.jsx b/src/components/modals/Marketplace.jsx index dd4ddd44..a1dbd85b 100644 --- a/src/components/modals/Marketplace.jsx +++ b/src/components/modals/Marketplace.jsx @@ -143,7 +143,7 @@ export default class Marketplace extends React.PureComponent { installStuff(); break; case 'quote_packs': - if (this.state.current_data.content.data.quoteapi) localStorage.setItem('quote_api', JSON.stringify(this.state.current_data.content.data.quoteapi)); + if (this.state.current_data.content.data.quote_api) localStorage.setItem('quote_api', JSON.stringify(this.state.current_data.content.data.quote_api)); localStorage.setItem('quote_packs', JSON.stringify(this.state.current_data.content.data.quotes)); installStuff(); break; diff --git a/src/components/widgets/Quote.jsx b/src/components/widgets/Quote.jsx index acd3a5fe..46fafea1 100644 --- a/src/components/widgets/Quote.jsx +++ b/src/components/widgets/Quote.jsx @@ -22,7 +22,11 @@ export default class Quote extends React.PureComponent { } getQuotePack() { - const quotePack = JSON.parse(localStorage.getItem('quote_packs')); + let quotePack = localStorage.getItem('quote_packs'); + console.log(quotePack) + if (quotePack === 'undefined') return this.doOffline(); + quotePack = JSON.parse(quotePack); + if (quotePack) { const data = quotePack[Math.floor(Math.random() * quotePack.length)]; return this.setState({