|
1 | 1 | <script setup lang="ts"> |
| 2 | +import { LoaderCircleIcon } from '@modrinth/assets' |
2 | 3 | import type { GameVersion } from '@modrinth/ui' |
3 | 4 | import { GAME_MODES, HeadingLink, injectNotificationManager } from '@modrinth/ui' |
4 | 5 | import type { Dayjs } from 'dayjs' |
@@ -39,6 +40,7 @@ const props = defineProps<{ |
39 | 40 | const theme = useTheming() |
40 | 41 |
|
41 | 42 | const jumpBackInItems = ref<JumpBackInItem[]>([]) |
| 43 | +const loading = ref(true) |
42 | 44 | const serverData = ref<Record<string, ServerData>>({}) |
43 | 45 | const protocolVersions = ref<Record<string, ProtocolVersion | null>>({}) |
44 | 46 | const gameVersions = ref<GameVersion[]>(await get_game_versions().catch(() => [])) |
@@ -71,9 +73,13 @@ watch([() => props.recentInstances, () => showWorlds.value], async () => { |
71 | 73 | }) |
72 | 74 | }) |
73 | 75 |
|
74 | | -await populateJumpBackIn().catch(() => { |
75 | | - console.error('Failed to populate jump back in') |
76 | | -}) |
| 76 | +populateJumpBackIn() |
| 77 | + .catch(() => { |
| 78 | + console.error('Failed to populate jump back in') |
| 79 | + }) |
| 80 | + .finally(() => { |
| 81 | + loading.value = false |
| 82 | + }) |
77 | 83 |
|
78 | 84 | async function populateJumpBackIn() { |
79 | 85 | console.info('Repopulating jump back in...') |
@@ -233,7 +239,15 @@ onUnmounted(() => { |
233 | 239 | </script> |
234 | 240 |
|
235 | 241 | <template> |
236 | | - <div v-if="jumpBackInItems.length > 0" class="flex flex-col gap-2"> |
| 242 | + <div v-if="loading" class="flex flex-col gap-2"> |
| 243 | + <span class="flex mt-1 mb-3 leading-none items-center gap-1 text-primary text-lg font-bold"> |
| 244 | + Jump back in |
| 245 | + </span> |
| 246 | + <div class="text-center py-4"> |
| 247 | + <LoaderCircleIcon class="mx-auto size-8 animate-spin text-contrast" /> |
| 248 | + </div> |
| 249 | + </div> |
| 250 | + <div v-else-if="jumpBackInItems.length > 0" class="flex flex-col gap-2"> |
237 | 251 | <HeadingLink v-if="theme.getFeatureFlag('worlds_tab')" to="/worlds" class="mt-1"> |
238 | 252 | Jump back in |
239 | 253 | </HeadingLink> |
|
0 commit comments