* change name to certification.tsx * migrate certification.js to ts * update ceritification import in index and fix prettier errors * Update client/src/components/layouts/certification.tsx Co-authored-by: Nicholas Carrigan (he/him) <nhcarrigan@gmail.com> * Update client/src/components/layouts/certification.tsx Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com> * Update client/src/components/layouts/certification.tsx Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com> * Update client/src/components/layouts/certification.tsx Co-authored-by: Nicholas Carrigan (he/him) <nhcarrigan@gmail.com> * fix: reorder imports Co-authored-by: Raymen Deol <raymen.deol@outlook.com> Co-authored-by: Nicholas Carrigan (he/him) <nhcarrigan@gmail.com> Co-authored-by: Tom <20648924+moT01@users.noreply.github.com> Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
50 lines
1.2 KiB
TypeScript
50 lines
1.2 KiB
TypeScript
import React, { Component } from 'react';
|
|
import Helmet from 'react-helmet';
|
|
import { connect } from 'react-redux';
|
|
|
|
import { createSelector } from 'reselect';
|
|
import { fetchUser, isSignedInSelector, executeGA } from '../../redux';
|
|
|
|
interface CertificationProps {
|
|
children?: React.ReactNode;
|
|
executeGA?: (args: { type: string; data: string }) => void;
|
|
fetchUser: () => void;
|
|
isSignedIn?: boolean;
|
|
pathname: string;
|
|
}
|
|
|
|
const mapStateToProps = createSelector(isSignedInSelector, isSignedIn => ({
|
|
isSignedIn
|
|
}));
|
|
|
|
const mapDispatchToProps = { fetchUser, executeGA };
|
|
|
|
class CertificationLayout extends Component<CertificationProps> {
|
|
static displayName = 'CertificationLayout';
|
|
componentDidMount() {
|
|
const { isSignedIn, fetchUser, pathname } = this.props;
|
|
if (!isSignedIn) {
|
|
fetchUser();
|
|
}
|
|
if (this.props.executeGA) {
|
|
this.props.executeGA({ type: 'page', data: pathname });
|
|
}
|
|
}
|
|
|
|
render(): JSX.Element {
|
|
const { children } = this.props;
|
|
|
|
return (
|
|
<>
|
|
<Helmet bodyAttributes={{ class: 'light-palette' }} />
|
|
{children}
|
|
</>
|
|
);
|
|
}
|
|
}
|
|
|
|
export default connect(
|
|
mapStateToProps,
|
|
mapDispatchToProps
|
|
)(CertificationLayout);
|