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
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ interface MarketInsightsRouteParams {
tokenChainId?: string;
/** When true, indicates the view was opened from the Perps market details view */
isPerps?: boolean;
/** When true, the user has an existing perps position for this asset */
hasPerpsPosition?: boolean;
}

/**
Expand Down Expand Up @@ -182,6 +184,7 @@ const MarketInsightsView: React.FC = () => {
tokenName,
tokenChainId,
isPerps = false,
hasPerpsPosition = false,
} = route.params;

const isMarketInsightsEnabled = isPerps
Expand Down Expand Up @@ -660,65 +663,79 @@ const MarketInsightsView: React.FC = () => {
>
{strings('market_insights.helpful_prompt')}
</Text>
{isPerps && hasPerpsPosition && (
<Text
variant={TextVariant.BodySm}
color={TextColor.TextAlternative}
twClassName="pt-3"
>
{strings('market_insights.footer_disclaimer')}
</Text>
)}
</Box>
</ScrollView>

<Box
twClassName={`border-t border-muted bg-default px-4 pt-4 pb-[${insets.bottom + 8}px]`}
>
{isPerps ? (
<Box flexDirection={BoxFlexDirection.Row} gap={3}>
<Button
variant={ButtonVariant.Primary}
size={ButtonSize.Lg}
twClassName="flex-1"
onPress={() => handlePerpsDirectionPress('long')}
testID={MarketInsightsSelectorsIDs.LONG_BUTTON}
>
{strings('perps.market.long')}
</Button>
<Button
variant={ButtonVariant.Primary}
size={ButtonSize.Lg}
twClassName="flex-1"
onPress={() => handlePerpsDirectionPress('short')}
testID={MarketInsightsSelectorsIDs.SHORT_BUTTON}
>
{strings('perps.market.short')}
</Button>
</Box>
) : (
<Box flexDirection={BoxFlexDirection.Row} gap={3}>
<Box twClassName="flex-1">
{!(isPerps && hasPerpsPosition) && (
<Box
twClassName={`border-t border-muted bg-default px-4 pt-4 pb-[${insets.bottom + 8}px]`}
>
{isPerps ? (
<Box flexDirection={BoxFlexDirection.Row} gap={3}>
<Button
variant={ButtonVariant.Primary}
size={ButtonSize.Lg}
isFullWidth
onPress={handleSwapPress}
testID={MarketInsightsSelectorsIDs.SWAP_BUTTON}
twClassName="flex-1"
onPress={() => handlePerpsDirectionPress('long')}
testID={MarketInsightsSelectorsIDs.LONG_BUTTON}
>
{strings('market_insights.swap_button')}
{strings('perps.market.long')}
</Button>
</Box>
<Box twClassName="flex-1">
<Button
variant={ButtonVariant.Primary}
size={ButtonSize.Lg}
isFullWidth
onPress={handleBuyPress}
testID={MarketInsightsSelectorsIDs.BUY_BUTTON}
twClassName="flex-1"
onPress={() => handlePerpsDirectionPress('short')}
testID={MarketInsightsSelectorsIDs.SHORT_BUTTON}
>
{strings('market_insights.buy_button')}
{strings('perps.market.short')}
</Button>
</Box>
) : (
<Box flexDirection={BoxFlexDirection.Row} gap={3}>
<Box twClassName="flex-1">
<Button
variant={ButtonVariant.Primary}
size={ButtonSize.Lg}
isFullWidth
onPress={handleSwapPress}
testID={MarketInsightsSelectorsIDs.SWAP_BUTTON}
>
{strings('market_insights.swap_button')}
</Button>
</Box>
<Box twClassName="flex-1">
<Button
variant={ButtonVariant.Primary}
size={ButtonSize.Lg}
isFullWidth
onPress={handleBuyPress}
testID={MarketInsightsSelectorsIDs.BUY_BUTTON}
>
{strings('market_insights.buy_button')}
</Button>
</Box>
</Box>
)}
<Box twClassName="pt-3" alignItems={BoxAlignItems.Center}>
<Text
variant={TextVariant.BodySm}
color={TextColor.TextAlternative}
>
{strings('market_insights.footer_disclaimer')}
</Text>
</Box>
)}
<Box twClassName="pt-3" alignItems={BoxAlignItems.Center}>
<Text variant={TextVariant.BodySm} color={TextColor.TextAlternative}>
{strings('market_insights.footer_disclaimer')}
</Text>
</Box>
</Box>
)}

{selectedTrend ? (
<MarketInsightsTrendSourcesBottomSheet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1040,8 +1040,9 @@ const PerpsMarketDetailsView: React.FC<PerpsMarketDetailsViewProps> = () => {
assetSymbol: market.symbol,
assetIdentifier: market.symbol,
isPerps: true,
hasPerpsPosition: !!existingPosition,
});
}, [market?.symbol, navigation, track]);
}, [market?.symbol, navigation, track, existingPosition]);

// Handler for order selection - navigates to order details
const handleOrderSelect = useCallback(
Expand Down
Loading