import { RawParams } from '@uirouter/react'; import clsx from 'clsx'; import { ReactNode } from 'react'; import { Icon } from '@@/Icon'; import { Link } from '@@/Link'; export interface Tab { name: string; icon: ReactNode; widget: ReactNode; selectedTabParam: string; } interface Props { currentTabIndex: number; tabs: Tab[]; } export function WidgetTabs({ currentTabIndex, tabs }: Props) { // ensure that the selectedTab param is always valid const invalidQueryParamValue = tabs.every( (tab) => encodeURIComponent(tab.selectedTabParam) !== tab.selectedTabParam ); if (invalidQueryParamValue) { throw new Error('Invalid query param value for tab'); } return (