Skip to content

Commit

Permalink
Load locations from editable file
Browse files Browse the repository at this point in the history
  • Loading branch information
marvin-roesch committed Jul 16, 2020
1 parent 0333da0 commit 3454e19
Show file tree
Hide file tree
Showing 3 changed files with 1,216 additions and 62 deletions.
8 changes: 4 additions & 4 deletions bin/dump-lang-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ events.forEach((event) => {
})

const locations = JSON.parse(fs.readFileSync('./src/store/locations.json', 'utf8'))
Object.values(locations).forEach((location) => {
const path = `./translations/en/locations/${location.id}.md`
locations.forEach((location) => {
const path = `./translations/en/locations/${location.name}.md`

if (fs.existsSync(path)) {
return
}

fs.writeFileSync(path, `# ${location.id}\nDetails\n`)
fs.writeFileSync(path, `# ${location.name}\nDetails\n`)

console.log(`Created new translation file for location ${location.id}`)
console.log(`Created new translation file for location ${location.name}`)
})
14 changes: 10 additions & 4 deletions src/store/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Vue from 'vue'
import Vuex from 'vuex'
import baseEvents from '@/store/events.json'
import locations from '@/store/locations.json'
import baseLocations from '@/store/locations.json'

Vue.use(Vuex)

Expand Down Expand Up @@ -50,9 +50,15 @@ const events = baseEvents.sort(
return -1
}).map((event, index) => ({ ...event, index }))

Object.keys(locations).forEach((id) => {
locations[id].type = 'location'
})
const locations = baseLocations.sort((a, b) => a.id - b.id).reduce((acc, location) => ({
...acc,
[location.id]: {
type: 'location',
id: location.name,
image: location.image,
coppermind: location.coppermind
}
}), {})

let lastEvent = null
let runningOffset = 0
Expand Down
Loading

0 comments on commit 3454e19

Please sign in to comment.