Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix lp badge gradient overflow and android shadows #6296

Merged
merged 1 commit into from
Dec 5, 2024
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
3 changes: 2 additions & 1 deletion src/screens/positions/LpPositionListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export const LpPositionListItem: React.FC<Props> = ({ assets, totalAssetsValue,
borderColor={{ custom: 'rgba(0,0,0,0.02)' }}
backgroundColor={rangeStatus === 'in_range' || rangeStatus === 'full_range' ? colors.green : colors.red}
shadowColor={rangeStatus === 'in_range' || rangeStatus === 'full_range' ? colors.green : colors.red}
elevation={12}
elevation={2}
shadowOpacity={IS_IOS ? 0.2 : 1}
shadowRadius={6}
style={{
Expand All @@ -137,6 +137,7 @@ export const LpPositionListItem: React.FC<Props> = ({ assets, totalAssetsValue,
</Box>
<LpRangeBadge
assets={assets.map((underlying, index) => ({
id: underlying.asset.asset_code,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

possible for two LPs to have the same asset? If so this would create double indices

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are for each LP pool, and to my knowledge there are no LP pools that allow you to pool two of the same asset, I don't think that would make sense.

color: underlying.asset.colors?.primary ?? underlying.asset.colors?.fallback ?? colors.black,
allocationPercentage: assetAllocations[index],
}))}
Expand Down
36 changes: 25 additions & 11 deletions src/screens/positions/LpRangeBadge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const MAX_ALLOCATION_PERCENTAGE = 0.75;

type LpRangeBadgeProps = {
assets: {
id: string;
color: string;
allocationPercentage: number;
}[];
Expand Down Expand Up @@ -54,7 +55,7 @@ export const LpRangeBadge = ({ assets }: LpRangeBadgeProps) => {

return (
<Box
key={`${asset.color}-${asset.allocationPercentage}`}
key={asset.id}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same goes for here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

borderTopLeftRadius={borderTopLeftRadius}
borderBottomLeftRadius={borderBottomLeftRadius}
borderTopRightRadius={borderTopRightRadius}
Expand All @@ -65,21 +66,34 @@ export const LpRangeBadge = ({ assets }: LpRangeBadgeProps) => {
shadowColor={asset.color}
shadowOpacity={IS_IOS ? 0.2 : 1}
shadowRadius={9}
elevation={3}
style={{
shadowOffset: { width: 0, height: 3 },
borderCurve: 'continuous',
}}
>
<LinearGradient
colors={
isMiddle
? ['rgba(255, 255, 255, 0.1)', 'rgba(255, 255, 255, 0.0)', 'rgba(255, 255, 255, 0.1)']
: ['rgba(255, 255, 255, 0)', 'rgba(255, 255, 255, 0.3)']
}
start={{ x: isFirst ? 0 : 1, y: 0.5 }}
end={{ x: isFirst ? 1 : 0, y: 0.5 }}
style={StyleSheet.absoluteFillObject}
/>
<Box
height={'full'}
borderTopLeftRadius={borderTopLeftRadius}
borderBottomLeftRadius={borderBottomLeftRadius}
borderTopRightRadius={borderTopRightRadius}
borderBottomRightRadius={borderBottomRightRadius}
style={{
overflow: 'hidden',
borderCurve: 'continuous',
}}
>
<LinearGradient
colors={
isMiddle
? ['rgba(255, 255, 255, 0.1)', 'rgba(255, 255, 255, 0.0)', 'rgba(255, 255, 255, 0.1)']
: ['rgba(255, 255, 255, 0)', 'rgba(255, 255, 255, 0.3)']
}
start={{ x: isFirst ? 0 : 1, y: 0.5 }}
end={{ x: isFirst ? 1 : 0, y: 0.5 }}
style={StyleSheet.absoluteFillObject}
/>
</Box>
</Box>
);
})}
Expand Down
Loading