mirror of
https://github.com/mue/mue.git
synced 2026-07-19 06:54:10 +02:00
fix: quote packs, add preset settings to sidebar (WIP)
This commit is contained in:
@@ -11,6 +11,7 @@ export default function Marketplace() {
|
||||
<Tabs>
|
||||
<div label={marketplace.photo_packs}><MarketplaceTab type='photo_packs'/></div>
|
||||
<div label={marketplace.quote_packs}><MarketplaceTab type='quote_packs'/></div>
|
||||
<div label={marketplace.preset_settings}><MarketplaceTab type='preset_settings'/></div>
|
||||
</Tabs>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -67,6 +67,7 @@ function Tab(props) {
|
||||
// Store
|
||||
case marketplace.photo_packs: icon = <Background/>; break;
|
||||
case marketplace.quote_packs: icon = <Quote/>; break;
|
||||
case marketplace.preset_settings: icon = <Advanced/>; break;
|
||||
case addons.added: icon = <Added/>; break;
|
||||
case addons.sideload: icon = <Sideload/>; break;
|
||||
|
||||
|
||||
@@ -41,26 +41,6 @@ export default class Quote extends React.PureComponent {
|
||||
});
|
||||
}
|
||||
|
||||
getQuotePack() {
|
||||
let quotePack = localStorage.getItem('quote_packs');
|
||||
|
||||
if (quotePack === 'undefined') {
|
||||
return this.doOffline();
|
||||
}
|
||||
|
||||
quotePack = JSON.parse(quotePack);
|
||||
|
||||
if (quotePack) {
|
||||
const data = quotePack[Math.floor(Math.random() * quotePack.length)];
|
||||
return this.setState({
|
||||
quote: '"' + data.quote + '"',
|
||||
author: data.author
|
||||
});
|
||||
} else {
|
||||
this.doOffline();
|
||||
}
|
||||
}
|
||||
|
||||
async getQuote() {
|
||||
const favouriteQuote = localStorage.getItem('favouriteQuote');
|
||||
if (favouriteQuote) {
|
||||
@@ -91,7 +71,23 @@ export default class Quote extends React.PureComponent {
|
||||
author: quotePackAPI.author || data.author
|
||||
});
|
||||
} catch (e) {
|
||||
return this.getQuotePack();
|
||||
return this.doOffline();
|
||||
}
|
||||
}
|
||||
|
||||
let quotePack = localStorage.getItem('quote_packs');
|
||||
|
||||
if (quotePack !== null) {
|
||||
quotePack = JSON.parse(quotePack);
|
||||
|
||||
if (quotePack) {
|
||||
const data = quotePack[Math.floor(Math.random() * quotePack.length)];
|
||||
return this.setState({
|
||||
quote: '"' + data.quote + '"',
|
||||
author: data.author
|
||||
});
|
||||
} else {
|
||||
return this.doOffline();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user