waveterm/frontend/app/tab/tab.tsx

39 lines
1.1 KiB
TypeScript
Raw Normal View History

2024-05-14 00:10:31 +02:00
// Copyright 2023, Command Line Inc.
// SPDX-License-Identifier: Apache-2.0
import * as React from "react";
import * as jotai from "jotai";
import { Block } from "@/app/block/block";
import { atoms } from "@/store/global";
import * as WOS from "@/store/wos";
2024-05-14 00:10:31 +02:00
import "./tab.less";
2024-05-28 01:33:31 +02:00
import { CenteredDiv, CenteredLoadingDiv } from "../element/quickelems";
2024-05-14 00:10:31 +02:00
const TabContent = ({ tabId }: { tabId: string }) => {
const [tabData, tabLoading] = WOS.useWaveObjectValue<Tab>(WOS.makeORef("tab", tabId));
if (tabLoading) {
return <CenteredLoadingDiv />;
}
if (!tabData) {
2024-05-28 01:33:31 +02:00
return (
<div className="tabcontent">
<CenteredDiv>Tab Not Found</CenteredDiv>
</div>
);
}
2024-05-14 00:10:31 +02:00
return (
<div className="tabcontent">
{tabData.blockids.map((blockId: string) => {
return (
<div key={blockId} className="block-container">
<Block key={blockId} tabId={tabId} blockId={blockId} />
</div>
);
})}
2024-05-14 00:10:31 +02:00
</div>
);
};
export { TabContent };