diff --git a/app/javascript/gabsocial/features/compose/components/schedule_post_dropdown.js b/app/javascript/gabsocial/features/compose/components/schedule_post_dropdown.js
index cf7b05a5..094910a6 100644
--- a/app/javascript/gabsocial/features/compose/components/schedule_post_dropdown.js
+++ b/app/javascript/gabsocial/features/compose/components/schedule_post_dropdown.js
@@ -11,11 +11,22 @@ const messages = defineMessages({
schedule_status: { id: 'schedule_status.title', defaultMessage: 'Schedule Status' },
});
-const DatePickerWrapper = ({ value, onClick }) => (
-
-);
+class DatePickerWrapper extends React.PureComponent {
+ static propTypes = {
+ value: PropTypes.string,
+ onClick: PropTypes.func,
+ };
+
+ render() {
+ const { value, onClick } = this.props;
+
+ return (
+
+ )
+ }
+}
export default @injectIntl
class SchedulePostDropdown extends React.PureComponent {
@@ -28,23 +39,14 @@ class SchedulePostDropdown extends React.PureComponent {
onOpenProUpgradeModal: PropTypes.func.isRequired,
};
- state = {
- open: false,
- };
-
handleToggle = () => {
if (!this.props.isPro) {
return this.props.onOpenProUpgradeModal();
}
- const newOpen = !this.state.open;
- const newDate = newOpen ? new Date() : null;
-
- this.handleSetDate(newDate);
-
- this.setState({
- open: newOpen
- });
+ const { date } = this.props;
+ const value = date ? null : new Date();
+ this.handleSetDate(value);
}
handleSetDate = (date) => {
@@ -53,7 +55,8 @@ class SchedulePostDropdown extends React.PureComponent {
render () {
const { intl, date, isPro } = this.props;
- const { open } = this.state;
+
+ const open = !!date;
const datePickerDisabled = !isPro;
const withPortal = isMobile(window.innerWidth);