mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-10-18 04:51:29 +08:00

* feat: integrate billing api and wire up billing ui * feat: show billing to admin only if on plans other than basic plan * feat: show billing to admin only if on plans other than basic plan * feat: update notfound snapshot * chore: fix billing sidenav logic * chore: fix several bugs * chore: backend fix for billing * fix: window.open pop blocker issue and error ui (#3750) --------- Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com> Co-authored-by: Rajat Dabade <rajat@signoz.io>
43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
import { Tabs, Typography } from 'antd';
|
|
import Spinner from 'components/Spinner';
|
|
import useLicense from 'hooks/useLicense';
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
import ApplyLicenseForm from './ApplyLicenseForm';
|
|
import ListLicenses from './ListLicenses';
|
|
|
|
function Licenses(): JSX.Element {
|
|
const { t } = useTranslation(['licenses']);
|
|
const { data, isError, isLoading, refetch } = useLicense();
|
|
|
|
if (isError || data?.error) {
|
|
return <Typography>{data?.error}</Typography>;
|
|
}
|
|
|
|
if (isLoading || data?.payload === undefined) {
|
|
return <Spinner tip={t('loading_licenses')} height="90vh" />;
|
|
}
|
|
|
|
const allValidLicense =
|
|
data?.payload?.licenses?.filter((license) => license.isCurrent) || [];
|
|
|
|
const tabs = [
|
|
{
|
|
label: t('tab_current_license'),
|
|
key: 'licenses',
|
|
children: <ApplyLicenseForm licenseRefetch={refetch} />,
|
|
},
|
|
{
|
|
label: t('tab_license_history'),
|
|
key: 'history',
|
|
children: <ListLicenses licenses={allValidLicense} />,
|
|
},
|
|
];
|
|
|
|
return (
|
|
<Tabs destroyInactiveTabPane defaultActiveKey="licenses" items={tabs} />
|
|
);
|
|
}
|
|
|
|
export default Licenses;
|