Skip to content

Commit

Permalink
Merge branch 'main' into feat/nft-grid-view
Browse files Browse the repository at this point in the history
  • Loading branch information
gambinish authored Jan 18, 2025
2 parents 9bfd19d + 3822bda commit 4afd0ca
Show file tree
Hide file tree
Showing 279 changed files with 4,921 additions and 1,993 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ module.exports = {
'selectProviderType',
'selectRpcUrl',
'selectSelectedNetworkClientId',
'selectTicker'
'selectTicker',
]
.map((method) => `(${method})`)
.join('|')}/]`,
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -335,3 +335,16 @@ jobs:
echo "All jobs passed step skipped. Block PR."
exit 1
fi
log-merge-group-failure:
name: Log merge group failure
# Only run this job if the merge group event fails, skip on forks
if: ${{ github.event_name == 'merge_group' && failure() && !github.event.repository.fork }}
needs:
- check-all-jobs-pass
uses: metamask/github-tools/.github/workflows/log-merge-group-failure.yml@6bbad335a01fce1a9ec1eabd9515542c225d46c0
secrets:
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
GOOGLE_SERVICE_ACCOUNT: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }}
SPREADSHEET_ID: ${{ secrets.GOOGLE_MERGE_QUEUE_SPREADSHEET_ID }}
SHEET_NAME: ${{ secrets.GOOGLE_MERGE_QUEUE_SHEET_NAME }}
3 changes: 3 additions & 0 deletions .js.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ export SEGMENT_FLUSH_INTERVAL="1"
# example for flush when 1 event is queued
export SEGMENT_FLUSH_EVENT_LIMIT="1"

# URL of the decoding API used to provide additional data from signature requests
export DECODING_API_URL: 'https://signature-insights.api.cx.metamask.io/v1'

# URL of security alerts API used to validate dApp requests.
export SECURITY_ALERTS_API_URL="https://security-alerts.api.cx.metamask.io"

Expand Down
4 changes: 3 additions & 1 deletion app/__mocks__/pngMock.js
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export default { uri: 'MockImage' };
// When required, assets in React Native returns a number
// eslint-disable-next-line import/no-commonjs
module.exports = 1;
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// Third party dependencies.
import { StyleSheet } from 'react-native';

// External dependencies.
import { Theme } from '../../../../util/theme/models';

/**
* Style sheet input parameters.
*/
export interface ButtonPillStyleSheetVars {
isDisabled: boolean;
isPressed: boolean;
}

/**
* Style sheet function for ButtonPill component
*
* @param params Style sheet params
* @param params.theme Theme object
* @param params.vars Arbitrary inputs this style sheet depends on
* @returns StyleSheet object
*/
const styleSheet = (params: {
theme: Theme;
vars: ButtonPillStyleSheetVars;
}) => {
const {
theme: { colors },
vars: { isDisabled, isPressed }
} = params;

return StyleSheet.create({
base: {
backgroundColor: colors.background.alternative,
color: colors.text.default,
alignItems: 'center',
justifyContent: 'center',
paddingHorizontal: 8,
paddingVertical: 4,
borderRadius: 99,
opacity: isDisabled ? 0.5 : 1,
...(isPressed && {
backgroundColor: colors.background.alternativePressed,
}),
},
});
};

export default styleSheet;
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Third party dependencies.
import React from 'react';
import { render } from '@testing-library/react-native';

// Internal dependencies.
import ButtonPill from './ButtonPill';

describe('ButtonPill', () => {
it('should render correctly', () => {
const { toJSON } = render(
<ButtonPill onPress={jest.fn} />,
);
expect(toJSON()).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// Third party dependencies.
import React, { useCallback, useState } from 'react';
import { GestureResponderEvent, TouchableOpacity, TouchableOpacityProps } from 'react-native';

// External dependencies.
import { useStyles } from '../../../hooks';

// Internal dependencies.
import stylesheet from './ButtonPill.styles';

/**
* ButtonPill component props.
*/
export interface ButtonPillProps extends TouchableOpacityProps {
/**
* Optional param to disable the button.
*/
isDisabled?: boolean;
}

const ButtonPill = ({
onPress,
onPressIn,
onPressOut,
style,
isDisabled = false,
children,
...props
}: ButtonPillProps) => {
const [isPressed, setIsPressed] = useState(false);
const { styles } = useStyles(stylesheet, {
style,
isPressed,
isDisabled,
});

const triggerOnPressedIn = useCallback(
(e: GestureResponderEvent) => {
setIsPressed(true);
onPressIn?.(e);
},
[setIsPressed, onPressIn],
);

const triggerOnPressedOut = useCallback(
(e: GestureResponderEvent) => {
setIsPressed(false);
onPressOut?.(e);
},
[setIsPressed, onPressOut],
);

return (
<TouchableOpacity
style={styles.base}
onPress={!isDisabled ? onPress : undefined}
onPressIn={!isDisabled ? triggerOnPressedIn : undefined}
onPressOut={!isDisabled ? triggerOnPressedOut : undefined}
accessible
activeOpacity={1}
disabled={isDisabled}
{...props}
>
{children}
</TouchableOpacity>
);
};

export default ButtonPill;
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`ButtonPill should render correctly 1`] = `
<TouchableOpacity
accessible={true}
activeOpacity={1}
disabled={false}
onPress={[Function]}
onPressIn={[Function]}
onPressOut={[Function]}
style={
{
"alignItems": "center",
"backgroundColor": "#f2f4f6",
"borderRadius": 99,
"color": "#141618",
"justifyContent": "center",
"opacity": 1,
"paddingHorizontal": 8,
"paddingVertical": 4,
}
}
/>
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './ButtonPill';
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@

exports[`Badge should render badge network given the badge network variant 1`] = `
<BadgeNetwork
imageSource={
{
"default": {
"uri": "MockImage",
},
}
}
imageSource={1}
isScaled={true}
name="Ethereum"
testID="badge-badgenetwork"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,7 @@ exports[`BadgeNetwork should render BadgeNetwork 1`] = `
<Image
onError={[Function]}
resizeMode="contain"
source={
{
"default": {
"uri": "MockImage",
},
}
}
source={1}
style={
{
"height": 32,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,7 @@ exports[`BadgeWrapper should render BadgeWrapper correctly 1`] = `
}
>
<Badge
imageSource={
{
"default": {
"uri": "MockImage",
},
}
}
imageSource={1}
isScaled={true}
name="Ethereum"
variant="network"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,7 @@ exports[`BannerTip should render default settings correctly 1`] = `
>
<Image
resizeMode="contain"
source={
{
"uri": "MockImage",
}
}
source={1}
style={
{
"height": 55,
Expand Down
3 changes: 2 additions & 1 deletion app/components/Base/StatusText.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const styles = StyleSheet.create({

export const ConfirmedText = (props) => (
<Text
testID={CommonSelectorsIDs.STATUS_CONFIRMED}
testID={CommonSelectorsIDs.TRANSACTION_STATUS}
bold
green
style={styles.status}
Expand All @@ -38,6 +38,7 @@ export const FailedText = (props) => {
const { colors } = useTheme();
return (
<Text
testID={CommonSelectorsIDs.TRANSACTION_STATUS}
bold
style={[styles.status, { color: colors.error.default }]}
{...props}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { InternalAccount } from '@metamask/keyring-api';
import { InternalAccount } from '@metamask/keyring-internal-api';

interface SelectedAsset {
isETH: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,13 +288,7 @@ exports[`AccountFromToInfoCard should match snapshot 1`] = `
<Image
onError={[Function]}
resizeMode="contain"
source={
{
"default": {
"uri": "MockImage",
},
}
}
source={1}
style={
{
"height": 32,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -543,13 +543,7 @@ exports[`AccountRightButton should render correctly 1`] = `
<Image
onError={[Function]}
resizeMode="contain"
source={
{
"default": {
"uri": "MockImage",
},
}
}
source={1}
style={
{
"height": 32,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { selectInternalAccounts } from '../../../selectors/accountsController';
import Cell, {
CellVariant,
} from '../../../component-library/components/Cells/Cell';
import { InternalAccount } from '@metamask/keyring-api';
import { InternalAccount } from '@metamask/keyring-internal-api';
import { useStyles } from '../../../component-library/hooks';
import { TextColor } from '../../../component-library/components/Texts/Text';
import SensitiveText, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,7 @@ exports[`Balance should render correctly with a fiat balance 1`] = `
<Image
onError={[Function]}
resizeMode="contain"
source={
{
"uri": "MockImage",
}
}
source={1}
style={
{
"height": 32,
Expand Down Expand Up @@ -376,11 +372,7 @@ exports[`Balance should render correctly without a fiat balance 1`] = `
<Image
onError={[Function]}
resizeMode="contain"
source={
{
"uri": "MockImage",
}
}
source={1}
style={
{
"height": 32,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ const TokenDetails: React.FC<TokenDetailsProps> = ({ asset }) => {

return (
<View style={styles.tokenDetailsContainer}>
{asset.isETH && <StakingEarnings />}
{asset.isETH && <StakingEarnings asset={asset} />}
{(asset.isETH || tokenMetadata) && (
<TokenDetailsList tokenDetails={tokenDetails} />
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1056,11 +1056,7 @@ exports[`AssetOverview should render correctly 1`] = `
<Image
onError={[Function]}
resizeMode="contain"
source={
{
"uri": "MockImage",
}
}
source={1}
style={
{
"height": 32,
Expand Down Expand Up @@ -2190,13 +2186,7 @@ exports[`AssetOverview should render correctly when portfolio view is enabled 1`
<Image
onError={[Function]}
resizeMode="contain"
source={
{
"default": {
"uri": "MockImage",
},
}
}
source={1}
style={
{
"height": 32,
Expand Down
Loading

0 comments on commit 4afd0ca

Please sign in to comment.