Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
Nos Hs2023
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Språksamlingane
stadnamn
Nos Hs2023
Commits
a9247dfe
Commit
a9247dfe
authored
6 years ago
by
Esko Ikkala
Browse files
Options
Downloads
Patches
Plain Diff
Init with a full screen map and then open drawer to fix map size problem
parent
a9e1e4e6
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/actions/index.js
+5
-0
5 additions, 0 deletions
src/actions/index.js
src/containers/MapApp.js
+18
-3
18 additions, 3 deletions
src/containers/MapApp.js
src/reducers/options.js
+7
-3
7 additions, 3 deletions
src/reducers/options.js
with
30 additions
and
6 deletions
src/actions/index.js
+
5
−
0
View file @
a9247dfe
...
@@ -13,6 +13,7 @@ export const UPDATE_RESULTS = 'UPDATE_RESULTS';
...
@@ -13,6 +13,7 @@ export const UPDATE_RESULTS = 'UPDATE_RESULTS';
export
const
CLEAR_RESULTS
=
'
CLEAR_RESULTS
'
;
export
const
CLEAR_RESULTS
=
'
CLEAR_RESULTS
'
;
export
const
CLEAR_ERROR
=
'
CLEAR_ERROR
'
;
export
const
CLEAR_ERROR
=
'
CLEAR_ERROR
'
;
export
const
UPDATE_LANGUAGE
=
'
UPDATE_LANGUAGE
'
;
export
const
UPDATE_LANGUAGE
=
'
UPDATE_LANGUAGE
'
;
export
const
SET_MAP_READY
=
'
SET_MAP_READY
'
;
export
const
openDrawer
=
()
=>
({
export
const
openDrawer
=
()
=>
({
type
:
OPEN_DRAWER
,
type
:
OPEN_DRAWER
,
...
@@ -80,3 +81,7 @@ export const updateLanguage = (language) => ({
...
@@ -80,3 +81,7 @@ export const updateLanguage = (language) => ({
type
:
UPDATE_LANGUAGE
,
type
:
UPDATE_LANGUAGE
,
language
language
});
});
export
const
setMapReady
=
()
=>
({
type
:
SET_MAP_READY
,
});
This diff is collapsed.
Click to expand it.
src/containers/MapApp.js
+
18
−
3
View file @
a9247dfe
...
@@ -25,7 +25,8 @@ import {
...
@@ -25,7 +25,8 @@ import {
clearSuggestions
,
clearSuggestions
,
fetchResults
,
fetchResults
,
openDrawer
,
openDrawer
,
closeDrawer
closeDrawer
,
setMapReady
}
from
'
../actions
'
;
}
from
'
../actions
'
;
const
drawerWidth
=
800
;
const
drawerWidth
=
800
;
...
@@ -110,7 +111,7 @@ const styles = theme => ({
...
@@ -110,7 +111,7 @@ const styles = theme => ({
});
});
let
MapApp
=
(
props
)
=>
{
let
MapApp
=
(
props
)
=>
{
const
{
classes
,
error
,
theme
,
drawerIsOpen
}
=
props
;
const
{
classes
,
error
,
theme
,
drawerIsOpen
,
mapReady
}
=
props
;
const
anchor
=
'
left
'
;
const
anchor
=
'
left
'
;
//console.log("MapApp.js", props);
//console.log("MapApp.js", props);
...
@@ -156,6 +157,14 @@ let MapApp = (props) => {
...
@@ -156,6 +157,14 @@ let MapApp = (props) => {
after
=
drawer
;
after
=
drawer
;
}
}
if
(
!
mapReady
)
{
props
.
setMapReady
();
setTimeout
(()
=>
{
props
.
openDrawer
();
},
300
);
}
return
(
return
(
<
div
className
=
{
classes
.
root
}
>
<
div
className
=
{
classes
.
root
}
>
<
div
className
=
{
classes
.
appFrame
}
>
<
div
className
=
{
classes
.
appFrame
}
>
...
@@ -188,7 +197,9 @@ let MapApp = (props) => {
...
@@ -188,7 +197,9 @@ let MapApp = (props) => {
>
>
<
div
className
=
{
classes
.
drawerHeader
}
/
>
<
div
className
=
{
classes
.
drawerHeader
}
/
>
<
Message
error
=
{
error
}
/
>
<
Message
error
=
{
error
}
/
>
<
LeafletMap
results
=
{
props
.
search
.
results
}
/
>
<
LeafletMap
drawerIsOpen
=
{
drawerIsOpen
}
results
=
{
props
.
search
.
results
}
/
>
<
/main
>
<
/main
>
{
after
}
{
after
}
<
/div
>
<
/div
>
...
@@ -199,6 +210,7 @@ let MapApp = (props) => {
...
@@ -199,6 +210,7 @@ let MapApp = (props) => {
const
mapStateToProps
=
(
state
)
=>
({
const
mapStateToProps
=
(
state
)
=>
({
search
:
state
.
search
,
search
:
state
.
search
,
drawerIsOpen
:
state
.
options
.
drawerIsOpen
,
drawerIsOpen
:
state
.
options
.
drawerIsOpen
,
mapReady
:
state
.
options
.
mapReady
,
error
:
state
.
error
,
error
:
state
.
error
,
});
});
...
@@ -210,6 +222,7 @@ const mapDispatchToProps = ({
...
@@ -210,6 +222,7 @@ const mapDispatchToProps = ({
fetchSuggestions
,
fetchSuggestions
,
clearSuggestions
,
clearSuggestions
,
fetchResults
,
fetchResults
,
setMapReady
});
});
MapApp
.
propTypes
=
{
MapApp
.
propTypes
=
{
...
@@ -218,12 +231,14 @@ MapApp.propTypes = {
...
@@ -218,12 +231,14 @@ MapApp.propTypes = {
search
:
PropTypes
.
object
.
isRequired
,
search
:
PropTypes
.
object
.
isRequired
,
error
:
PropTypes
.
object
.
isRequired
,
error
:
PropTypes
.
object
.
isRequired
,
drawerIsOpen
:
PropTypes
.
bool
.
isRequired
,
drawerIsOpen
:
PropTypes
.
bool
.
isRequired
,
mapReady
:
PropTypes
.
bool
.
isRequired
,
openDrawer
:
PropTypes
.
func
.
isRequired
,
openDrawer
:
PropTypes
.
func
.
isRequired
,
closeDrawer
:
PropTypes
.
func
.
isRequired
,
closeDrawer
:
PropTypes
.
func
.
isRequired
,
updateQuery
:
PropTypes
.
func
.
isRequired
,
updateQuery
:
PropTypes
.
func
.
isRequired
,
fetchSuggestions
:
PropTypes
.
func
.
isRequired
,
fetchSuggestions
:
PropTypes
.
func
.
isRequired
,
clearSuggestions
:
PropTypes
.
func
.
isRequired
,
clearSuggestions
:
PropTypes
.
func
.
isRequired
,
fetchResults
:
PropTypes
.
func
.
isRequired
,
fetchResults
:
PropTypes
.
func
.
isRequired
,
setMapReady
:
PropTypes
.
func
.
isRequired
,
};
};
MapApp
=
connect
(
MapApp
=
connect
(
...
...
This diff is collapsed.
Click to expand it.
src/reducers/options.js
+
7
−
3
View file @
a9247dfe
import
{
import
{
UPDATE_LANGUAGE
,
UPDATE_LANGUAGE
,
OPEN_DRAWER
,
OPEN_DRAWER
,
CLOSE_DRAWER
CLOSE_DRAWER
,
SET_MAP_READY
}
from
'
../actions
'
;
}
from
'
../actions
'
;
const
DEFAULT_LANGUAGE
=
'
en
'
;
const
DEFAULT_LANGUAGE
=
'
en
'
;
const
DEFAULT_DRAWER_IS_OPEN
=
tru
e
;
const
DEFAULT_DRAWER_IS_OPEN
=
fals
e
;
export
const
INITIAL_STATE
=
{
export
const
INITIAL_STATE
=
{
language
:
DEFAULT_LANGUAGE
,
language
:
DEFAULT_LANGUAGE
,
drawerIsOpen
:
DEFAULT_DRAWER_IS_OPEN
drawerIsOpen
:
DEFAULT_DRAWER_IS_OPEN
,
mapReady
:
false
};
};
const
options
=
(
state
=
INITIAL_STATE
,
action
)
=>
{
const
options
=
(
state
=
INITIAL_STATE
,
action
)
=>
{
...
@@ -20,6 +22,8 @@ const options = (state = INITIAL_STATE, action) => {
...
@@ -20,6 +22,8 @@ const options = (state = INITIAL_STATE, action) => {
return
{
...
state
,
drawerIsOpen
:
true
};
return
{
...
state
,
drawerIsOpen
:
true
};
case
CLOSE_DRAWER
:
case
CLOSE_DRAWER
:
return
{
...
state
,
drawerIsOpen
:
false
};
return
{
...
state
,
drawerIsOpen
:
false
};
case
SET_MAP_READY
:
return
{
...
state
,
mapReady
:
true
};
default
:
default
:
return
state
;
return
state
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment