Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
feat: add flags to hide route selection and route details
  • Loading branch information
priyajeet committed Dec 13, 2025
commit 9df816698faef284d13baea08984aecbe731f299
6 changes: 6 additions & 0 deletions src/config/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ export type UiConfig = {

// When enabled hides the Fastest/Cheapest route selection toggle pills
hideRouteSelectionPills?: boolean;

// When enabled hides route selection
hideRouteSelection?: boolean;

// When enabled hides route details
hideRouteDetails?: boolean;
};

export type TestOptions = {
Expand Down
97 changes: 53 additions & 44 deletions src/views/v3/Bridge/Routes/details/RouteDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import MaxSlippage from './MaxSlippage';
import MinOutput from './MinOutput';
import { useToggle } from 'usehooks-ts';
import Typography from '@mui/material/Typography';
import { ChevronToggle } from './index';
import ChevronToggle from './ChevronToggle';
import config from 'config';

export interface RouteDetailsProps {
destChain?: string;
Expand Down Expand Up @@ -37,6 +38,10 @@ export default function RouteDetails({
const [isShowingDetails, handleChevronClick] = useToggle(false);
const hasAnyDetails = minReceived || quoteSlippageBps;
const hasIndicators = !!eta; // Add Fee component here when ready.
const isRouteSelectionVisible = !config.ui.hideRouteSelection;
const isRouteDetailsVisible = !config.ui.hideRouteDetails;
const justifyContent = isRouteSelectionVisible ? 'space-between' : 'end';

return (
<Stack direction="column" useFlexGap sx={{ width: '100%' }}>
<Stack
Expand All @@ -47,54 +52,58 @@ export default function RouteDetails({
}}
height={18}
alignItems="center"
justifyContent="space-between"
justifyContent={justifyContent}
>
<ProviderLabel
destChain={destChain}
provider={provider}
route={selectedRoute}
sourceChain={sourceChain}
onClick={handleToggleRoutes}
/>
<Stack
direction="row"
gap={theme.spacing(1)}
height={18}
alignItems="center"
>
<Eta eta={eta} />
{isRouteSelectionVisible && (
<ProviderLabel
destChain={destChain}
provider={provider}
route={selectedRoute}
sourceChain={sourceChain}
onClick={handleToggleRoutes}
/>
)}
{isRouteDetailsVisible && (
<Stack
direction="row"
sx={{
transition: '0.3s',
color: !hasIndicators
? theme.palette.text.secondary
: theme.palette.text.primary,
'&:hover': {
color: theme.palette.text.accent,
},
}}
gap={theme.spacing(1)}
height={18}
alignItems="center"
>
{!hasIndicators && (
<Typography
variant={'body2'}
sx={{
fontWeight: 500,
cursor: 'pointer',
}}
onClick={handleChevronClick}
>
Details
</Typography>
)}
{hasAnyDetails && (
<ChevronToggle
expanded={isShowingDetails}
onToggle={handleChevronClick}
/>
)}
<Eta eta={eta} />
<Stack
direction="row"
sx={{
transition: '0.3s',
color: !hasIndicators
? theme.palette.text.secondary
: theme.palette.text.primary,
'&:hover': {
color: theme.palette.text.accent,
},
}}
>
{!hasIndicators && (
<Typography
variant={'body2'}
sx={{
fontWeight: 500,
cursor: 'pointer',
}}
onClick={handleChevronClick}
>
Details
</Typography>
)}
{hasAnyDetails && (
<ChevronToggle
expanded={isShowingDetails}
onToggle={handleChevronClick}
/>
)}
</Stack>
</Stack>
</Stack>
)}
</Stack>
{hasAnyDetails && (
<Collapse in={isShowingDetails} timeout={500}>
Expand Down
5 changes: 1 addition & 4 deletions src/views/v3/Bridge/Routes/details/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
export { default as MaxSlippage } from './MaxSlippage';
export { default as MinOutput } from './MinOutput';
export { default as RouteDetails } from './RouteDetails';
export { default as ChevronToggle } from './ChevronToggle';
export { default } from './RouteDetails';
12 changes: 10 additions & 2 deletions src/views/v3/Bridge/Routes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { setToNativeToken } from 'store/relay';
import RoutesMobile from './RoutesBottomSheet';
import RoutesDesktop from './RoutesModal';
import RoutesLoader from './RoutesLoader';
import RouteDetails from './details/RouteDetails';
import RouteDetails from './details';
import {
getMinReceivedFromQuote,
getSlippageFromQuote,
Expand Down Expand Up @@ -288,10 +288,18 @@ function Routes({

const selectButtonDisabled =
!!selectedRoute && selectedRoute === highlightedRoute;

const isRoutesHidden =
!!config.ui.hideRouteSelection && !!config.ui.hideRouteDetails;

if (isRoutesHidden) {
return null;
}

// Done fetching and no routes are available.
// This can be an error case which the message is shown by the parent component.
if (!isLoading && routesList.length === 0) {
return <></>;
return null;
}

return (
Expand Down
Loading