mirror of
https://github.com/netzbegruenung/jitsi-meet-electron.git
synced 2024-05-02 08:44:52 +02:00
67 lines
1.3 KiB
JavaScript
67 lines
1.3 KiB
JavaScript
|
// @flow
|
||
|
|
||
|
import React, { Component } from 'react';
|
||
|
import { connect } from 'react-redux';
|
||
|
import type { Dispatch } from 'redux';
|
||
|
|
||
|
import { onboardingComponents, onboardingSteps } from '../../onboarding';
|
||
|
|
||
|
type Props = {
|
||
|
|
||
|
/**
|
||
|
* Redux dispatch.
|
||
|
*/
|
||
|
dispatch: Dispatch<*>;
|
||
|
|
||
|
/**
|
||
|
* Onboarding Section.
|
||
|
*/
|
||
|
section: string;
|
||
|
|
||
|
/**
|
||
|
* Active Onboarding.
|
||
|
*/
|
||
|
_activeOnboarding: string;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Onboarding Component Entry Point.
|
||
|
*/
|
||
|
class Onboarding extends Component<Props, *> {
|
||
|
/**
|
||
|
* Render function of component.
|
||
|
*
|
||
|
* @returns {ReactElement}
|
||
|
*/
|
||
|
render() {
|
||
|
const { section, _activeOnboarding } = this.props;
|
||
|
const steps = onboardingSteps[section];
|
||
|
|
||
|
if (_activeOnboarding && steps.includes(_activeOnboarding)) {
|
||
|
const ActiveOnboarding = onboardingComponents[_activeOnboarding];
|
||
|
|
||
|
return <ActiveOnboarding />;
|
||
|
}
|
||
|
|
||
|
return null;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Maps (parts of) the redux state to the React props.
|
||
|
*
|
||
|
* @param {Object} state - The redux state.
|
||
|
* @returns {{
|
||
|
* _activeOnboarding: string
|
||
|
* }}
|
||
|
*/
|
||
|
function _mapStateToProps(state: Object) {
|
||
|
return {
|
||
|
_activeOnboarding: state.onboarding.activeOnboarding
|
||
|
};
|
||
|
}
|
||
|
|
||
|
export default connect(_mapStateToProps)(Onboarding);
|
||
|
|
||
|
|