import * as React from "react"; import { Helmet } from "react-helmet"; import { Set } from "immutable"; import { NewsroomListing } from "@joincivil/typescript-types"; import { Tabs, Tab, StyledSquarePillTabNav, StyledSquarePillTab, NewApplicationsTabTitle, UnderChallengeTabTitle, AppealToCouncilTabTitle, ChallengeCouncilAppealTabTitle, ReadyToUpdateTabTitle, ListingSummaryUnderChallengeComponent, ListingSummaryReadyToUpdateComponent, } from "@joincivil/components"; import ListingList from "./ListingList"; import { EmptyRegistryTabContentComponent, REGISTRY_PHASE_TAB_TYPES } from "./EmptyRegistryTabContent"; import { NewApplicationsTabDescription, UnderChallengeTabDescription, UnderAppealTabDescription, UnderAppealChallengeTabDescription, ReadyToUpdateTabDescription, } from "./TabDescriptions"; export interface ListingProps { match?: any; history?: any; } export interface ListingsInProgressProps { applications: Set; readyToWhitelistListings: Set; inChallengeCommitListings: Set; inChallengeRevealListings: Set; awaitingAppealRequestListings: Set; awaitingAppealJudgmentListings: Set; awaitingAppealChallengeListings: Set; appealChallengeCommitPhaseListings: Set; appealChallengeRevealPhaseListings: Set; resolveChallengeListings: Set; resolveAppealListings: Set; govtParameters: any; } const TABS: string[] = [ "new-applications", "under-challenge", "under-appeal", "decision-challenged", "ready-to-update", ]; class ListingsInProgress extends React.Component { public render(): JSX.Element { const { subListingType } = this.props.match.params; let activeIndex = 0; if (subListingType) { activeIndex = TABS.indexOf(subListingType) || 0; } const applications = this.props.applications; const beingChallenged = this.props.inChallengeCommitListings .merge(this.props.inChallengeRevealListings) .merge(this.props.awaitingAppealRequestListings); const consideringAppeal = this.props.awaitingAppealJudgmentListings.merge( this.props.awaitingAppealChallengeListings, ); const appealChallenge = this.props.appealChallengeCommitPhaseListings.merge( this.props.appealChallengeRevealPhaseListings, ); const readyToUpdate = this.props.readyToWhitelistListings .merge(this.props.resolveChallengeListings) .merge(this.props.resolveAppealListings); const newApplicationsTab = ; const underChallengeTab = ; const appealToCouncilTab = ; const challengeCouncilAppealTab = ; const readyToUpdateTab = ; return ( <> {this.renderApplications()} <> {this.renderUnderChallenge()} <> {this.renderUnderAppeal()} <> {this.renderUnderAppealChallenge()} <> {this.renderReadyToUpdate()} ); } private renderApplications = (): JSX.Element => { if (this.props.applications.count()) { return ( <> ); } return ; }; private renderUnderChallenge = (): JSX.Element => { const beingChallenged = this.props.inChallengeCommitListings .merge(this.props.inChallengeRevealListings) .merge(this.props.awaitingAppealRequestListings); if (beingChallenged.count()) { return ( <> ); } return ; }; private renderUnderAppeal = (): JSX.Element => { const consideringAppeal = this.props.awaitingAppealJudgmentListings.merge( this.props.awaitingAppealChallengeListings, ); if (consideringAppeal.count()) { return ( <> ); } return ; }; private renderUnderAppealChallenge = (): JSX.Element => { const appealChallenge = this.props.appealChallengeCommitPhaseListings.merge( this.props.appealChallengeRevealPhaseListings, ); if (appealChallenge.count()) { return ( <> ; ); } return ; }; private renderReadyToUpdate = (): JSX.Element => { const readyToUpdate = this.props.readyToWhitelistListings .merge(this.props.resolveChallengeListings) .merge(this.props.resolveAppealListings); if (readyToUpdate.count()) { return ( <> ); } return ; }; private onTabChange = (activeIndex: number = 0): void => { const tabName = this.props.match.params.listingType; const subTabName = TABS[activeIndex]; this.props.history.push(`/registry/${tabName}/${subTabName}`); }; } export default ListingsInProgress;