preview map editor 60%
This commit is contained in:
@@ -3,18 +3,10 @@
|
||||
import { UndoAction } from "@/lib/useEditorState";
|
||||
|
||||
type Mode = "draw" | "select" | "idle" | "add-point" | "add-line" | "add-path" | "add-circle";
|
||||
type EntityOption = {
|
||||
id: string;
|
||||
name: string;
|
||||
geometry_count?: number;
|
||||
};
|
||||
|
||||
type Props = {
|
||||
mode: Mode;
|
||||
setMode: (mode: Mode) => void;
|
||||
entities: EntityOption[];
|
||||
selectedEntityId: string | null;
|
||||
onSelectEntityId: (entityId: string | null) => void;
|
||||
entityStatus?: string | null;
|
||||
onUndo: () => void;
|
||||
onSave: () => void;
|
||||
@@ -26,9 +18,6 @@ type Props = {
|
||||
export default function Editor({
|
||||
mode,
|
||||
setMode,
|
||||
entities,
|
||||
selectedEntityId,
|
||||
onSelectEntityId,
|
||||
entityStatus,
|
||||
onUndo,
|
||||
onSave,
|
||||
@@ -148,48 +137,21 @@ export default function Editor({
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<div
|
||||
style={{
|
||||
marginTop: "12px",
|
||||
padding: "10px",
|
||||
background: "#0b1220",
|
||||
borderRadius: "6px",
|
||||
border: "1px solid #1f2937",
|
||||
}}
|
||||
>
|
||||
<div style={{ marginBottom: "6px", fontWeight: 600, fontSize: "13px", color: "#e2e8f0" }}>
|
||||
Entity mặc định cho geometry mới
|
||||
</div>
|
||||
<select
|
||||
value={selectedEntityId || ""}
|
||||
onChange={(event) => onSelectEntityId(event.target.value || null)}
|
||||
{entityStatus ? (
|
||||
<div
|
||||
style={{
|
||||
width: "100%",
|
||||
padding: "6px 8px",
|
||||
borderRadius: "4px",
|
||||
border: "1px solid #334155",
|
||||
background: "#111827",
|
||||
color: "#f8fafc",
|
||||
fontSize: "13px",
|
||||
marginTop: "12px",
|
||||
padding: "10px",
|
||||
background: "#0b1220",
|
||||
borderRadius: "6px",
|
||||
border: "1px solid #1f2937",
|
||||
color: "#fca5a5",
|
||||
fontSize: "12px",
|
||||
}}
|
||||
>
|
||||
<option value="">Không gắn entity</option>
|
||||
{entities.map((entity) => (
|
||||
<option key={entity.id} value={entity.id}>
|
||||
{entity.name}
|
||||
{typeof entity.geometry_count === "number" ? ` (${entity.geometry_count})` : ""}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<div style={{ marginTop: "6px", color: "#94a3b8", fontSize: "12px" }}>
|
||||
Geometry mới tạo sẽ gắn sẵn entity này, bạn có thể thêm nhiều entity ở panel bên phải.
|
||||
{entityStatus}
|
||||
</div>
|
||||
{entityStatus ? (
|
||||
<div style={{ marginTop: "6px", color: "#fca5a5", fontSize: "12px" }}>
|
||||
{entityStatus}
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<div style={{ marginTop: "12px", display: "flex", gap: "8px" }}>
|
||||
<button
|
||||
|
||||
Reference in New Issue
Block a user