Refresh the homepage and improve export and draft guidance

This commit is contained in:
2026-10-04 17:48:39 +05:00
parent 04cc4f39f6
commit 244d27a309
33 changed files with 2110 additions and 215 deletions

View File

@@ -9,6 +9,7 @@ type Draft = {
description: string;
state: string;
source: string;
rejection_reason: string | null;
map: string | null;
manifest: DatasetManifest;
previews: { id: string; image: string | null }[];
@@ -22,14 +23,27 @@ export function DraftEditor({ id }: { id: string }) {
[message, setMessage] = useState(""),
[busy, setBusy] = useState(false);
useEffect(() => {
api<Draft>("datasets/" + id)
.then((d) => {
setDraft(d);
setName(d.name);
setDescription(d.description);
setSelected(d.manifest.viewpoints.map((p) => p.id));
})
.catch((e) => setError(e.message));
let disposed = false;
let timer: ReturnType<typeof setTimeout>;
const load = () =>
api<Draft>("datasets/" + id)
.then((d) => {
if (disposed) return;
setDraft(d);
setName(d.name);
setDescription(d.description);
setSelected(d.manifest.viewpoints.map((p) => p.id));
if (["uploading", "processing"].includes(d.state))
timer = setTimeout(load, 5000);
})
.catch((e) => {
if (!disposed) setError(e.message);
});
load();
return () => {
disposed = true;
clearTimeout(timer);
};
}, [id]);
async function save(submit = false) {
setBusy(true);
@@ -55,6 +69,11 @@ export function DraftEditor({ id }: { id: string }) {
setBusy(true);
try {
await api("datasets/" + id + "/cancel", {});
setDraft((d) =>
d
? { ...d, state: "failed", rejection_reason: "Processing cancelled" }
: d,
);
setMessage("Processing cancelled.");
} catch (e) {
setError((e as Error).message);
@@ -70,6 +89,18 @@ export function DraftEditor({ id }: { id: string }) {
return (
<>
<span className="badge">{draft.state}</span>
{["uploading", "processing"].includes(draft.state) && (
<p role="status" className="success-message">
{draft.state === "uploading"
? "Waiting for the capture tool to finish uploading. Retry upload in the tool if the connection was interrupted."
: "Your map and panoramas are being rendered. This page updates automatically."}
</p>
)}
{draft.rejection_reason && (
<p className="error-message" role="alert">
{draft.rejection_reason}
</p>
)}
<p className="muted">
{draft.source === "plugin"
? "Server-generated views use vanilla terrain and simplified lighting. Entities, shaders, custom packs and dynamic sign text are omitted."

View File

@@ -17,12 +17,12 @@ export function Header() {
<div className="header-inner">
<Brand />
<nav aria-label="Main navigation">
<Link href="/servers">Explore servers</Link>
<Link href="/downloads">Create a map</Link>
<Link href="/about">How to play</Link>
<Link href="/servers">Play & maps</Link>
<Link href="/downloads">Downloads</Link>
<Link href="/about">Guide</Link>
</nav>
<Link href="/dashboard" className="header-account">
My expedition <ArrowUpRight size={15} />
My account <ArrowUpRight size={15} />
</Link>
</div>
</header>