import * as React from "react"; import { connect } from "react-redux"; import { Helmet } from "react-helmet"; import { EthAddress } from "@joincivil/typescript-types"; import { Hero, HomepageHero, Tabs, Tab, StyledTabNav, StyledTabLarge, ApprovedNewsroomsTabText, ApplicationsInProgressTabText, RejectedNewsroomsTabText, LoadingMessage, } from "@joincivil/components"; import { urlConstants as links } from "@joincivil/utils"; import { State } from "../../redux/reducers"; import * as heroImgUrl from "../images/img-hero-listings.png"; import ScrollToTopOnMount from "../utility/ScrollToTop"; import { StyledPageContent } from "../utility/styledComponents"; import WhitelistedListingListContainer from "./WhitelistedListingListContainer"; import RejectedListingListContainer from "./RejectedListingListContainer"; import ListingsInProgressContainer from "./ListingsInProgressContainer"; const TABS: string[] = ["approved", "in-progress", "rejected"]; export interface ListingProps { match?: any; history: any; } export interface ListingReduxProps { govtParameters: any; error: undefined | string; loadingFinished: boolean; userAcct: EthAddress; } class Listings extends React.Component { public render(): JSX.Element { const { listingType } = this.props.match.params; let activeIndex = 0; if (listingType) { activeIndex = TABS.indexOf(listingType) || 0; } return ( <> {!this.props.loadingFinished && } {this.props.loadingFinished && ( }> }> }> )} ); } private onTabChange = (activeIndex: number = 0): void => { const tabName = TABS[activeIndex]; this.props.history.push(`/registry/${tabName}`); }; } const mapStateToProps = (state: State, ownProps: ListingProps): ListingProps & ListingReduxProps => { const { govtParameters, user } = state.networkDependent; const userAcct = user && user.account && user.account.account; return { ...ownProps, govtParameters, error: undefined, loadingFinished: true, userAcct, }; }; export default connect(mapStateToProps)(Listings);