Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Phyks
kresus
Commits
384ecd48
Commit
384ecd48
authored
Mar 05, 2018
by
Antoine
Browse files
Prevent display the section title at startup.
parent
2005c341
Pipeline
#41409
passed with stages
in 8 minutes and 25 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
client/main.js
View file @
384ecd48
...
...
@@ -38,6 +38,9 @@ function computeIsSmallScreen(width = null) {
return
actualWidth
<=
SMALL_SCREEN_MAX_WIDTH
;
}
// The list of the available sections.
const
sections
=
[
'
reports
'
,
'
budget
'
,
'
charts
'
,
'
duplicates
'
,
'
categories
'
,
'
settings
'
];
// Lazy-loaded components
const
Charts
=
props
=>
(
<
LazyLoader
load
=
{
loadCharts
}
>
...
...
@@ -115,6 +118,19 @@ class BaseApp extends React.Component {
return
<
Redirect
to
=
"
/
"
/>
;
};
makeSectionTitle
=
props
=>
{
// The routing component expects a '/#' basename and is not able to deal with kresus'
// url prefix. It will further redirect to '/#' but params.section will not match
// the default section (report) on the first render. This check avoids a warning
// error in the client logs".
return
props
.
match
&&
sections
.
includes
(
props
.
match
.
params
.
section
)
?
(
<
span
className
=
"
section-title
"
>
&
nbsp
;
/ 
;
{
$t
(
`client.menu.
${
props
.
match
.
params
.
section
}
`
)}
<
/span
>
)
:
null
;
};
renderMain
=
()
=>
{
if
(
!
this
.
props
.
isWeboobInstalled
)
{
return
<
Redirect
to
=
"
/weboob-readme
"
push
=
{
false
}
/>
;
...
...
@@ -149,10 +165,7 @@ class BaseApp extends React.Component {
<
Link
to
=
"
/
"
>
{
$t
(
'
client.KRESUS
'
)}
<
/Link
>
<
/h1
>
<
span
className
=
"
section-title
"
>
&
nbsp
;
/ 
;
{
$t
(
`client.menu.
${
this
.
props
.
match
.
params
.
section
}
`
)}
<
/span
>
<
Route
path
=
"
/:section
"
render
=
{
this
.
makeSectionTitle
}
/
>
<
LocaleSelector
/>
<
/header
>
...
...
@@ -264,12 +277,7 @@ export default function runKresus() {
<
BrowserRouter
basename
=
{
`
${
urlPrefix
}
/#`
}
>
<
Provider
store
=
{
rx
}
>
<
Switch
>
<
Route
path
=
"
/:section/:subsection?/:currentAccountId
"
exact
=
{
true
}
component
=
{
Kresus
}
/
>
<
Route
path
=
"
/*
"
component
=
{
Kresus
}
/
>
<
Route
component
=
{
Kresus
}
/
>
<
/Switch
>
<
/Provider
>
<
/BrowserRouter>
,
...
...
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