From 0459bbb90cb9b93be9d249609008fc661ab90feb Mon Sep 17 00:00:00 2001 From: Spythere Date: Wed, 17 Nov 2021 14:16:23 +0100 Subject: [PATCH] Aktualizacja 1.0.5 --- .firebase/hosting.ZGlzdA.cache | 26 +-- package.json | 2 +- src/App.vue | 1 + src/assets/randomize-icon.svg | 10 + src/components/InputsSection.vue | 91 +------- src/components/ListSection.vue | 214 +++++++++++++++--- src/components/RandomizerCard.vue | 355 ++++++++++++++++++++++++++++++ src/store.ts | 13 +- src/styles/global.scss | 8 + 9 files changed, 592 insertions(+), 128 deletions(-) create mode 100644 src/assets/randomize-icon.svg create mode 100644 src/components/RandomizerCard.vue diff --git a/.firebase/hosting.ZGlzdA.cache b/.firebase/hosting.ZGlzdA.cache index c34e936..60157f7 100644 --- a/.firebase/hosting.ZGlzdA.cache +++ b/.firebase/hosting.ZGlzdA.cache @@ -1,13 +1,13 @@ -favicon.ico,1636839873685,665ba81c9556ba00abb1a0fa575fe801b3c35f23481b17528a211b8c3021f7cd -index.html,1636839873685,2bfbcf0ae387abf043a6c4012c8383751c3df6bac2abb5fbfa00ecb7ec1e29ba -css/app.e318326a.css,1636839873687,5f8edf44d0d80443531b74e2fba1c192d8f524f7a92daab577abd758c568eb73 -img/add-icon.a0f313fe.svg,1636839873690,be43aa8b694c90777971ad2d7f611f52c7ee172131fe2e24a82348891bb6aa18 -img/higher-icon.68df973e.svg,1636839873690,258bcb0fc4c62a0ecd53681bfa4777451e0cb4b980e1094f68d89d4077fa657a -img/lower-icon.7c306380.svg,1636839873685,286e1759ea8d4c11327f425f6d6af41603b329dab36c419b228acbea217c2080 -img/remove-icon.09c0dbc9.svg,1636839873690,1e01bccdf38cee755fc54c9768b4089fdb11d904a6b9aa86fcb20a2357dc8d61 -img/logo.c9fcc748.svg,1636839873690,59a9ce681c6123558f2b025931a262148f1d0bb47d5a3300a14a2e9020a85bc9 -img/sub-icon.bfa10f67.svg,1636839873690,afa120d2f8afe18161a6ed011eb0482ef9604fd35c1d3be8cd93b1087b1138eb -js/app.e79b9cbd.js,1636839873687,371740d1e17483c569dbfde222073ba25cca03b522d4af59c9dd617d3c5372e6 -js/app.e79b9cbd.js.map,1636839873691,2e93a681e3d233d413b4045488ba0fedd0cf40592570b9e743b52bd36d8b5c62 -js/chunk-vendors.e3e59fe7.js,1636839873690,b8da867c1596780117d35525b8065aeaa4337aa2caee1c5bc043834baf717406 -js/chunk-vendors.e3e59fe7.js.map,1636839873692,cdae68767a1b7010a6ccdcb43952d9fcd5d1d974617e4d02b4da5919d28dfbac +favicon.ico,1636908703056,665ba81c9556ba00abb1a0fa575fe801b3c35f23481b17528a211b8c3021f7cd +index.html,1636908703056,6894914497fb85a5fd56e07601efb80d51eb8459397f3c98753f4f29f2a1cbd1 +img/higher-icon.68df973e.svg,1636908703060,258bcb0fc4c62a0ecd53681bfa4777451e0cb4b980e1094f68d89d4077fa657a +css/app.e6df6391.css,1636908703060,649cf1518bfa2a52c89ec8e6703b22bc462b9f1942de6706855febed1f734241 +img/add-icon.a0f313fe.svg,1636908703060,be43aa8b694c90777971ad2d7f611f52c7ee172131fe2e24a82348891bb6aa18 +img/lower-icon.7c306380.svg,1636908703059,286e1759ea8d4c11327f425f6d6af41603b329dab36c419b228acbea217c2080 +img/sub-icon.bfa10f67.svg,1636908703060,afa120d2f8afe18161a6ed011eb0482ef9604fd35c1d3be8cd93b1087b1138eb +img/remove-icon.09c0dbc9.svg,1636908703060,1e01bccdf38cee755fc54c9768b4089fdb11d904a6b9aa86fcb20a2357dc8d61 +img/logo.c9fcc748.svg,1636908703060,59a9ce681c6123558f2b025931a262148f1d0bb47d5a3300a14a2e9020a85bc9 +js/app.68f816df.js,1636908703060,2c887f2145b31dee1596c41b6aa4e0bd67ad5c590dbeeacc9f1aa2fd1eba37e9 +js/app.68f816df.js.map,1636908703061,a3bb3a6d8b76b0ab08428bd9a098b4d9c1ae55e895ceda9e88dcea1bf18e4d40 +js/chunk-vendors.1cf1afd1.js,1636908703061,138b204e055fd02583bb465dcac5481d5f10484aa9765cf40c69997e045f4a7d +js/chunk-vendors.1cf1afd1.js.map,1636908703061,46aa56f02ef6c577f5ed79d5c3e58f06306595c6c83d1652e9bfea77fb303321 diff --git a/package.json b/package.json index 60bbd4a..38f808f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pojazdownik", - "version": "1.0.4", + "version": "1.0.5", "private": true, "scripts": { "serve": "vue-cli-service serve", diff --git a/src/App.vue b/src/App.vue index d106553..489afa9 100644 --- a/src/App.vue +++ b/src/App.vue @@ -55,6 +55,7 @@ export default defineComponent({ if (this.store.vehiclePreviewSrc == '') return; if (ev.key.toLowerCase() == 'escape') this.store.vehiclePreviewSrc = ''; + // if(ev.key.toLowerCase() == 'enter') }); // window.focus(); diff --git a/src/assets/randomize-icon.svg b/src/assets/randomize-icon.svg new file mode 100644 index 0000000..0b6586a --- /dev/null +++ b/src/assets/randomize-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/src/components/InputsSection.vue b/src/components/InputsSection.vue index da23dfe..70a7db2 100644 --- a/src/components/InputsSection.vue +++ b/src/components/InputsSection.vue @@ -125,91 +125,20 @@ export default defineComponent({ }, mounted() { - document.addEventListener('wheel', (ev) => { - if (!ev.target) return; - - const selectAttr = (ev.target as Element).attributes.getNamedItem('data-select'); - - if (!selectAttr) return; - - if (selectAttr.value == 'loco') { - const chosenLoco = this.store.chosenLoco; - - if (!chosenLoco) { - this.store.chosenLoco = this.locoOptions[0]; - this.onLocoTypeChange(); - return; - } - - if (ev.deltaY > 0) { - const nextOptionIndex = this.locoOptions.findIndex((opt) => opt.type == chosenLoco.type) + 1; - - if (nextOptionIndex >= this.locoOptions.length) return; - - this.store.chosenLoco = this.locoOptions[nextOptionIndex]; - this.onLocoTypeChange(); - } else { - const prevOptionIndex = this.locoOptions.findIndex((opt) => opt.type == chosenLoco.type) - 1; - - if (prevOptionIndex < 0) return; - - this.store.chosenLoco = this.locoOptions[prevOptionIndex]; - this.onLocoTypeChange(); - } + document.addEventListener('keydown', (ev) => { + const keyName = ev.key.toLowerCase(); + if (keyName == 'enter') { + ev.preventDefault(); + this.addVehicle(); } - if (selectAttr.value == 'car') { - const chosenCar = this.store.chosenCar; + if (keyName == 'backspace') { + if (this.store.stockList.length == 0) return; - if (!chosenCar) { - this.store.chosenCar = this.carOptions[0]; - this.onCarTypeChange(); + const lastStock = this.store.stockList.slice(-1)[0]; - return; - } - - if (ev.deltaY > 0) { - const nextOptionIndex = this.carOptions.findIndex((opt) => opt.type == chosenCar.type) + 1; - - if (nextOptionIndex >= this.carOptions.length) return; - - this.store.chosenCar = this.carOptions[nextOptionIndex]; - this.onCarTypeChange(); - } else { - const prevOptionIndex = this.carOptions.findIndex((opt) => opt.type == chosenCar.type) - 1; - - if (prevOptionIndex < 0) return; - - this.store.chosenCar = this.carOptions[prevOptionIndex]; - this.onCarTypeChange(); - } - } - - if (selectAttr.value == 'cargo') { - if (!this.store.chosenCar) return; - - if (!this.store.chosenCar.cargoList || this.store.chosenCar.cargoList.length == 0) return; - - const chosenCargoList = this.store.chosenCar.cargoList; - - if (!this.store.chosenCargo) { - this.store.chosenCargo = chosenCargoList[0]; - return; - } - - if (ev.deltaY > 0) { - const nextOptionIndex = chosenCargoList.findIndex((cargo) => cargo.id == this.store.chosenCargo?.id) + 1; - - if (nextOptionIndex >= chosenCargoList.length) return; - - this.store.chosenCargo = chosenCargoList[nextOptionIndex]; - } else { - const prevOptionIndex = chosenCargoList.findIndex((cargo) => cargo.id == this.store.chosenCargo?.id) - 1; - - if (prevOptionIndex < 0) return; - - this.store.chosenCargo = chosenCargoList[prevOptionIndex]; - } + if (lastStock.count > 1) lastStock.count--; + else this.store.stockList.splice(-1); } }); diff --git a/src/components/ListSection.vue b/src/components/ListSection.vue index d64a5fc..b5c407f 100644 --- a/src/components/ListSection.vue +++ b/src/components/ListSection.vue @@ -1,5 +1,11 @@ + + diff --git a/src/store.ts b/src/store.ts index a668e8c..3069745 100644 --- a/src/store.ts +++ b/src/store.ts @@ -142,7 +142,6 @@ export const carDataList = computed(() => Object.keys(vehicleDataJSON).reduce( id: cargo.split(":")[0], totalMass: Number(cargo.split(":")[1]), })) : [], - mass: carPropsData?.mass || 0, length: carPropsData?.length || 0, }); @@ -272,6 +271,18 @@ export const warnings = { if (headingLoco.type.startsWith("SM") && totalMass.value > 2400) return true; + return false; + }), + + tooManyLocos: computed(() => { + if (Store.stockList.reduce((acc, stock) => { + if (!stock.isLoco) return acc; + + acc += stock.count; + + return acc; + }, 0) > 2) return true; + return false; }) } diff --git a/src/styles/global.scss b/src/styles/global.scss index 8480bdb..705a254 100644 --- a/src/styles/global.scss +++ b/src/styles/global.scss @@ -34,11 +34,19 @@ a { } } +p { + font-size: 1.2em; + font-weight: bold; + color: $accentColor; +} + select, option, input, button { font-family: "Lato", sans-serif; + font-size: 1em; + } button {