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
9 changes: 1 addition & 8 deletions packages/common/src/store/ui/buy-sell/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,10 @@ export const findTokenBySymbol = (
tokens: Record<string, TokenInfo>
): TokenInfo | null => {
if (!symbol || typeof symbol !== 'string') {
console.warn('findTokenBySymbol: Invalid symbol provided:', symbol)
return null
}

if (!tokens || typeof tokens !== 'object') {
console.warn('findTokenBySymbol: Invalid tokens object provided:', tokens)
return null
}

Expand All @@ -84,7 +82,6 @@ export const findTokenBySymbol = (
// Try with $ prefix
if (tokens[`$${normalized}`]) return tokens[`$${normalized}`]

console.debug(`findTokenBySymbol: Token not found for symbol: ${symbol}`)
return null
}

Expand All @@ -96,18 +93,14 @@ export const findTokenByAddress = (
tokens: Record<string, TokenInfo>
): TokenInfo | null => {
if (!address || typeof address !== 'string') {
console.warn('findTokenByAddress: Invalid address provided:', address)
return null
}

if (!tokens || typeof tokens !== 'object') {
console.warn('findTokenByAddress: Invalid tokens object provided:', tokens)
return null
}

const token = Object.values(tokens).find((token) => token.address === address)
if (!token) {
console.debug(`findTokenByAddress: Token not found for address: ${address}`)
}

return token || null
}
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export const InputTokenSection = ({
hideLabel
placeholder={placeholder}
startAdornmentText={isStablecoin ? '$' : ''}
endAdornmentText={symbol}
endAdornmentText={symbol === 'USDC' ? 'USD' : symbol}
value={localAmount}
onChangeText={handleTextChange}
keyboardType='numeric'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const OutputTokenSection = ({
hideLabel
placeholder={placeholder}
startAdornmentText={isStablecoin ? '$' : ''}
endAdornmentText={symbol}
endAdornmentText={symbol === 'USDC' ? 'USD' : symbol}
value={localAmount}
onChangeText={handleTextChange}
keyboardType='numeric'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
} from '@audius/harmony-native'
import { TooltipInfoIcon } from 'app/components/buy-sell/TooltipInfoIcon'
import { useDrawer } from 'app/hooks/useDrawer'
import { env } from 'app/services/env'
import { isIos } from 'app/utils/os'

import { GraduationProgressBar } from './GraduationProgressBar'
Expand Down Expand Up @@ -96,7 +97,9 @@ const MetricRow = ({ metric, coin }: { metric: MetricData; coin?: Coin }) => {
const isGraduationProgress = metric.label === 'Graduation Progress'

if (isGraduationProgress) {
return <GraduationMetricRow metric={metric} coin={coin} />
return env.WAUDIO_MINT_ADDRESS === coin?.mint ? null : (
<GraduationMetricRow metric={metric} coin={coin} />
)
}

return (
Expand Down
1 change: 1 addition & 0 deletions packages/web/src/components/buy-sell-modal/BuyTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export const BuyTab = ({
availableBalance={availableBalance}
error={error}
errorMessage={errorMessage}
hideTokenDisplay={true}
/>
<OutputTokenSection
tokenInfo={selectedOutputToken}
Expand Down
10 changes: 9 additions & 1 deletion packages/web/src/components/buy-sell-modal/ConvertTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,15 @@ export const ConvertTab = ({
color='subdued'
onClick={onChangeSwapDirection}
aria-label='Swap token direction'
css={{ transform: 'rotate(90deg)' }}
css={{
transform: 'rotate(90deg)',
'&:hover svg': {
transform: 'rotate(90deg) scale(1.1)'
},
'&:active svg': {
transform: 'rotate(90deg) scale(0.98)'
}
}}
Comment on lines +188 to +196

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

messy, but works

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

cool yeah this is what i landed on too but was so sad :/

/>
<Divider />
</Flex>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type InputTokenSectionProps = {
tokenPriceDecimalPlaces?: number
availableTokens?: TokenInfo[]
onTokenChange?: (token: TokenInfo) => void
hideTokenDisplay?: boolean
}

export const InputTokenSection = ({
Expand All @@ -54,7 +55,8 @@ export const InputTokenSection = ({
error,
errorMessage,
availableTokens,
onTokenChange
onTokenChange,
hideTokenDisplay = false
}: InputTokenSectionProps) => {
const { symbol, isStablecoin } = tokenInfo
const [localAmount, setLocalAmount] = useState(amount || '')
Expand Down Expand Up @@ -131,7 +133,7 @@ export const InputTokenSection = ({
hideLabel
placeholder={placeholder}
startAdornmentText={isStablecoin ? '$' : ''}
endAdornmentText={symbol}
endAdornmentText={symbol === 'USDC' ? 'USD' : symbol}
value={localAmount}
onChange={(e) => handleTextChange(e.target.value)}
type='number'
Expand All @@ -140,19 +142,19 @@ export const InputTokenSection = ({
/>
</Flex>

{shouldDisplayTokenDropdown ? (
{!hideTokenDisplay && shouldDisplayTokenDropdown ? (
<Flex css={(theme) => ({ minWidth: theme.spacing.unit15 })}>
<TokenDropdown
selectedToken={tokenInfo}
availableTokens={availableTokens}
onTokenChange={onTokenChange}
/>
</Flex>
) : (
) : !hideTokenDisplay ? (
<Flex css={(theme) => ({ minWidth: theme.spacing.unit15 })}>
<StaticTokenDisplay tokenInfo={tokenInfo} />
</Flex>
)}
) : null}

{onMaxClick ? (
<Button variant='secondary' size='large' onClick={onMaxClick}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export const OutputTokenSection = ({
hideLabel
placeholder={placeholder}
startAdornmentText={isStablecoin ? '$' : ''}
endAdornmentText={symbol}
endAdornmentText={symbol === 'USDC' ? 'USD' : symbol}
value={localAmount}
onChange={(e) => handleTextChange(e.target.value)}
type='number'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { Coin } from '@audius/common/adapters'
import { useArtistCoin } from '@audius/common/api'
import { coinDetailsMessages } from '@audius/common/messages'
import { createCoinMetrics, MetricData } from '@audius/common/utils'
Expand All @@ -11,6 +12,7 @@ import {
} from '@audius/harmony'

import { Tooltip } from 'components/tooltip'
import { env } from 'services/env'

import { componentWithErrorBoundary } from '../../../components/error-wrapper/componentWithErrorBoundary'
import Skeleton from '../../../components/skeleton/Skeleton'
Expand Down Expand Up @@ -143,13 +145,15 @@ const MetricRowComponent = ({
coin
}: {
metric: MetricData
coin?: any
coin?: Coin
}) => {
const changeColor = metric.change?.isPositive ? 'premium' : 'subdued'
const isGraduationProgress = metric.label === 'Graduation Progress'

if (isGraduationProgress) {
return <GraduationProgressMetricRow metric={metric} coin={coin} />
return env.WAUDIO_MINT_ADDRESS === coin?.mint ? null : (
<GraduationProgressMetricRow metric={metric} coin={coin} />
)
}

return (
Expand Down