-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new analytics productivity route and components (#4223)
* new Productivity route and components * remove console.log * Add more tests * Add alumni and inactive badges * fix test * linting * linting * fix test * fix multiple display * add flag * add test * Update tests * camel to kebab routes * fix import order * fix type import * re-enable productivity flag * update badge labels * adjust table sizings * skip e2e tests
- Loading branch information
Showing
56 changed files
with
1,083 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,84 @@ | ||
import { isEnabled } from '@asap-hub/flags'; | ||
import { SkeletonBodyFrame as Frame } from '@asap-hub/frontend-utils'; | ||
import { AnalyticsPage } from '@asap-hub/react-components'; | ||
import { FC, lazy, useEffect } from 'react'; | ||
import { Route, Switch, useRouteMatch } from 'react-router-dom'; | ||
import { analytics } from '@asap-hub/routing'; | ||
import { lazy, useEffect } from 'react'; | ||
import { Redirect, Route, Switch, useRouteMatch } from 'react-router-dom'; | ||
|
||
const loadAnalytics = () => | ||
import(/* webpackChunkName: "analytics" */ './Analytics'); | ||
const loadProductivity = () => | ||
import(/* webpackChunkName: "productivity" */ './productivity/Productivity'); | ||
|
||
const AnalyticsBody = lazy(loadAnalytics); | ||
const loadLeadership = () => | ||
import(/* webpackChunkName: "leadership" */ './leadership/Leadership'); | ||
|
||
const About: FC<Record<string, never>> = () => { | ||
const LeadershipBody = lazy(loadLeadership); | ||
const ProductivityBody = lazy(loadProductivity); | ||
|
||
const Routes = () => { | ||
useEffect(() => { | ||
// eslint-disable-next-line @typescript-eslint/no-floating-promises | ||
loadAnalytics(); | ||
loadLeadership().then(loadLeadership); | ||
}, []); | ||
|
||
const { path } = useRouteMatch(); | ||
|
||
return ( | ||
<Switch> | ||
<Route exact path={path}> | ||
<AnalyticsPage> | ||
<Frame title="Analytics"> | ||
<AnalyticsBody /> | ||
</Frame> | ||
</AnalyticsPage> | ||
{isEnabled('DISPLAY_ANALYTICS_PRODUCTIVITY') && ( | ||
<Route path={path + analytics({}).productivity.template}> | ||
<Switch> | ||
<Route | ||
exact | ||
path={ | ||
path + | ||
analytics({}).productivity.template + | ||
analytics({}).productivity({}).metric.template | ||
} | ||
> | ||
<AnalyticsPage> | ||
<Frame title="Resource & Data Sharing"> | ||
<ProductivityBody /> | ||
</Frame> | ||
</AnalyticsPage> | ||
</Route> | ||
<Redirect | ||
to={analytics({}).productivity({}).metric({ metric: 'user' }).$} | ||
/> | ||
</Switch> | ||
</Route> | ||
)} | ||
<Route path={path + analytics({}).leadership.template}> | ||
<Switch> | ||
<Route | ||
exact | ||
path={ | ||
path + | ||
analytics({}).leadership.template + | ||
analytics({}).leadership({}).metric.template | ||
} | ||
> | ||
<AnalyticsPage> | ||
<Frame title="Leadership & Membership"> | ||
<LeadershipBody /> | ||
</Frame> | ||
</AnalyticsPage> | ||
</Route> | ||
<Redirect | ||
to={ | ||
analytics({}).leadership({}).metric({ metric: 'working-group' }).$ | ||
} | ||
/> | ||
</Switch> | ||
</Route> | ||
{isEnabled('DISPLAY_ANALYTICS_PRODUCTIVITY') ? ( | ||
<Redirect to={analytics({}).productivity({ metric: 'user' }).$} /> | ||
) : ( | ||
<Redirect | ||
to={analytics({}).leadership({ metric: 'working-group' }).$} | ||
/> | ||
)} | ||
</Switch> | ||
); | ||
}; | ||
|
||
export default About; | ||
export default Routes; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.