Skip to content

Commit

Permalink
Merge pull request #64 from urbanriskmap/dev
Browse files Browse the repository at this point in the history
flagged reports functionality
  • Loading branch information
asbarve authored Oct 31, 2018
2 parents 663ad21 + 7f10c27 commit 608fe16
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 28 deletions.
Binary file removed deployments/in/images/cards_image.png
Binary file not shown.
Binary file removed deployments/in/images/cards_image_twitter.jpg
Binary file not shown.
5 changes: 4 additions & 1 deletion deployments/in/resources/layers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,10 @@ export default {
'icon-ignore-placement': true,
'icon-size': 0.75
},
filter: ['all', ['!=', 'pkey', '']]
filter: ['all',
// Use this array to change icons for report selection
['!=', 'pkey', '']
]
},
legend: [
{
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"author": "Urban Risk Lab",
"license": "GPL-3.0",
"scripts": {
"start": "dep=us npm run fetch-assets && ng serve",
"start": "dep=in npm run fetch-assets && ng serve",
"build": "npm run build-dev && npm run build-prod",
"build-dev": "npm run build-dev-in && npm run build-dev-us",
"build-prod": "npm run build-prod-ngsw-us && npm run build-prod-ngsw-in",
Expand Down
17 changes: 17 additions & 0 deletions src/app/services/layer.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,22 @@ export class LayerService {
}
}

// removing flagged reorts from the map
getUnflaggedReports(
reports: Feature<GeometryObject, { [name: string]: any }>[]
): Feature<GeometryObject, { [name: string]: any }>[] {
const unflaggedReports = [];

for (const report of reports) {
if (!report.properties.report_data.hasOwnProperty('flag')
&& !report.properties.report_data.flag === true) {
unflaggedReports.push(report);
}
}

return unflaggedReports;
}

initializeLayers(
region: Region,
adminMode: boolean
Expand Down Expand Up @@ -180,6 +196,7 @@ export class LayerService {

default:
if (layer.metadata.name === 'reports') {
geojson.features = this.getUnflaggedReports(geojson.features);
this.showReportsNotification(geojson.features.length);
}
// Overwrite data object
Expand Down
46 changes: 20 additions & 26 deletions src/environments/environment.ts
Original file line number Diff line number Diff line change
@@ -1,57 +1,51 @@
export const environment = {
production: false,
envName: 'dev-us',
deploymentName: 'us',
envName: 'dev-in',
deploymentName: 'in',

servers: {
data: 'https://data-dev.riskmap.us/',
sensors: 'https://sensors-dev.riskmap.us/',
web_app: 'https://dev.riskmap.us/',
data: 'https://data-dev.riskmap.in/',
sensors: 'https://sensors-dev.riskmap.in/',
web_app: 'https://dev.riskmap.in/',
settings: {
reportTimeperiod: 604800
}
},

authorization: {
userPoolId: 'us-west-2_olPNYtmQ7',
appClientId: '5en9df3auvag0msrurit123v30'
userPoolId: 'ap-south-1_yNLDVmvAW',
appClientId: '7iu4qevi6rge61bsnaovckghup'
},

map: {
accessToken: 'pk.eyJ1IjoidXJiYW5yaXNrbWFwIiwiYSI6ImNqZnY2cGxndzN3M3AyeHMydGVyeHcyMWIifQ.D6K1H9c8CTnP6twGYdtDKA',
center: [-80.199261, 26.138301],
initZoom: 11,
minZoom: 9,
center: [76.5, 19], // map initializes on india
initZoom: 6,
minZoom: 6,
baseMapStyle: 'mapbox://styles/urbanriskmap/cjfvacwic1cfc2smiwbyfwcs4'
},

locales: {
supportedLanguages: [
{code: 'en', name: 'English'},
{code: 'es', name: 'Spanish'}
{code: 'hi', name: 'Hindi'},
{code: 'ta', name: 'Tamil'},
{code: 'mr', name: 'Marathi'},
{code: 'ml', name: 'Malayalam'}
],
defaultLanguage: 'en',
timezone: 'America/New_York'
timezone: 'Asia/Kolkata'
},

networks: {
contact_links: {
flag_email: 'risk@mit.edu'
flag_email: 'riskmap@mit.edu'
},

deep_links: [
{ name: 'facebook',
link: 'http://m.me/1747847428843379' // FB page id is used as no username is allowed at this point.
},
{ name: 'twitter',
link: 'https://twitter.com/messages/compose?recipient_id=915571825689624576'
},
{
name: 'sms',
link: 'sms:1-202-883-5663;?&body=flood'
}
// Disable telegram button for US deployment
// {name: 'telegram', link: 'https://telegram.me/CognicityUS_bot'}
]
{name: 'facebook', link: 'http://m.me/CognicityDevIndia'},
// {name: 'twitter', link: 'https://twitter.com/intent/tweet?text=Report+flood&via=CognicityDev_IN'},
{name: 'telegram', link: 'https://telegram.me/CognicityIN_bot'}
]
}
};

0 comments on commit 608fe16

Please sign in to comment.