Skip to content

Commit

Permalink
Merge pull request #43709 from code-dot-org/header-more-responsive-fi…
Browse files Browse the repository at this point in the history
…x-project-update-updates

Header: fix project update updates
  • Loading branch information
breville committed Nov 19, 2021
2 parents 7109192 + f5c73f8 commit bd12200
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
15 changes: 14 additions & 1 deletion apps/src/code-studio/components/header/ProjectUpdatedAt.jsx
Expand Up @@ -11,9 +11,22 @@ import RetryProjectSaveDialog from './RetryProjectSaveDialog';
class ProjectUpdatedAt extends React.Component {
static propTypes = {
status: PropTypes.oneOf(Object.values(statuses)),
updatedAt: PropTypes.string
updatedAt: PropTypes.string,
onContentUpdated: PropTypes.func
};

componentDidMount() {
if (this.props.onContentUpdated) {
this.props.onContentUpdated();
}
}

componentDidUpdate() {
if (this.props.onContentUpdated) {
this.props.onContentUpdated();
}
}

renderText() {
if (this.props.status === statuses.error) {
return (
Expand Down
8 changes: 7 additions & 1 deletion apps/src/code-studio/components/header/ScriptName.jsx
Expand Up @@ -44,6 +44,10 @@ class ScriptName extends React.Component {
);
}

onProjectUpdatedAtContentUpdated = () => {
this.setDesiredWidth();
};

renderScriptLink() {
let className = 'header_text';
if (this.props.smallText) {
Expand Down Expand Up @@ -101,7 +105,9 @@ class ScriptName extends React.Component {
<div style={styles.outerContainer}>
<div style={styles.containerWithUpdatedAt}>
{this.renderScriptLink()}
<ProjectUpdatedAt />
<ProjectUpdatedAt
onContentUpdated={this.onProjectUpdatedAtContentUpdated}
/>
</div>
</div>
</div>
Expand Down

0 comments on commit bd12200

Please sign in to comment.