Use new TabWidget for VM route

This commit is contained in:
2024-01-03 00:12:16 +01:00
parent 219fc184ee
commit e561942cf7
3 changed files with 19 additions and 17 deletions
virtweb_frontend/src/widgets

@ -10,14 +10,14 @@ export interface TabWidgetOption<E> {
export function TabsWidget<E>(p: {
currTab: E;
options: TabWidgetOption<E>[];
onValueChange: (v: E) => void;
onTabChange: (v: E) => void;
}): React.ReactElement {
const activeOptions = p.options.filter((v) => v.visible);
const currTabIndex = activeOptions.findIndex((v) => v.value === p.currTab);
const updateActiveTab = (index: number) => {
p.onValueChange(activeOptions[index].value);
p.onTabChange(activeOptions[index].value);
};
return (