-
-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6315 from hotosm/feature/liveMonitoringDQ
Feature/live monitoring DQ
- Loading branch information
Showing
14 changed files
with
899 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
import { FormattedMessage } from 'react-intl'; | ||
|
||
import messages from './messages'; | ||
import { CustomButton } from '../button'; | ||
|
||
export const LiveViewButton = ({ projectId, className, compact = false }) => ( | ||
<Link to={`/projects/${projectId}/live`} className="pr2"> | ||
{ | ||
<CustomButton className={className}> | ||
{compact ? ( | ||
<FormattedMessage {...messages.live} /> | ||
) : ( | ||
<FormattedMessage {...messages.liveMonitoring} /> | ||
)} | ||
</CustomButton> | ||
} | ||
</Link> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import { MAPBOX_TOKEN, UNDERPASS_URL } from '.'; | ||
|
||
export const underpassConfig = { | ||
API_URL: UNDERPASS_URL, | ||
MAPBOX_TOKEN, | ||
// set default sources of Tasking Manager | ||
sources: { | ||
osm: { | ||
type: 'raster', | ||
tiles: ['https://a.tile.openstreetmap.org/{z}/{x}/{y}.png'], | ||
tileSize: 256, | ||
attribution: '© OpenStreetMap Contributors', | ||
maxzoom: 19, | ||
}, | ||
Bing: { | ||
type: 'raster', | ||
tiles: ['https://ecn.t3.tiles.virtualearth.net/tiles/a{quadkey}.jpeg?g=1'], | ||
tileSize: 256, | ||
attribution: '© OpenStreetMap Contributors', | ||
maxzoom: 18, | ||
}, | ||
Mapbox: { | ||
type: 'raster', | ||
tiles: [ | ||
`https://api.mapbox.com/styles/v1/mapbox/satellite-v9/tiles/{z}/{x}/{y}?access_token=${MAPBOX_TOKEN}`, | ||
], | ||
tileSize: 512, | ||
attribution: '© OpenStreetMap Contributors © Mapbox', | ||
maxzoom: 19, | ||
}, | ||
EsriWorldImagery: { | ||
type: 'raster', | ||
tiles: [ | ||
'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', | ||
], | ||
tileSize: 256, | ||
attribution: '© OpenStreetMap Contributors © ESRI', | ||
maxzoom: 18, | ||
}, | ||
}, | ||
}; | ||
|
||
export const availableImageryOptions = [ | ||
{ label: 'OSM', value: 'osm' }, | ||
{ label: 'Bing', value: 'Bing' }, | ||
{ label: 'Mapbox Satellite', value: 'Mapbox' }, | ||
{ label: 'ESRI World Imagery', value: 'EsriWorldImagery' }, | ||
]; | ||
|
||
export const statusList = { | ||
ALL: '', | ||
UNSQUARED: 'badgeom', | ||
OVERLAPPING: 'overlapping', | ||
BADVALUE: 'badvalue', | ||
}; | ||
|
||
export const mappingTypesTags = { | ||
ROADS: 'highway', | ||
BUILDINGS: 'building', | ||
WATERWAYS: 'waterway', | ||
}; | ||
|
||
export const mappingTypesFeatureTypes = { | ||
ROADS: 'line', | ||
BUILDINGS: 'polygon', | ||
WATERWAYS: 'line', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { useState, useEffect } from 'react'; | ||
import { useSelector } from 'react-redux'; | ||
import { useParams } from 'react-router-dom'; | ||
|
||
import { useProjectQuery } from '../api/projects'; | ||
import { useAvailableCountriesQuery } from '../api/projects'; | ||
|
||
/** | ||
* A React custom hook that checks if a project can view live monitoring feature | ||
* | ||
* Returns null if the status is unknown, else returns boolean | ||
* | ||
*/ | ||
export default function useHasLiveMonitoringFeature() { | ||
const { id: projectId } = useParams(); | ||
const userDetails = useSelector((state) => state.auth.userDetails); | ||
const [hasLiveMonitoringFeature, setHasLiveMonitoringFeature] = useState(null); | ||
|
||
const { data: project } = useProjectQuery(projectId); | ||
const { data: availableCountries } = useAvailableCountriesQuery(); | ||
|
||
useEffect(() => { | ||
if (!availableCountries || !project || !userDetails) return; | ||
|
||
// set hasLiveMonitoringFeature to false if project is not published | ||
// or expert mode is not enabled | ||
if (project.data.status !== 'PUBLISHED' || !userDetails.isExpert) { | ||
setHasLiveMonitoringFeature(false); | ||
return; | ||
} | ||
|
||
// check if the project has live monitoring feature enabled | ||
// based on the country list provided by available.json | ||
const isLiveMonitoringAvailableInCountry = project.data.countryTag.some((country) => | ||
availableCountries.countries.some((item) => country.toLowerCase() === item.toLowerCase()), | ||
); | ||
|
||
setHasLiveMonitoringFeature(isLiveMonitoringAvailableInCountry); | ||
}, [availableCountries, project, userDetails]); | ||
|
||
return hasLiveMonitoringFeature; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
@import '@hotosm/underpass-ui/dist/index.css'; | ||
|
||
.maplibregl-map { | ||
height: calc(100vh - 6.05rem); | ||
} | ||
|
||
.top { | ||
position: absolute; | ||
top: 0.625rem; | ||
left: 0.625rem; | ||
z-index: 999; | ||
} | ||
|
||
svg.pl2 { | ||
display: inherit; | ||
height: 22px !important; | ||
width: 19px !important; | ||
margin-left: 0px; | ||
} | ||
|
||
.react-select__control { | ||
border-radius: 0.25rem !important; | ||
min-height: 36px !important; | ||
width: 15.8rem; | ||
} | ||
|
||
.react-select__menu { | ||
width: 15.8rem !important; | ||
} | ||
|
||
.title-text { | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
display: -webkit-box; | ||
-webkit-line-clamp: 2; | ||
-webkit-box-orient: vertical; | ||
} |
Oops, something went wrong.