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";
|
2024-05-14 08:45:41 +02:00
|
|
|
import { Block } from "@/app/block/block";
|
|
|
|
import { atoms } from "@/store/global";
|
2024-05-27 22:59:58 +02:00
|
|
|
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
|
|
|
|
2024-05-14 08:45:41 +02:00
|
|
|
const TabContent = ({ tabId }: { tabId: string }) => {
|
2024-05-27 22:59:58 +02:00
|
|
|
const [tabData, tabLoading] = WOS.useWaveObjectValue<Tab>(WOS.makeORef("tab", tabId));
|
2024-05-27 09:47:10 +02:00
|
|
|
if (tabLoading) {
|
|
|
|
return <CenteredLoadingDiv />;
|
|
|
|
}
|
2024-05-14 08:45:41 +02:00
|
|
|
if (!tabData) {
|
2024-05-28 01:33:31 +02:00
|
|
|
return (
|
|
|
|
<div className="tabcontent">
|
|
|
|
<CenteredDiv>Tab Not Found</CenteredDiv>
|
|
|
|
</div>
|
|
|
|
);
|
2024-05-14 08:45:41 +02:00
|
|
|
}
|
2024-05-14 00:10:31 +02:00
|
|
|
return (
|
|
|
|
<div className="tabcontent">
|
2024-05-24 23:08:24 +02:00
|
|
|
{tabData.blockids.map((blockId: string) => {
|
2024-05-14 08:45:41 +02:00
|
|
|
return (
|
|
|
|
<div key={blockId} className="block-container">
|
2024-05-28 00:44:57 +02:00
|
|
|
<Block key={blockId} tabId={tabId} blockId={blockId} />
|
2024-05-14 08:45:41 +02:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
})}
|
2024-05-14 00:10:31 +02:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export { TabContent };
|