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

Commit

Permalink
[MM-20582] Migrate 'components/admin_console/team_channel_settings/ch…
Browse files Browse the repository at this point in the history
…annel' module and associated tests to TypeScript
  • Loading branch information
cinlloc committed Oct 19, 2020
1 parent 65b0319 commit 6b657cd
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 11 deletions.
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 {ChannelsSettings} from './channel_settings.jsx';
import {ChannelsSettings} from './channel_settings';

describe('admin_console/team_channel_settings/channel/ChannelSettings', () => {
test('should match snapshot', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,24 @@
// See LICENSE.txt for license information.

import React from 'react';
import PropTypes from 'prop-types';
import {FormattedMessage} from 'react-intl';

import {t} from 'utils/i18n';
import ChannelsList from 'components/admin_console/team_channel_settings/channel/list';
import AdminPanel from 'components/widgets/admin_console/admin_panel';

export class ChannelsSettings extends React.PureComponent {
static propTypes = {
siteName: PropTypes.string.isRequired,
};
interface Props {
siteName?: string,
}

export interface ChannelSettingsState {
startCount: number,
endCount: number,
total: number,
}

constructor(props) {
export class ChannelsSettings extends React.PureComponent<Props> {
constructor(props: Props) {
super(props);
this.state = {
startCount: 0,
Expand All @@ -23,8 +28,8 @@ export class ChannelsSettings extends React.PureComponent {
};
}

onPageChangedCallback = ({startCount, endCount, total}) => {
this.setState({startCount, endCount, total});
onPageChangedCallback = (state: ChannelSettingsState) => {
this.setState({...state});
}

render = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
import {getConfig} from 'mattermost-redux/selectors/entities/general';
import {connect} from 'react-redux';

import {GlobalState} from 'mattermost-redux/types/store';

import {ChannelsSettings} from './channel_settings';

function mapStateToProps(state) {
function mapStateToProps(state: GlobalState) {
const config = getConfig(state);
const siteName = config.SiteName;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import LockIcon from 'components/widgets/icons/lock_icon';
import ArchiveIcon from 'components/widgets/icons/archive_icon';

import './channel_list.scss';
import {ChannelSettingsState} from "../channel_settings";
interface ChannelListProps {
actions: {
searchAllChannels: (term: string, opts: ChannelSearchOpts) => Promise<{ data: any }>;
Expand All @@ -31,7 +32,7 @@ interface ChannelListProps {
data: ChannelWithTeamData[];
total: number;
removeGroup?: () => void;
onPageChangedCallback?: () => void;
onPageChangedCallback?: (state: ChannelSettingsState) => void;
emptyListTextId?: string;
emptyListTextDefaultMessage?: string;
isDisabled?: boolean;
Expand Down

0 comments on commit 6b657cd

Please sign in to comment.