From 4ad9d4810e60bf81315a36f72b8df1e3297d95e8 Mon Sep 17 00:00:00 2001 From: David Ralph Date: Sat, 18 Sep 2021 20:51:00 +0100 Subject: [PATCH] feat: add create quote pack (WIP) --- .../main/marketplace/sections/Create.jsx | 64 +++++++++++++++++-- .../modals/main/settings/Dropdown.jsx | 4 +- .../modals/main/settings/sections/Stats.jsx | 2 +- 3 files changed, 64 insertions(+), 6 deletions(-) diff --git a/src/components/modals/main/marketplace/sections/Create.jsx b/src/components/modals/main/marketplace/sections/Create.jsx index ead3f5a6..66de88d5 100644 --- a/src/components/modals/main/marketplace/sections/Create.jsx +++ b/src/components/modals/main/marketplace/sections/Create.jsx @@ -11,6 +11,7 @@ import { toast } from 'react-toastify'; import { saveFile } from 'modules/helpers/settings/modals'; import FileUpload from '../../settings/FileUpload'; +import Dropdown from '../../settings/Dropdown'; import '../../../welcome/welcome.scss'; @@ -72,11 +73,46 @@ export default class Create extends PureComponent { toast('Imported settings!'); } + updateQuotePackType(e) { + if (e === 'quotePack') { + this.setState({ + addonMetadata: { + type: e, + quotes: [{ + quote: '', + author: '' + }] + } + }); + } else { + this.setState({ + addonMetadata: { + type: e, + quote_api: { + url: '', + name: '', + author: '' + } + } + }); + } + } + + updateQuotePackAPI(type, data) { + this.setState({ + addonData: { + url: (type === 'url') ? data : this.state.addonData.url || '', + name: (type === 'name') ? data : this.state.addonData.name || '', + author: (type === 'author') ? data : this.state.addonData.author || '', + } + }); + } + downloadAddon() { saveFile({ name: this.state.addonMetadata.name, description: this.state.addonMetadata.description, - type: this.state.addonMetadata.type, + type: (this.state.addonMetadata.type === 'quote_api') ? 'quotes' : this.state.addonMetadata.type, version: this.state.addonMetadata.version, author: this.state.addonMetadata.author, icon_url: this.state.addonMetadata.icon_url, @@ -99,11 +135,11 @@ export default class Create extends PureComponent { {marketplace.photo_packs} + */}
this.changeTab(2, 'quotes')}> - {marketplace.quote_packs} + {getMessage('modals.main.marketplace.quote_packs')}
- */}
this.changeTab(2, 'settings')}> {getMessage('modals.main.marketplace.preset_settings')} @@ -151,7 +187,7 @@ export default class Create extends PureComponent {