diff --git a/src/components/modals/marketplace/Item.jsx b/src/components/modals/marketplace/Item.jsx index f1295bf5..aaac6335 100644 --- a/src/components/modals/marketplace/Item.jsx +++ b/src/components/modals/marketplace/Item.jsx @@ -3,55 +3,56 @@ import ArrowBackIcon from '@material-ui/icons/ArrowBack'; export default class Item extends React.PureComponent { render() { - //if (!this.props.data.icon) return null; let warningHTML; try { // For some reason it breaks sometimes so we use try/catch if (this.props.content.content.data.quote_api) { - warningHTML =
{this.props.language.background.custom_url} this.resetItem('customBackground')}>{this.props.language.reset}
- + this.setState({ customBackground: e.target.value })}>{this.props.language.background.custom_background} this.resetItem('customBackground')}>{this.props.language.reset}
diff --git a/src/components/modals/settings/sections/GreetingSettings.jsx b/src/components/modals/settings/sections/GreetingSettings.jsx index 25e3dbd4..4895e1e9 100644 --- a/src/components/modals/settings/sections/GreetingSettings.jsx +++ b/src/components/modals/settings/sections/GreetingSettings.jsx @@ -3,17 +3,19 @@ import Section from '../Section'; import Checkbox from '../Checkbox'; import DatePicker from 'react-date-picker'; import { toast } from 'react-toastify'; +import { Beforeunload } from 'react-beforeunload'; export default class GreetingSettings extends React.PureComponent { constructor(...args) { super(...args); this.state = { - birthday: new Date(localStorage.getItem('birthday')) || new Date() + birthday: new Date(localStorage.getItem('birthday')) || new Date(), + greetingName: localStorage.getItem('greetingName') || '' }; } resetItem() { - document.getElementById('greetingName').value = ''; + this.setState({ greetingName: '' }); toast(this.props.toastLanguage.reset); } @@ -23,24 +25,25 @@ export default class GreetingSettings extends React.PureComponent { this.setState({ birthday: data }); } - componentDidMount() { - document.getElementById('greetingName').value = localStorage.getItem('greetingName'); + beforeUnload() { + localStorage.setItem('greetingName', this.state.greetingName); } render() { return ( -{this.props.language.greeting.name} this.resetItem()}>{this.props.language.reset}
- + this.setState({ greetingName: e.target.value })}>Birthday Date