2022-12-23 08:21:55 +02:00
|
|
|
<template>
|
|
|
|
<div class="wbrkwale">
|
|
|
|
<MkLoading v-if="fetching"/>
|
2022-12-23 09:46:08 +02:00
|
|
|
<div v-else class="instances">
|
2022-12-23 08:21:55 +02:00
|
|
|
<MkA v-for="(instance, i) in instances" :key="instance.id" :to="`/instance-info/${instance.host}`" class="instance">
|
|
|
|
<MkInstanceCardMini :instance="instance"/>
|
|
|
|
</MkA>
|
2022-12-23 09:46:08 +02:00
|
|
|
</div>
|
2022-12-23 08:21:55 +02: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>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.wbrkwale {
|
|
|
|
> .instances {
|
|
|
|
display: grid;
|
|
|
|
grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
|
|
|
|
grid-gap: 12px;
|
|
|
|
|
|
|
|
> .instance:hover {
|
|
|
|
text-decoration: none;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|