diff --git a/src/containers/ProtocolOverview/index.tsx b/src/containers/ProtocolOverview/index.tsx index 0f70fd507..e1d40709e 100644 --- a/src/containers/ProtocolOverview/index.tsx +++ b/src/containers/ProtocolOverview/index.tsx @@ -92,6 +92,22 @@ export const ProtocolOverview = (props: IProtocolOverviewPageData) => { return formattedNum(value, true) } + const compareProtocolsUrl = useMemo(() => { + // If this is a combined protocol with child versions, compare the child protocols + if (props.otherProtocols && props.otherProtocols.length > 1) { + const childProtocols = props.otherProtocols + .slice(1, 4) + .map((p) => `protocol=${encodeURIComponent(p)}`) + .join('&') + return `/compare-protocols?${childProtocols}` + } + // Otherwise, compare with top competitor if available + if (props.competitors?.length) { + return `/compare-protocols?protocol=${encodeURIComponent(props.name)}&protocol=${encodeURIComponent(props.competitors[0].name)}` + } + return `/compare-protocols?protocol=${encodeURIComponent(props.name)}` + }, [props.otherProtocols, props.competitors, props.name]) + return ( { {props.token.symbol && props.token.symbol !== '-' ? ( ({props.token.symbol}) ) : null} - +
+ + + Compare + + +
{ {props.token.symbol && props.token.symbol !== '-' ? ( ({props.token.symbol}) ) : null} + + + Compare +