Testing functionality of the workspace storing and receiving
This commit is contained in:
@@ -9,7 +9,7 @@ import {
|
||||
} from "../ui/sidebar";
|
||||
import { Collapsible, CollapsibleContent } from "../ui/collapsible";
|
||||
import { ChevronDown } from "lucide-react";
|
||||
import { Workspace } from "@/hooks/workspace";
|
||||
import { EntityId, SetState, Workspace } from "@/lib/types";
|
||||
|
||||
export type SidebarEntity =
|
||||
| {
|
||||
@@ -25,9 +25,11 @@ export type SidebarEntity =
|
||||
export default function EntitySwitch({
|
||||
entity,
|
||||
workspace,
|
||||
setRoute,
|
||||
}: {
|
||||
entity: SidebarEntity;
|
||||
workspace: Workspace;
|
||||
setRoute: SetState<EntityId | undefined>;
|
||||
}) {
|
||||
if (entity.kind === "group") {
|
||||
return (
|
||||
@@ -45,7 +47,12 @@ export default function EntitySwitch({
|
||||
<SidebarGroupContent>
|
||||
<SidebarMenu>
|
||||
{entity.children?.map((entity, i) => (
|
||||
<EntitySwitch entity={entity} workspace={workspace} key={i} />
|
||||
<EntitySwitch
|
||||
entity={entity}
|
||||
workspace={workspace}
|
||||
key={i}
|
||||
setRoute={setRoute}
|
||||
/>
|
||||
))}
|
||||
</SidebarMenu>
|
||||
</SidebarGroupContent>
|
||||
@@ -58,7 +65,7 @@ export default function EntitySwitch({
|
||||
<SidebarMenuItem>
|
||||
<SidebarMenuButton
|
||||
onClick={() => {
|
||||
workspace.setRoute(entity.id);
|
||||
setRoute(entity.id);
|
||||
}}
|
||||
>
|
||||
{workspace.entities[entity.id].name}
|
||||
|
||||
Reference in New Issue
Block a user