diff --git a/src/_scss/pages/agency/v2/_tabs.scss b/src/_scss/pages/agency/v2/_tabs.scss index 4ccf52da47..9f31f67481 100644 --- a/src/_scss/pages/agency/v2/_tabs.scss +++ b/src/_scss/pages/agency/v2/_tabs.scss @@ -66,6 +66,11 @@ line-height: rem(20); } } + + &:disabled { + color: $color-gray-medium; + background-color: $color-gray-lightest; + } } } } diff --git a/src/_scss/pages/agency/v2/index.scss b/src/_scss/pages/agency/v2/index.scss index 3cf3a7d4ff..f9ad3976d9 100644 --- a/src/_scss/pages/agency/v2/index.scss +++ b/src/_scss/pages/agency/v2/index.scss @@ -191,6 +191,77 @@ @media(min-width: $tablet-screen) { width: 70%; } + .body__content { + @import '../../search/results/table/tableMessages'; + .results-table-message-container { + position: relative; + background-color: rgb(246, 246, 246); + .results-table-loading { + margin-bottom: rem(100); + } + .no-results-container { + text-align: center; + margin-top: rem(100); + margin-bottom: rem(100); + .no-results-title { + h4 { + margin-bottom: 0; + vertical-align: bottom; + } + } + .no-results-message { + p { + margin-top: 0; + vertical-align: top; + } + } + } + .loading-animation { + @import "../../search/results/screens/loading"; + } + .results-table-error { + .icon { + width: rem(36); + height: rem(36); + svg { + width: rem(36); + height: rem(36); + } + } + .title { + font-size: rem(20); + line-height: rem(45); + } + .description { + font-size: rem(16); + line-height: rem(10); + } + } + } + .usda-table { + td { + &:first-child { + @include span-columns(6 of 12, table); + text-align: left; + } + @include span-columns(2 of 12, table); + text-align: right; + word-break: break-word; + } + + .table-header { + .table-header__label { + @include flex(0 1 auto); + text-align: right; + } + + .table-header__sort { + margin-top: auto; + margin-bottom: auto; + } + } + } + } .body__section { @import './tabs'; @include display(flex); diff --git a/src/js/app.jsx b/src/js/app.jsx index cb6a146a2b..9221029a44 100644 --- a/src/js/app.jsx +++ b/src/js/app.jsx @@ -11,8 +11,10 @@ import { faBook, faBuilding, faCalendarAlt, + faCaretDown, faCaretLeft, faCaretRight, + faCaretUp, faChartArea, faChartBar, faChartPie, @@ -65,8 +67,10 @@ library.add( faBook, faBuilding, faCalendarAlt, + faCaretDown, faCaretLeft, faCaretRight, + faCaretUp, faChartArea, faChartBar, faChartPie, diff --git a/src/js/components/agency/v2/CountTab.jsx b/src/js/components/agency/v2/CountTab.jsx index b979752b08..4f24e20902 100644 --- a/src/js/components/agency/v2/CountTab.jsx +++ b/src/js/components/agency/v2/CountTab.jsx @@ -13,28 +13,37 @@ const propTypes = { setActiveTab: PropTypes.func.isRequired, active: PropTypes.bool, count: PropTypes.number, - subCount: PropTypes.number + subCount: PropTypes.number, + disabled: PropTypes.bool }; -const CountTab = (props) => ( - -); +
+ {(props.count || props.count === 0) ? `${props.count}` : '--'} +
+ {props.subHeading ? ( +
+ With {(props.subCount || props.subCount === 0) ? `${props.subCount}` : '--'} {props.subHeading} +
+ ) : <> } + + + ); +}; CountTab.propTypes = propTypes; export default CountTab; diff --git a/src/js/components/agency/v2/accountSpending/AccountSpending.jsx b/src/js/components/agency/v2/accountSpending/AccountSpending.jsx index ca3d47a2e6..6bd5f254e6 100644 --- a/src/js/components/agency/v2/accountSpending/AccountSpending.jsx +++ b/src/js/components/agency/v2/accountSpending/AccountSpending.jsx @@ -6,6 +6,7 @@ import React, { useState } from 'react'; import PropTypes from 'prop-types'; import CountTabContainer from 'containers/agency/v2/accountSpending/CountTabContainer'; +import TableContainer from 'containers/agency/v2/accountSpending/TableContainer'; const propTypes = { fy: PropTypes.string, @@ -45,6 +46,7 @@ const tabs = [ const AccountSpending = ({ agencyId, fy }) => { const [activeTab, setActiveTab] = useState('budget_function'); + const subHeading = tabs.find((tab) => tab.type === activeTab).subHeading; return (
@@ -66,6 +68,11 @@ const AccountSpending = ({ agencyId, fy }) => { active={activeTab === tab.type} /> ))}
+
); diff --git a/src/js/containers/agency/v2/AgencyContainerV2.jsx b/src/js/containers/agency/v2/AgencyContainerV2.jsx index 82e201c1a8..cf86f774d0 100644 --- a/src/js/containers/agency/v2/AgencyContainerV2.jsx +++ b/src/js/containers/agency/v2/AgencyContainerV2.jsx @@ -3,11 +3,9 @@ * Created by Maxwell Kendall 01/31/2020 */ -/* eslint-disable no-unused-vars */ -/* eslint-disable react/prop-types */ - import React, { useState, useEffect } from 'react'; -import { connect } from 'react-redux'; +import PropTypes from 'prop-types'; +import { useDispatch } from 'react-redux'; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { startCase, snakeCase } from "lodash"; import { @@ -15,7 +13,9 @@ import { Picker } from 'data-transparency-ui'; -import { setAgencyOverview, resetAgency } from 'redux/actions/agency/agencyActions'; +import { setBudgetaryResources } from 'redux/actions/agencyV2/agencyV2Actions'; +import { fetchBudgetaryResources } from 'helpers/agencyV2Helper'; +import BaseAgencyBudgetaryResources from 'models/v2/agency/BaseAgencyBudgetaryResources'; import { agencyPageMetaTags } from 'helpers/metaTagHelper'; import { scrollToY } from 'helpers/scrollToHelper'; @@ -32,10 +32,10 @@ import { defaultSortFy } from 'components/sharedComponents/pickers/FYPicker'; import ShareIcon from 'components/sharedComponents/stickyHeader/ShareIcon'; import AccountSpending from 'components/agency/v2/accountSpending/AccountSpending'; +import Error from '../../../components/sharedComponents/Error'; require('pages/agency/v2/index.scss'); -// document.querySelector('.site-navigation').offsetHeight + document.querySelector('.site-navigation').offsetTop const scrollPositionOfSiteHeader = 96; const TooltipComponent = () => ( @@ -70,15 +70,39 @@ const ComingSoon = () => ( ); +const propTypes = { + params: PropTypes.shape({ + agencyId: PropTypes.string + }) +}; + export const AgencyProfileV2 = ({ - agencyOverview, - agencyId, - params, - clearAgency, - setOverview + params }) => { + const dispatch = useDispatch(); const [activeSection, setActiveSection] = useState('overview'); const [selectedFy, setSelectedFy] = useState(FiscalYearHelper.defaultFiscalYear()); + const [loading, setLoading] = useState(true); + const [error, setError] = useState(false); + + useEffect(() => { + setLoading(true); + // request budgetary resources data for this agency + const budgetaryResourcesRequest = fetchBudgetaryResources(params.agencyId); + budgetaryResourcesRequest.promise + .then((res) => { + // parse the response using our data model + setLoading(false); + const budgetaryResources = Object.create(BaseAgencyBudgetaryResources); + budgetaryResources.populate(res.data); + // store the data model object in Redux + dispatch(setBudgetaryResources(budgetaryResources)); + }).catch((err) => { + setError(true); + setLoading(false); + console.error(err); + }); + }, [params.agencyId]); const componentByAgencySection = { overview: , @@ -154,7 +178,8 @@ export const AgencyProfileV2 = ({
@@ -166,7 +191,7 @@ export const AgencyProfileV2 = ({
- +
-
- {Object.keys(componentByAgencySection).map((section) => ( - - {componentByAgencySection[section]} - - ))} -
+ {error && +
+ +
} + {!error && +
+ {Object.keys(componentByAgencySection).map((section) => ( + + {componentByAgencySection[section]} + + ))} +
+ }