mirror of
https://github.com/Spythere/pojazdownik.git
synced 2026-05-03 11:45:34 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4859a265e7 | |||
| 82d051a7a4 | |||
| c9ad50b01e | |||
| 50f573e8c6 | |||
| f1720c88e8 | |||
| efefebe202 | |||
| 218f616df4 | |||
| 8d737f6429 |
@@ -24,5 +24,8 @@ pnpm-debug.log*
|
|||||||
*.sw?
|
*.sw?
|
||||||
node_modules
|
node_modules
|
||||||
|
|
||||||
|
# Lock files
|
||||||
|
*.lock
|
||||||
|
|
||||||
# Dev files
|
# Dev files
|
||||||
stockInfoDev.json
|
stockInfoDev.json
|
||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "pojazdownik",
|
"name": "pojazdownik",
|
||||||
"version": "1.9.0",
|
"version": "1.9.1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -12,8 +12,8 @@
|
|||||||
"format": "prettier --write src/"
|
"format": "prettier --write src/"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@heroicons/vue": "^2.2.0",
|
|
||||||
"axios": "^1.4.0",
|
"axios": "^1.4.0",
|
||||||
|
"lucide-vue-next": "^0.487.0",
|
||||||
"pinia": "^2.0.17",
|
"pinia": "^2.0.17",
|
||||||
"prettier": "^3.0.3",
|
"prettier": "^3.0.3",
|
||||||
"vue": "^3.2.37",
|
"vue": "^3.2.37",
|
||||||
|
|||||||
@@ -16,19 +16,16 @@
|
|||||||
|
|
||||||
<div class="storage-item-top-actions">
|
<div class="storage-item-top-actions">
|
||||||
<button class="btn btn--icon" @click="chooseStorageStock(storageEntry.id)">
|
<button class="btn btn--icon" @click="chooseStorageStock(storageEntry.id)">
|
||||||
<ArrowRightEndOnRectangleIcon style="width: 25px" />
|
<LogIn />
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button class="btn btn--icon" @click="toggleStorageEntryExpand(storageEntry.id)">
|
<button class="btn btn--icon" @click="toggleStorageEntryExpand(storageEntry.id)">
|
||||||
<ChevronDownIcon
|
<ChevronDown v-if="!expandedEntries.includes(storageEntry.id)" />
|
||||||
v-if="!expandedEntries.includes(storageEntry.id)"
|
<ChevronUp v-else />
|
||||||
style="width: 25px"
|
|
||||||
/>
|
|
||||||
<ChevronUpIcon v-else style="width: 25px" />
|
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button class="btn btn--icon" @click="removeStockIndexFromStorage(storageEntry.id)">
|
<button class="btn btn--icon" @click="removeStockIndexFromStorage(storageEntry.id)">
|
||||||
<TrashIcon style="width: 25px" />
|
<Trash2 />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -62,24 +59,16 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent } from 'vue';
|
import { defineComponent } from 'vue';
|
||||||
|
|
||||||
import {
|
|
||||||
ArrowRightEndOnRectangleIcon,
|
|
||||||
ChevronDownIcon,
|
|
||||||
ChevronUpIcon,
|
|
||||||
FolderArrowDownIcon,
|
|
||||||
TrashIcon,
|
|
||||||
} from '@heroicons/vue/20/solid';
|
|
||||||
|
|
||||||
import { useStore } from '../../store';
|
import { useStore } from '../../store';
|
||||||
import stockMixin from '../../mixins/stockMixin';
|
import stockMixin from '../../mixins/stockMixin';
|
||||||
|
import { ChevronDown, ChevronUp, LogIn, Trash2 } from 'lucide-vue-next';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: {
|
components: {
|
||||||
ChevronDownIcon,
|
ChevronDown,
|
||||||
ChevronUpIcon,
|
ChevronUp,
|
||||||
FolderArrowDownIcon,
|
LogIn,
|
||||||
TrashIcon,
|
Trash2,
|
||||||
ArrowRightEndOnRectangleIcon,
|
|
||||||
},
|
},
|
||||||
|
|
||||||
mixins: [stockMixin],
|
mixins: [stockMixin],
|
||||||
@@ -112,7 +101,9 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
new Map() as Map<string, number>
|
new Map() as Map<string, number>
|
||||||
)
|
)
|
||||||
).map(([stockName, count]) => `${count}x ${stockName.replace(/_/g, ' ')}`).join(', ');
|
)
|
||||||
|
.map(([stockName, count]) => `${count}x ${stockName.replace(/_/g, ' ')}`)
|
||||||
|
.join(', ');
|
||||||
},
|
},
|
||||||
removeStockIndexFromStorage(stockName: string) {
|
removeStockIndexFromStorage(stockName: string) {
|
||||||
let removeConfirm = confirm(this.$t('storage.remove-confirm'));
|
let removeConfirm = confirm(this.$t('storage.remove-confirm'));
|
||||||
@@ -184,10 +175,10 @@ ul.storage-list > li {
|
|||||||
.storage-item-top {
|
.storage-item-top {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
gap: 0.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.storage-item-top > h3 {
|
.storage-item-top > h3 {
|
||||||
font-size: 1.2em;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
:data-button-tooltip="$t('stocklist.action-upload-file')"
|
:data-button-tooltip="$t('stocklist.action-upload-file')"
|
||||||
>
|
>
|
||||||
<input type="file" @change="uploadStockFromFile" ref="conFile" accept=".con,.txt" />
|
<input type="file" @change="uploadStockFromFile" ref="conFile" accept=".con,.txt" />
|
||||||
<FolderPlusIcon />
|
<FolderUp :stroke-width="2.5" />
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
@click="uploadStockFromClipboard"
|
@click="uploadStockFromClipboard"
|
||||||
:data-button-tooltip="$t('stocklist.action-upload-clipboard')"
|
:data-button-tooltip="$t('stocklist.action-upload-clipboard')"
|
||||||
>
|
>
|
||||||
<ClipboardDocumentCheckIcon />
|
<ClipboardPaste :stroke-width="2.5" />
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
@click="downloadStock"
|
@click="downloadStock"
|
||||||
:data-button-tooltip="$t('stocklist.action-download')"
|
:data-button-tooltip="$t('stocklist.action-download')"
|
||||||
>
|
>
|
||||||
<ArrowDownTrayIcon />
|
<FolderDown :stroke-width="2.5" />
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
@click="copyToClipboard"
|
@click="copyToClipboard"
|
||||||
:data-button-tooltip="$t('stocklist.action-copy')"
|
:data-button-tooltip="$t('stocklist.action-copy')"
|
||||||
>
|
>
|
||||||
<DocumentDuplicateIcon />
|
<ClipboardCopy :stroke-width="2.5" />
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
@click="saveStockDataToStorage"
|
@click="saveStockDataToStorage"
|
||||||
:data-button-tooltip="$t('stocklist.action-bookmark')"
|
:data-button-tooltip="$t('stocklist.action-bookmark')"
|
||||||
>
|
>
|
||||||
<BookmarkIcon />
|
<Bookmark :stroke-width="2.5" />
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
@@ -55,7 +55,7 @@
|
|||||||
@click="resetStock"
|
@click="resetStock"
|
||||||
:data-button-tooltip="$t('stocklist.action-reset')"
|
:data-button-tooltip="$t('stocklist.action-reset')"
|
||||||
>
|
>
|
||||||
<ArrowUturnLeftIcon />
|
<ListRestart :stroke-width="2.5" />
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
@@ -65,7 +65,17 @@
|
|||||||
@click="shuffleCars"
|
@click="shuffleCars"
|
||||||
:data-button-tooltip="$t('stocklist.action-shuffle')"
|
:data-button-tooltip="$t('stocklist.action-shuffle')"
|
||||||
>
|
>
|
||||||
<ArrowPathIcon />
|
<Shuffle :stroke-width="2.5" />
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button
|
||||||
|
class="btn btn--image"
|
||||||
|
:data-disabled="stockIsEmpty"
|
||||||
|
:disabled="stockIsEmpty"
|
||||||
|
@click="turnAroundCars"
|
||||||
|
:data-button-tooltip="$t('stocklist.action-switch')"
|
||||||
|
>
|
||||||
|
<Repeat :stroke-width="2.5" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -75,7 +85,7 @@
|
|||||||
:tabindex="store.chosenStockListIndex == -1 ? -1 : 0"
|
:tabindex="store.chosenStockListIndex == -1 ? -1 : 0"
|
||||||
@click="stockListUtils.moveUpStock(store.chosenStockListIndex)"
|
@click="stockListUtils.moveUpStock(store.chosenStockListIndex)"
|
||||||
>
|
>
|
||||||
<ChevronUpIcon />
|
<ChevronUp :stroke-width="2.5" />
|
||||||
{{ $t('stocklist.action-move-up') }}
|
{{ $t('stocklist.action-move-up') }}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
@@ -84,7 +94,7 @@
|
|||||||
:tabindex="store.chosenStockListIndex == -1 ? -1 : 0"
|
:tabindex="store.chosenStockListIndex == -1 ? -1 : 0"
|
||||||
@click="stockListUtils.moveDownStock(store.chosenStockListIndex)"
|
@click="stockListUtils.moveDownStock(store.chosenStockListIndex)"
|
||||||
>
|
>
|
||||||
<ChevronDownIcon />
|
<ChevronDown :stroke-width="2.5" />
|
||||||
{{ $t('stocklist.action-move-down') }}
|
{{ $t('stocklist.action-move-down') }}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
@@ -93,7 +103,7 @@
|
|||||||
:tabindex="store.chosenStockListIndex == -1 ? -1 : 0"
|
:tabindex="store.chosenStockListIndex == -1 ? -1 : 0"
|
||||||
@click="stockListUtils.removeStock(store.chosenStockListIndex)"
|
@click="stockListUtils.removeStock(store.chosenStockListIndex)"
|
||||||
>
|
>
|
||||||
<TrashIcon />
|
<Trash2 :stroke-width="2.5" />
|
||||||
{{ $t('stocklist.action-remove') }}
|
{{ $t('stocklist.action-remove') }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -108,33 +118,38 @@ import { isTractionUnit } from '../../../utils/vehicleUtils';
|
|||||||
import { useFileUtils } from '../../../utils/fileUtils';
|
import { useFileUtils } from '../../../utils/fileUtils';
|
||||||
import stockMixin from '../../../mixins/stockMixin';
|
import stockMixin from '../../../mixins/stockMixin';
|
||||||
import { useStockListUtils } from '../../../utils/stockListUtils';
|
import { useStockListUtils } from '../../../utils/stockListUtils';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ArrowDownTrayIcon,
|
Bookmark,
|
||||||
ArrowPathIcon,
|
ChevronDown,
|
||||||
ArrowUturnLeftIcon,
|
ChevronUp,
|
||||||
BookmarkIcon,
|
ClipboardCopy,
|
||||||
ChevronDownIcon,
|
ClipboardPaste,
|
||||||
ChevronUpIcon,
|
Download,
|
||||||
ClipboardDocumentCheckIcon,
|
FolderDown,
|
||||||
DocumentDuplicateIcon,
|
FolderUp,
|
||||||
FolderPlusIcon,
|
ListRestart,
|
||||||
TrashIcon,
|
Repeat,
|
||||||
} from '@heroicons/vue/20/solid';
|
Shuffle,
|
||||||
|
Trash2,
|
||||||
|
} from 'lucide-vue-next';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
mixins: [stockMixin],
|
mixins: [stockMixin],
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
ArrowDownTrayIcon,
|
Bookmark,
|
||||||
ArrowPathIcon,
|
ChevronDown,
|
||||||
ArrowUturnLeftIcon,
|
ChevronUp,
|
||||||
BookmarkIcon,
|
ClipboardCopy,
|
||||||
ChevronDownIcon,
|
ClipboardPaste,
|
||||||
ChevronUpIcon,
|
Download,
|
||||||
ClipboardDocumentCheckIcon,
|
FolderUp,
|
||||||
DocumentDuplicateIcon,
|
ListRestart,
|
||||||
FolderPlusIcon,
|
Repeat,
|
||||||
TrashIcon,
|
Shuffle,
|
||||||
|
FolderDown,
|
||||||
|
Trash2,
|
||||||
},
|
},
|
||||||
|
|
||||||
data: () => ({
|
data: () => ({
|
||||||
@@ -196,6 +211,22 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
turnAroundCars() {
|
||||||
|
if (this.store.stockList.length <= 1) return;
|
||||||
|
|
||||||
|
const isFirstTractionUnit = isTractionUnit(this.store.stockList[0].vehicleRef);
|
||||||
|
|
||||||
|
const sliceToSwap = isFirstTractionUnit
|
||||||
|
? this.store.stockList.slice(1)
|
||||||
|
: this.store.stockList.slice();
|
||||||
|
|
||||||
|
sliceToSwap.reverse();
|
||||||
|
|
||||||
|
if (isFirstTractionUnit) sliceToSwap.unshift(this.store.stockList[0]);
|
||||||
|
|
||||||
|
this.store.stockList = sliceToSwap;
|
||||||
|
},
|
||||||
|
|
||||||
downloadStock() {
|
downloadStock() {
|
||||||
if (this.store.stockList.length == 0) return alert(this.$t('stocklist.alert-empty'));
|
if (this.store.stockList.length == 0) return alert(this.$t('stocklist.alert-empty'));
|
||||||
|
|
||||||
|
|||||||
@@ -1,20 +1,26 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="stock_specs">
|
<div class="stock-specs">
|
||||||
<div v-if="store.chosenStorageStockName || chosenRealComposition">
|
<div v-if="store.chosenStorageStockName || chosenRealComposition">
|
||||||
<b class="bookmarked-stock-info" v-if="store.chosenStorageStockName">
|
<b v-if="store.chosenStorageStockName">
|
||||||
<span
|
<span
|
||||||
class="text--accent"
|
class="text--accent"
|
||||||
:title="store.chosenStorageStockName.length > 41 ? store.chosenStorageStockName : ''"
|
:title="store.chosenStorageStockName.length > 41 ? store.chosenStorageStockName : ''"
|
||||||
>
|
>
|
||||||
<BookmarkIcon />
|
<BookmarkCheck :size="19" />
|
||||||
{{ store.chosenStorageStockName.slice(0, 40) }}
|
{{ store.chosenStorageStockName.slice(0, 40) }}
|
||||||
{{ store.chosenStorageStockName.length > 41 ? '...' : '' }}
|
{{ store.chosenStorageStockName.length > 41 ? '...' : '' }}
|
||||||
</span>
|
</span>
|
||||||
</b>
|
</b>
|
||||||
|
|
||||||
<span v-if="store.chosenStorageStockName && chosenRealComposition"> | </span>
|
<span v-if="store.chosenStorageStockName && chosenRealComposition"> | </span>
|
||||||
|
|
||||||
<b class="real-stock-info" v-if="chosenRealComposition">
|
<b class="real-stock-info" v-if="chosenRealComposition">
|
||||||
<span class="text--accent">
|
<span class="text--accent">
|
||||||
<img :src="getIconURL(chosenRealComposition.type)" :alt="chosenRealComposition.type" />
|
<img
|
||||||
|
class="real-stock-icon"
|
||||||
|
:src="getIconURL(chosenRealComposition.type)"
|
||||||
|
:alt="chosenRealComposition.type"
|
||||||
|
/>
|
||||||
{{ chosenRealComposition.number }} {{ chosenRealComposition.name }}
|
{{ chosenRealComposition.number }} {{ chosenRealComposition.name }}
|
||||||
</span>
|
</span>
|
||||||
</b>
|
</b>
|
||||||
@@ -40,10 +46,10 @@
|
|||||||
import { defineComponent } from 'vue';
|
import { defineComponent } from 'vue';
|
||||||
import { useStore } from '../../../store';
|
import { useStore } from '../../../store';
|
||||||
import imageMixin from '../../../mixins/imageMixin';
|
import imageMixin from '../../../mixins/imageMixin';
|
||||||
import { BookmarkIcon } from '@heroicons/vue/20/solid';
|
import { BookmarkCheck } from 'lucide-vue-next';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: { BookmarkIcon },
|
components: { BookmarkCheck },
|
||||||
|
|
||||||
mixins: [imageMixin],
|
mixins: [imageMixin],
|
||||||
|
|
||||||
@@ -62,11 +68,11 @@ export default defineComponent({
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.bookmarked-stock-info,
|
.real-stock-icon {
|
||||||
.real-stock-info {
|
height: 1.3ch;
|
||||||
svg,
|
}
|
||||||
img {
|
|
||||||
height: 1.3ch;
|
.stock-specs svg {
|
||||||
}
|
vertical-align: text-top;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -68,6 +68,7 @@
|
|||||||
"action-copy": "COPY TO CLIPBOARD",
|
"action-copy": "COPY TO CLIPBOARD",
|
||||||
"action-reset": "RESET",
|
"action-reset": "RESET",
|
||||||
"action-shuffle": "SHUFFLE",
|
"action-shuffle": "SHUFFLE",
|
||||||
|
"action-switch": "TURN AROUND",
|
||||||
"action-bookmark": "BOOKMARK",
|
"action-bookmark": "BOOKMARK",
|
||||||
"mass": "Mass",
|
"mass": "Mass",
|
||||||
"mass-accepted": "accepted",
|
"mass-accepted": "accepted",
|
||||||
|
|||||||
@@ -68,6 +68,7 @@
|
|||||||
"action-copy": "SKOPIUJ DO SCHOWKA",
|
"action-copy": "SKOPIUJ DO SCHOWKA",
|
||||||
"action-reset": "ZRESETUJ",
|
"action-reset": "ZRESETUJ",
|
||||||
"action-shuffle": "PRZETASUJ",
|
"action-shuffle": "PRZETASUJ",
|
||||||
|
"action-switch": "ODWRÓĆ",
|
||||||
"action-bookmark": "ZAPISZ",
|
"action-bookmark": "ZAPISZ",
|
||||||
"mass": "Masa",
|
"mass": "Masa",
|
||||||
"mass-accepted": "dopuszczalna",
|
"mass-accepted": "dopuszczalna",
|
||||||
|
|||||||
+1
-1
@@ -64,7 +64,7 @@ export const useStore = defineStore({
|
|||||||
chosenStorageStockName: '',
|
chosenStorageStockName: '',
|
||||||
chosenStorageStockString: '',
|
chosenStorageStockString: '',
|
||||||
|
|
||||||
compatibleSimulatorVersion: '2024.3.1',
|
compatibleSimulatorVersion: '2025.1.1',
|
||||||
}),
|
}),
|
||||||
|
|
||||||
getters: {
|
getters: {
|
||||||
|
|||||||
+10
-1
@@ -128,14 +128,23 @@ button {
|
|||||||
&:hover::after,
|
&:hover::after,
|
||||||
&:focus-visible::after {
|
&:focus-visible::after {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
transform: translateX(10px);
|
|
||||||
|
|
||||||
content: attr(data-tooltip);
|
content: attr(data-tooltip);
|
||||||
color: white;
|
color: white;
|
||||||
background: black;
|
background: black;
|
||||||
|
border-radius: 0.5em;
|
||||||
|
margin: 0 0.75em;
|
||||||
padding: 0.5em;
|
padding: 0.5em;
|
||||||
|
|
||||||
max-width: 300px;
|
max-width: 300px;
|
||||||
|
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
|
|
||||||
|
@media screen and (max-width: $breakpointSm) {
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, 3ex);
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user