From f616470dfc09f0fa31f4d66bb82bca348781fb27 Mon Sep 17 00:00:00 2001 From: zuies Date: Wed, 6 Dec 2023 12:39:55 +0300 Subject: [PATCH] fix tooltip on mobile version --- .../TcConnectedPlatformsItem.tsx | 26 +++++++++++--- .../pages/statistics/StatisticalData.tsx | 34 ++++++++++++++----- .../memberBreakdowns/CustomTable.tsx | 32 +++++++++++++---- 3 files changed, 71 insertions(+), 21 deletions(-) diff --git a/src/components/communitySettings/communityIntegrations/TcConnectedPlatformsItem.tsx b/src/components/communitySettings/communityIntegrations/TcConnectedPlatformsItem.tsx index fac8de4f..3dedc535 100644 --- a/src/components/communitySettings/communityIntegrations/TcConnectedPlatformsItem.tsx +++ b/src/components/communitySettings/communityIntegrations/TcConnectedPlatformsItem.tsx @@ -37,7 +37,7 @@ * */ -import React from 'react'; +import React, { useState } from 'react'; import TcText from '../../shared/TcText'; import clsx from 'clsx'; import TcAvatar from '../../shared/TcAvatar'; @@ -49,13 +49,22 @@ import TcIntegrationIcon from './TcIntegrationIcon'; import { capitalizeFirstChar, truncateCenter } from '../../../helpers/helper'; import { IntegrationPlatform } from '../../../utils/enums'; import { BsThreeDots } from 'react-icons/bs'; -import { Tooltip } from '@mui/material'; +import { ClickAwayListener, Tooltip } from '@mui/material'; interface TcConnectedPlatformsItemProps { platform: IPlatformProps; } function TcConnectedPlatformsItem({ platform }: TcConnectedPlatformsItemProps) { + const [open, setOpen] = useState(false); + + const handleTooltipClose = () => { + setOpen(false); + }; + + const handleTooltipOpen = () => { + setOpen(true); + }; return ( <> @@ -75,9 +84,16 @@ function TcConnectedPlatformsItem({ platform }: TcConnectedPlatformsItemProps) { variant="body1" className="text-semibold" /> - -
- + + +
+ +
= ({ handleSelectedOption, }) => { const [activeState, setActiveState] = useState(); + const [open, setOpen] = useState(false); useEffect(() => { const queries = router.query; @@ -55,6 +56,14 @@ const StatisticalData: React.FC = ({ } }, [router.query]); + const handleTooltipClose = () => { + setOpen(false); + }; + + const handleTooltipOpen = () => { + setOpen(true); + }; + return ( <>
= ({ {stat.label} {stat.hasTooltip && ( - - - - - + + + + + + + )}
diff --git a/src/components/pages/statistics/memberBreakdowns/CustomTable.tsx b/src/components/pages/statistics/memberBreakdowns/CustomTable.tsx index 13b8ec93..0235f010 100644 --- a/src/components/pages/statistics/memberBreakdowns/CustomTable.tsx +++ b/src/components/pages/statistics/memberBreakdowns/CustomTable.tsx @@ -2,6 +2,7 @@ import { Avatar, Button, Checkbox, + ClickAwayListener, FormControlLabel, List, ListItem, @@ -78,6 +79,7 @@ const CustomTable: React.FC = ({ >(activityCompositionOptions.map((option) => option.value)); const [selectAllActivityOptions, setSelectAllActivityOptions] = useState(true); + const [tooltipOpen, setTooltipOpen] = useState(false); const handleOpenActivityPopup = ( event: React.MouseEvent @@ -230,6 +232,14 @@ const CustomTable: React.FC = ({ } }, [router.query]); + const handleTooltipClose = () => { + setTooltipOpen(false); + }; + + const handleTooltipOpen = () => { + setTooltipOpen(true); + }; + return ( <> @@ -462,13 +472,21 @@ const CustomTable: React.FC = ({ {row.ngu} {row[column.id].length > 10 ? ( - - - {`${row[column.id].slice(0, 3)}...${row[ - column.id - ].slice(-4)}`} - - + + + + {`${row[column.id].slice(0, 3)}...${row[ + column.id + ].slice(-4)}`} + + + ) : ( {row[column.id]}