Improve MineGeo exploration and mapping features

This commit is contained in:
2026-10-05 13:41:36 +05:00
parent aec0641f87
commit c5368fa8cc
69 changed files with 3581 additions and 333 deletions

View File

@@ -6,6 +6,11 @@ export type MapListing = {
description: string;
source: "plugin" | "fabric";
state: string;
parent_dataset_id: string | null;
contribution_status: string | null;
allow_contributions: boolean;
contribution_server_address: string | null;
update_state: string | null;
bounds: { minX: number; minZ: number; maxX: number; maxZ: number };
panorama_count: number;
server_id: string;
@@ -37,9 +42,19 @@ export async function catalog() {
const servers = required(
await client.from("catalog_servers").select("*"),
) as { id: string; name: string; address: string | null }[];
const owners = maps.length
? required(
await client
.from("profiles")
.select("id,display_name")
.in("id", [...new Set(maps.map((m) => m.owner_id))]),
)
: [];
return Promise.all(
maps.map(async (m) => ({
...m,
credit:
owners.find((p) => p.id === m.owner_id)?.display_name ?? "Explorer",
image: (await mediaUrl(m.map_path || m.cover_path)) ?? undefined,
mapImage: (await mediaUrl(m.map_path)) ?? undefined,
server: servers.find((s) => s.id === m.server_id),
@@ -55,8 +70,14 @@ export async function getMap(id: string) {
.eq("state", "published")
.single(),
) as MapListing;
const owner = await admin()
.from("profiles")
.select("display_name")
.eq("id", map.owner_id)
.maybeSingle();
return {
...map,
credit: owner.data?.display_name ?? "Explorer",
image: await mediaUrl(map.cover_path),
mapImage: await mediaUrl(map.map_path),
};