From c5d116e2dbb1c67bc19775ba38129e2f11159ffc Mon Sep 17 00:00:00 2001 From: Spythere Date: Mon, 6 Nov 2023 21:20:07 +0100 Subject: [PATCH] added alphabetical cargo sort --- src/components/tabs/StockGeneratorTab.vue | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/components/tabs/StockGeneratorTab.vue b/src/components/tabs/StockGeneratorTab.vue index d30da1f..a843b9b 100644 --- a/src/components/tabs/StockGeneratorTab.vue +++ b/src/components/tabs/StockGeneratorTab.vue @@ -37,13 +37,13 @@
@@ -129,6 +129,19 @@ export default defineComponent({ computedChosenCarTypes() { return new Set(this.chosenCarTypes.slice().sort((c1, c2) => (c1 > c2 ? 1 : -1))); }, + + computedCargoData() { + if (!this.store.stockData?.generator.cargo) return []; + + const cargoGeneratorData = this.store.stockData.generator.cargo; + + return Object.keys(cargoGeneratorData) + .sort((v1, v2) => this.$t(`cargo.${v1}`).localeCompare(this.$t(`cargo.${v2}`))) + .map((v) => ({ + name: v, + cargoList: cargoGeneratorData[v], + })); + }, }, methods: {