Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
minerva
frontend
Commits
9a0b09a4
Commit
9a0b09a4
authored
9 months ago
by
Piotr Gawron
Browse files
Options
Downloads
Patches
Plain Diff
comment selector implemented
parent
4d971ccb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!223
reset the pin numbers before search results are fetch (so the results will be...
,
!200
Resolve "[MIN-113] Show comments on the map"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/components/Map/MapViewer/utils/config/commentsLayer/useOlMapCommentsLayer.ts
+41
-0
41 additions, 0 deletions
...iewer/utils/config/commentsLayer/useOlMapCommentsLayer.ts
src/redux/comment/comment.selectors.ts
+25
-0
25 additions, 0 deletions
src/redux/comment/comment.selectors.ts
with
66 additions
and
0 deletions
src/components/Map/MapViewer/utils/config/commentsLayer/useOlMapCommentsLayer.ts
0 → 100644
+
41
−
0
View file @
9a0b09a4
/* eslint-disable no-magic-numbers */
import
{
usePointToProjection
}
from
'
@/utils/map/usePointToProjection
'
;
import
Feature
from
'
ol/Feature
'
;
import
{
Geometry
}
from
'
ol/geom
'
;
import
VectorLayer
from
'
ol/layer/Vector
'
;
import
VectorSource
from
'
ol/source/Vector
'
;
import
{
useSelector
}
from
'
react-redux
'
;
import
{
allCommentsSelectorOfCurrentMap
}
from
'
@/redux/comment/comment.selectors
'
;
import
{
getCommentsFeatures
}
from
'
@/components/Map/MapViewer/utils/config/commentsLayer/getCommentsFeatures
'
;
import
{
useMemo
}
from
'
react
'
;
export
const
useOlMapCommentsLayer
=
():
VectorLayer
<
VectorSource
<
Feature
<
Geometry
>>>
=>
{
const
pointToProjection
=
usePointToProjection
();
const
comments
=
useSelector
(
allCommentsSelectorOfCurrentMap
);
const
elementsFeatures
=
useMemo
(
()
=>
[
getCommentsFeatures
(
comments
,
{
pointToProjection
,
}),
].
flat
(),
[
comments
,
pointToProjection
],
);
const
vectorSource
=
useMemo
(()
=>
{
return
new
VectorSource
({
features
:
[...
elementsFeatures
],
});
},
[
elementsFeatures
]);
const
pinsLayer
=
useMemo
(
()
=>
new
VectorLayer
({
source
:
vectorSource
,
}),
[
vectorSource
],
);
return
pinsLayer
;
};
This diff is collapsed.
Click to expand it.
src/redux/comment/comment.selectors.ts
0 → 100644
+
25
−
0
View file @
9a0b09a4
import
{
rootSelector
}
from
'
@/redux/root/root.selectors
'
;
import
{
createSelector
}
from
'
@reduxjs/toolkit
'
;
import
{
CommentWithPinType
}
from
'
@/types/comment
'
;
import
{
currentModelIdSelector
}
from
'
../models/models.selectors
'
;
export
const
commentSelector
=
createSelector
(
rootSelector
,
state
=>
state
.
comment
);
export
const
allCommentsSelectorOfCurrentMap
=
createSelector
(
commentSelector
,
currentModelIdSelector
,
(
commentState
,
currentModelId
):
CommentWithPinType
[]
=>
{
if
(
!
commentState
)
{
return
[];
}
return
(
commentState
.
data
||
[])
.
filter
(
comment
=>
comment
.
modelId
===
currentModelId
)
.
map
(
comment
=>
{
return
{
...
comment
,
pinType
:
'
comment
'
,
};
});
},
);
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