mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 21:38:13 +00:00
refactor typów danych
This commit is contained in:
@@ -29,8 +29,8 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, Ref, ref } from 'vue';
|
||||
import { useStore } from '../../store/store';
|
||||
import { regions as regionsJSON } from '../../data/options.json';
|
||||
import { useStore } from '../../store/mainStore';
|
||||
|
||||
interface Item {
|
||||
id: string;
|
||||
|
||||
@@ -16,12 +16,12 @@
|
||||
<script lang="ts">
|
||||
import { PropType, defineComponent } from 'vue';
|
||||
import dateMixin from '../../mixins/dateMixin';
|
||||
import { DispatcherStatus } from '../../scripts/enums/DispatcherStatus';
|
||||
import { Status } from '../../typings/common';
|
||||
|
||||
export default defineComponent({
|
||||
props: {
|
||||
dispatcherStatus: {
|
||||
type: Number as PropType<DispatcherStatus | number>
|
||||
type: Number as PropType<Status.ActiveDispatcher | number>
|
||||
},
|
||||
isOnline: {
|
||||
type: Boolean
|
||||
@@ -34,25 +34,25 @@ export default defineComponent({
|
||||
if (!this.dispatcherStatus) return 'free';
|
||||
|
||||
switch (this.dispatcherStatus) {
|
||||
case DispatcherStatus.AFK:
|
||||
case Status.ActiveDispatcher.AFK:
|
||||
return 'afk';
|
||||
|
||||
case DispatcherStatus.ENDING:
|
||||
case Status.ActiveDispatcher.ENDING:
|
||||
return 'ending';
|
||||
|
||||
case DispatcherStatus.INVALID:
|
||||
case Status.ActiveDispatcher.INVALID:
|
||||
return 'invalid';
|
||||
|
||||
case DispatcherStatus.NOT_LOGGED_IN:
|
||||
case Status.ActiveDispatcher.NOT_LOGGED_IN:
|
||||
return 'not-signed';
|
||||
|
||||
case DispatcherStatus.NO_SPACE:
|
||||
case Status.ActiveDispatcher.NO_SPACE:
|
||||
return 'no-space';
|
||||
|
||||
case DispatcherStatus.UNAVAILABLE:
|
||||
case Status.ActiveDispatcher.UNAVAILABLE:
|
||||
return 'unavailable';
|
||||
|
||||
case DispatcherStatus.UNKNOWN:
|
||||
case Status.ActiveDispatcher.UNKNOWN:
|
||||
return 'unknown';
|
||||
|
||||
default:
|
||||
|
||||
@@ -50,8 +50,8 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { PropType, defineComponent } from 'vue';
|
||||
import { useStore } from '../../store/store';
|
||||
import { RollingStockInfo } from '../../scripts/interfaces/github_api/StockInfoGithubData';
|
||||
import { useStore } from '../../store/mainStore';
|
||||
import { API } from '../../typings/api';
|
||||
|
||||
export default defineComponent({
|
||||
props: {
|
||||
@@ -71,7 +71,7 @@ export default defineComponent({
|
||||
onImageError(event: Event, stockName: string) {
|
||||
const fallbackName =
|
||||
Object.keys(this.store.rollingStockData!.info).find((type) => {
|
||||
return this.store.rollingStockData!.info[type as keyof RollingStockInfo].find(
|
||||
return this.store.rollingStockData!.info[type as keyof API.RollingStock.Info].find(
|
||||
(v) => v[0] === stockName.split(':')[0]
|
||||
);
|
||||
}) || 'vehicle-unknown';
|
||||
|
||||
@@ -51,16 +51,16 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { PropType, defineComponent } from 'vue';
|
||||
import dateMixin from '../../mixins/dateMixin';
|
||||
import TrainStop from '../../scripts/interfaces/TrainStop';
|
||||
import { TrainStop } from '../../store/typings';
|
||||
|
||||
export default defineComponent({
|
||||
mixins: [dateMixin],
|
||||
|
||||
props: {
|
||||
stop: {
|
||||
type: Object as () => TrainStop,
|
||||
type: Object as PropType<TrainStop>,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
import { defineComponent } from 'vue';
|
||||
import modalTrainMixin from '../../mixins/modalTrainMixin';
|
||||
import trainInfoMixin from '../../mixins/trainInfoMixin';
|
||||
import { useStore } from '../../store/store';
|
||||
import TrainInfo from '../TrainsView/TrainInfo.vue';
|
||||
import TrainSchedule from '../TrainsView/TrainSchedule.vue';
|
||||
|
||||
@@ -30,14 +29,6 @@ export default defineComponent({
|
||||
};
|
||||
},
|
||||
|
||||
setup() {
|
||||
const store = useStore();
|
||||
|
||||
return {
|
||||
store
|
||||
};
|
||||
},
|
||||
|
||||
activated() {
|
||||
const contentEl = this.$refs['content'] as HTMLElement;
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { useStore } from '../../store/store';
|
||||
import { RollingStockInfo } from '../../scripts/interfaces/github_api/StockInfoGithubData';
|
||||
import { useStore } from '../../store/mainStore';
|
||||
import { API } from '../../typings/api';
|
||||
|
||||
export default defineComponent({
|
||||
props: {
|
||||
@@ -54,7 +54,7 @@ export default defineComponent({
|
||||
|
||||
return (
|
||||
Object.keys(this.store.rollingStockData.info).find((type) => {
|
||||
return this.store.rollingStockData?.info[type as keyof RollingStockInfo].find(
|
||||
return this.store.rollingStockData?.info[type as keyof API.RollingStock.Info].find(
|
||||
(v) => v[0] === this.name.split(':')[0]
|
||||
);
|
||||
}) || 'vehicle-unknown'
|
||||
|
||||
Reference in New Issue
Block a user