import React from 'react'; import Checkbox from '../../Checkbox'; import Dropdown from '../../Dropdown'; import FileUpload from '../../FileUpload'; import Slider from '../../Slider'; import Switch from '../../Switch'; import Radio from '../../Radio'; import ColourSettings from './Colour'; import { toast } from 'react-toastify'; export default class BackgroundSettings extends React.PureComponent { constructor() { super(); this.state = { customBackground: localStorage.getItem('customBackground') || '', backgroundType: localStorage.getItem('backgroundType') || 'api' }; this.language = window.language.modals.main.settings; } resetCustom() { localStorage.setItem('customBackground', ''); this.setState({ customBackground: '' }); toast(this.language.toasts.reset); } fileUpload(e) { localStorage.setItem('customBackground', e.target.result); this.setState({ customBackground: e.target.result }); } videoCustomSettings = () => { const customBackground = this.state.customBackground; if (customBackground.endsWith('.mp4') || customBackground.endsWith('.webm') || customBackground.endsWith('.ogg')) { return ( <> ) } else { return null; } } marketplaceType = () => { if (localStorage.getItem('photo_packs')) { return } } componentDidUpdate() { localStorage.setItem('customBackground', this.state.customBackground); } render() { const { background } = this.language.sections; let backgroundSettings; const apiOptions = [ { 'name': 'Mue', 'value': 'mue' }, { 'name': 'Unsplash', 'value': 'unsplash' } ]; const APISettings = ( <>

); const customSettings = ( <>

    {background.source.custom_url} this.resetCustom()}>{this.language.buttons.reset}

    this.setState({ customBackground: e.target.value })}>
{this.videoCustomSettings()}

    {background.source.custom_background} this.resetCustom()}>{this.language.buttons.reset}

    this.fileUpload(e)} />
); switch (this.state.backgroundType) { case 'custom': backgroundSettings = customSettings; break; case 'colour': backgroundSettings = ; break; // API default: backgroundSettings = APISettings; break; } return ( <>

{background.title}

{background.source.title}

this.setState({ backgroundType: value })}> {this.marketplaceType()}
{backgroundSettings}

{background.buttons.title}

{background.effects.title}



); } }