2020-12-16 16:54:41 +00:00
|
|
|
<!--
|
|
|
|
- Copyright 2020 James Lyne
|
|
|
|
-
|
|
|
|
- Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
- you may not use this file except in compliance with the License.
|
|
|
|
- You may obtain a copy of the License at
|
|
|
|
-
|
|
|
|
- http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
-
|
|
|
|
- Unless required by applicable law or agreed to in writing, software
|
|
|
|
- distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
- See the License for the specific language governing permissions and
|
|
|
|
- limitations under the License.
|
|
|
|
-->
|
|
|
|
|
2020-11-23 12:13:28 +00:00
|
|
|
<template>
|
2021-05-25 18:26:14 +00:00
|
|
|
<CollapsibleSection name="maps">
|
|
|
|
<template v-slot:heading>{{ heading }}</template>
|
|
|
|
<template v-slot:default>
|
2021-05-28 13:41:24 +00:00
|
|
|
<RadioList v-if="worlds.size" class="section__content" aria-labelledby="maps-heading">
|
2021-05-28 13:50:32 +00:00
|
|
|
<WorldListItem :world="world" v-for="[name, world] in worlds" :key="`${prefix}_${currentServer}_${name}`"></WorldListItem>
|
2021-05-27 18:16:45 +00:00
|
|
|
</RadioList>
|
2021-05-28 23:09:00 +00:00
|
|
|
<div v-else class="section__content section__skeleton">{{ skeletonWorlds }}</div>
|
2021-05-25 18:26:14 +00:00
|
|
|
</template>
|
|
|
|
</CollapsibleSection>
|
2020-11-23 12:13:28 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import WorldListItem from './WorldListItem.vue';
|
|
|
|
import {defineComponent} from 'vue';
|
|
|
|
import {useStore} from "@/store";
|
2021-05-25 18:26:14 +00:00
|
|
|
import CollapsibleSection from "@/components/sidebar/CollapsibleSection.vue";
|
2021-05-27 18:16:45 +00:00
|
|
|
import RadioList from "@/components/util/RadioList.vue";
|
2020-11-23 12:13:28 +00:00
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
name: 'WorldList',
|
|
|
|
components: {
|
2021-05-27 18:16:45 +00:00
|
|
|
RadioList,
|
2021-05-25 18:26:14 +00:00
|
|
|
CollapsibleSection,
|
2021-05-17 13:17:52 +00:00
|
|
|
WorldListItem
|
2020-11-23 12:13:28 +00:00
|
|
|
},
|
|
|
|
|
2021-05-28 13:50:32 +00:00
|
|
|
props: {
|
|
|
|
prefix: {
|
|
|
|
type: String,
|
|
|
|
default: 'map',
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2020-11-23 12:13:28 +00:00
|
|
|
computed: {
|
2020-12-15 22:11:29 +00:00
|
|
|
heading() {
|
2021-05-20 15:39:41 +00:00
|
|
|
return useStore().state.messages.worldsHeading;
|
|
|
|
},
|
|
|
|
|
|
|
|
skeletonWorlds() {
|
|
|
|
return useStore().state.messages.worldsSkeleton;
|
2020-12-15 22:11:29 +00:00
|
|
|
},
|
|
|
|
|
2020-11-23 12:13:28 +00:00
|
|
|
worlds() {
|
|
|
|
return useStore().state.worlds;
|
2021-05-27 18:16:45 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
currentServer() {
|
2021-05-28 13:50:32 +00:00
|
|
|
const store = useStore();
|
|
|
|
return store.state.currentServer ? store.state.currentServer.id : undefined;
|
2020-11-23 12:13:28 +00:00
|
|
|
}
|
2021-05-25 18:26:14 +00:00
|
|
|
}
|
2020-11-23 12:13:28 +00:00
|
|
|
});
|
|
|
|
</script>
|