All files / src App.js

100% Statements 8/8
50% Branches 1/2
100% Functions 3/3
100% Lines 8/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92                                              61x 1200x 600x 600x       1200x         61x 122x 122x                                                                                                            
import React, { useEffect } from 'react';
import { BrowserRouter, Redirect, Route, Switch } from 'react-router-dom';
import { QueryParamProvider } from 'use-query-params';
import Layout from './components/common/Layout';
import ScrollToTop from './components/common/ScrollToTop';
import About from './pages/About';
import Contact from './pages/RadicalCollaboration/Contact';
import Contributors from './pages/Contributors';
import Donation from './pages/Donation';
import Faq from './pages/RadicalCollaboration/Faq';
import IndvOrgPage from './pages/IndvOrganization';
import Home from './pages/Home';
import HowToUse from './pages/HowToUse';
import Landing from './pages/Landing';
import RadicalCollaboration from './pages/RadicalCollaboration'
import SearchProjects from './pages/SearchProjects';
import TagCreator from './pages/TagCreator';
import Placeholder from './pages/Placeholder';
import Error404 from './pages/Error404'
import ShareTheCti from './pages/RadicalCollaboration/Share';
import Guides from './guides/';
import useStyles from './styles';
 
const RouteTitled = ({ title, ...rest }) => {
  useEffect(() => {
    Eif (title) {
      document.title = 'Civic Tech Index — ' + title
    }
  })
 
  return (
    <Route {...rest} />
  )
}
 
const App = () => {
  useStyles();
  return (
    <BrowserRouter>
      <ScrollToTop />
      <QueryParamProvider ReactRouterRoute={Route}>
        <Layout>
          <Switch>
            <Route exact path='/' component={Landing} />
            <RouteTitled exact path='/about' component={About} title='About' />
            <RouteTitled exact path='/about/contact' component={Contact} title='Contact Us' />
            <RouteTitled exact path='/about/faq' component={Faq} title='FAQ' />
            <RouteTitled exact path='/organizations/:affiliation' component={Contributors} title='Organizations' />
            <RouteTitled exact path='/home' component={Home} title='Home' />
            <RouteTitled exact path='/projects' component={SearchProjects} title='Search Projects' />
            <RouteTitled exact path='/join-index' component={TagCreator} title='Join the Index' />
            <RouteTitled exact path='/join-index/how-to-add' component={HowToUse} title='How to Add Your Project' />
            <RouteTitled exact path='/support' component={RadicalCollaboration} title='Collaborate with Us' />
            <RouteTitled exact path='/support/donate' component={Donation} title='Donate' />
            <RouteTitled exact path='/support/share' component={ShareTheCti} title='Share the CTI' />
            <Route exact path='/organizations/*' component={IndvOrgPage} />
            {/* test and error page routes begin */}
            <Route path='/guides/:guide' component={Guides} />
            <Route path='/blank' component={Placeholder} />
            <Route path='/404' component={Error404} />
            {/* test and error page routes end */}
            <Redirect from='/add' to='/join-index/how-to-add' />
            <Redirect from='/adding' to='/join-index/how-to-add' />
            <Redirect from='/adding-projects' to='/join-index/how-to-add' />
            <Redirect from='/contact' to='/about/contact' />
            <Redirect from='/donate' to='/support/donate' />
            <Redirect from='/donation' to='/support/donate' />
            <Redirect from='/faq' to='/about/faq' />
            <Redirect from='/how' to='/join-index/how-to-add' />
            <Redirect from='/how-to' to='/join-index/how-to-add' />
            <Redirect from='/how-to-use' to='/join-index/how-to-add' />
            <Redirect from='/join' to='/join-index' />
            <Redirect from='/search' to='/projects' />
            <Redirect from='/share' to='/support/share' />
            <Redirect from='/tag-creator' to='/join-index' />
            <Redirect from='/tagcreator' to='/join-index' />
            <Redirect from='/taggenerator' to='/join-index' />
            {/* test and error page redirect begin */}
            <Redirect from='/guides' to='/guides/colors' />
            <Redirect from='/placeholder' to='/blank' />
            <Redirect from='/template' to='/blank' />
            <Redirect to='/404' />
            {/* test and error page redirect end */}
          </Switch>
        </Layout>
      </QueryParamProvider>
    </BrowserRouter>
  );
};
 
export default App;