add success badge for result tab
This commit is contained in:
parent
192bb089a0
commit
ac76f7dcdb
@ -6,7 +6,7 @@ import { Component as Validation } from './Validation';
|
||||
import { Notification } from '@/Components/Common';
|
||||
import { NavigationBar, Tabs } from '@/Components/Layout/Navigation';
|
||||
import { NavigationProvider } from '@/context/navigation';
|
||||
import { useErrors } from '@/stores/hooks';
|
||||
import { useErrors, useResults } from '@/stores/hooks';
|
||||
import { Media } from '@/styles/media';
|
||||
import { getPageTitle } from '@/utils/page';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
@ -41,7 +41,15 @@ export const tabs = [
|
||||
},
|
||||
{
|
||||
Component: Output,
|
||||
Icon: () => <BarChartOutlined style={defaultIconStyle} />,
|
||||
Icon: observer(() => {
|
||||
const { hasResults } = useResults();
|
||||
|
||||
return (
|
||||
<StyledBadge status="success" dot={hasResults}>
|
||||
<BarChartOutlined style={defaultIconStyle} />
|
||||
</StyledBadge>
|
||||
);
|
||||
}),
|
||||
key: 'output',
|
||||
title: 'Результаты',
|
||||
},
|
||||
@ -51,7 +59,7 @@ export const tabs = [
|
||||
const { hasErrors } = useErrors();
|
||||
|
||||
return (
|
||||
<StyledBadge dot={hasErrors}>
|
||||
<StyledBadge status="error" dot={hasErrors}>
|
||||
<WarningOutlined style={defaultIconStyle} />
|
||||
</StyledBadge>
|
||||
);
|
||||
|
||||
@ -22,3 +22,11 @@ export function useErrors() {
|
||||
hasErrors: hasElementsErrors || hasPaymentsErrors || hasInsuranceErrors || hasFingapErrors,
|
||||
};
|
||||
}
|
||||
|
||||
export function useResults() {
|
||||
const { $results } = useStore();
|
||||
|
||||
return {
|
||||
hasResults: $results.payments.length > 0,
|
||||
};
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user