waveterm/frontend/app/tab/tab.tsx

31 lines
883 B
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";
2024-05-14 00:10:31 +02:00
import "./tab.less";
const TabContent = ({ tabId }: { tabId: string }) => {
const tabs = jotai.useAtomValue(atoms.tabsAtom);
const tabData = tabs.find((tab) => tab.tabid === tabId);
if (!tabData) {
return <div className="tabcontent">Tab not found</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">
2024-05-16 22:22:46 +02:00
<Block tabId={tabId} blockId={blockId} />
</div>
);
})}
2024-05-14 00:10:31 +02:00
</div>
);
};
export { TabContent };