diff --git a/.eslintrc.cjs b/.eslintrc.cjs new file mode 100644 index 0000000..7c4376e --- /dev/null +++ b/.eslintrc.cjs @@ -0,0 +1,18 @@ +/* eslint-env node */ +require('@rushstack/eslint-patch/modern-module-resolution') + +module.exports = { + root: true, + extends: [ + 'plugin:vue/vue3-essential', + 'eslint:recommended', + '@vue/eslint-config-typescript', + '@vue/eslint-config-prettier/skip-formatting' + ], + rules: { + 'vue/multi-word-component-names': 'off' + }, + parserOptions: { + ecmaVersion: 'latest' + } +} diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..6b858bb --- /dev/null +++ b/.prettierrc @@ -0,0 +1,7 @@ +{ + "$schema": "https://json.schemastore.org/prettierrc", + "tabWidth": 2, + "singleQuote": true, + "printWidth": 100, + "trailingComma": "none" +} diff --git a/package-lock.json b/package-lock.json index f1e7b8f..7da9f64 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,6 +24,7 @@ "@vite-pwa/assets-generator": "^0.0.10", "@vitejs/plugin-vue": "^4.3.4", "axios": "^1.5.0", + "prettier": "^3.0.3", "typescript": "^5.2.2", "vite": "^4.4.9", "vite-plugin-pwa": "^0.16.5", @@ -5440,6 +5441,21 @@ "node": ">=6" } }, + "node_modules/prettier": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.3.tgz", + "integrity": "sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==", + "dev": true, + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/pretty-bytes": { "version": "6.1.1", "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-6.1.1.tgz", @@ -10873,6 +10889,12 @@ } } }, + "prettier": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.3.tgz", + "integrity": "sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==", + "dev": true + }, "pretty-bytes": { "version": "6.1.1", "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-6.1.1.tgz", diff --git a/package.json b/package.json index cff0342..6721d4c 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,10 @@ "dev": "vite", "build": "vue-tsc --noEmit && vite build", "deploy": "yarn build && firebase deploy --only hosting", - "preview": "yarn build && vite preview" + "preview": "yarn build && vite preview", + "type-check": "vue-tsc --noEmit -p tsconfig.app.json --composite false", + "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore", + "format": "prettier --write src/" }, "dependencies": { "core-js": "^3.32.2", @@ -25,10 +28,17 @@ "@vite-pwa/assets-generator": "^0.0.10", "@vitejs/plugin-vue": "^4.3.4", "axios": "^1.5.0", + "prettier": "^3.0.3", "typescript": "^5.2.2", "vite": "^4.4.9", "vite-plugin-pwa": "^0.16.5", - "vue-tsc": "^1.8.11" + "vue-tsc": "^1.8.11", + "@vue/eslint-config-prettier": "^8.0.0", + "@vue/eslint-config-typescript": "^12.0.0", + "@vue/tsconfig": "^0.4.0", + "eslint": "^8.49.0", + "eslint-plugin-vue": "^9.17.0", + "@rushstack/eslint-patch": "^1.3.3" }, "browserslist": [ "> 1%", diff --git a/src/App.scss b/src/App.scss index 8ceb3e8..267ed5e 100644 --- a/src/App.scss +++ b/src/App.scss @@ -1,105 +1,105 @@ -@import './styles/responsive.scss'; -@import './styles/variables.scss'; -@import './styles/global.scss'; - -// VUE ROUTE CHANGE ANIMATION -.view-anim { - &-enter-from, - &-leave-to { - opacity: 0.02; - } - - &-enter-active, - &-leave-active { - transition: all $animDuration $animType; - min-height: 100%; - } -} - -.modal-anim { - &-enter-active, - &-leave-active { - transition: all $animDuration $animType; - } - - &-enter-from, - &-leave-to { - transform: translateY(-25%); - opacity: 0; - } -} - -.route { - margin: 0 0.2em; - - &-active, - &[data-active='true'] { - color: $accentCol; - font-weight: bold; - } -} - -// APP -#app { - color: white; - font-size: 1rem; - - @include smallScreen() { - font-size: calc(0.55rem + 1.1vw); - } - - @include screenLandscape() { - font-size: calc(0.45rem + 0.8vw); - } -} - -// CONTAINER -.app_container { - display: flex; - flex-flow: column; - - min-height: 100vh; - - header { - flex: 0 0 auto; - } - - main { - flex: 1 1 auto; - - padding: 0 0.5em; - } - - footer { - flex: 0 1 0.2em; - } -} - -.warning { - background-color: firebrick; - text-align: center; - padding: 0.5em 0.4em; - max-width: 1100px; - margin: 0 auto; - - border-radius: 0 0 1em 1em; -} - -// FOOTER -footer.app_footer { - max-width: 100%; - padding: 0.5em; - - img { - width: 1.1em; - vertical-align: text-bottom; - } - - z-index: 10; - - background: #111; - color: white; - - text-align: center; - vertical-align: middle; -} +@import './styles/responsive.scss'; +@import './styles/variables.scss'; +@import './styles/global.scss'; + +// VUE ROUTE CHANGE ANIMATION +.view-anim { + &-enter-from, + &-leave-to { + opacity: 0.02; + } + + &-enter-active, + &-leave-active { + transition: all $animDuration $animType; + min-height: 100%; + } +} + +.modal-anim { + &-enter-active, + &-leave-active { + transition: all $animDuration $animType; + } + + &-enter-from, + &-leave-to { + transform: translateY(-25%); + opacity: 0; + } +} + +.route { + margin: 0 0.2em; + + &-active, + &[data-active='true'] { + color: $accentCol; + font-weight: bold; + } +} + +// APP +#app { + color: white; + font-size: 1rem; + + @include smallScreen() { + font-size: calc(0.55rem + 1.1vw); + } + + @include screenLandscape() { + font-size: calc(0.45rem + 0.8vw); + } +} + +// CONTAINER +.app_container { + display: flex; + flex-flow: column; + + min-height: 100vh; + + header { + flex: 0 0 auto; + } + + main { + flex: 1 1 auto; + + padding: 0 0.5em; + } + + footer { + flex: 0 1 0.2em; + } +} + +.warning { + background-color: firebrick; + text-align: center; + padding: 0.5em 0.4em; + max-width: 1100px; + margin: 0 auto; + + border-radius: 0 0 1em 1em; +} + +// FOOTER +footer.app_footer { + max-width: 100%; + padding: 0.5em; + + img { + width: 1.1em; + vertical-align: text-bottom; + } + + z-index: 10; + + background: #111; + color: white; + + text-align: center; + vertical-align: middle; +} diff --git a/src/App.vue b/src/App.vue index 3f7db36..63b481f 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,178 +1,176 @@ - - - - - + + + + + diff --git a/src/components/App/AppHeader.vue b/src/components/App/AppHeader.vue index ae710b4..36bc3da 100644 --- a/src/components/App/AppHeader.vue +++ b/src/components/App/AppHeader.vue @@ -1,237 +1,249 @@ - - - + + + diff --git a/src/components/App/Clock.vue b/src/components/App/Clock.vue index 6d66d13..8f0f0d1 100644 --- a/src/components/App/Clock.vue +++ b/src/components/App/Clock.vue @@ -1,36 +1,37 @@ - - - - - - \ No newline at end of file + + + + + diff --git a/src/components/App/StatusIndicator.vue b/src/components/App/StatusIndicator.vue index 0936a1c..b4acdaa 100644 --- a/src/components/App/StatusIndicator.vue +++ b/src/components/App/StatusIndicator.vue @@ -43,7 +43,13 @@ - + @@ -56,7 +62,13 @@ - + @@ -82,7 +94,12 @@ - + - + - + - + @@ -173,14 +205,14 @@ export default defineComponent({ indicator: { offline: false, status: DataStatus.Loading, - message: 'data-status.S3', + message: 'data-status.S3' }, greenLight: false, greenBlinkLight: false, redTopLight: false, orangeLight: false, - redBottomLight: false, + redBottomLight: false }; }, @@ -193,7 +225,7 @@ export default defineComponent({ return { dataStatus: store.dataStatuses, - store, + store }; }, @@ -248,8 +280,8 @@ export default defineComponent({ this.indicator.status = DataStatus.Loaded; this.indicator.message = 'data-status.S2'; } - }, - }, + } + } }, methods: { @@ -280,8 +312,8 @@ export default defineComponent({ if (status == DataStatus.Loading) { this.greenBlinkLight = true; } - }, - }, + } + } }); @@ -375,4 +407,3 @@ export default defineComponent({ } } - diff --git a/src/components/App/UpdateModal.vue b/src/components/App/UpdateModal.vue deleted file mode 100644 index e35539f..0000000 --- a/src/components/App/UpdateModal.vue +++ /dev/null @@ -1,168 +0,0 @@ - - - - - diff --git a/src/components/App/UpdatePrompt.vue b/src/components/App/UpdatePrompt.vue deleted file mode 100644 index 0dda26a..0000000 --- a/src/components/App/UpdatePrompt.vue +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - diff --git a/src/components/Global/ActionButton.vue b/src/components/Global/ActionButton.vue index 1c2f488..ae2163f 100644 --- a/src/components/Global/ActionButton.vue +++ b/src/components/Global/ActionButton.vue @@ -1,24 +1,24 @@ - - - - - \ No newline at end of file + + + + + diff --git a/src/components/Global/AddDataButton.vue b/src/components/Global/AddDataButton.vue index edf888a..7f242cd 100644 --- a/src/components/Global/AddDataButton.vue +++ b/src/components/Global/AddDataButton.vue @@ -15,18 +15,18 @@ export default defineComponent({ props: { scrollNoMoreData: { type: Boolean, - required: true, + required: true }, scrollDataLoaded: { type: Boolean, - required: true, + required: true }, list: { type: Array as PropType, - required: true, - }, + required: true + } }, emits: ['addHistoryData'], @@ -34,8 +34,8 @@ export default defineComponent({ methods: { addHistoryData() { this.$emit('addHistoryData'); - }, - }, + } + } }); diff --git a/src/components/Global/Loading.vue b/src/components/Global/Loading.vue index 0fb9bfa..d9e3c49 100644 --- a/src/components/Global/Loading.vue +++ b/src/components/Global/Loading.vue @@ -12,7 +12,7 @@ import { defineComponent } from 'vue'; export default defineComponent({ setup() { return {}; - }, + } }); diff --git a/src/components/Global/ProgressBar.vue b/src/components/Global/ProgressBar.vue index 211d228..f2a395f 100644 --- a/src/components/Global/ProgressBar.vue +++ b/src/components/Global/ProgressBar.vue @@ -1,62 +1,65 @@ - - - - - + + + + + diff --git a/src/components/Global/SearchBox.vue b/src/components/Global/SearchBox.vue index b8a4777..edefcb5 100644 --- a/src/components/Global/SearchBox.vue +++ b/src/components/Global/SearchBox.vue @@ -7,39 +7,34 @@ @keypress="updateValue" /> - exit-icon + exit-icon \ No newline at end of file + diff --git a/src/components/Global/SelectBox.vue b/src/components/Global/SelectBox.vue index 7331c63..8d57b1f 100644 --- a/src/components/Global/SelectBox.vue +++ b/src/components/Global/SelectBox.vue @@ -1,217 +1,224 @@ - - - - - + + + + + diff --git a/src/components/Global/StationStatusBadge.vue b/src/components/Global/StationStatusBadge.vue index eb54033..a02ffa1 100644 --- a/src/components/Global/StationStatusBadge.vue +++ b/src/components/Global/StationStatusBadge.vue @@ -1,90 +1,90 @@ - - - - - + + + + + diff --git a/src/components/Global/StockList.vue b/src/components/Global/StockList.vue index 42d1868..ae34f69 100644 --- a/src/components/Global/StockList.vue +++ b/src/components/Global/StockList.vue @@ -1,12 +1,17 @@ @@ -163,11 +160,7 @@ h3 { text-align: center; } - .last-timetables { overflow-y: auto; } - - - diff --git a/src/components/JournalView/JournalDispatchersList.vue b/src/components/JournalView/JournalDispatchersList.vue index 2e2f4de..a35b00b 100644 --- a/src/components/JournalView/JournalDispatchersList.vue +++ b/src/components/JournalView/JournalDispatchersList.vue @@ -1,241 +1,254 @@ - - - - - + + + + + diff --git a/src/components/JournalView/JournalDriverStats.vue b/src/components/JournalView/JournalDriverStats.vue index b5566b3..5ce8c5a 100644 --- a/src/components/JournalView/JournalDriverStats.vue +++ b/src/components/JournalView/JournalDriverStats.vue @@ -2,13 +2,17 @@

- {{ $t('journal.stats-title') }} {{ store.driverStatsName.toUpperCase() }} + {{ $t('journal.stats-title') }} + {{ store.driverStatsName.toUpperCase() }}

{{ $t('journal.stats-timetables') }} - {{ store.driverStatsData._count.fulfilled }} / {{ store.driverStatsData._count._all }} + {{ store.driverStatsData._count.fulfilled }} / + {{ store.driverStatsData._count._all }} @@ -39,7 +43,9 @@
- {{ $t('journal.stats-loading') }} + {{ + $t('journal.stats-loading') + }} {{ $t('journal.stats-error ') }} @@ -56,9 +62,9 @@ export default defineComponent({ data() { return { store: useStore(), - DataStatus, + DataStatus }; - }, + } }); diff --git a/src/components/JournalView/JournalOptions.vue b/src/components/JournalView/JournalOptions.vue index 45c6c72..528a06c 100644 --- a/src/components/JournalView/JournalOptions.vue +++ b/src/components/JournalView/JournalOptions.vue @@ -1,300 +1,303 @@ - - - - - + + + + + diff --git a/src/components/JournalView/JournalStats.vue b/src/components/JournalView/JournalStats.vue index daceb0a..c957b39 100644 --- a/src/components/JournalView/JournalStats.vue +++ b/src/components/JournalView/JournalStats.vue @@ -3,6 +3,7 @@
@@ -24,7 +28,7 @@ - - + + + + + diff --git a/src/components/JournalView/JournalTimetables/TimetableExtra.vue b/src/components/JournalView/JournalTimetables/TimetableExtra.vue index e1f98b8..0609a32 100644 --- a/src/components/JournalView/JournalTimetables/TimetableExtra.vue +++ b/src/components/JournalView/JournalTimetables/TimetableExtra.vue @@ -18,7 +18,11 @@ {{ $t('journal.stock-length') }} - {{ currentHistoryIndex == 0 ? timetable.stockLength : stockHistory[currentHistoryIndex].stockLength || timetable.stockLength }}m + {{ + currentHistoryIndex == 0 + ? timetable.stockLength + : stockHistory[currentHistoryIndex].stockLength || timetable.stockLength + }}m @@ -26,7 +30,11 @@ {{ $t('journal.stock-mass') }} {{ - Math.floor((currentHistoryIndex == 0 ? timetable.stockMass! : stockHistory[currentHistoryIndex].stockMass || timetable.stockMass) / 1000) + Math.floor( + (currentHistoryIndex == 0 + ? timetable.stockMass! + : stockHistory[currentHistoryIndex].stockMass || timetable.stockMass) / 1000 + ) }}t @@ -34,13 +42,26 @@
-
- + - - -
- - - - - -
- -
- - - - - + + + + + diff --git a/src/components/SceneryView/SceneryInfo/SceneryInfoDispatcher.vue b/src/components/SceneryView/SceneryInfo/SceneryInfoDispatcher.vue index 0fe14f6..ce0e542 100644 --- a/src/components/SceneryView/SceneryInfo/SceneryInfoDispatcher.vue +++ b/src/components/SceneryView/SceneryInfo/SceneryInfoDispatcher.vue @@ -3,7 +3,12 @@
{{ station.onlineInfo.dispatcherExp > 1 ? station.onlineInfo.dispatcherExp : 'L' }} @@ -30,7 +35,7 @@ @@ -98,4 +103,3 @@ export default defineComponent({ } } - diff --git a/src/components/SceneryView/SceneryInfo/SceneryInfoIcons.vue b/src/components/SceneryView/SceneryInfo/SceneryInfoIcons.vue index 9295c65..a084a38 100644 --- a/src/components/SceneryView/SceneryInfo/SceneryInfoIcons.vue +++ b/src/components/SceneryView/SceneryInfo/SceneryInfoIcons.vue @@ -76,7 +76,7 @@ @@ -118,4 +118,3 @@ export default defineComponent({ } } - diff --git a/src/components/SceneryView/SceneryInfo/SceneryInfoRoutes.vue b/src/components/SceneryView/SceneryInfo/SceneryInfoRoutes.vue index bab7fbf..22a43be 100644 --- a/src/components/SceneryView/SceneryInfo/SceneryInfoRoutes.vue +++ b/src/components/SceneryView/SceneryInfo/SceneryInfoRoutes.vue @@ -1,129 +1,142 @@ - - - - - + + + + + diff --git a/src/components/SceneryView/SceneryInfo/SceneryInfoSpawnList.vue b/src/components/SceneryView/SceneryInfo/SceneryInfoSpawnList.vue index ea416d0..3fc9810 100644 --- a/src/components/SceneryView/SceneryInfo/SceneryInfoSpawnList.vue +++ b/src/components/SceneryView/SceneryInfo/SceneryInfoSpawnList.vue @@ -1,65 +1,71 @@ - - - - - + + + + + diff --git a/src/components/SceneryView/SceneryInfo/SceneryInfoStats.vue b/src/components/SceneryView/SceneryInfo/SceneryInfoStats.vue index b52f33d..2ff8979 100644 --- a/src/components/SceneryView/SceneryInfo/SceneryInfoStats.vue +++ b/src/components/SceneryView/SceneryInfo/SceneryInfoStats.vue @@ -23,7 +23,10 @@ {{ station.onlineInfo?.scheduledTrains?.length || '0' }} / {{ station.onlineInfo?.scheduledTrains?.filter((train) => train.stopInfo.confirmed).length || '0' }} + >{{ + station.onlineInfo?.scheduledTrains?.filter((train) => train.stopInfo.confirmed) + .length || '0' + }} @@ -31,7 +34,7 @@ diff --git a/src/components/SceneryView/SceneryInfo/SceneryInfoUserList.vue b/src/components/SceneryView/SceneryInfo/SceneryInfoUserList.vue index a920397..6ac0afa 100644 --- a/src/components/SceneryView/SceneryInfo/SceneryInfoUserList.vue +++ b/src/components/SceneryView/SceneryInfo/SceneryInfoUserList.vue @@ -1,131 +1,136 @@ - - - - - + + + + + diff --git a/src/components/SceneryView/SceneryTimetable.vue b/src/components/SceneryView/SceneryTimetable.vue index 2385167..fe96aa8 100644 --- a/src/components/SceneryView/SceneryTimetable.vue +++ b/src/components/SceneryView/SceneryTimetable.vue @@ -1,457 +1,481 @@ - - - - - + + + + + diff --git a/src/components/SceneryView/SceneryTimetablesHistory.vue b/src/components/SceneryView/SceneryTimetablesHistory.vue index 186094d..14aff15 100644 --- a/src/components/SceneryView/SceneryTimetablesHistory.vue +++ b/src/components/SceneryView/SceneryTimetablesHistory.vue @@ -1,110 +1,117 @@ - - - - - + + + + + diff --git a/src/components/SceneryView/ScheduledTrainStatus.vue b/src/components/SceneryView/ScheduledTrainStatus.vue index 73a8ba3..c376d7a 100644 --- a/src/components/SceneryView/ScheduledTrainStatus.vue +++ b/src/components/SceneryView/ScheduledTrainStatus.vue @@ -1,6 +1,9 @@