Skip to content

Commit

Permalink
#91 detailed cache information and logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Mihkel Oviir committed Apr 29, 2020
1 parent 6b4e1c7 commit 2334576
Show file tree
Hide file tree
Showing 11 changed files with 257 additions and 142 deletions.
28 changes: 14 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 11 additions & 6 deletions src/config/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,21 @@ export const apiUrls = {
}
}
export const geocache = {
authUrl: 'http://geopeitus.ee',
authUrl: 'https://geopeitus.ee',
downloadUrl: {
page: 'http://www.geopeitus.ee/index.php?p=300',
geojson: 'http://www.geopeitus.ee/index.php?p=301&status[]=1&format=2',
page: 'https://www.geopeitus.ee/index.php?p=300',
geojson: 'https://www.geopeitus.ee/index.php?p=301&status[]=1&format=2',
gpx: {
gpxActive: 'http://www.geopeitus.ee/index.php?p=301&status[]=1&format=1',
gpxAll: 'http://www.geopeitus.ee/index.php?p=301&status[]=1&status[]=2&status[]=3&format=1'
gpxActive: 'https://www.geopeitus.ee/index.php?p=301&status[]=1&status[]=3&format=1',
gpxActiveLogs: 'https://www.geopeitus.ee/index.php?p=301&status[]=1&status[]=3&format=1&gpx_events=2',
gpxAll: 'https://www.geopeitus.ee/index.php?p=301&status[]=1&status[]=2&status[]=3&format=1'
}
},
cacheUrl: 'http://geopeitus.ee/aare/',
cacheUrl: 'https://geopeitus.ee/aare/',
logUrl: {
'geopeitus.ee': 'https://www.geopeitus.ee/logs/new/c/{id}',
'geocaching.com': 'https://www.geocaching.com/seek/log.aspx?ID={id}&lcn=1'
},
radiusStyle: {
maxResolution: 30,
radius: 160
Expand Down
16 changes: 10 additions & 6 deletions src/config/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"Find streetview link and measure tools from context menu.": "Find streetview link and measure tools from context menu.",
"Found": "Found",
"Geocache importing": "Geocache importing",
"GeocacheList": "Caches",
"GeocacheInfo": "Info",
"GeocacheLoader": "",
"Geocaches": "Geocaches",
"Geocache|Event Cache": "Event Cache",
Expand All @@ -75,13 +75,14 @@
"Geocache|Unknown Cache": "Unknown Cache",
"Geocache|Virtual Cache": "Virtual Cache",
"Geocache|Webcam Cache": "Webcam Cache",
"Geocache|Whereigo Cache": "Whereigo Cache",
"Geocache|Wherigo Cache": "Wherigo Cache",
"Geop is progressive web application with partial offline support.": "Geop is progressive web application with partial offline support.",
"Geotrip": "Geotrip",
"Geotrip reordered by optimum path": "Geotrip reordered by optimum path",
"Go to": "Go to",
"gpxActive": "Active caches",
"gpxAll": "All caches (active, archived, unavailable)",
"gpxActiveLogs": "Active caches with logs",
"gpxAll": "All caches (with archived, w.o logs)",
"here": "here",
"Hiking": "Hiking",
"Imported": "Imported",
Expand All @@ -100,6 +101,7 @@
"Less than 2 pair of coordinates, aborting!": "Less than 2 pair of coordinates, aborting!",
"Limit address search with comma separated list of country codes (ee,fi - Estonia, Finland). Empty means no limit.": "Limit address search with comma separated list of country codes (ee,fi - Estonia, Finland). Empty means no limit.",
"Location information is unavailable.": "Location information is unavailable.",
"Logs": "Logs",
"Map": "Map",
"Measure": "Measure",
"Micro": "Micro",
Expand Down Expand Up @@ -252,7 +254,7 @@
"Find streetview link and measure tools from context menu.": "Parema kliki menüüst leiad tänavavaate ja mõõtmise tööriistad.",
"Found": "Leitud",
"Geocache importing": "Aarete importimine",
"GeocacheList": "Aarded",
"GeocacheInfo": "Info",
"GeocacheLoader": "",
"Geocaches": "Aarded",
"Geocache|Event Cache": "Sündmusaare",
Expand All @@ -263,13 +265,14 @@
"Geocache|Unknown Cache": "Mõistatusaare",
"Geocache|Virtual Cache": "Virtuaalne aare",
"Geocache|Webcam Cache": "Veebikaamera aare",
"Geocache|Whereigo Cache": "Whereigo aare",
"Geocache|Wherigo Cache": "Wherigo aare",
"Geop is progressive web application with partial offline support.": "Geop on progressiivne veebirakendus (PWA) osalise võrguta töötamise toega.",
"Geotrip": "Geotuur",
"Geotrip reordered by optimum path": "Geotuur järjestatud lühima teekonna järgi",
"Go to": "Mine",
"gpxActive": "Aktiivsed aarded",
"gpxAll": "Kõik aarded (aktiivsed, arhiveeritud, ajutiselt kättesaamatud)",
"gpxActiveLogs": "Aktiivsed aarded koos logidega",
"gpxAll": "Kõik aarded (k.a arhiveeritud, ilma logideta)",
"here": "siit",
"Hiking": "Matk",
"Imported": "Imporditud",
Expand All @@ -288,6 +291,7 @@
"Less than 2 pair of coordinates, aborting!": "Peab olema vähemalt kaks punkti, lõpetan!",
"Limit address search with comma separated list of country codes (ee,fi - Estonia, Finland). Empty means no limit.": "Piira aadressiotsingut riigiti. Mitme riigi otsingu jaoks eralda komaga (ee,fi - Eesti, Soome). Tühi otsib üle maailma.",
"Location information is unavailable.": "Asukoha info ei ole kättesaadav.",
"Logs": "Logid",
"Map": "Kaart",
"Measure": "Mõõda",
"Micro": "Mikro",
Expand Down
1 change: 1 addition & 0 deletions src/geop/components/featureinfo/Popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class Popup extends Component {
popContent.onHide(evt)
})
this.el.popover('show')
setState('popup/show', { layerId: hit[0].get('id'), feature: hit[1] })
}
open (e) {
let coords = e.coordinate
Expand Down
12 changes: 7 additions & 5 deletions src/geop/components/geocache/Geocache.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { toLonLat } from 'ol/proj'
import Component from 'Geop/Component'
import Sidebar from 'Components/sidebar/Sidebar'
import GeocacheLoader from './GeocacheLoader'
import GeocacheList from './GeocacheList'
import GeocacheInfo from './GeocacheInfo'
import Filter from './Filter'
import Geotrip from './Geotrip'
import { createStyle } from 'Components/layer/StyleBuilder'
Expand All @@ -30,7 +30,6 @@ const state = {
layerOnMap: false,
styleCache: {},
styleConfig: cacheConf.styles,
currentUser: getState('app/account'),
cacheFormatParser: null,
stat: {
'Not Found': 'far fa-square',
Expand Down Expand Up @@ -67,7 +66,7 @@ class Geocache extends Component {
position: 'left',
components: {
GeocacheLoader,
GeocacheList,
GeocacheInfo,
Filter,
Geotrip
},
Expand Down Expand Up @@ -111,7 +110,10 @@ class Geocache extends Component {
}
})
state.layer.getSource().on('clear', listenLayer)
onchange('geocache/filter', listenLayer)
onchange('geocache/filter', () => {
listenLayer()
setState('layerchange', ['overlays', state.layer.get('id')])
})
listenLayer()
}
createLayer (layer = null) {
Expand Down Expand Up @@ -292,7 +294,7 @@ export function importCaches (features, disableLog = false) {
features: features,
newCacheDays: cacheConf.newCacheDays,
mapping: cacheConf.mapping,
user: state.currentUser,
user: getState('app/account'),
uid: uid,
url: cacheConf.cacheUrl,
date: formatDate
Expand Down
39 changes: 34 additions & 5 deletions src/geop/components/geocache/GeocacheGPX.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
export default {
test: features => {
const test = features.filter(f => {
return features.filter(f => {
return (f.get('wpt') && f.get('wpt')['groundspeak:cache'])
})
return test.length > 0
}).length > 0
},
formatFeatures: opts => {
const today = new Date()
opts.features.forEach(feature => {
const wpt = feature.get('wpt')
if (wpt['groundspeak:cache']) {
// format always
if (feature.get('isCache')) {
if (opts.user && opts.user === feature.get('owner')) {
const fstatus = 'Geocache Owner'
feature.set('fstatus', opts.mapping.fstatusGPX[fstatus] || fstatus)
}
}
if (typeof feature.get('isCache') === 'undefined' && wpt['groundspeak:cache']) {
const cacheData = {}
Object.keys(wpt['groundspeak:cache']).forEach(i => {
if (i !== '_text') {
Expand Down Expand Up @@ -56,12 +62,35 @@ export default {
)
const newCache = (feature.get('fstatus') === 'Not Found' && testDate > today) ? 'New Cache' : null
feature.set('newCache', newCache)
} else {
// description
if (cacheData.long_description) {
feature.set('description', cacheData.long_description)
}
if (cacheData.logs && cacheData.logs['groundspeak:log']) {
// in case of one log, it is object, not array
if (typeof cacheData.logs['groundspeak:log'] === 'object' && '@id' in cacheData.logs['groundspeak:log']) {
cacheData.logs['groundspeak:log'] = [cacheData.logs['groundspeak:log']]
}
feature.set('logs', cacheData.logs['groundspeak:log'].map(log => {
return {
type: log['groundspeak:type']['_text'],
date: log['groundspeak:date']['_text'],
finder: log['groundspeak:finder']['_text'],
text: log['groundspeak:text']['_text']
}
}))
}
feature.set('wpt', {
'groundspeak:cache': true
})
}
if (typeof feature.get('isCachePoint') === 'undefined' && !wpt['groundspeak:cache']) {
// assume waypoint
// name
feature.set('name', feature.get('type'))
// url
feature.set('url', wpt.url['_text'])
feature.set('isCachePoint', true)
}
if (!feature.getId()) {
feature.setId(opts.uid())
Expand Down
Loading

0 comments on commit 2334576

Please sign in to comment.