mirror of
https://github.com/wavetermdev/backup.git
synced 2026-08-05 13:57:07 -07:00
delete block and close tab working
This commit is contained in:
@@ -55,9 +55,24 @@
|
||||
height: 100%;
|
||||
border-right: 1px solid var(--border-color);
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
|
||||
&.active {
|
||||
background-color: var(--highlight-bg-color);
|
||||
}
|
||||
|
||||
&.active:hover .tab-close {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.tab-close {
|
||||
position: absolute;
|
||||
display: none;
|
||||
padding: 5px;
|
||||
right: 2px;
|
||||
top: 5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
.tab-add {
|
||||
|
||||
@@ -14,17 +14,22 @@ import "./workspace.less";
|
||||
function Tab({ tabId }: { tabId: string }) {
|
||||
const windowData = jotai.useAtomValue(atoms.waveWindow);
|
||||
const [tabData, tabLoading] = WOS.useWaveObjectValue<Tab>(WOS.makeORef("tab", tabId));
|
||||
function setActiveTab(tabId: string) {
|
||||
if (tabId == null) {
|
||||
return;
|
||||
}
|
||||
function setActiveTab() {
|
||||
WOS.SetActiveTab(tabId);
|
||||
}
|
||||
function handleCloseTab() {
|
||||
WOS.CloseTab(tabId);
|
||||
}
|
||||
return (
|
||||
<div
|
||||
className={clsx("tab", { active: tabData != null && windowData.activetabid === tabData.oid })}
|
||||
onClick={() => setActiveTab(tabData?.oid)}
|
||||
onClick={() => setActiveTab()}
|
||||
>
|
||||
<div className="tab-close" onClick={() => handleCloseTab()}>
|
||||
<div>
|
||||
<i className="fa fa-solid fa-xmark" />
|
||||
</div>
|
||||
</div>
|
||||
{tabData?.name ?? "..."}
|
||||
</div>
|
||||
);
|
||||
@@ -115,8 +120,14 @@ function WorkspaceElem() {
|
||||
<div className="workspace">
|
||||
<TabBar workspace={ws} />
|
||||
<div className="workspace-tabcontent">
|
||||
<TabContent key={windowData.workspaceid} tabId={activeTabId} />
|
||||
<Widgets />
|
||||
{activeTabId == "" ? (
|
||||
<CenteredDiv>No Active Tab</CenteredDiv>
|
||||
) : (
|
||||
<>
|
||||
<TabContent key={windowData.workspaceid} tabId={activeTabId} />
|
||||
<Widgets />
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user