2022-12-23 15:21:55 +09:00
|
|
|
<template>
|
|
|
|
<div class="wbrkwale">
|
2022-12-30 13:52:40 +09:00
|
|
|
<Transition :name="$store.state.animation ? '_transition_zoom' : ''" mode="out-in">
|
2022-12-26 14:34:46 +09:00
|
|
|
<MkLoading v-if="fetching"/>
|
|
|
|
<div v-else class="instances">
|
|
|
|
<MkA v-for="(instance, i) in instances" :key="instance.id" v-tooltip.mfm.noDelay="`${instance.name}\n${instance.host}\n${instance.softwareName} ${instance.softwareVersion}`" :to="`/instance-info/${instance.host}`" class="instance">
|
|
|
|
<MkInstanceCardMini :instance="instance"/>
|
|
|
|
</MkA>
|
|
|
|
</div>
|
2022-12-30 13:37:14 +09:00
|
|
|
</Transition>
|
2022-12-23 15:21:55 +09:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
|
import { onMounted, onUnmounted, ref } from 'vue';
|
|
|
|
import * as os from '@/os';
|
|
|
|
import { useInterval } from '@/scripts/use-interval';
|
|
|
|
import MkInstanceCardMini from '@/components/MkInstanceCardMini.vue';
|
|
|
|
|
|
|
|
const instances = ref([]);
|
|
|
|
const fetching = ref(true);
|
|
|
|
|
|
|
|
const fetch = async () => {
|
|
|
|
const fetchedInstances = await os.api('federation/instances', {
|
|
|
|
sort: '+lastCommunicatedAt',
|
|
|
|
limit: 6,
|
|
|
|
});
|
|
|
|
instances.value = fetchedInstances;
|
|
|
|
fetching.value = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
useInterval(fetch, 1000 * 60, {
|
|
|
|
immediate: true,
|
|
|
|
afterMounted: true,
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
2022-12-27 18:29:39 +09:00
|
|
|
<style lang="scss" scoped>
|
2022-12-23 15:21:55 +09:00
|
|
|
.wbrkwale {
|
|
|
|
> .instances {
|
|
|
|
display: grid;
|
2022-12-26 13:40:20 +09:00
|
|
|
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
|
2022-12-23 15:21:55 +09:00
|
|
|
grid-gap: 12px;
|
|
|
|
|
|
|
|
> .instance:hover {
|
|
|
|
text-decoration: none;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|