Files
mattermost-webapp/components/tutorial/index.jsx
T
Karl Marx Lopez fe547996d3 Migrate 'utils/notifications.jsx' and associated tests to TypeScript (#3857)
* chore: changed extension to .tsx

* chore: changed extension .tsx

* chore: patch for key-mirror

* chore: run patch-package on postinstall

* fix: declare module for .svg files

* fix: type errors

* fix: type errors on notifications.tsx

* fix: updated utils/notifications import

* fix: updated utils/constants imports

* chore: removed .tsx extension on import

* chore: set onClick as optional

* fix: duplicate utils/constants import

* chore: installed @types/react-redux

* fix: renamed to system_notice.ts

* chore: moved .svg type def to /types dir

* chore: ignore mattermost-redux ts error for now

* chore: removed key-mirror type patch

* fix: moved key-mirror type def into /types dir

* chore: fix lint error

* chore: forgot header

* chore: fix lint errors

* chore: fixed merge conflict

* chore: add empty space for import groups

* chore: fixed dragster import

* chore: fixed eslint error

* chore: fixed formatting

* test: updated snapshot

* chore: revert system_notice/index.ts to .js

* chore: revert to constants.jsx

* chore: revert utils.jsx

* chore: revert login_controller.jsx

* chore: fixed utils/notification import

* chore: pin @types/react-redux to v7.1.4

* chore: fixed formatting

* refactor: fixed double utils/constants import

* test: updated snapshot
2019-10-22 17:37:20 +08:00

40 lines
1.5 KiB
React

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {connect} from 'react-redux';
import {Permissions} from 'mattermost-redux/constants';
import {getChannelsNameMapInCurrentTeam} from 'mattermost-redux/selectors/entities/channels';
import {getLicense, getConfig} from 'mattermost-redux/selectors/entities/general';
import {haveITeamPermission} from 'mattermost-redux/selectors/entities/roles';
import {getCurrentTeam} from 'mattermost-redux/selectors/entities/teams';
import Constants from 'utils/constants';
import TutorialView from './tutorial_view.jsx';
function mapStateToProps(state) {
const license = getLicense(state);
const config = getConfig(state);
const team = getCurrentTeam(state);
const teamChannels = getChannelsNameMapInCurrentTeam(state);
const townSquare = teamChannels[Constants.DEFAULT_CHANNEL];
const townSquareDisplayName = townSquare ? townSquare.display_name : Constants.DEFAULT_CHANNEL_UI_NAME;
const appDownloadLink = config.AppDownloadLink;
const isLicensed = license.IsLicensed === 'true';
const restrictTeamInvite = !haveITeamPermission(state, {team: team.id, permission: Permissions.INVITE_USER});
const supportEmail = config.SupportEmail;
return {
townSquareDisplayName,
appDownloadLink,
isLicensed,
restrictTeamInvite,
supportEmail,
};
}
export default connect(mapStateToProps)(TutorialView);