Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion client/ui/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ function App({ engine }: { engine: Engine }) {
const initialEngineMode = EngineMode.Edit;
const [currentMode, setModeState] = useState(initialEngineMode);
const [blockRegistry, setBlockRegistry] = useState<BlockRegistry>();
const [selectedEntity, setSelectedEntity] = useState(false);
const [entityTypeRegistry, setEntityTypeRegistry] = useState<EntityTypeRegistry>();

useEffect(() => {
Expand Down Expand Up @@ -36,9 +37,10 @@ function App({ engine }: { engine: Engine }) {
currentMode={currentMode}
blockRegistry={blockRegistry}
entityTypeRegistry={entityTypeRegistry}
setSelectedEntity={setSelectedEntity}
/>
)}
<RightBar selectedEntity={false} />
<RightBar selectedEntity={selectedEntity} />
</div>
);
}
Expand Down
2 changes: 2 additions & 0 deletions client/ui/src/LeftBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ export default function LeftBar({
engine,
blockRegistry,
entityTypeRegistry,
setSelectedEntity,
}: {
engine: Engine;
currentMode: EngineMode;
blockRegistry: BlockRegistry;
entityTypeRegistry: EntityTypeRegistry;
setSelectedEntity: (bool) => void;
}) {
const [currentTab, setCurrentTab] = useState(LeftBarTab.Blocks);
let theContent;
Expand Down
4 changes: 3 additions & 1 deletion client/ui/src/RightBar.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// The "right bar": invisible unless an entity is selected, and in that latter
// case, the properties panel

import { SelectedEntity } from "../../pkg/client.js";

// TODO: implement entities and thus this

export default function RightBar({ selectedEntity }: { selectedEntity: boolean } ) {
export default function RightBar({ selectedEntity }: { selectedEntity: SelectedEntity|undefined } ) {
if(selectedEntity) {
return <div className="editor-panel editor-only" id="propbox">
<p>Siege chopper, checking in 🚁</p>
Expand Down
2 changes: 1 addition & 1 deletion entities/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ edition = "2021"
glam.workspace = true
serde.workspace = true
wasm-bindgen.workspace = true
tsify.workspace = true
tsify.workspace = true
3 changes: 3 additions & 0 deletions entities/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/// This crate contains data types relevant to entities
///
/// It is designed to be used on both the server and the client
use {
serde::{Deserialize, Serialize},
tsify::Tsify,
Expand Down