Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

MM 20404 Migrate 'components/announcement_bar/version_bar' module and associated tests to TypeScript #6976

Merged
merged 7 commits into from
Nov 13, 2020
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@

import {connect} from 'react-redux';

import VersionBar from './version_bar.jsx';
import {GlobalState} from 'mattermost-redux/types/store';

function mapStateToProps(state) {
import VersionBar from './version_bar';

function mapStateToProps(state:GlobalState) {
return {
serverVersion: state.entities.general.serverVersion,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import React from 'react';
import {shallow} from 'enzyme';

import VersionBar from 'components/announcement_bar/version_bar/version_bar.jsx';
import VersionBar from 'components/announcement_bar/version_bar/version_bar';
import AnnouncementBar from 'components/announcement_bar/default_announcement_bar';

describe('components/VersionBar', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// See LICENSE.txt for license information.

import React from 'react';
import PropTypes from 'prop-types';

import {FormattedMessage} from 'react-intl';

Expand All @@ -11,20 +10,24 @@ import {AnnouncementBarTypes} from 'utils/constants';

import AnnouncementBar from '../default_announcement_bar';

export default class VersionBar extends React.PureComponent {
static propTypes = {
serverVersion: PropTypes.string,
};
interface Props {
serverVersion: string,
}

interface State {
serverVersionOnAppLoad: string,
}

constructor(props) {
export default class VersionBar extends React.PureComponent <Props, State> {
constructor(props:Props) {
super(props);

this.state = {
serverVersionOnAppLoad: props.serverVersion,
};
}

static getDerivedStateFromProps(props, state) {
static getDerivedStateFromProps(props:Props, state:State) {
if (!state.serverVersionOnAppLoad && props.serverVersion) {
return {
serverVersionOnAppLoad: props.serverVersion,
Expand Down