diff --git a/.firebase/hosting.ZGlzdA.cache b/.firebase/hosting.ZGlzdA.cache index 95722a9..62752fb 100644 --- a/.firebase/hosting.ZGlzdA.cache +++ b/.firebase/hosting.ZGlzdA.cache @@ -1,12 +1,12 @@ -favicon.ico,1636721486902,367865b7acbed5bbbb8468e8d21ace4046cfc5f8fd94d1ce9331b15d46e05dbd -index.html,1636721486902,79878fe159eda46925f5992fc8130e9cb23f1957e509a44d6d8c430c721de1f3 -css/app.c9c754fa.css,1636721486902,586d2f40532754848a4c732e63d6f57c15f646a8ce6e611066cea2c7f2a29176 -img/add-icon.a0f313fe.svg,1636721486906,8b45ce3f55a88da7b0e7bf7e2ae14964009fc5e0475ae97c6c00e2ce6e391315 -img/higher-icon.68df973e.svg,1636721486906,35d368c152cecefc20b8c87d6bf9e8f742a92f9a063d67a63108ea9a2dff3144 -img/lower-icon.7c306380.svg,1636721486902,12730a2eaccdc679d02fc8c2a021fdde21a4b206b4a8b27cfbc9b3b96d557f8a -img/remove-icon.09c0dbc9.svg,1636721486906,0d74f6038c49cc34ebd4aebfe3ad36af087709bc740b4b942b4c0e2247427bf1 -img/sub-icon.bfa10f67.svg,1636721486906,1eda992a4e59f8ec1237fe987390cf10a55c4474299d0e9d615a2b4468bcab40 -js/app.fa6fa1a7.js,1636721486902,c8185312c75dbb09d131699c81b80d264d914ad5d80e33ae0be1284221c0bfbe -js/app.fa6fa1a7.js.map,1636721486906,97654b66237502c6548753c33fc9e32dd824cf954780fd10b3febfb9ad49f5da -js/chunk-vendors.70a49fdd.js,1636721486907,68930e9087cbaacd31fe6f67acbcd2fbe2e9b4a4f19a9f54760683fc4aaa9422 -js/chunk-vendors.70a49fdd.js.map,1636721486911,00bed712f443ca2e18bd9c3ab7e37fb223d5e0803dbee534e9a43f571437b0fd +favicon.ico,1636754930622,665ba81c9556ba00abb1a0fa575fe801b3c35f23481b17528a211b8c3021f7cd +index.html,1636754930622,a85d733bf42fa374cd381ca113a84eacb24688c8661c162b5decf6bcdef60cb4 +img/add-icon.a0f313fe.svg,1636754930627,be43aa8b694c90777971ad2d7f611f52c7ee172131fe2e24a82348891bb6aa18 +css/app.edd474fc.css,1636754930624,4b72a5a097d10fd1c33f0f23e5e7d1140ba39278e676b6d2d419cdf3b2c4f5b5 +img/higher-icon.68df973e.svg,1636754930627,258bcb0fc4c62a0ecd53681bfa4777451e0cb4b980e1094f68d89d4077fa657a +img/lower-icon.7c306380.svg,1636754930622,286e1759ea8d4c11327f425f6d6af41603b329dab36c419b228acbea217c2080 +img/remove-icon.09c0dbc9.svg,1636754930627,1e01bccdf38cee755fc54c9768b4089fdb11d904a6b9aa86fcb20a2357dc8d61 +img/sub-icon.bfa10f67.svg,1636754930627,afa120d2f8afe18161a6ed011eb0482ef9604fd35c1d3be8cd93b1087b1138eb +js/app.c9f256e0.js,1636754930624,c48f50d629834c256c1a402a473f3105da981a6b499fd6ec5a03038b41e86ac5 +js/app.c9f256e0.js.map,1636754930627,7efa1cefe01f64e7d2321673228445b825933f34bbf3d0c4aaa95b7a58e778a6 +js/chunk-vendors.2acd6c99.js,1636754930627,f399fa3a67437656b0adcdbe8cf597b03d0dcf11fa0416f3dba3b3715b01cb10 +js/chunk-vendors.2acd6c99.js.map,1636754930628,a63469ac3619ed0aae3d81c5cb5d8d5b68d06c28b7b74773d09dfc093c9b12a7 diff --git a/src/components/InputsSection.vue b/src/components/InputsSection.vue index 65a97d8..ec9539f 100644 --- a/src/components/InputsSection.vue +++ b/src/components/InputsSection.vue @@ -100,7 +100,14 @@ " v-model="store.chosenCargo" > - brak + + brak dostępnych ładunków + + + próżny import { ICarWagon, ILocomotive, IStore } from "@/types"; import { defineComponent, inject } from "vue"; -import { computed } from "@vue/reactivity"; -import statsMixin from "@/mixins/StatsMixin"; - -function isILocomotive( +function isLocomotive( vehicle: ILocomotive | ICarWagon ): vehicle is ILocomotive { return (vehicle as ILocomotive).power !== undefined; } export default defineComponent({ - mixins: [statsMixin], - setup() { const store = inject("Store") as IStore; return { store, - totalMass: computed(() => - store.stockList.reduce( - (acc, stock) => - acc + - (stock.cargo ? stock.cargo.totalMass : stock.mass) * stock.count, - 0 - ) - ), - totalLength: computed(() => - store.stockList.reduce( - (acc, stock) => acc + stock.length * stock.count, - 0 - ) - ), - maxSpeed: computed(() => - store.stockList.reduce( - (acc, stock) => - stock.maxSpeed < acc || acc == 0 ? stock.maxSpeed : acc, - 0 - ) - ), + locoDataList: inject("locoDataList") as ILocomotive[], + carDataList: inject("carDataList") as ICarWagon[], + isTrainPassenger: inject("isTrainPassenger") as boolean, + totalLength: inject("totalLength") as number, + totalMass: inject("totalMass") as number, + maxStockSpeed: inject("maxStockSpeed") as number, + maxAllowedSpeed: inject("maxAllowedSpeed") as number, }; }, @@ -242,18 +230,13 @@ export default defineComponent({ if (!vehicle) return; - if (vehicle.length + this.totalLength > 650) { - alert("Maksymalna długość składu to 650m!"); - return; - } - const previousStock = this.store.stockList.length > 0 ? this.store.stockList[this.store.stockList.length - 1] : null; if ( - isILocomotive(vehicle) && + isLocomotive(vehicle) && previousStock && previousStock.type == vehicle.type ) { @@ -262,7 +245,7 @@ export default defineComponent({ } if ( - !isILocomotive(vehicle) && + !isLocomotive(vehicle) && previousStock && previousStock.type == vehicle.type && previousStock.cargo?.id == this.store.chosenCargo?.id @@ -277,18 +260,18 @@ export default defineComponent({ length: vehicle.length, mass: vehicle.mass, maxSpeed: vehicle.maxSpeed, - isLoco: isILocomotive(vehicle), + isLoco: isLocomotive(vehicle), cargo: - !isILocomotive(vehicle) && vehicle.loadable && this.store.chosenCargo + !isLocomotive(vehicle) && vehicle.loadable && this.store.chosenCargo ? this.store.chosenCargo : undefined, count: 1, imgSrc: vehicle.imageSrc, - useType: isILocomotive(vehicle) ? vehicle.power : vehicle.useType, + useType: isLocomotive(vehicle) ? vehicle.power : vehicle.useType, }; if ( - isILocomotive(vehicle) && + isLocomotive(vehicle) && this.store.stockList.length > 0 && !this.store.stockList[0].isLoco ) @@ -317,7 +300,7 @@ export default defineComponent({ pointer-events: none; } } - + @media screen and (max-width: 800px) { flex-direction: column; } diff --git a/src/components/ListSection.vue b/src/components/ListSection.vue index 0eecc9e..0df7d62 100644 --- a/src/components/ListSection.vue +++ b/src/components/ListSection.vue @@ -36,9 +36,23 @@ Masa: {{ totalMass }} t | Długość: {{ totalLength }} - m | Vmax składu: - {{ maxSpeed }} km/h + m + + + + Lokomotywy EP07 i EP08 są przeznaczone jedynie do ruchu pasażerskiego! + + + + Ten skład jest za długi! + + + + Ten skład jest za ciężki! + + + Lista pojazdów jest pusta! @@ -97,42 +111,28 @@