docs: add comprehensive project documentation and clean up snapshot-related files and components

This commit is contained in:
taDuc
2026-05-14 23:50:49 +07:00
parent b220798978
commit 57e3d6b3e5
13 changed files with 1527 additions and 288 deletions
+4 -13
View File
@@ -1,7 +1,7 @@
"use client";
import { useCallback, useEffect, useMemo, useRef, useState, type SetStateAction, type PointerEvent as ReactPointerEvent } from "react";
import { useParams, useRouter, useSearchParams } from "next/navigation";
import { useParams, useRouter } from "next/navigation";
import Map from "@/uhm/components/Map";
import Editor from "@/uhm/components/Editor";
import BackgroundLayersPanel from "@/uhm/components/editor/BackgroundLayersPanel";
@@ -70,11 +70,8 @@ const DEFAULT_EDITOR_USER_ID = "local-editor";
export default function Page() {
const params = useParams();
const router = useRouter();
const searchParams = useSearchParams();
const projectId = String(params.id || "");
const openedProjectIdRef = useRef<string | null>(null);
const autoOpenWiki = searchParams.get("only") === "wiki";
const wikiOnly = autoOpenWiki;
const [blockedPendingSubmissionId, setBlockedPendingSubmissionId] = useState<string | null>(null);
const [searchKind, setSearchKind] = useState<UnifiedSearchKind>("entity");
const [searchQuery, setSearchQuery] = useState("");
@@ -423,8 +420,6 @@ export default function Page() {
internalSetMode(m);
}, [internalSetMode]);
const onSetMode = setMode;
const effectiveGeometryVisibility = useMemo(() => {
const visibility: Record<string, boolean> = { ...geometryVisibility };
@@ -1360,7 +1355,7 @@ export default function Page() {
</div>
) : null}
{!wikiOnly && !blockedPendingSubmissionId ? (
{!blockedPendingSubmissionId ? (
<div style={{ flex: 1, position: "relative", minHeight: "100vh" }}>
{isBackgroundVisibilityReady ? (
<Map
@@ -1397,10 +1392,7 @@ export default function Page() {
/>
)}
</div>
) : blockedPendingSubmissionId ? null : (
// Wiki-only mode: avoid mounting Map/Timeline (WebGL + geometry fetching) to reduce lag.
<div style={{ flex: 1, minHeight: "100vh", background: "#0b1220" }} />
)}
) : null}
{mode !== "replay" ? (
<>
@@ -1676,7 +1668,6 @@ export default function Page() {
projectId={projectId}
wikis={snapshotWikis}
setWikis={setSnapshotWikisUndoable}
autoOpen={autoOpenWiki}
requestedActiveId={requestedActiveWikiId}
/>
@@ -1686,7 +1677,7 @@ export default function Page() {
links={snapshotEntityWikiLinks}
setLinks={setSnapshotEntityWikiLinksUndoable}
/>
{!wikiOnly && selectedFeature ? (
{selectedFeature ? (
<SelectedGeometryPanel
selectedFeatures={selectedFeatures}
entityTypeOptions={GEOMETRY_TYPE_OPTIONS}
-3
View File
@@ -311,9 +311,6 @@ export default function ProjectDetailsPage() {
<Button size="sm" variant="outline" onClick={() => router.push(`/editor/${id}`)}>
Mo editor
</Button>
<Button size="sm" variant="outline" onClick={() => router.push(`/editor/${id}?only=wiki`)}>
Editor only wiki
</Button>
</div>
</div>
</div>
+1 -16
View File
@@ -380,21 +380,6 @@ export default function ProjectsPage() {
</span>
</div>
<div className="relative group/btn3 inline-flex">
<Button
size="sm"
variant="outline"
className="!p-0 w-9 h-9 flex items-center justify-center"
onClick={() => router.push(`/editor/${project.id}?only=wiki`)}
>
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor" className="w-4 h-4">
<path strokeLinecap="round" strokeLinejoin="round" d="M12 6.042A8.967 8.967 0 006 3.75c-1.052 0-2.062.18-3 .512v14.25A8.987 8.987 0 016 18c2.305 0 4.408.867 6 2.292m0-14.25a8.966 8.966 0 016-2.292c1.052 0 2.062.18 3 .512v14.25A8.987 8.987 0 0018 18a8.967 8.967 0 00-6 2.292m0-14.25v14.25" />
</svg>
</Button>
<span className="absolute -top-8 left-1/2 -translate-x-1/2 scale-0 rounded bg-gray-900 px-2 py-1 text-[11px] font-medium text-white opacity-0 transition-all group-hover/btn3:scale-100 group-hover/btn3:opacity-100 z-50 pointer-events-none whitespace-nowrap shadow-sm dark:bg-gray-700">
Wiki Editor
</span>
</div>
</div>
</div>
))}
@@ -491,4 +476,4 @@ export default function ProjectsPage() {
</Modal>
</div>
);
}
}