Files
fly-sprites-workers/index.client.tsx
T

64 lines
1.7 KiB
TypeScript

import type {
PluginClientContext,
PluginSidebarItemProps,
PluginWorkspacePanelProps,
} from "@getpaseo/plugin/client";
import { SidebarRow } from "@getpaseo/plugin/client/ui";
import { FlySpritesSettingsScreen } from "./client/settings-screen";
import { FlySpritesWorkersScreen } from "./client/workers-screen";
function WorkersSidebarItem({ currentScreen, openScreen }: PluginSidebarItemProps) {
return (
<SidebarRow
icon="Cpu"
active={currentScreen?.screenId === "workers"}
onPress={() => openScreen({ screenId: "workers" })}
/>
);
}
function WorkspaceWorkersPanel({ workspaceId, ...hostProps }: PluginWorkspacePanelProps) {
return <FlySpritesWorkersScreen {...hostProps} workspaceId={workspaceId} />;
}
export default function contribute(client: PluginClientContext) {
client.addScreen({
id: "workers",
title: "Fly Sprites Workers",
Component: FlySpritesWorkersScreen,
});
client.addWorkspacePanel({
id: "fly-sprites-workers",
title: "Fly Sprites",
icon: "Cpu",
Component: WorkspaceWorkersPanel,
});
client.addSidebarHeaderItem({
id: "fly-sprites-workers",
title: "Fly Sprites",
Component: WorkersSidebarItem,
});
client.addCommandCenterItem({
id: "open-fly-sprites-workers",
title: "Open Fly Sprites Workers",
icon: "Cpu",
keywords: ["fly", "sprites", "workers", "vm", "sandbox", "remote"],
context: "global",
onSelect({ openScreen }) {
openScreen({ screenId: "workers" });
},
});
client.addSettingsScreen({
id: "fly-sprites",
title: "Fly Sprites Workers",
icon: "Cpu",
Component: FlySpritesSettingsScreen,
});
return () => {};
}