Fix skeleton sticking around on back, add new server indicator

This commit is contained in:
Prospector 2025-06-03 12:30:21 -07:00
parent 4e093131f3
commit d3d0c8c523
3 changed files with 15 additions and 1 deletions

View File

@ -43,7 +43,14 @@
</div>
<div v-else class="min-h-[20px]"></div>
<div
v-if="isConfiguring"
class="flex min-w-0 items-center gap-2 truncate text-sm font-semibold text-brand"
>
<SparklesIcon class="size-5 shrink-0" /> New server
</div>
<UiServersServerInfoLabels
v-else
:server-data="{ game, mc_version, loader, loader_version, net }"
:show-game-label="showGameLabel"
:show-loader-label="showLoaderLabel"
@ -73,7 +80,7 @@
</template>
<script setup lang="ts">
import { ChevronRightIcon, HammerIcon, LockIcon } from "@modrinth/assets";
import { ChevronRightIcon, LockIcon, SparklesIcon } from "@modrinth/assets";
import type { Project, Server } from "~/types/servers";
const props = defineProps<Partial<Server>>();
@ -106,4 +113,5 @@ if (import.meta.server && projectData.value?.icon_url) {
}
const iconUrl = computed(() => projectData.value?.icon_url || undefined);
const isConfiguring = computed(() => props.flows?.intro);
</script>

View File

@ -102,6 +102,7 @@
:mc_version="server.mc_version"
:upstream="server.upstream"
:net="server.net"
:flows="server.flows"
/>
<LazyUiServersServerListingSkeleton v-if="isPollingForNewServers" />
</ul>
@ -133,6 +134,7 @@ interface ServerResponse {
servers: Server[];
}
const router = useRouter();
const route = useRoute();
const hasError = ref(false);
const isPollingForNewServers = ref(false);
@ -179,6 +181,7 @@ const checkForNewServers = async () => {
if (JSON.stringify(previousServerList.value) !== JSON.stringify(serverList.value)) {
isPollingForNewServers.value = false;
clearInterval(intervalId);
router.replace({ query: {} });
} else if (refreshCount.value >= 5) {
isPollingForNewServers.value = false;
clearInterval(intervalId);

View File

@ -104,6 +104,9 @@ export interface Server {
version_id: string;
};
motd: string;
flows: {
intro?: boolean;
};
}
export interface Stats {