Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Genesys PGR
Genesys Website
Commits
2a5c6817
Commit
2a5c6817
authored
Nov 06, 2018
by
Matija Obreza
Browse files
Fix: SSR for top-level navigation
- location is a reserved word, doesn't trigger compile-time error if not provided
parent
ea2c1e2f
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/ui/layout/AdminLayout.tsx
View file @
2a5c6817
import
*
as
React
from
'
react
'
;
import
{
connect
}
from
'
react-redux
'
;
import
{
translate
}
from
'
react-i18next
'
;
import
renderRoutes
from
'
ui/renderRoutes
'
;
...
...
@@ -63,4 +64,9 @@ const Layout = ({route, match, t, location}: { route: any, match: any, t: any, l
</
div
>
);
export
default
translate
()(
Layout
);
const
mapStateToProps
=
(
state
,
ownProps
)
=>
({
location
:
ownProps
.
location
,
});
export
default
translate
()(
connect
(
mapStateToProps
)(
Layout
));
src/ui/layout/headers/v1/MenuBar.tsx
View file @
2a5c6817
...
...
@@ -26,7 +26,7 @@ interface IMenuBarProps extends React.ClassAttributes<any> {
class
MenuBar
extends
React
.
Component
<
IMenuBarProps
,
any
>
{
private
renderMenu
=
(
path
:
any
)
=>
{
const
{
t
}
=
this
.
props
;
const
{
t
,
location
}
=
this
.
props
;
return
(
path
.
subMenus
?
(
<
MenuItem
...
...
@@ -48,7 +48,7 @@ class MenuBar extends React.Component<IMenuBarProps, any> {
}
private
renderSubMenu
=
(
path
:
any
)
=>
{
const
{
t
}
=
this
.
props
;
const
{
t
,
location
}
=
this
.
props
;
return
(
<
MenuItem
label
=
{
t
(
path
.
label
)
}
...
...
@@ -60,8 +60,8 @@ class MenuBar extends React.Component<IMenuBarProps, any> {
}
public
render
()
{
const
{
classes
,
location
,
menuItems
}
=
this
.
props
;
console
.
log
(
location
.
pathname
);
const
{
classes
,
location
,
menuItems
}
=
this
.
props
;
console
.
log
(
`Rendering menues with current location=
${
location
.
pathname
}
`
);
return
(
<
nav
className
=
{
classes
.
nav
}
>
{
menuItems
.
map
(
this
.
renderMenu
)
}
...
...
src/ui/layout/headers/v1/NavigationBar.tsx
View file @
2a5c6817
...
...
@@ -149,7 +149,7 @@ interface IHeaderProps extends React.ClassAttributes<any> {
classes
?:
any
;
t
:
any
;
menuItems
:
object
[];
location
:
string
;
location
:
any
;
}
class
AdminHeader
extends
React
.
Component
<
IHeaderProps
|
any
,
any
>
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment