Skip to content

Commit

Permalink
More UI fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Perronef5 committed Oct 16, 2024
1 parent 6596735 commit ee6cfc9
Show file tree
Hide file tree
Showing 21 changed files with 332 additions and 212 deletions.
4 changes: 2 additions & 2 deletions src/assets/images/closeModal.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions src/assets/images/info.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 37 additions & 13 deletions src/components/ButtonPressable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { useCreateOpacity } from '@theme/themeHooks'
import Box from './Box'
import ButtonPressAnimation from './ButtonPressAnimation'
import Text from './Text'
import CircleLoader from './CircleLoader'

type Props = BoxProps<Theme> & {
backgroundColorDisabled?: Color
Expand All @@ -34,6 +35,9 @@ type Props = BoxProps<Theme> & {
LeadingComponent?: React.ReactNode
TrailingComponent?: React.ReactNode
iconProps?: SvgProps
loading?: boolean
customLoadingColor?: Color
customLoadingColorDisabled?: Color
}

const ButtonPressable = ({
Expand Down Expand Up @@ -62,6 +66,9 @@ const ButtonPressable = ({
LeadingComponent,
TrailingComponent,
iconProps,
loading,
customLoadingColor = 'primaryText',
customLoadingColorDisabled = 'text.disabled',
...boxProps
}: Props) => {
const [pressed, setPressed] = useState(false)
Expand Down Expand Up @@ -137,6 +144,12 @@ const ButtonPressable = ({
backgroundColorOpacity,
])

const circleLoaderColor = useMemo(() => {
if (disabled) return customLoadingColorDisabled
if (loading) return customLoadingColor
return 'primaryText'
}, [disabled, loading, customLoadingColor, customLoadingColorDisabled])

return (
<ButtonPressAnimation
overflow="hidden"
Expand All @@ -155,23 +168,34 @@ const ButtonPressable = ({
flexDirection="row"
justifyContent={Icon ? 'center' : 'center'}
alignItems="center"
borderRadius="full"
{...containerProps}
>
{LeadingComponent && <Box marginEnd="xs">{LeadingComponent}</Box>}
{loading ? (
<Box flexDirection="row" alignItems="center" padding="4">
<CircleLoader color={circleLoaderColor} loaderSize={20} />
</Box>
) : (
<>
{LeadingComponent && <Box marginEnd="xs">{LeadingComponent}</Box>}

{title && (
<Text
variant="textXlMedium"
fontSize={fontSize || 19}
fontWeight={fontWeight}
style={titleColorStyle}
marginHorizontal="xs"
>
{title}
</Text>
{title && (
<Text
variant="textXlMedium"
fontSize={fontSize || 19}
fontWeight={fontWeight}
style={titleColorStyle}
marginHorizontal="xs"
>
{title}
</Text>
)}
{Icon && <Icon color={iconColor} {...iconProps} />}
{TrailingComponent && (
<Box marginStart="xs">{TrailingComponent}</Box>
)}
</>
)}
{Icon && <Icon color={iconColor} {...iconProps} />}
{TrailingComponent && <Box marginStart="xs">{TrailingComponent}</Box>}
</Box>
</ButtonPressAnimation>
)
Expand Down
14 changes: 10 additions & 4 deletions src/components/CloseButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,31 @@ import Close from '@assets/images/closeModal.svg'
import { GestureResponderEvent, Insets } from 'react-native'
import { BoxProps } from '@shopify/restyle'
import { useColors } from '@theme/themeHooks'
import { Theme } from '@theme/theme'
import { Color, Theme } from '@theme/theme'
import IconPressedContainer from './IconPressedContainer'
import Box from './Box'

export type CloseButtonProps = {
onPress?: ((event: GestureResponderEvent) => void) | null | undefined
hitSlop?: Insets | undefined
color?: Color
} & BoxProps<Theme>

const CloseButton = ({ onPress, hitSlop, ...props }: CloseButtonProps) => {
const { primaryText } = useColors()
const CloseButton = ({
onPress,
hitSlop,
color = 'primaryText',
...props
}: CloseButtonProps) => {
const colors = useColors()
return (
<Box hitSlop={hitSlop} {...props}>
<IconPressedContainer
onPress={onPress}
idleOpacity={0.75}
activeOpacity={0.9}
>
<Close color={primaryText} />
<Close color={colors[color]} />
</IconPressedContainer>
</Box>
)
Expand Down
7 changes: 6 additions & 1 deletion src/features/account/AccountActionBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,13 @@ const AccountActionBar = ({
if (pin?.status === 'on' && requirePinForPayment) {
walletPageNav.navigate('ConfirmPin', { action: 'payment' })
} else {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
navigation.navigate('Send', {
mint: mint?.toBase58(),
screen: 'PaymentScreen',
params: {
mint: mint?.toBase58(),
},
})
}
break
Expand Down
2 changes: 1 addition & 1 deletion src/features/account/AccountManageTokenListScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ const AccountManageTokenListScreen: React.FC = () => {

return (
<ScrollBox>
<BackScreen>
<BackScreen edges={[]} headerTopMargin="6xl">
<FlatList
refreshControl={
<RefreshControl
Expand Down
16 changes: 14 additions & 2 deletions src/features/collectables/AssertLocationScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import 'text-encoding-polyfill'
import { useDebounce } from 'use-debounce'
import { useColors, useCreateOpacity, useSpacing } from '@theme/themeHooks'
import { useSafeAreaInsets } from 'react-native-safe-area-context'
import CloseButton from '@components/CloseButton'
import {
CollectableNavigationProp,
CollectableStackParamList,
Expand Down Expand Up @@ -732,7 +733,8 @@ const AssertLocationScreen = () => {
</Box>
)}
{elevGainVisible ? (
<ReAnimatedBlurBox
<ReAnimatedBox
backgroundColor="primaryBackground"
visible={elevGainVisible}
entering={FadeInFast}
flexDirection="row"
Expand All @@ -743,6 +745,15 @@ const AssertLocationScreen = () => {
>
<TouchableWithoutFeedback onPress={() => Keyboard.dismiss()}>
<Box flex={1}>
<Box flexDirection="row">
<Box flex={1} />
<CloseButton
marginEnd="4"
marginTop="6xl"
color="primaryText"
onPress={() => setElevGainVisible(false)}
/>
</Box>
<KeyboardAvoidingView style={{ flex: 1 }} behavior="padding">
<Box
backgroundColor="transparent"
Expand All @@ -755,6 +766,7 @@ const AssertLocationScreen = () => {
textAlign="left"
variant="textLgMedium"
adjustsFontSizeToFit
color="primaryText"
>
{t('assertLocationScreen.antennaSetup')}
</Text>
Expand Down Expand Up @@ -824,7 +836,7 @@ const AssertLocationScreen = () => {
</Box>
</Box>
</TouchableWithoutFeedback>
</ReAnimatedBlurBox>
</ReAnimatedBox>
) : undefined}
</Box>
</ReAnimatedBox>
Expand Down
2 changes: 1 addition & 1 deletion src/features/collectables/HotspotMapScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ const HotspotMapScreen = () => {
<BottomSheetModalProvider>
<BottomSheetModal
ref={bottomSheetRef}
snapPoints={[160]}
snapPoints={[200]}
enablePanDownToClose
enableDynamicSizing
animateOnMount
Expand Down
Loading

0 comments on commit ee6cfc9

Please sign in to comment.