diff --git a/docker-compose.yml b/docker-compose.yml index c189a2bf88..b5cf6f90f6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -26,5 +26,6 @@ services: - REACT_APP_ADA_HANDLE_API=${REACT_APP_ADA_HANDLE_API} - REACT_APP_BOLNISI_NAME_API=${REACT_APP_BOLNISI_NAME_API} - REACT_APP_API_URL_COIN_GECKO=${REACT_APP_API_URL_COIN_GECKO} + - REACT_APP_FF_GLOBAL_IS_CONWAY_ERA=${REACT_APP_FF_GLOBAL_IS_CONWAY_ERA} ports: - "${PORT}:80" diff --git a/env.global.tmp.js b/env.global.tmp.js index 2b2c9f9838..70866ba03b 100644 --- a/env.global.tmp.js +++ b/env.global.tmp.js @@ -20,3 +20,4 @@ window.env.REACT_APP_CARDANO_NEWS_URL = `$REACT_APP_CARDANO_NEWS_URL`; window.env.REACT_APP_ADA_HANDLE_API = `$REACT_APP_ADA_HANDLE_API`; window.env.REACT_APP_BOLNISI_NAME_API = `$REACT_APP_BOLNISI_NAME_API`; window.env.REACT_APP_API_URL_COIN_GECKO = `$REACT_APP_API_URL_COIN_GECKO`; +window.env.REACT_APP_FF_GLOBAL_IS_CONWAY_ERA = `$REACT_APP_FF_GLOBAL_IS_CONWAY_ERA`; diff --git a/src/commons/utils/constants.ts b/src/commons/utils/constants.ts index 1d6406018e..6cf3958640 100644 --- a/src/commons/utils/constants.ts +++ b/src/commons/utils/constants.ts @@ -134,6 +134,8 @@ export const EXT_ADA_PRICE_URL = process.env.REACT_APP_EXT_ADA_PRICE_URL || get(window, "env.REACT_APP_EXT_ADA_PRICE_URL"); export const BOLNISI_NAME_API = process.env.REACT_APP_BOLNISI_NAME_API || get(window, "env.REACT_APP_BOLNISI_NAME_API"); export const API_GECKO = process.env.REACT_APP_API_URL_COIN_GECKO || get(window, "env.REACT_APP_API_URL_COIN_GECKO"); +export const IS_CONWAY_ERA = + (process.env.REACT_APP_FF_GLOBAL_IS_CONWAY_ERA || get(window, "env.REACT_APP_FF_GLOBAL_IS_CONWAY_ERA")) === "true"; export enum ACCOUNT_ERROR { UNKNOWN_ERROR = "CC_1", diff --git a/src/components/DelegationPool/DelegationList/index.tsx b/src/components/DelegationPool/DelegationList/index.tsx index 1ac9749f6c..4e88f07401 100644 --- a/src/components/DelegationPool/DelegationList/index.tsx +++ b/src/components/DelegationPool/DelegationList/index.tsx @@ -14,6 +14,7 @@ import ADAicon from "src/components/commons/ADAIcon"; import CustomFilterMultiRange from "src/components/commons/CustomFilterMultiRange"; import CustomTooltip from "src/components/commons/CustomTooltip"; import Table, { Column } from "src/components/commons/Table"; +import { IS_CONWAY_ERA } from "src/commons/utils/constants"; import { AntSwitch, PoolName, ShowRetiredPools, TopSearchContainer } from "./styles"; @@ -194,7 +195,12 @@ const DelegationLists: React.FC = () => { { + if ((col.key === "governanceParticipationRate" || col.key === "votingPower") && !IS_CONWAY_ERA) { + return false; + } + return true; + })} total={{ count: fetchData.total, title: "Total", isDataOverSize: fetchData.isDataOverSize }} onClickRow={(_, r: Delegators) => history.push(details.delegation(r.poolId), { fromPath })} pagination={{ diff --git a/src/components/commons/CustomFilterMultiRange/index.tsx b/src/components/commons/CustomFilterMultiRange/index.tsx index e9ebc69fc1..2daf3d59f4 100644 --- a/src/components/commons/CustomFilterMultiRange/index.tsx +++ b/src/components/commons/CustomFilterMultiRange/index.tsx @@ -21,6 +21,7 @@ import { API } from "src/commons/utils/api"; import { LARGE_NUMBER_ABBREVIATIONS, formatADA, formatPercent } from "src/commons/utils/helper"; import { FilterWrapper } from "src/pages/NativeScriptsAndSC/styles"; import usePageInfo from "src/commons/hooks/usePageInfo"; +import { IS_CONWAY_ERA } from "src/commons/utils/constants"; import { ApplyFilterButton, StyledInput } from "../CustomFilter/styles"; import { AccordionContainer, AccordionDetailsFilter, FilterContainer, StyledSlider } from "./styles"; @@ -373,98 +374,103 @@ const CustomFilterMultiRange: React.FC = () => { - - - - - - palette.secondary.main}> - {t("pool.poolParticipation")} + {IS_CONWAY_ERA && ( + <> + + + + + + palette.secondary.main}> + {t("pool.poolParticipation")} + + + + {expanded === "poolParticipation" ? ( + + ) : ( + + )} + - - - {expanded === "poolParticipation" ? ( - - ) : ( - - )} - - - - - - {formatPercent(dataRange?.minGovParticipationRate) || `0%`} - formatPercent(value)} - data-testid="slider" - getAriaLabel={() => "Minimum distance"} - defaultValue={[ - filterParams.minGovParticipationRate || 0, - initParams.maxGovParticipationRate || 0 - ]} - onChange={(e, newValue) => - handleChangeValueRange(e, newValue, "minGovParticipationRate", "maxGovParticipationRate") - } - value={[ - filterParams.minGovParticipationRate || 0, - filterParams.maxGovParticipationRate ?? (initParams.maxGovParticipationRate || 0) - ]} - valueLabelDisplay="auto" - disableSwap - step={0.000001} - min={dataRange?.minGovParticipationRate || 0} - max={dataRange?.maxGovParticipationRate || 0} - /> - {formatPercent(dataRange?.maxGovParticipationRate || 0) || `0%`} - - - - - - - - - palette.secondary.main}> - {t("pool.poolVoting")} + + + + {formatPercent(dataRange?.minGovParticipationRate) || `0%`} + formatPercent(value)} + data-testid="slider" + getAriaLabel={() => "Minimum distance"} + defaultValue={[ + filterParams.minGovParticipationRate || 0, + initParams.maxGovParticipationRate || 0 + ]} + onChange={(e, newValue) => + handleChangeValueRange(e, newValue, "minGovParticipationRate", "maxGovParticipationRate") + } + value={[ + filterParams.minGovParticipationRate || 0, + filterParams.maxGovParticipationRate ?? (initParams.maxGovParticipationRate || 0) + ]} + valueLabelDisplay="auto" + disableSwap + step={0.000001} + min={dataRange?.minGovParticipationRate || 0} + max={dataRange?.maxGovParticipationRate || 0} + /> + {formatPercent(dataRange?.maxGovParticipationRate || 0) || `0%`} - - - {expanded === "poolVoting" ? ( - - ) : ( - - )} - - - - - - {formatPercent(dataRange?.minVotingPower || 0)} - formatPercent(value)} - data-testid="slider" - getAriaLabel={() => "Minimum distance"} - defaultValue={[filterParams.minVotingPower || 0, initParams.maxVotingPower || 0]} - onChange={(e, newValue) => - handleChangeValueRange(e, newValue, "minVotingPower", "maxVotingPower") - } - value={[ - filterParams.minVotingPower || 0, - filterParams.maxVotingPower ?? (initParams.maxVotingPower || 0) - ]} - valueLabelDisplay="auto" - disableSwap - min={dataRange?.minVotingPower || 0} - step={0.0001} - max={dataRange?.maxVotingPower || 0} - /> - {formatPercent(dataRange?.maxVotingPower || 0)} - - - + + + + + + + + palette.secondary.main}> + {t("pool.poolVoting")} + + + + {expanded === "poolVoting" ? ( + + ) : ( + + )} + + + + + + {formatPercent(dataRange?.minVotingPower || 0)} + formatPercent(value)} + data-testid="slider" + getAriaLabel={() => "Minimum distance"} + defaultValue={[filterParams.minVotingPower || 0, initParams.maxVotingPower || 0]} + onChange={(e, newValue) => + handleChangeValueRange(e, newValue, "minVotingPower", "maxVotingPower") + } + value={[ + filterParams.minVotingPower || 0, + filterParams.maxVotingPower ?? (initParams.maxVotingPower || 0) + ]} + valueLabelDisplay="auto" + disableSwap + min={dataRange?.minVotingPower || 0} + step={0.0001} + max={dataRange?.maxVotingPower || 0} + /> + {formatPercent(dataRange?.maxVotingPower || 0)} + + + + + )} + = ({ history }) => { {children?.length ? ( - {children.map((subItem, subIndex) => { - const { href, icon, isSpecialPath, key } = subItem; - const title = t(key || ""); - return href ? ( - ({ - ...itemStyle(theme, sidebar), - ...(isActiveMenu(href, isSpecialPath) - ? { - backgroundColor: (theme) => `${theme.palette.primary[200]} !important`, - color: (theme) => `${theme.palette.secondary.main} !important` - } - : { color: (theme) => theme.palette.secondary.light }), - paddingLeft: "70px", - [theme.breakpoints.down("md")]: { - paddingLeft: "60px" - }, - ":hover": isActiveMenu(href, isSpecialPath) - ? { - color: `#fff !important` - } - : { - backgroundColor: (theme) => `${theme.palette.primary[200]} !important` - } - })} - > - {icon ? ( - - ) : null} - - - ) : null; - })} + {children + .filter((i) => { + if (i.key === "head.page.drep" && !IS_CONWAY_ERA) return false; + return true; + }) + .map((subItem, subIndex) => { + const { href, icon, isSpecialPath, key } = subItem; + const title = t(key || ""); + return href ? ( + ({ + ...itemStyle(theme, sidebar), + ...(isActiveMenu(href, isSpecialPath) + ? { + backgroundColor: (theme) => `${theme.palette.primary[200]} !important`, + color: (theme) => `${theme.palette.secondary.main} !important` + } + : { color: (theme) => theme.palette.secondary.light }), + paddingLeft: "70px", + [theme.breakpoints.down("md")]: { + paddingLeft: "60px" + }, + ":hover": isActiveMenu(href, isSpecialPath) + ? { + color: `#fff !important` + } + : { + backgroundColor: (theme) => `${theme.palette.primary[200]} !important` + } + })} + > + {icon ? ( + + ) : null} + + + ) : null; + })} ) : null} diff --git a/src/pages/DelegationDetail/index.tsx b/src/pages/DelegationDetail/index.tsx index c2238d5f85..5639900b85 100644 --- a/src/pages/DelegationDetail/index.tsx +++ b/src/pages/DelegationDetail/index.tsx @@ -13,7 +13,7 @@ import useFetchList from "src/commons/hooks/useFetchList"; import { StakeKeyHistoryIcon, StakingDelegators, TimelineIconComponent, VotesIcon } from "src/commons/resources"; import { routers } from "src/commons/routers"; import { API } from "src/commons/utils/api"; -import { VOTE_TYPE, POOL_STATUS, STATUS_VOTE } from "src/commons/utils/constants"; +import { VOTE_TYPE, POOL_STATUS, STATUS_VOTE, IS_CONWAY_ERA } from "src/commons/utils/constants"; import { getPageInfo } from "src/commons/utils/helper"; import DelegationDetailChart from "src/components/DelegationDetail/DelegationDetailChart"; import DelegationDetailInfo from "src/components/DelegationDetail/DelegationDetailInfo"; @@ -180,7 +180,12 @@ const DelegationDetail: React.FC = () => { ) } - ]; + ].filter((tab) => { + if (tab.key === "governanceVotes" && !IS_CONWAY_ERA) { + return false; + } + return true; + }); const indexExpand = tabs.findIndex((item) => item.key === tab); const needBorderRadius = (currentKey: string) => { diff --git a/src/pages/DrepDetail/index.tsx b/src/pages/DrepDetail/index.tsx index 14272b68fe..e01255f000 100644 --- a/src/pages/DrepDetail/index.tsx +++ b/src/pages/DrepDetail/index.tsx @@ -53,10 +53,11 @@ import { CommonSkeleton } from "src/components/commons/CustomSkeleton"; import { TruncateSubTitleContainer } from "src/components/share/styled"; import DynamicEllipsisText from "src/components/DynamicEllipsisText"; import { useScreen } from "src/commons/hooks/useScreen"; -import { VOTE_TYPE } from "src/commons/utils/constants"; +import { IS_CONWAY_ERA, VOTE_TYPE } from "src/commons/utils/constants"; import DelegationGovernanceVotes, { ActionMetadataModalConfirm } from "src/components/GovernanceVotes"; import { StyledContainer, StyledMenuItem, StyledSelect, TimeDuration, TitleCard, TitleTab, ValueCard } from "./styles"; +import NotFound from "../NotFound"; const voteOption = [ { title: "Action Type", value: "Default" }, @@ -265,6 +266,10 @@ const DrepDetail = () => { ) } ]; + + if (!IS_CONWAY_ERA) { + return ; + } if (loading) { return ( diff --git a/src/pages/Dreps/index.tsx b/src/pages/Dreps/index.tsx index 4132b35352..ab0e422251 100644 --- a/src/pages/Dreps/index.tsx +++ b/src/pages/Dreps/index.tsx @@ -1,14 +1,19 @@ import { useEffect } from "react"; import OverViews from "src/components/Dreps/DrepsOverview"; +import { IS_CONWAY_ERA } from "src/commons/utils/constants"; import DrepsList from "src/components/Dreps/DrepsList"; +import NotFound from "../NotFound"; import { Horizon, StyledContainer } from "./styles"; const Dreps = () => { useEffect(() => { document.title = `Delegated Representative | Cardano Blockchain Explorer`; }, []); + if (!IS_CONWAY_ERA) { + return ; + } return ( diff --git a/vite.config.ts b/vite.config.ts index 5dfb94de9e..ecaef5f52a 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -20,7 +20,8 @@ export default defineConfig(({ mode }) => { "process.env.REACT_APP_SANCHONET_APP_URL": JSON.stringify(env.REACT_APP_SANCHONET_APP_URL), "process.env.REACT_APP_BOLNISI_NAME_API": JSON.stringify(env.REACT_APP_BOLNISI_NAME_API), "process.env.REACT_APP_ADA_HANDLE_API": JSON.stringify(env.REACT_APP_ADA_HANDLE_API), - "process.env.REACT_APP_API_URL_COIN_GECKO": JSON.stringify(env.REACT_APP_API_URL_COIN_GECKO) + "process.env.REACT_APP_API_URL_COIN_GECKO": JSON.stringify(env.REACT_APP_API_URL_COIN_GECKO), + "process.env.REACT_APP_FF_GLOBAL_IS_CONWAY_ERA": JSON.stringify(env.REACT_APP_FF_GLOBAL_IS_CONWAY_ERA) }, optimizeDeps: { esbuildOptions: {