This commit is contained in:
2023-02-09 18:13:37 +01:00
parent e7cdeb68fd
commit 3575c90c27
6 changed files with 55 additions and 65 deletions
+4 -6
View File
@@ -86,6 +86,7 @@ export default defineComponent({
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center;
} }
/* APP */ /* APP */
@@ -94,10 +95,7 @@ export default defineComponent({
color: $textColor; color: $textColor;
font-size: 1em; font-size: 1em;
padding: 1em; padding: 1em 0.5em;
display: flex;
justify-content: center;
} }
/* HEADER SECTION */ /* HEADER SECTION */
@@ -145,14 +143,14 @@ main {
display: grid; display: grid;
gap: 1em 3em; gap: 1em 3em;
width: 100vw; width: 100%;
max-width: 1300px; max-width: 1300px;
min-height: 75vh; min-height: 75vh;
grid-template-columns: 1fr 2fr; grid-template-columns: 1fr 2fr;
grid-template-rows: auto 360px minmax(400px, 1fr); grid-template-rows: auto 360px minmax(400px, 1fr);
padding: 0 1em; // padding: 0 1em;
margin-bottom: 2em; margin-bottom: 2em;
} }
+8 -12
View File
@@ -175,10 +175,9 @@ export default defineComponent({
}, },
addOrSwitchVehicle() { addOrSwitchVehicle() {
if(!this.store.chosenVehicle) return; if (!this.store.chosenVehicle) return;
if (this.store.chosenStockListIndex == -1) if (this.store.chosenStockListIndex == -1) this.addVehicle(this.store.chosenVehicle, this.store.chosenCargo);
this.addVehicle(this.store.chosenVehicle, this.store.chosenCargo);
else this.switchVehicles(); else this.switchVehicles();
}, },
@@ -224,7 +223,7 @@ export default defineComponent({
.inputs-section { .inputs-section {
display: flex; display: flex;
justify-content: space-between; justify-content: center;
grid-row: 2; grid-row: 2;
grid-column: 1; grid-column: 1;
@@ -264,11 +263,12 @@ button.btn--choice {
} }
.input_actions { .input_actions {
display: flex; display: grid;
flex-wrap: wrap; grid-template-columns: repeat(2, 1fr);
gap: 0.5em;
button { button:nth-child(3) {
margin: 0.5em 0.5em 0 0; grid-column: 1 / 3;
} }
} }
@@ -285,10 +285,6 @@ button.btn--choice {
text-align: center; text-align: center;
} }
.input_actions {
justify-content: center;
}
.vehicle-types { .vehicle-types {
justify-content: center; justify-content: center;
} }
+40 -33
View File
@@ -1,23 +1,8 @@
<template> <template>
<section class="stock-list"> <section class="stock-list">
<div class="stock_actions"> <div class="stock_actions">
<button class="btn" @click="downloadStock">POBIERZ POCIĄG</button>
<button class="btn" @click="store.stockSectionMode = 'stock-generator'">LOSUJ SKŁAD</button>
<button class="btn" @click="store.stockSectionMode = 'number-generator'">GENERUJ NUMER</button> <button class="btn" @click="store.stockSectionMode = 'number-generator'">GENERUJ NUMER</button>
</div> <button class="btn" @click="store.stockSectionMode = 'stock-generator'">LOSUJ SKŁAD</button>
<div class="stock_actions">
<button
class="btn"
:data-disabled="store.stockList.length == 0"
:disabled="store.stockList.length == 0"
@click="copyToClipboard"
>
KOPIUJ DO SCHOWKA
</button>
<button class="btn" @click="resetStock">ZRESETUJ LISTĘ</button>
<button class="btn" @click="shuffleCars">TASUJ WAGONY</button>
</div> </div>
<div class="stock_controls" :data-disabled="store.chosenStockListIndex == -1"> <div class="stock_controls" :data-disabled="store.chosenStockListIndex == -1">
@@ -26,30 +11,48 @@
</b> </b>
<button <button
class="btn action-btn" class="btn"
:tabindex="store.chosenStockListIndex == -1 ? -1 : 0" :tabindex="store.chosenStockListIndex == -1 ? -1 : 0"
@click="moveUpStock(store.chosenStockListIndex)" @click="moveUpStock(store.chosenStockListIndex)"
> >
<img :src="getIconURL('higher')" alt="move up vehicle" /> <img :src="getIconURL('higher')" alt="move up vehicle" />
Przenieś wyżej PRZENIEŚ WYŻEJ
</button> </button>
<button <button
class="btn action-btn" class="btn"
:tabindex="store.chosenStockListIndex == -1 ? -1 : 0" :tabindex="store.chosenStockListIndex == -1 ? -1 : 0"
@click="moveDownStock(store.chosenStockListIndex)" @click="moveDownStock(store.chosenStockListIndex)"
> >
<img :src="getIconURL('lower')" alt="move down vehicle" /> <img :src="getIconURL('lower')" alt="move down vehicle" />
Przenieś niżej PRZENIEŚ NIŻEJ
</button> </button>
<button <button
class="btn action-btn" class="btn"
:tabindex="store.chosenStockListIndex == -1 ? -1 : 0" :tabindex="store.chosenStockListIndex == -1 ? -1 : 0"
@click="removeStock(store.chosenStockListIndex)" @click="removeStock(store.chosenStockListIndex)"
> >
<img :src="getIconURL('remove')" alt="remove vehicle" /> <img :src="getIconURL('remove')" alt="remove vehicle" />
Usuń USUŃ
</button>
</div>
<div class="stock_actions">
<button class="btn" :data-disabled="stockIsEmpty" :disabled="stockIsEmpty" @click="downloadStock">
POBIERZ POCIĄG
</button>
<button class="btn" :data-disabled="stockIsEmpty" :disabled="stockIsEmpty" @click="copyToClipboard">
KOPIUJ DO SCHOWKA
</button>
<button class="btn" :data-disabled="stockIsEmpty" :disabled="stockIsEmpty" @click="resetStock">
ZRESETUJ LISTĘ
</button>
<button class="btn" :data-disabled="stockIsEmpty" :disabled="stockIsEmpty" @click="shuffleCars">
TASUJ WAGONY
</button> </button>
</div> </div>
@@ -99,7 +102,7 @@
<!-- Stock list --> <!-- Stock list -->
<ul ref="list"> <ul ref="list">
<li v-if="store.stockList.length == 0" class="list-empty"> <li v-if="stockIsEmpty" class="list-empty">
<div class="stock-info">Lista pojazdów jest pusta!</div> <div class="stock-info">Lista pojazdów jest pusta!</div>
</li> </li>
@@ -153,12 +156,13 @@ import imageMixin from '../mixins/imageMixin';
import stockPreviewMixin from '../mixins/stockPreviewMixin'; import stockPreviewMixin from '../mixins/stockPreviewMixin';
import { IStock } from '../types'; import { IStock } from '../types';
import StockThumbnails from './StockThumbnails.vue'; import StockThumbnails from './StockThumbnails.vue';
import stockMixin from '../mixins/stockMixin';
export default defineComponent({ export default defineComponent({
name: 'stock-list', name: 'stock-list',
components: { TrainImage, StockThumbnails }, components: { TrainImage, StockThumbnails },
mixins: [warningsMixin, imageMixin, stockPreviewMixin], mixins: [warningsMixin, imageMixin, stockMixin, stockPreviewMixin],
setup() { setup() {
const store = useStore(); const store = useStore();
@@ -188,6 +192,10 @@ export default defineComponent({
.join(';'); .join(';');
}, },
stockIsEmpty() {
return this.store.stockList.length == 0;
},
chosenStockVehicle() { chosenStockVehicle() {
return this.store.chosenStockListIndex == -1 ? undefined : this.store.stockList[this.store.chosenStockListIndex]; return this.store.chosenStockListIndex == -1 ? undefined : this.store.stockList[this.store.chosenStockListIndex];
}, },
@@ -266,6 +274,8 @@ export default defineComponent({
if (index == -1) return; if (index == -1) return;
this.store.stockList = this.store.stockList.filter((stock, i) => i != index); this.store.stockList = this.store.stockList.filter((stock, i) => i != index);
if (this.store.stockList.length < index + 1) this.store.chosenStockListIndex = -1;
}, },
moveUpStock(index: number) { moveUpStock(index: number) {
@@ -386,7 +396,6 @@ export default defineComponent({
gap: 0.5em; gap: 0.5em;
flex-wrap: wrap; flex-wrap: wrap;
margin: 1em 0;
padding: 0.5em; padding: 0.5em;
background-color: #353a57; background-color: #353a57;
@@ -410,20 +419,18 @@ export default defineComponent({
} }
button { button {
padding: 0.25em 0.5em;
img { img {
vertical-align: text-bottom;
margin-right: 0.25em; margin-right: 0.25em;
width: 1.1em;
height: 1.1em;
} }
} }
} }
.stock_actions button { .stock_actions {
width: 100%; display: grid;
gap: 0.5em;
margin: 1em 0;
grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
} }
.real-stock-info { .real-stock-info {
-11
View File
@@ -65,16 +65,5 @@ export default defineComponent({
overflow: hidden; overflow: hidden;
} }
// Stock tabs styles
.stock_actions {
display: flex;
gap: 0.5em;
margin: 0.5em 0;
@media only screen and (max-width: 450px) {
flex-wrap: wrap;
}
}
</style> </style>
+1
View File
@@ -98,6 +98,7 @@ const allowDrop = (e: DragEvent) => {
display: flex; display: flex;
align-items: flex-end; align-items: flex-end;
cursor: pointer; cursor: pointer;
min-height: 100px;
&[data-selected='true'] { &[data-selected='true'] {
background-color: rebeccapurple; background-color: rebeccapurple;
+2 -3
View File
@@ -9,8 +9,8 @@ $secondaryColor: #222;
$accentColor: #e4c428; $accentColor: #e4c428;
::-webkit-scrollbar { ::-webkit-scrollbar {
width: 0.5rem; width: 7px;
height: 0.5rem; height: 7px;
&-track { &-track {
background: #222; background: #222;
@@ -31,7 +31,6 @@ html {
font-family: 'Lato', sans-serif; font-family: 'Lato', sans-serif;
background-color: $bgColor; background-color: $bgColor;
width: 100vw;
overflow-x: hidden; overflow-x: hidden;
} }