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

Claimables [PR #2]: claim panel ui #6141

Merged
merged 37 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
382c49d
raps
benisgold Sep 24, 2024
d4dd19b
nit
benisgold Sep 24, 2024
3d8d9d1
comments
benisgold Sep 24, 2024
c268875
nit
benisgold Sep 24, 2024
9beb669
nit
benisgold Sep 24, 2024
8d7b65b
prettier
benisgold Sep 25, 2024
d6d69ce
updates to query, types, & wallet screen components
benisgold Sep 25, 2024
112fd07
rm onPress
benisgold Sep 25, 2024
d624f5c
Merge branch '@benisgold/claimables-wallet-screen-fixes' of https://g…
benisgold Sep 25, 2024
2226d95
rm logic
benisgold Sep 25, 2024
72df248
claim panel ui
benisgold Sep 25, 2024
4614748
nav
benisgold Sep 25, 2024
82fa2fc
onPress -> onLongPress
benisgold Sep 25, 2024
9d15e2d
i18n
benisgold Sep 25, 2024
b2fe4e9
pending state, i18n
benisgold Sep 25, 2024
519b1ce
comment
benisgold Sep 25, 2024
d8c84b1
shimmer
benisgold Sep 25, 2024
97241dc
tweak gas fee formatting
benisgold Sep 26, 2024
46e86ac
number formatting
benisgold Sep 26, 2024
81573c0
wallet screen number format
benisgold Sep 26, 2024
bd0e1b9
route types
benisgold Sep 26, 2024
567bae1
do not require long press for goBack
benisgold Sep 26, 2024
a14612d
tweak button text
benisgold Sep 26, 2024
066569c
nit
benisgold Sep 26, 2024
7947399
formatting
benisgold Sep 26, 2024
e556e60
thanks greg
benisgold Sep 27, 2024
cddc706
Merge branch '@benisgold/claimables-wallet-screen-fixes' of https://g…
benisgold Sep 27, 2024
8b64245
Merge branch '@benisgold/claimables-wallet-screen-fixes' of https://g…
benisgold Sep 27, 2024
6c954b3
revert
benisgold Sep 27, 2024
8f75015
Merge branch '@benisgold/raps' of https://github.com/rainbow-me/rainb…
benisgold Sep 27, 2024
460601e
fix android button width
benisgold Sep 27, 2024
1bedad2
rm memo
benisgold Sep 30, 2024
34046f1
try catch gas
benisgold Sep 30, 2024
45a9552
rm functionality from tx
benisgold Sep 30, 2024
198310c
Merge branch 'develop' of https://github.com/rainbow-me/rainbow into …
benisgold Sep 30, 2024
529e513
Merge branch '@benisgold/raps' of https://github.com/rainbow-me/rainb…
benisgold Sep 30, 2024
6bdf0f2
rm rapsv2
benisgold Sep 30, 2024
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
12 changes: 9 additions & 3 deletions src/components/asset-list/RecyclerAssetList2/Claimable.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { useMemo } from 'react';
import { Box, Inline, Stack, Text } from '@/design-system';
import { useAccountSettings } from '@/hooks';
import { useClaimables } from '@/resources/addys/claimables/query';
Expand All @@ -7,6 +7,7 @@ import { ButtonPressAnimation } from '@/components/animations';
import { deviceUtils } from '@/utils';
import Routes from '@/navigation/routesNames';
import { ExtendedState } from './core/RawRecyclerList';
import { convertAmountToNativeDisplayWorklet } from '@/__swaps__/utils/numbers';

export const Claimable = React.memo(function Claimable({ uniqueId, extendedState }: { uniqueId: string; extendedState: ExtendedState }) {
const { accountAddress, nativeCurrency } = useAccountSettings();
Expand All @@ -24,12 +25,17 @@ export const Claimable = React.memo(function Claimable({ uniqueId, extendedState

const [claimable] = data;

const nativeDisplay = useMemo(
() => convertAmountToNativeDisplayWorklet(claimable.value.nativeAsset.amount, nativeCurrency, true),
[claimable.value.nativeAsset.amount, nativeCurrency]
);
benisgold marked this conversation as resolved.
Show resolved Hide resolved

if (!claimable) return null;

return (
<Box
as={ButtonPressAnimation}
// onPress={() => navigate(Routes.CLAIM_CLAIMABLE_PANEL, { claimable })}
onPress={() => navigate(Routes.CLAIM_CLAIMABLE_PANEL, { claimable })}
scaleTo={0.96}
paddingHorizontal="20px"
justifyContent="space-between"
Expand Down Expand Up @@ -68,7 +74,7 @@ export const Claimable = React.memo(function Claimable({ uniqueId, extendedState
style={{ backgroundColor: 'rgba(7, 17, 32, 0.02)' }}
>
<Text weight="semibold" color="label" align="center" size="17pt">
{claimable.value.nativeAsset.display}
{nativeDisplay}
</Text>
</Box>
</Box>
Expand Down
16 changes: 16 additions & 0 deletions src/languages/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,22 @@
"action": "Continue"
}
},
"claimables": {
"panel": {
"calculating_gas_fee": "Calculating gas fee...",
"amount_to_claim_on_network": "%{amount} to claim on %{network}",
"claim": "Claim",
"claiming": "Claiming",
"claim_in_progress": "Claim in Progress...",
"claimed": "Claimed!",
"claiming_failed": "Claim Failed",
"insufficient_funds": "Insufficient Funds",
"claim_amount": "Claim %{amount}",
"done": "Done",
"try_again": "Try Again",
"tokens_on_the_way": "Tokens on the way!"
}
},
"cloud": {
"backup_success": "Your wallet has been backed up successfully!"
},
Expand Down
2 changes: 2 additions & 0 deletions src/navigation/Routes.android.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ import { SwapScreen } from '@/__swaps__/screens/Swap/Swap';
import { useRemoteConfig } from '@/model/remoteConfig';
import { ControlPanel } from '@/components/DappBrowser/control-panel/ControlPanel';
import { ClaimRewardsPanel } from '@/screens/points/claim-flow/ClaimRewardsPanel';
import { ClaimClaimablePanel } from '@/screens/claimables/ClaimClaimablePanel';
import { RootStackParamList } from './types';

const Stack = createStackNavigator();
Expand Down Expand Up @@ -247,6 +248,7 @@ function BSNavigator() {
<BSStack.Screen component={AppIconUnlockSheet} name={Routes.APP_ICON_UNLOCK_SHEET} options={appIconUnlockSheetPreset} />
<BSStack.Screen component={ControlPanel} name={Routes.DAPP_BROWSER_CONTROL_PANEL} />
<BSStack.Screen component={ClaimRewardsPanel} name={Routes.CLAIM_REWARDS_PANEL} />
<BSStack.Screen component={ClaimClaimablePanel} name={Routes.CLAIM_CLAIMABLE_PANEL} />
<BSStack.Screen component={ChangeWalletSheet} name={Routes.CHANGE_WALLET_SHEET} options={{ ...bottomSheetPreset }} />
{swapsV2Enabled && <BSStack.Screen component={SwapScreen} name={Routes.SWAP} options={swapSheetPreset} />}
</BSStack.Navigator>
Expand Down
8 changes: 5 additions & 3 deletions src/navigation/Routes.ios.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import {
hardwareWalletTxNavigatorConfig,
consoleSheetConfig,
customGasSheetConfig,
dappBrowserControlPanelConfig,
defaultScreenStackOptions,
ensAdditionalRecordsSheetConfig,
ensConfirmRegisterSheetConfig,
Expand All @@ -50,6 +49,7 @@ import {
nftOffersSheetConfig,
nftSingleOfferSheetConfig,
pairHardwareWalletNavigatorConfig,
panelConfig,
profileConfig,
profilePreviewConfig,
qrScannerConfig,
Expand Down Expand Up @@ -104,6 +104,7 @@ import { useRemoteConfig } from '@/model/remoteConfig';
import CheckIdentifierScreen from '@/screens/CheckIdentifierScreen';
import { ControlPanel } from '@/components/DappBrowser/control-panel/ControlPanel';
import { ClaimRewardsPanel } from '@/screens/points/claim-flow/ClaimRewardsPanel';
import { ClaimClaimablePanel } from '@/screens/claimables/ClaimClaimablePanel';
import { RootStackParamList } from './types';

const Stack = createStackNavigator();
Expand Down Expand Up @@ -285,8 +286,9 @@ function NativeStackNavigator() {
<NativeStack.Screen name={Routes.MINTS_SHEET} component={MintsSheet} {...mintsSheetConfig} />
<NativeStack.Screen component={ConsoleSheet} name={Routes.CONSOLE_SHEET} {...consoleSheetConfig} />
<NativeStack.Screen component={AppIconUnlockSheet} name={Routes.APP_ICON_UNLOCK_SHEET} {...appIconUnlockSheetConfig} />
<NativeStack.Screen component={ControlPanel} name={Routes.DAPP_BROWSER_CONTROL_PANEL} {...dappBrowserControlPanelConfig} />
<NativeStack.Screen component={ClaimRewardsPanel} name={Routes.CLAIM_REWARDS_PANEL} {...dappBrowserControlPanelConfig} />
<NativeStack.Screen component={ControlPanel} name={Routes.DAPP_BROWSER_CONTROL_PANEL} {...panelConfig} />
<NativeStack.Screen component={ClaimRewardsPanel} name={Routes.CLAIM_REWARDS_PANEL} {...panelConfig} />
<NativeStack.Screen component={ClaimClaimablePanel} name={Routes.CLAIM_CLAIMABLE_PANEL} {...panelConfig} />

{swapsV2Enabled && <NativeStack.Screen component={SwapScreen} name={Routes.SWAP} {...swapConfig} />}
</NativeStack.Navigator>
Expand Down
2 changes: 1 addition & 1 deletion src/navigation/config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ export const consoleSheetConfig = {
}),
};

export const dappBrowserControlPanelConfig = {
export const panelConfig = {
options: ({ route: { params = {} } }) => ({
...buildCoolModalConfig({
...params,
Expand Down
1 change: 1 addition & 0 deletions src/navigation/routesNames.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const Routes = {
CHANGE_WALLET_SHEET: 'ChangeWalletSheet',
CHANGE_WALLET_SHEET_NAVIGATOR: 'ChangeWalletSheetNavigator',
CHECK_IDENTIFIER_SCREEN: 'CheckIdentifierScreen',
CLAIM_CLAIMABLE_PANEL: 'ClaimClaimablePanel',
CONFIRM_REQUEST: 'ConfirmRequest',
CONNECTED_DAPPS: 'ConnectedDapps',
CONSOLE_SHEET: 'ConsoleSheet',
Expand Down
4 changes: 4 additions & 0 deletions src/navigation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Routes from '@/navigation/routesNames';
import { PortalSheetProps } from '@/screens/Portal';
import { REGISTRATION_MODES } from '@/helpers/ens';
import { CampaignCheckResult } from '@/components/remote-promo-sheet/checkForRemotePromoSheet';
import { Claimable } from '@/resources/addys/claimables/types';

export type PartialNavigatorConfigOptions = Pick<Partial<Parameters<ReturnType<typeof createStackNavigator>['Screen']>[0]>, 'options'>;

Expand Down Expand Up @@ -75,4 +76,7 @@ export type RootStackParamList = {
[Routes.SWAP]: {
action?: 'open_swap_settings';
};
[Routes.CLAIM_CLAIMABLE_PANEL]: {
claimable: Claimable;
};
};
17 changes: 17 additions & 0 deletions src/screens/claimables/ClaimClaimablePanel.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react';
import { RouteProp, useRoute } from '@react-navigation/native';
import { ClaimingTransactionClaimable } from './ClaimingTransactionClaimable';
import { ClaimingSponsoredClaimable } from './ClaimingSponsoredClaimable';
import { RootStackParamList } from '@/navigation/types';

export const ClaimClaimablePanel = () => {
const {
params: { claimable },
} = useRoute<RouteProp<RootStackParamList, 'ClaimClaimablePanel'>>();

return claimable.type === 'transaction' ? (
<ClaimingTransactionClaimable claimable={claimable} />
) : (
<ClaimingSponsoredClaimable claimable={claimable} />
);
};
Loading