mirror of
https://github.com/getbible/app.git
synced 2024-11-15 17:47:12 +00:00
Merge branch 'main' of github.com:getbible/app into main
Please enter a commit message to explain why this merge is necessary,
This commit is contained in:
commit
b0227834e5
5
package-lock.json
generated
5
package-lock.json
generated
@ -13657,6 +13657,11 @@
|
|||||||
"integrity": "sha512-4gDntzrifFnCEvyoO8PqyJDmguXgVPxKiIxrBKjIowvL9l+N66196+72XVYR8BBf1Uv1Fgt3bGevJ+sEmxfZzw==",
|
"integrity": "sha512-4gDntzrifFnCEvyoO8PqyJDmguXgVPxKiIxrBKjIowvL9l+N66196+72XVYR8BBf1Uv1Fgt3bGevJ+sEmxfZzw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"vuex": {
|
||||||
|
"version": "4.0.0-beta.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/vuex/-/vuex-4.0.0-beta.4.tgz",
|
||||||
|
"integrity": "sha512-/+4E1dokq5cwbl4mohOqOj8h0vOLOWmLSqlqTf++bfmN9/JKWtwYfsBrzlK0sYrNfuYcpQeX0BVxQHoHXDfYZQ=="
|
||||||
|
},
|
||||||
"watchpack": {
|
"watchpack": {
|
||||||
"version": "1.7.4",
|
"version": "1.7.4",
|
||||||
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.7.4.tgz",
|
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.7.4.tgz",
|
||||||
|
@ -16,7 +16,8 @@
|
|||||||
"core-js": "^3.6.5",
|
"core-js": "^3.6.5",
|
||||||
"lodash": "^4.17.20",
|
"lodash": "^4.17.20",
|
||||||
"uikit": "^3.5.9",
|
"uikit": "^3.5.9",
|
||||||
"vue": "^3.0.0"
|
"vue": "^3.0.0",
|
||||||
|
"vuex": "^4.0.0-beta.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vue/cli-plugin-babel": "~4.5.0",
|
"@vue/cli-plugin-babel": "~4.5.0",
|
||||||
|
@ -37,4 +37,11 @@ export default {
|
|||||||
color: #2c3e50;
|
color: #2c3e50;
|
||||||
// margin-top: 60px;
|
// margin-top: 60px;
|
||||||
}
|
}
|
||||||
|
.disabled {
|
||||||
|
cursor: not-allowed;
|
||||||
|
color: gray
|
||||||
|
}
|
||||||
|
.disabled:hover {
|
||||||
|
color:gray
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -74,15 +74,17 @@
|
|||||||
<div>
|
<div>
|
||||||
<ul class="uk-list uk-list-large uk-list-divider">
|
<ul class="uk-list uk-list-large uk-list-divider">
|
||||||
<li
|
<li
|
||||||
v-for="(tr,i) in Object.keys(savedTranslations)"
|
v-for="(tr,i) in savedTranslations"
|
||||||
:key="i"
|
:key="i"
|
||||||
><div><span>{{savedTranslations[tr]["language"]?`(${savedTranslations[tr]["language"]})`:null}} {{savedTranslations[tr]['translation']}}</span> <a class="uk-position-center-right uk-position-relative"><span uk-icon="icon: minus-circle;"></span></a>
|
><div><span>{{tr["language"]?`(${tr["language"]})`:null}} {{tr['translation']}}</span>
|
||||||
|
{{" "}}<a @click="remove(tr.abbreviation)" class="uk-position-center-right uk-position-relative"><span uk-icon="icon: minus-circle;"></span></a>
|
||||||
</div> </li>
|
</div> </li>
|
||||||
|
<li v-if="!savedTranslations.length">No saved translation</li>
|
||||||
|
|
||||||
<li>
|
<li>Add
|
||||||
<div uk-form-custom="target: > * > span:first-child">
|
<div uk-form-custom="target: > * > span:first-child">
|
||||||
<select>
|
<select v-model="translation">
|
||||||
<option value="">Add Translation...</option>
|
<option selected value="Add Translation...">Add Translation...</option>
|
||||||
<option
|
<option
|
||||||
v-for="(tr,i) in Object.keys(translations)"
|
v-for="(tr,i) in Object.keys(translations)"
|
||||||
:key="i"
|
:key="i"
|
||||||
@ -95,7 +97,7 @@
|
|||||||
<span uk-icon="icon: chevron-down"></span>
|
<span uk-icon="icon: chevron-down"></span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<a><span uk-icon="icon: plus-circle; ratio:2"></span></a>
|
<a @click="add(translations[translation])" :class="{disabled:!translations[translation]}"><span uk-icon="icon: plus-circle; ratio:2"></span></a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
@ -116,23 +118,33 @@
|
|||||||
export default {
|
export default {
|
||||||
data: () => {
|
data: () => {
|
||||||
return {
|
return {
|
||||||
|
translation: 'Add Translation...',
|
||||||
translations: {},
|
translations: {},
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
savedTranslations() {
|
savedTranslations() {
|
||||||
let o = {}
|
// let o = {}
|
||||||
let counter = 0
|
// let counter = 0
|
||||||
for(const tr in this.translations){
|
// for(const tr in this.translations){
|
||||||
if(counter>2)
|
// if(counter>2)
|
||||||
break;
|
// break;
|
||||||
o = {...o, [tr]:this.translations[tr]}
|
// o = {...o, [tr]:this.translations[tr]}
|
||||||
counter +=1
|
// counter +=1
|
||||||
// Object.assign({}, o,{[tr]: this.translations[tr]})
|
// // Object.assign({}, o,{[tr]: this.translations[tr]})
|
||||||
|
// }
|
||||||
|
// console.log(o);
|
||||||
|
return this.$store.state.settings.savedTr;
|
||||||
}
|
}
|
||||||
console.log(o);
|
},
|
||||||
return o
|
methods: {
|
||||||
|
add(tr){
|
||||||
|
if(!tr) return;
|
||||||
|
this.$store.dispatch('add', tr)
|
||||||
|
},
|
||||||
|
remove(tr){
|
||||||
|
this.$store.dispatch('remove', tr)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async created(){
|
async created(){
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
import { createApp } from 'vue'
|
import { createApp } from 'vue'
|
||||||
import App from './App.vue'
|
import App from './App.vue'
|
||||||
|
import {store} from './store'
|
||||||
|
|
||||||
createApp(App).mount('#app')
|
const app = createApp(App)
|
||||||
|
app.use(store)
|
||||||
|
app.mount('#app')
|
35
src/store.js
Normal file
35
src/store.js
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
import { createStore } from 'vuex'
|
||||||
|
|
||||||
|
export const store = createStore({
|
||||||
|
state: {
|
||||||
|
settings: {
|
||||||
|
savedTr: []
|
||||||
|
},
|
||||||
|
search: '',
|
||||||
|
},
|
||||||
|
mutations: {
|
||||||
|
add_translation (state,translation ) {
|
||||||
|
state.settings.savedTr.push(translation)
|
||||||
|
},
|
||||||
|
remove_translation (state,abbr ) {
|
||||||
|
state.settings.savedTr = state.settings.savedTr.filter(tr => tr.abbreviation !==abbr)
|
||||||
|
|
||||||
|
},
|
||||||
|
add_search(state, search){
|
||||||
|
state.search = search
|
||||||
|
}
|
||||||
|
},
|
||||||
|
actions:{
|
||||||
|
add({commit}, tr){
|
||||||
|
commit('add_translation', tr);
|
||||||
|
},
|
||||||
|
remove({commit}, abbr){
|
||||||
|
commit('remove_translation', abbr);
|
||||||
|
},
|
||||||
|
add_s({commit}, sr){
|
||||||
|
commit('add_search', sr);
|
||||||
|
},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// export default store;
|
Loading…
Reference in New Issue
Block a user