Skip to content

Commit 8e5d8bb

Browse files
committed
1 parent 2ce737a commit 8e5d8bb

1 file changed

Lines changed: 15 additions & 7 deletions

File tree

src/components/app/App.jsx

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ import ConceptsComparison from '../concepts/ConceptsComparison'
3838
import MappingsComparison from '../mappings/MappingsComparison'
3939
import CheckAuth from './CheckAuth'
4040
import { loadUsageDashboard } from "../../common/loadRoutes";
41+
import UserChip from '../users/UserChip'
42+
import UserTooltip from '../users/UserTooltip'
4143

4244

4345

@@ -61,10 +63,10 @@ const SessionUserRoute = ({component: Component, ...rest}) => (
6163
/>
6264
)
6365

64-
const StaffUserRoute = ({component: Component, ...rest}) => (
66+
const StaffUserRoute = ({component: Component, componentProps={}, ...rest}) => (
6567
<Route
6668
{...rest}
67-
render={props => getCurrentUser()?.is_staff ? <Component {...props} /> : <Error404 />}
69+
render={props => getCurrentUser()?.is_staff ? <Component {...props} {...componentProps} /> : <Error404 />}
6870
/>
6971
)
7072

@@ -78,6 +80,9 @@ const App = props => {
7880
hotjar.initialize(HID, 6);
7981
}
8082

83+
/*eslint no-undef: 0*/
84+
const ANALYTICS_URL = window.ANALYTICS_API || process.env.ANALYTICS_API
85+
8186
const fetchToggles = async () => {
8287
return new Promise(resolve => {
8388
APIService.toggles().get().then(response => {
@@ -128,12 +133,8 @@ const App = props => {
128133
const [UsageDashboard, setUsageDashboard] = React.useState(null);
129134

130135
React.useEffect(() => {
131-
loadUsageDashboard().then(setUsageDashboard);
136+
ANALYTICS_URL ? loadUsageDashboard().then(setUsageDashboard) : null
132137
}, []);
133-
/*eslint no-console: 0*/
134-
console.log("UsageDashboard:", UsageDashboard)
135-
136-
137138

138139
const repoTabs = ['concepts', 'mappings', 'versions', 'summary', 'about', 'references']
139140
const orgTabs = ['repos']
@@ -160,6 +161,13 @@ const App = props => {
160161
exact
161162
path='/admin'
162163
component={UsageDashboard}
164+
componentProps={{
165+
APIService: APIService,
166+
currentUser: getCurrentUser(),
167+
ANALYTICS_URL: ANALYTICS_URL,
168+
UserChip: UserChip,
169+
UserTooltip: UserTooltip
170+
}}
163171
/>
164172
}
165173
<AuthenticationRequiredRoute exact path={`/:ownerType(users|orgs)/:owner/sources/:repo/:repoVersion/concepts/$match`} component={RepoConceptsMatch} />

0 commit comments

Comments
 (0)