// Copyright 2024, Command Line Inc. // SPDX-License-Identifier: Apache-2.0 import { Block } from "@/app/block/block"; import { CenteredDiv } from "@/element/quickelems"; import { ContentRenderer, NodeModel, PreviewRenderer, TileLayout } from "@/layout/index"; import { getApi } from "@/store/global"; import * as services from "@/store/services"; import * as WOS from "@/store/wos"; import { useAtomValue } from "jotai"; import * as React from "react"; import { useMemo } from "react"; import "./tabcontent.less"; const TabContent = React.memo(({ tabId }: { tabId: string }) => { const oref = useMemo(() => WOS.makeORef("tab", tabId), [tabId]); const loadingAtom = useMemo(() => WOS.getWaveObjectLoadingAtom(oref), [oref]); const tabLoading = useAtomValue(loadingAtom); const tabAtom = useMemo(() => WOS.getWaveObjectAtom(oref), [oref]); const tabData = useAtomValue(tabAtom); const tileLayoutContents = useMemo(() => { const renderBlock: ContentRenderer = (nodeModel: NodeModel) => { return ; }; const renderPreview: PreviewRenderer = (nodeModel: NodeModel) => { return ; }; function onNodeDelete(data: TabLayoutData) { return services.ObjectService.DeleteBlock(data.blockId); } return { renderContent: renderBlock, renderPreview: renderPreview, tabId: tabId, onNodeDelete: onNodeDelete, }; }, [tabId]); if (tabLoading) { return (
Tab Loading
); } if (!tabData) { return (
Tab Not Found
); } if (tabData?.blockids?.length == 0) { return
; } return (
); }); export { TabContent };