diff --git a/imports/plugins/core/catalog/client/components/publishControls.js b/imports/plugins/core/catalog/client/components/publishControls.js index faa6c5c6be8..b06ba372fd2 100644 --- a/imports/plugins/core/catalog/client/components/publishControls.js +++ b/imports/plugins/core/catalog/client/components/publishControls.js @@ -1,5 +1,8 @@ import React, { Component } from "react"; import PropTypes from "prop-types"; +import classnames from "classnames"; +import { Meteor } from "meteor/meteor"; +import { ReactiveVar } from "meteor/reactive-var"; import { Components } from "@reactioncommerce/reaction-components"; import { Button, @@ -10,7 +13,7 @@ import { import { Translatable } from "/imports/plugins/core/ui/client/providers"; /** TMP **/ -import { Reaction } from "/client/api"; +import { i18next, Reaction } from "/client/api"; class PublishControls extends Component { static propTypes = { @@ -37,14 +40,28 @@ class PublishControls extends Component { constructor(props) { super(props); - this.state = { - showDiffs: false - }; + this.currentProductHash = new ReactiveVar([]); this.handleToggleShowChanges = this.handleToggleShowChanges.bind(this); this.handlePublishClick = this.handlePublishClick.bind(this); } + state = { + isHashUpdating: false, + showDiffs: false + }; + + componentWillReceiveProps() { + this.setState({ + isHashUpdating: false + }); + } + + componentDidUpdate() { + // Re-calculate hash after publishing + this.renderHashCalculation(); + } + handleToggleShowChanges() { this.setState({ showDiffs: !this.state.showDiffs @@ -54,6 +71,10 @@ class PublishControls extends Component { handlePublishClick() { if (this.props.onPublishClick) { this.props.onPublishClick(this.props.revisions); + + this.setState({ + isHashUpdating: true + }); } } @@ -200,13 +221,13 @@ class PublishControls extends Component { return (
+ {this.renderChangesNotification()}