23 lines
1.2 KiB
TypeScript
23 lines
1.2 KiB
TypeScript
import { EnvironmentSettingsWindow, LandingStage } from "@nodedc/ui-react";
|
|
import type { EnvironmentPage } from "@nodedc/ui-core";
|
|
import { views, type ViewId } from "./nodeModel";
|
|
import type { usePresentation } from "./usePresentation";
|
|
|
|
const surfaces = [{ id: "home", home: true, description: "Главная страница продукта", actions: views }];
|
|
|
|
export function Home({ page, openView }: { page: EnvironmentPage; openView: (id: ViewId) => void }) {
|
|
const actions = [page.primaryWorkspaceId, page.secondaryWorkspaceId].flatMap(id => {
|
|
const view = views.find(item => item.id === id);
|
|
return view ? [{ id: view.id, label: view.label, icon: view.icon, onSelect: () => openView(view.id) }] : [];
|
|
});
|
|
return <LandingStage page={page} actions={actions} />;
|
|
}
|
|
|
|
export function HomeSettings({ open, onClose, presentation }: {
|
|
open: boolean; onClose: () => void; presentation: ReturnType<typeof usePresentation>;
|
|
}) {
|
|
return <EnvironmentSettingsWindow productName="Mission Core Node" open={open} onClose={onClose}
|
|
surfaces={surfaces} settings={presentation.settings} state={presentation.state} error={presentation.error}
|
|
onSave={presentation.save} onUpload={presentation.upload} />;
|
|
}
|