diff --git a/src/commons/utils/helper.ts b/src/commons/utils/helper.ts index a6141ca123..afababd3b5 100644 --- a/src/commons/utils/helper.ts +++ b/src/commons/utils/helper.ts @@ -26,6 +26,14 @@ export const getShortHash = (address = "", firstpart?: number, lastPart?: number : ""; }; +export const getShortHashXs = (address = "", firstpart?: number, lastPart?: number) => { + if (address?.length <= 18) return address; + return address ? `${address.slice(0, firstpart ? firstpart : 7)}...${address.slice(-(lastPart ? lastPart : 5))}` : ""; +}; +export const getShortValue = (address = "", length = 50) => { + return address.slice(0, length); +}; + export const LARGE_NUMBER_ABBREVIATIONS = ["", "K", "M", "B", "T", "q", "Q", "s", "S"]; export const formatPrice = (value?: string | number, abbreviations: string[] = LARGE_NUMBER_ABBREVIATIONS): string => { diff --git a/src/components/AddressTransactionList/index.tsx b/src/components/AddressTransactionList/index.tsx index 3d780b55f9..e15e4e8e15 100644 --- a/src/components/AddressTransactionList/index.tsx +++ b/src/components/AddressTransactionList/index.tsx @@ -184,7 +184,7 @@ const AddressTransactionList: React.FC = ({ })); } return ( - + {transaction.tokens && transaction.tokens.length === 1 && } {transaction.tokens && transaction.tokens.length > 1 && ( diff --git a/src/components/DelegationPool/DelegationList/index.tsx b/src/components/DelegationPool/DelegationList/index.tsx index 4b2b695f6f..1d4a3eb3f4 100644 --- a/src/components/DelegationPool/DelegationList/index.tsx +++ b/src/components/DelegationPool/DelegationList/index.tsx @@ -45,6 +45,7 @@ const DelegationLists: React.FC = () => { if (tickerNameSearch) { setSearch(decodeURIComponent(tickerNameSearch)); } + setValue(""); // eslint-disable-next-line react-hooks/exhaustive-deps }, [tickerNameSearch]); diff --git a/src/components/StakingLifeCycle/SPOLifecycle/OperatorRewards/index.tsx b/src/components/StakingLifeCycle/SPOLifecycle/OperatorRewards/index.tsx index 88cfb14f34..66104158a9 100644 --- a/src/components/StakingLifeCycle/SPOLifecycle/OperatorRewards/index.tsx +++ b/src/components/StakingLifeCycle/SPOLifecycle/OperatorRewards/index.tsx @@ -6,7 +6,7 @@ import { useTranslation } from "react-i18next"; import CustomTooltip from "src/components/commons/CustomTooltip"; import { details } from "src/commons/routers"; -import { formatADAFull, getShortHash } from "src/commons/utils/helper"; +import { formatADAFull, getShortHash, getShortHashXs } from "src/commons/utils/helper"; import useFetch from "src/commons/hooks/useFetch"; import { API } from "src/commons/utils/api"; import CustomModal from "src/components/commons/CustomModal"; @@ -39,6 +39,7 @@ const OperatorReward = () => { const { data } = useFetch(API.SPO_LIFECYCLE.SPO_POOL_INFO(poolId)); const SPOHolderRef = useRef(null); const cardanoBlockchainRef = useRef(null); + const { isGalaxyFoldSmall } = useScreen(); const paths = useMemo((): LineArrowItem[] => { return [ @@ -62,7 +63,7 @@ const OperatorReward = () => { {t("common.rewardAccount")} = ({ data }) => { onClick={() => r.protocol === "costModel" && setCostModelScript(r.oldValue?.toString() || "")} color={({ palette }) => (r.protocol === "costModel" ? palette.primary.main : "unset")} > - {r.oldValue} + {getShortValue(r.oldValue?.toString())} ); @@ -59,7 +60,7 @@ const ProtocolUpdate: React.FC = ({ data }) => { onClick={() => r.protocol === "costModel" && setCostModelScript(r.value?.toString() || "")} color={({ palette }) => (r.protocol === "costModel" ? palette.primary.main : "unset")} > - {r.value} + {getShortValue(r.value?.toString())} ); diff --git a/src/components/TransactionDetail/TransactionMetadata/ProtocolUpdate/styles.ts b/src/components/TransactionDetail/TransactionMetadata/ProtocolUpdate/styles.ts index f2723c33f5..909d280633 100644 --- a/src/components/TransactionDetail/TransactionMetadata/ProtocolUpdate/styles.ts +++ b/src/components/TransactionDetail/TransactionMetadata/ProtocolUpdate/styles.ts @@ -37,7 +37,12 @@ export const UpdatedValue = styled(Box)(() => ({ export const Wrapper = styled(Box)(({ theme }) => ({ border: `1px solid ${theme.isDark ? theme.palette.secondary[700] : theme.palette.primary[200]}`, borderRadius: theme.spacing(2), - overflow: "hidden" + overflow: "hidden", + "& .table-wrapper": { + [theme.breakpoints.down("sm")]: { + paddingBottom: "8px" + } + } })); export const LimitCell = styled(Box)` @@ -47,4 +52,10 @@ export const LimitCell = styled(Box)` overflow: hidden; white-space: nowrap; text-overflow: ellipsis; + ${({ theme }) => theme.breakpoints.between("xs", "sm")} { + max-width: 120px; + } + ${({ theme }) => theme.breakpoints.between("sm", "md")} { + max-width: 220px; + } `; diff --git a/src/components/commons/CustomModal/styles.ts b/src/components/commons/CustomModal/styles.ts index 83bcc7fb2a..aeeba75edb 100644 --- a/src/components/commons/CustomModal/styles.ts +++ b/src/components/commons/CustomModal/styles.ts @@ -50,7 +50,7 @@ export const WrapTitle = styled(Box)(({ theme }) => ({ position: "relative", zIndex: 2, [theme.breakpoints.down("sm")]: { - maxWidth: " 100% - 40px)", + maxWidth: "calc(100% - 40px)", fontSize: 20, lineHeight: "23px" } diff --git a/src/components/commons/Epoch/FirstEpoch/index.tsx b/src/components/commons/Epoch/FirstEpoch/index.tsx index bee1621e02..40764c460b 100644 --- a/src/components/commons/Epoch/FirstEpoch/index.tsx +++ b/src/components/commons/Epoch/FirstEpoch/index.tsx @@ -37,27 +37,35 @@ export default function FirstEpoch({ data: currentEpochData, onClick }: IProps) icon: ExchangeIcon, hideHeader: true, title: ( - + {currentEpochData?.no} ), value: ( - - {`${progress}%`} - - {EPOCH_STATUS_MAPPING[EPOCH_STATUS[currentEpochData?.status]]} - - + {currentEpochData?.status === "SYNCING" ? ( + + + {EPOCH_STATUS_MAPPING[EPOCH_STATUS[currentEpochData?.status]]} + + + ) : ( + + {`${progress}%`} + + {EPOCH_STATUS_MAPPING[EPOCH_STATUS[currentEpochData?.status]]} + + + )} ) }, diff --git a/src/components/commons/Layout/Sidebar/SidebarMenu/index.tsx b/src/components/commons/Layout/Sidebar/SidebarMenu/index.tsx index beb62699f9..97176d772d 100644 --- a/src/components/commons/Layout/Sidebar/SidebarMenu/index.tsx +++ b/src/components/commons/Layout/Sidebar/SidebarMenu/index.tsx @@ -8,7 +8,6 @@ import { useTranslation } from "react-i18next"; import { useScreen } from "src/commons/hooks/useScreen"; import { footerMenus, menus } from "src/commons/menus"; import { isExternalLink } from "src/commons/utils/helper"; -import CustomTooltip from "src/components/commons/CustomTooltip"; import { RootState } from "src/stores/types"; import { setSidebar } from "src/stores/user"; @@ -103,82 +102,78 @@ const SidebarMenu: React.FC = ({ history }) => { const tooltipTitle = `${!sidebar ? `${title}${title && tooltip ? `: ` : ``}` : ``}${tooltip || ``}`; return ( - - {href ? ( - setActive(null)} - data-testid={`menu-button-${title.toLowerCase().replaceAll(" ", "_")}`} - {...(isExternalLink(href) - ? { component: "a", href, target: "_blank" } - : { component: Link, to: href })} - selected={isActiveMenu(href)} - sx={(theme) => ({ - ...itemStyle(theme, sidebar), - ...(isActiveMenu(href) + {href ? ( + setActive(null)} + data-testid={`menu-button-${title.toLowerCase().replaceAll(" ", "_")}`} + {...(isExternalLink(href) + ? { component: "a", href, target: "_blank" } + : { component: Link, to: href })} + selected={isActiveMenu(href)} + sx={(theme) => ({ + ...itemStyle(theme, sidebar), + ...(isActiveMenu(href) + ? { + backgroundColor: (theme) => `${theme.palette.primary.main} !important`, + color: (theme) => theme.palette.secondary[0] + } + : { color: (theme) => theme.palette.secondary.light }), + fontWeight: "bold !important", + ":hover": isActiveMenu(href) + ? { + backgroundColor: `${theme.palette.primary.dark} !important` + } + : { backgroundColor: `${theme.palette.primary[200]} !important` } + })} + > + {icon ? : null} + + + ) : ( + children?.length && handleOpen(`menu-${index}`)} + sx={(theme) => ({ + ...itemStyle(theme, sidebar), + ...(`menu-${index}` === currentActive + ? { + backgroundColor: (theme) => `${theme.palette.primary.main} !important`, + color: (theme) => theme.palette.secondary[0] + } + : { color: (theme) => theme.palette.secondary.light }), + fontWeight: "bold !important", + ":hover": + `menu-${index}` === currentActive ? { - backgroundColor: (theme) => `${theme.palette.primary.main} !important`, - color: (theme) => theme.palette.secondary[0] - } - : { color: (theme) => theme.palette.secondary.light }), - fontWeight: "bold !important", - ":hover": isActiveMenu(href) - ? { - backgroundColor: `${theme.palette.primary.dark} !important` + backgroundColor: `${theme.palette.primary.dark} !important` } : { backgroundColor: `${theme.palette.primary[200]} !important` } - })} - > - {icon ? ( - - ) : null} - - - ) : ( - children?.length && handleOpen(`menu-${index}`)} - sx={(theme) => ({ - ...itemStyle(theme, sidebar), - ...(`menu-${index}` === currentActive - ? { - backgroundColor: (theme) => `${theme.palette.primary.main} !important`, - color: (theme) => theme.palette.secondary[0] - } - : { color: (theme) => theme.palette.secondary.light }), - fontWeight: "bold !important", - ":hover": - `menu-${index}` === currentActive - ? { - backgroundColor: `${theme.palette.primary.dark} !important` - } - : { backgroundColor: `${theme.palette.primary[200]} !important` } - })} - > - {icon ? ( - - ) : null} - + {icon ? ( + + ) : null} + - {sidebar && children?.length ? ( - - {`menu-${index}` === active ? : } - - ) : null} - - )} - + {sidebar && children?.length ? ( + + {`menu-${index}` === active ? : } + + ) : null} + + )} {children?.length ? ( @@ -235,73 +230,68 @@ const SidebarMenu: React.FC = ({ history }) => { })} {footerMenus.map((item, index) => { - const { href, key, children, icon, tooltip } = item; + const { href, key, children, icon } = item; const title = t(key || ""); - const tooltipTitle = `${!sidebar ? `${title}${title && tooltip ? `: ` : ``}` : ``}${tooltip || ``}`; return ( - - {href ? ( - ({ - ...itemStyle(theme, sidebar), - ...(isActiveMenu(href) - ? { - backgroundColor: (theme) => `${theme.palette.primary.main} !important`, - color: (theme) => `${theme.palette.secondary[0]} !important` - } - : { color: (theme) => theme.palette.secondary.light }), - ":hover": isActiveMenu(href) + {href ? ( + ({ + ...itemStyle(theme, sidebar), + ...(isActiveMenu(href) + ? { + backgroundColor: (theme) => `${theme.palette.primary.main} !important`, + color: (theme) => `${theme.palette.secondary[0]} !important` + } + : { color: (theme) => theme.palette.secondary.light }), + ":hover": isActiveMenu(href) + ? { + backgroundColor: `${theme.palette.primary.dark} !important` + } + : { backgroundColor: `${theme.palette.primary[200]} !important` } + })} + > + {icon ? : null} + + + ) : ( + handleOpen(`footer-${index}`)} + sx={(theme) => ({ + ...itemStyle(theme, sidebar), + ...(`footer-${index}` === active + ? { + backgroundColor: (theme) => `${theme.palette.primary.main} !important`, + color: (theme) => theme.palette.secondary[0] + } + : { color: (theme) => theme.palette.secondary.light }), + fontWeight: "bold !important", + ":hover": + `footer-${index}` === active ? { backgroundColor: `${theme.palette.primary.dark} !important` } : { backgroundColor: `${theme.palette.primary[200]} !important` } - })} - > - {icon ? ( - - ) : null} - - - ) : ( - handleOpen(`footer-${index}`)} - sx={(theme) => ({ - ...itemStyle(theme, sidebar), - ...(`footer-${index}` === active - ? { - backgroundColor: (theme) => `${theme.palette.primary.main} !important`, - color: (theme) => theme.palette.secondary[0] - } - : { color: (theme) => theme.palette.secondary.light }), - fontWeight: "bold !important", - ":hover": - `footer-${index}` === active - ? { - backgroundColor: `${theme.palette.primary.dark} !important` - } - : { backgroundColor: `${theme.palette.primary[200]} !important` } - })} - > - {icon ? ( - - ) : null} - - {sidebar && - (children?.length ? ( - - {`footer-${index}` === active ? : } - - ) : null)} - - )} - + })} + > + {icon ? ( + + ) : null} + + {sidebar && + (children?.length ? ( + + {`footer-${index}` === active ? : } + + ) : null)} + + )} {children?.length ? ( diff --git a/src/components/commons/Layout/styles.ts b/src/components/commons/Layout/styles.ts index c3a6f1bbbd..dd2ac7314a 100644 --- a/src/components/commons/Layout/styles.ts +++ b/src/components/commons/Layout/styles.ts @@ -180,7 +180,7 @@ export const Main = styled(Box)<{ open: number }>(({ theme, open }) => ({ paddingTop: 80, width: "100vw", minHeight: "calc(100vh - 100px)", - height: "100vh" + height: "100%" }, [theme.breakpoints.down("sm")]: { minHeight: "calc(100vh - 263px)" diff --git a/src/pages/ForgotPassword/index.tsx b/src/pages/ForgotPassword/index.tsx index dec365cde2..d16b019a33 100644 --- a/src/pages/ForgotPassword/index.tsx +++ b/src/pages/ForgotPassword/index.tsx @@ -256,7 +256,7 @@ export default function ForgotPassword() { ) : ( - + )} diff --git a/src/pages/ProtocolParameter/index.tsx b/src/pages/ProtocolParameter/index.tsx index d8151efe57..4669e39ffc 100644 --- a/src/pages/ProtocolParameter/index.tsx +++ b/src/pages/ProtocolParameter/index.tsx @@ -28,7 +28,7 @@ import InfoSolidIcon from "src/components/commons/InfoSolidIcon"; import { details, lists } from "src/commons/routers"; import { API } from "src/commons/utils/api"; import { PROTOCOL_TYPE } from "src/commons/utils/constants"; -import { formatDateTimeLocal } from "src/commons/utils/helper"; +import { formatDateTimeLocal, getShortValue } from "src/commons/utils/helper"; import ParseScriptModal from "src/components/ParseScriptModal"; import Card from "src/components/commons/Card"; import DateRangeModal from "src/components/commons/CustomFilter/DateRangeModal"; @@ -233,7 +233,7 @@ const ProtocolParameter: React.FC = () => { textOverflow={"ellipsis"} color={({ palette }) => (isModalType ? palette.primary.main : "unset")} > - {r.value} + {getShortValue(r.value)} );