sidebar: apis: fix inconsistent tab switch

This commit is contained in:
end-4
2024-03-24 00:02:07 +07:00
parent 0555c945dd
commit 16ba0191a8
3 changed files with 16 additions and 7 deletions
+6 -4
View File
@@ -181,16 +181,18 @@ const apiCommandStack = Stack({
export const apiContentStack = IconTabContainer({
className: 'margin-top-5',
iconWidgets: APIS.map((api, id) => api.tabIcon),
iconWidgets: APIS.map((api) => api.tabIcon),
names: APIS.map((api) => api.name),
children: APIS.map((api) => api.contentWidget),
onChange: (self, id) => {
apiCommandStack.shown = APIS[id].name;
chatPlaceholder.label = APIS[id].placeholderText;
currentApiId = id;
}
});
function switchToTab(id) {
apiContentStack.shown.value = id;
apiCommandStack.shown = APIS[id].name;
chatPlaceholder.label = APIS[id].placeholderText;
currentApiId = id;
}
const apiWidgets = Widget.Box({