refactor(scenery): improved components visibility on API data loading

This commit is contained in:
2026-03-22 14:04:49 +01:00
parent d643259102
commit eae62a8064
4 changed files with 171 additions and 172 deletions
+1 -15
View File
@@ -1,10 +1,6 @@
<template> <template>
<section class="info-header"> <section class="info-header">
<button <button class="btn btn-return" :title="$t('scenery.return-btn')" @click="onReturnButtonClick">
class="btn btn-return"
:title="$t('scenery.return-btn')"
@click="onReturnButtonClick"
>
<img src="/images/icon-back.svg" alt="return button" /> <img src="/images/icon-back.svg" alt="return button" />
</button> </button>
@@ -12,10 +8,6 @@
{{ stationName.replace(/_/g, ' ') }} {{ stationName.replace(/_/g, ' ') }}
</a> </a>
<div class="scenery-abbrev" v-if="station?.generalInfo?.abbr">
{{ $t('scenery.abbrev') }} <b>{{ station.generalInfo.abbr }}</b>
</div>
<div class="scenery-hash" v-if="onlineScenery?.hash">#{{ onlineScenery.hash }}</div> <div class="scenery-hash" v-if="onlineScenery?.hash">#{{ onlineScenery.hash }}</div>
</section> </section>
</template> </template>
@@ -81,13 +73,7 @@ function onReturnButtonClick() {
text-transform: uppercase; text-transform: uppercase;
} }
.scenery-abbrev {
font-size: 1.3em;
color: #aaa;
}
.scenery-hash { .scenery-hash {
margin-top: 0.5em;
color: #aaa; color: #aaa;
font-size: 1.2em; font-size: 1.2em;
} }
+30 -22
View File
@@ -1,29 +1,32 @@
<template> <template>
<div class="scenery-info"> <div class="scenery-info">
<section> <section>
<div class="info-station-data" v-if="apiStore.dataStatuses.sceneries == Status.Data.Loaded">
<SceneryInfoIcons :station="station" /> <SceneryInfoIcons :station="station" />
<SceneryInfoGeneral :station="station" /> <SceneryInfoGeneral :station="station" />
<SceneryInfoRoutes v-if="station" :station="station" /> <SceneryInfoRoutes v-if="station" :station="station" />
<SceneryInfoAuthors :station="station" /> <SceneryInfoAuthors :station="station" />
</div>
<div style="margin: 1em 0; height: 2px; background-color: white"></div> <div class="info-station-loading" v-else>
<Loading />
</div>
<div class="info-divider"></div>
<!-- info dispatcher -->
<SceneryInfoDispatcher :onlineScenery="onlineScenery" /> <SceneryInfoDispatcher :onlineScenery="onlineScenery" />
<div class="info-lists"> <div class="info-online-lists">
<!-- user list -->
<SceneryInfoUserList :onlineScenery="onlineScenery" :station="station" /> <SceneryInfoUserList :onlineScenery="onlineScenery" :station="station" />
<!-- spawn list -->
<SceneryInfoSpawnList :onlineScenery="onlineScenery" /> <SceneryInfoSpawnList :onlineScenery="onlineScenery" />
</div> </div>
</section> </section>
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts" setup>
import { PropType, defineComponent } from 'vue'; import { PropType } from 'vue';
import { ActiveScenery, Station, Status } from '../../typings/common';
import SceneryInfoDispatcher from './SceneryInfo/SceneryInfoDispatcher.vue'; import SceneryInfoDispatcher from './SceneryInfo/SceneryInfoDispatcher.vue';
import SceneryInfoIcons from './SceneryInfo/SceneryInfoIcons.vue'; import SceneryInfoIcons from './SceneryInfo/SceneryInfoIcons.vue';
@@ -32,20 +35,12 @@ import SceneryInfoSpawnList from './SceneryInfo/SceneryInfoSpawnList.vue';
import SceneryInfoRoutes from './SceneryInfo/SceneryInfoRoutes.vue'; import SceneryInfoRoutes from './SceneryInfo/SceneryInfoRoutes.vue';
import SceneryInfoGeneral from './SceneryInfo/SceneryInfoGeneral.vue'; import SceneryInfoGeneral from './SceneryInfo/SceneryInfoGeneral.vue';
import SceneryInfoAuthors from './SceneryInfo/SceneryInfoAuthors.vue'; import SceneryInfoAuthors from './SceneryInfo/SceneryInfoAuthors.vue';
import { useApiStore } from '../../store/apiStore';
import Loading from '../Global/Loading.vue';
import { ActiveScenery, Station } from '../../typings/common'; const apiStore = useApiStore();
export default defineComponent({ defineProps({
components: {
SceneryInfoDispatcher,
SceneryInfoGeneral,
SceneryInfoIcons,
SceneryInfoAuthors,
SceneryInfoUserList,
SceneryInfoSpawnList,
SceneryInfoRoutes
},
props: {
station: { station: {
type: Object as PropType<Station> type: Object as PropType<Station>
}, },
@@ -53,14 +48,21 @@ export default defineComponent({
onlineScenery: { onlineScenery: {
type: Object as PropType<ActiveScenery> type: Object as PropType<ActiveScenery>
} }
}
}); });
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@use '../../styles/responsive'; @use '../../styles/responsive';
.info-lists { .info-station-loading {
display: flex;
align-items: center;
justify-content: center;
min-height: 300px;
}
.info-online-lists {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
justify-content: space-around; justify-content: space-around;
@@ -68,6 +70,12 @@ export default defineComponent({
margin-top: 1em; margin-top: 1em;
} }
.info-divider {
margin: 1em 0;
height: 3px;
background-color: #5b5b5b;
}
.scenery-topic a { .scenery-topic a {
font-weight: bold; font-weight: bold;
} }
@@ -5,8 +5,13 @@
</div> </div>
<div v-else> <div v-else>
<div>
<span> <span>
<b>{{ $t('availability.title') }}:</b> <b>{{ $t('scenery.abbrev') }}</b> {{ station.generalInfo.abbr }}
</span>
<span>
&bull; <b>{{ $t('availability.title') }}:</b>
{{ $t(`availability.${station.generalInfo.availability}`) }} {{ $t(`availability.${station.generalInfo.availability}`) }}
<span v-if="station.generalInfo.reqLevel > -1"> <span v-if="station.generalInfo.reqLevel > -1">
@@ -51,6 +56,7 @@
{{ additionalTools.join(', ') }} {{ additionalTools.join(', ') }}
</span> </span>
</div> </div>
</div>
</section> </section>
</template> </template>
@@ -84,9 +90,9 @@ export default defineComponent({
display: flex; display: flex;
justify-content: center; justify-content: center;
flex-wrap: wrap; flex-wrap: wrap;
}
div { .scenery-abbrev {
margin: 0 0.15em; font-size: 1.05em;
}
} }
</style> </style>
@@ -1,5 +1,6 @@
<template> <template>
<section class="info-icons"> <section class="info-icons-section">
<div class="icons-box">
<span v-if="!station || !station.generalInfo"> <span v-if="!station || !station.generalInfo">
<img <img
class="icon-info" class="icon-info"
@@ -12,7 +13,7 @@
<span <span
v-if="station?.generalInfo && station?.generalInfo.reqLevel >= 0" v-if="station?.generalInfo && station?.generalInfo.reqLevel >= 0"
class="scenery-icon icon-info level" class="scenery-icon icon-info level"
:style="calculateExpStyle(station?.generalInfo.reqLevel)" :style="calculateExpStyles(station?.generalInfo.reqLevel)"
> >
{{ station?.generalInfo.reqLevel >= 2 ? station?.generalInfo.reqLevel : 'L' }} {{ station?.generalInfo.reqLevel >= 2 ? station?.generalInfo.reqLevel : 'L' }}
</span> </span>
@@ -83,33 +84,31 @@
alt="dSAT ASDEK" alt="dSAT ASDEK"
:title="$t('sceneries.info.ASDEK')" :title="$t('sceneries.info.ASDEK')"
/> />
</div>
</section> </section>
</template> </template>
<script lang="ts"> <script lang="ts" setup>
import { PropType, defineComponent } from 'vue'; import { PropType } from 'vue';
import styleMixin from '../../../mixins/styleMixin';
import { Station } from '../../../typings/common'; import { Station } from '../../../typings/common';
import { calculateExpStyles } from '../../../composables/badge';
export default defineComponent({ defineProps({
mixins: [styleMixin],
props: {
station: { station: {
type: Object as PropType<Station> type: Object as PropType<Station>
} }
}
}); });
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@use '../../../styles/icons'; @use '../../../styles/icons';
.info-icons { .icons-box {
display: flex; display: flex;
justify-content: center; justify-content: center;
flex-wrap: wrap; flex-wrap: wrap;
margin: 1em; margin: 0.5em;
} }
.icon-info { .icon-info {