Skip to content

Commit cb0a2a8

Browse files
committed
Merge branch 'main' of github.com:svub/ibook-app
2 parents bfa5e2e + 2331b41 commit cb0a2a8

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!DOCTYPE html>
2-
<html lang="en">
2+
<html>
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">

src/App.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template web lang="pug">
2-
main(:class="page" :lang="config.language || 'en'")
2+
main(:class="page" :lang="lang")
33
transition(name="page")
44
//- use dynamic component: component(:is=page)
55
Start(key="1", v-if="page === 'start'")
@@ -89,6 +89,9 @@ export default class App extends Vue {
8989
this.setOverlay(testOverlay);
9090
}
9191
92+
// set root lang
93+
document.documentElement.lang = this.lang;
94+
9295
// for debugging and testing
9396
window["appState"] = appState;
9497
}
@@ -109,6 +112,10 @@ export default class App extends Vue {
109112
}))!;
110113
}
111114
115+
get lang() {
116+
return this.config.language || 'en';
117+
}
118+
112119
@Watch('options', { deep: true, immediate: true })
113120
@Watch('overlay', { immediate: true })
114121
updateClasses() {

src/components/elements/IfElement.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { Store } from "vuex";
1010
import { If } from "../../shared/entities";
1111
import { log, warn, error } from "../../shared/util";
1212
import { AppState } from "../../store";
13-
import TextElement from "./TextElement.vue";
1413
1514
export function evaluateCondition(condition: string, store: Store<AppState>): boolean {
1615
// examples conditions (case insensitive), "IF" is not part of condition:
@@ -32,7 +31,7 @@ export function evaluateCondition(condition: string, store: Store<AppState>): bo
3231
error(`Failed to parse condition "${condition}": should be four elements; example: STATE x > 0`);
3332
}
3433
if (!appState.states[name]) {
35-
warn(`State ${elements[1]} not found`);
34+
warn(`State ${name} not found`);
3635
}
3736
const state = appState.states[name]?.value ?? 0;
3837
const value = parseInt(elements[3]);
@@ -55,7 +54,7 @@ export function evaluateCondition(condition: string, store: Store<AppState>): bo
5554
return state != value;
5655
default:
5756
throw new Error(
58-
`Operator ${elements[2]} not supported. Support: =, <, <=, >, >=, !=`
57+
`Operator ${elements[2]} not supported. Supported: =, <, <=, >, >=, !=`
5958
);
6059
}
6160
case "item":

src/store/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,13 @@ export default new Vuex.Store({
128128
state.items.push(item.id);
129129
},
130130
removeItem(state, { item }: { item: RemoveItem }) {
131-
if (state.items.includes(item.id)) {
131+
const index = state.items.indexOf(item.id);
132+
if (index < 0) {
132133
return warn(`removeItem: item ${ item.id } not in inventory`);
133134
}
134135
// TODO is it enough to just remove the item? or do I need to recreate the map?
135136
// Vue.delete(state.items, item.id);
136-
state.items.splice(state.items.indexOf(item.id), 1);
137+
state.items.splice(index, 1);
137138
},
138139
setOption(state, { option, choice }: { option: Option; choice: Choice }) {
139140
if (!option.choices.find(c => c.id === choice.id)) {

0 commit comments

Comments
 (0)