Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show "Coming soon" Tooltip for Sablier functionality #2106

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 53 additions & 5 deletions src/components/pages/Roles/forms/RoleFormTabs.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
import { Box, Tab, TabList, TabPanels, TabPanel, Tabs, Button, Flex } from '@chakra-ui/react';
import {
Box,
Tab,
TabList,
TabPanels,
TabPanel,
Tabs,
Button,
Flex,
Tooltip,
} from '@chakra-ui/react';
import { useFormikContext } from 'formik';
import { useMemo, useState, useEffect } from 'react';
import { useMemo, useState, useEffect, ReactNode, useRef } from 'react';
import { useTranslation } from 'react-i18next';
import { useNavigate } from 'react-router-dom';
import { Hex, zeroAddress } from 'viem';
import { CARD_SHADOW, TAB_SHADOW } from '../../../../constants/common';
import { CARD_SHADOW, TAB_SHADOW, TOOLTIP_MAXW } from '../../../../constants/common';
import { DAO_ROUTES } from '../../../../constants/routes';
import { useFractal } from '../../../../providers/App/AppProvider';
import { useNetworkConfig } from '../../../../providers/NetworkConfig/NetworkConfigProvider';
import { useRolesState } from '../../../../state/useRolesState';
import ModalTooltip from '../../../ui/modals/ModalTooltip';
import { EditBadgeStatus, EditedRole, RoleFormValues, RoleValue } from '../types';
import RoleFormInfo from './RoleFormInfo';

Expand Down Expand Up @@ -81,7 +92,40 @@ export default function RoleFormTabs({ hatId, push }: { hatId: Hex; push: (obj:
};
}, [existingRoleHat, isRoleNameUpdated, isRoleDescriptionUpdated, isMemberUpdated]);

const payrollTabContainerRef = useRef<HTMLDivElement>(null);
const vestingTabContainerRef = useRef<HTMLDivElement>(null);

if (!daoAddress) return null;

function ComingSoonTooltip({
children,
type,
}: {
children: ReactNode;
type: 'payroll' | 'vesting';
}) {
if (payrollTabContainerRef || vestingTabContainerRef) {
return (
<ModalTooltip
containerRef={type === 'payroll' ? payrollTabContainerRef : vestingTabContainerRef}
maxW={TOOLTIP_MAXW}
label="Coming soon"
>
{children}
</ModalTooltip>
);
}

return (
<Tooltip
label="Coming soon"
aria-label="Coming soon"
>
{children}
</Tooltip>
);
}

return (
<Box>
<Tabs
Expand Down Expand Up @@ -118,7 +162,9 @@ export default function RoleFormTabs({ hatId, push }: { hatId: Hex; push: (obj:
boxShadow: CARD_SHADOW,
}}
>
Payroll
<Box ref={payrollTabContainerRef}>
<ComingSoonTooltip type="payroll">Payroll</ComingSoonTooltip>
</Box>
</Tab>
<Tab
w="full"
Expand All @@ -131,7 +177,9 @@ export default function RoleFormTabs({ hatId, push }: { hatId: Hex; push: (obj:
boxShadow: CARD_SHADOW,
}}
>
Vesting
<Box ref={vestingTabContainerRef}>
<ComingSoonTooltip type="vesting">Vesting</ComingSoonTooltip>
</Box>
</Tab>
</TabList>
<TabPanels>
Expand Down