diff --git a/src/components/ListSection.vue b/src/components/ListSection.vue
index b7ea7b4..a6e4210 100644
--- a/src/components/ListSection.vue
+++ b/src/components/ListSection.vue
@@ -439,18 +439,11 @@ export default defineComponent({
}
button {
- font-size: 0.9em;
- padding: 0.4em 0.55em;
margin-right: 0.5em;
&:nth-child(5) {
margin-right: 0;
}
-
- &:focus-visible {
- color: $accentColor;
- border-color: $accentColor;
- }
}
}
diff --git a/src/components/RandomizerCard.vue b/src/components/RandomizerCard.vue
index e33f478..c991676 100644
--- a/src/components/RandomizerCard.vue
+++ b/src/components/RandomizerCard.vue
@@ -20,7 +20,8 @@
LOKOMOTYWA
-
-
+
@@ -64,13 +105,18 @@
@@ -314,7 +370,7 @@ export default defineComponent({
height: 90vh;
max-height: 900px;
- background: #242424;
+ background: #111;
@media screen and (max-width: 700px) {
width: 95%;
@@ -323,10 +379,6 @@ export default defineComponent({
border-radius: 1em;
}
-p {
- font-size: 1.2em;
-}
-
h1 {
text-align: center;
color: $accentColor;
@@ -337,14 +389,13 @@ h3 {
margin: 0 0 0.5em 0;
}
-.car-choice div {
- display: grid;
+.rules {
+ margin: 0.5em 0;
- grid-template-columns: repeat(6, 1fr);
- justify-content: center;
-
- @media screen and (max-width: 800px) {
- grid-template-columns: repeat(4, 1fr);
+ ul {
+ list-style: inside;
+ border: 1px solid $accentColor;
+ padding: 0.5em;
}
}
@@ -398,6 +449,31 @@ h3 {
}
}
+.carwagon-list li {
+ margin: 0.5em 0;
+
+ display: flex;
+ align-items: center;
+
+ > * {
+ margin-right: 0.5em;
+ }
+
+ input.carwagon-type {
+ width: auto;
+ }
+
+ select.carwagon-cargo {
+ max-width: 150px;
+ }
+ .carwagon-chance {
+ input {
+ font-weight: bold;
+ width: auto;
+ }
+ }
+}
+
.random-stock-selections {
text-align: left;
@@ -406,37 +482,6 @@ h3 {
}
}
-ul.carwagons-list li select {
- margin: 0.5em 0.5em 0 0;
- &.select-type {
- width: 250px;
- }
-
- &.select-cargo {
- width: 120px;
- }
-}
-
-.carwagon-chance {
- position: relative;
- font-size: 1.2em;
- font-weight: bold;
-
- input {
- background-color: white;
- height: 1.6em;
- border: none;
- width: 3em;
- }
-
- &::after {
- content: '%';
- top: 0;
- right: -1em;
- position: absolute;
- }
-}
-
@media screen and (max-width: 600px) {
.car-preview .image-wrapper {
width: 20em;
diff --git a/src/data/vehicleData.json b/src/data/vehicleData.json
index 9abfd74..4b65068 100644
--- a/src/data/vehicleData.json
+++ b/src/data/vehicleData.json
@@ -1342,7 +1342,7 @@
],
[
"304C_PLK_Rob",
- "304c",
+ "304C",
false,
false,
"140",
@@ -1446,7 +1446,7 @@
],
[
"Gor77_PKP_Bhp_01",
- "Bhp",
+ "Gor77",
false,
false,
"120",
@@ -1454,7 +1454,7 @@
],
[
"Gor77_PKP_Bhp_02",
- "Bhp",
+ "Gor77",
false,
false,
"120",
@@ -1462,7 +1462,7 @@
],
[
"Gor77_PKP_Bhp_03",
- "Bhp",
+ "Gor77",
false,
false,
"120",
@@ -1585,7 +1585,7 @@
],
[
"29R_PLPOL_Zaekk_01",
- "29R_PLPOL",
+ "29R",
true,
false,
"100",
diff --git a/src/mixins/stockMixin.ts b/src/mixins/stockMixin.ts
new file mode 100644
index 0000000..7795bd6
--- /dev/null
+++ b/src/mixins/stockMixin.ts
@@ -0,0 +1,65 @@
+import { defineComponent } from 'vue';
+import { useStore } from '../store';
+import { ICargo, ICarWagon, ILocomotive, IStock, Vehicle } from '../types';
+import { isLocomotive } from '../utils/vehicleUtils';
+
+export default defineComponent({
+ setup() {
+ return {
+ store: useStore(),
+ };
+ },
+
+ methods: {
+ getStockId() {
+ return `${Math.random().toString(36).slice(5)}`;
+ },
+
+ getStockObject(vehicle: Vehicle, cargo?: ICargo, count = 1): IStock {
+ const isLoco = isLocomotive(vehicle);
+
+ return {
+ id: this.getStockId(),
+ type: vehicle.type,
+ length: vehicle.length,
+ mass: vehicle.mass,
+ maxSpeed: vehicle.maxSpeed,
+ isLoco,
+ cargo: !isLoco && vehicle.loadable && cargo ? cargo : undefined,
+ count,
+ imgSrc: vehicle.imageSrc,
+ useType: isLoco ? vehicle.power : vehicle.useType,
+ supportersOnly: false,
+ };
+ },
+
+ addLocomotive(loco: ILocomotive) {
+ const previousStock =
+ this.store.stockList.length > 0 ? this.store.stockList[this.store.stockList.length - 1] : null;
+ if (previousStock && previousStock.type == loco.type) {
+ this.store.stockList[this.store.stockList.length - 1].count++;
+ return;
+ }
+
+ const stockObj = this.getStockObject(loco);
+
+ if (this.store.stockList.length > 0 && !this.store.stockList[0].isLoco) this.store.stockList.unshift(stockObj);
+ else this.store.stockList.push(stockObj);
+ },
+
+ addCarWagon(car: ICarWagon, cargo?: ICargo) {
+ const previousStock =
+ this.store.stockList.length > 0 ? this.store.stockList[this.store.stockList.length - 1] : null;
+
+ if (previousStock && previousStock.type == car.type && previousStock.cargo?.id == cargo?.id) {
+ this.store.stockList[this.store.stockList.length - 1].count++;
+
+ return;
+ }
+
+ const stockObj = this.getStockObject(car, cargo);
+
+ this.store.stockList.push(stockObj);
+ },
+ },
+});
diff --git a/src/styles/global.scss b/src/styles/global.scss
index 70e3cc4..4c7b6e8 100644
--- a/src/styles/global.scss
+++ b/src/styles/global.scss
@@ -54,12 +54,6 @@ a {
}
}
-p {
- font-size: 1.2em;
- font-weight: bold;
- color: $accentColor;
-}
-
select,
option,
input,
@@ -87,17 +81,22 @@ button {
}
button.btn {
- padding: 0.25em 1em;
+ padding: 0.4em 0.75em;
- border-radius: 0.25em;
- border: 2px solid white;
outline: none;
- background: none;
+ background-color: #222;
transition: all 250ms;
+ &.btn--outline {
+ background: none;
+ font-weight: bold;
+ outline: 1px solid $accentColor;
+ }
+
&:focus-visible {
color: $accentColor;
+ outline: 1px solid white;
}
&[data-disabled='true'] {
@@ -112,7 +111,7 @@ button.btn {
&--text {
font-weight: bold;
transition: all 250ms;
- border: none;
+ background: none;
&:focus-visible {
outline: 1px solid white;
@@ -121,6 +120,7 @@ button.btn {
&--choice {
padding: 0.25em 0.3em;
+ background-color: #222;
&:focus-visible {
outline: 1px solid white;
@@ -128,28 +128,8 @@ button.btn {
}
}
-button.btn-rect {
- width: 1.5em;
- height: 1.5em;
- font-size: 1.65em;
-
- line-height: 1em;
-
- border-radius: 0.25em;
- border: 2px solid black;
- outline: none;
- background: white;
- color: black;
-
- transition: all 250ms;
-
- &:hover {
- color: white;
- background-color: black;
- }
-}
-
-select {
+select,
+input {
background: none;
border: 2px solid white;
outline: none;
@@ -160,6 +140,10 @@ select {
font-size: 1em;
width: 18em;
+
+ &:focus-visible {
+ border-color: $accentColor;
+ }
}
option {