Skip to content

Commit

Permalink
Merge branch 'main' into feature/update-attributions-only-in-no-forks
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptodev-2s authored Jul 1, 2024
2 parents ef60936 + 2478527 commit 526bfad
Show file tree
Hide file tree
Showing 156 changed files with 2,622 additions and 500 deletions.
17 changes: 16 additions & 1 deletion .github/workflows/run-bitrise-e2e-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,24 @@ env:
WORKFLOW_NAME: 'run-bitrise-e2e-check'

jobs:
is-fork-pull-request:
name: Determine pull request source
if: ${{ github.event.issue.pull_request || github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
outputs:
IS_FORK: ${{ steps.is-fork.outputs.IS_FORK }}
steps:
- uses: actions/checkout@v3
- name: Determine whether this PR is from a fork
id: is-fork
run: echo "IS_FORK=$(gh pr view --json isCrossRepository --jq '.isCrossRepository' "${{ github.event.number }}" )" >> "$GITHUB_OUTPUT"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

run-bitrise-e2e-check:
needs: is-fork-pull-request
runs-on: ubuntu-latest
if: ${{ github.event.issue.pull_request || github.event_name == 'pull_request' }}
if: ${{ needs.is-fork-pull-request.outputs.IS_FORK == 'false' }}
permissions:
pull-requests: write
contents: write
Expand Down
1 change: 1 addition & 0 deletions .storybook/storybook.requires.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ const getStories = () => {
'./app/component-library/components-temp/TagColored/TagColored.stories.tsx': require('../app/component-library/components-temp/TagColored/TagColored.stories.tsx'),
'./app/components/UI/Name/Name.stories.tsx': require('../app/components/UI/Name/Name.stories.tsx'),
"./app/components/UI/SimulationDetails/SimulationDetails.stories.tsx": require("../app/components/UI/SimulationDetails/SimulationDetails.stories.tsx"),
"./app/component-library/components-temp/CellSelectWithMenu/CellSelectWithMenu.stories.tsx": require("../app/component-library/components-temp/CellSelectWithMenu/CellSelectWithMenu.stories.tsx"),
};
};

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// External dependencies.
import { IconName } from '../../../component-library/components/Icons/Icon';
import {
AvatarVariant,
AvatarAccountType,
} from '../../../component-library/components/Avatars/Avatar';
import { AvatarProps } from '../../../component-library/components/Avatars/Avatar/Avatar.types';

// Internal dependencies.
import { CellSelectWithMenuProps } from './CellSelectWithMenu.types';

// Sample consts
const SAMPLE_CELLSELECT_WITH_BUTTON_TITLE = 'Orangefox.eth';
const SAMPLE_CELLSELECT_WITH_BUTTON_SECONDARYTEXT =
'0x2990079bcdEe240329a520d2444386FC119da21a';
const SAMPLE_CELLSELECT_WITH_BUTTON_TERTIARY_TEXT = 'Updated 1 sec ago';
const SAMPLE_CELLSELECT_WITH_BUTTON_TAGLABEL = 'Imported';
const SAMPLE_CELLSELECT_WITH_BUTTON_AVATARPROPS: AvatarProps = {
variant: AvatarVariant.Account,
accountAddress: '0x2990079bcdEe240329a520d2444386FC119da21a',
type: AvatarAccountType.JazzIcon,
};

// eslint-disable-next-line import/prefer-default-export
export const SAMPLE_CELLSELECT_WITH_BUTTON_PROPS: CellSelectWithMenuProps = {
title: SAMPLE_CELLSELECT_WITH_BUTTON_TITLE,
secondaryText: SAMPLE_CELLSELECT_WITH_BUTTON_SECONDARYTEXT,
tertiaryText: SAMPLE_CELLSELECT_WITH_BUTTON_TERTIARY_TEXT,
tagLabel: SAMPLE_CELLSELECT_WITH_BUTTON_TAGLABEL,
avatarProps: SAMPLE_CELLSELECT_WITH_BUTTON_AVATARPROPS,
isSelected: false,
isDisabled: false,
buttonIcon: IconName.MoreVertical,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Internal dependencies.
import { default as CellSelectWithMenu } from './CellSelectWithMenu';
import { SAMPLE_CELLSELECT_WITH_BUTTON_PROPS } from './CellSelectWithMenu.constants';

const CellSelectWithMenuMeta = {
title: 'Component Library / Cells',
component: CellSelectWithMenu,
argTypes: {
title: {
control: { type: 'text' },
defaultValue: SAMPLE_CELLSELECT_WITH_BUTTON_PROPS.title,
},
secondaryText: {
control: { type: 'text' },
defaultValue: SAMPLE_CELLSELECT_WITH_BUTTON_PROPS.secondaryText,
},
tertiaryText: {
control: { type: 'text' },
defaultValue: SAMPLE_CELLSELECT_WITH_BUTTON_PROPS.tertiaryText,
},
tagLabel: {
control: { type: 'text' },
defaultValue: SAMPLE_CELLSELECT_WITH_BUTTON_PROPS.tagLabel,
},
isSelected: {
control: { type: 'boolean' },
defaultValue: SAMPLE_CELLSELECT_WITH_BUTTON_PROPS.isSelected,
},
isDisabled: {
control: { type: 'boolean' },
defaultValue: SAMPLE_CELLSELECT_WITH_BUTTON_PROPS.isDisabled,
},
},
};
export default CellSelectWithMenuMeta;

export const CellMultiSelectWithMenu = {
args: {
avatarProps: SAMPLE_CELLSELECT_WITH_BUTTON_PROPS.avatarProps,
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Third library dependencies.
import { StyleSheet, ViewStyle } from 'react-native';

// External dependencies.
import { CellSelectWithMenuStyleSheetVars } from './CellSelectWithMenu.types';

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

/**
* Style sheet function for CellSelect component.
*
* @param params Style sheet params.
* @param params.theme App theme from ThemeContext.
* @param params.vars Inputs that the style sheet depends on.
* @returns StyleSheet object.
*/
const styleSheet = (params: {
theme: Theme;
vars: CellSelectWithMenuStyleSheetVars;
}) => {
const { vars } = params;
const { style } = vars;

return StyleSheet.create({
base: Object.assign(
{
padding: 16,
} as ViewStyle,
style,
) as ViewStyle,
});
};

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

import CellSelectWithMenu from './CellSelectWithMenu';
import { CellModalSelectorsIDs } from '../../../../e2e/selectors/Modals/CellModal.selectors';

import { SAMPLE_CELLSELECT_WITH_BUTTON_PROPS } from './CellSelectWithMenu.constants';

describe('CellSelectWithMenu', () => {
it('should render with default settings correctly', () => {
const wrapper = render(
<CellSelectWithMenu {...SAMPLE_CELLSELECT_WITH_BUTTON_PROPS} />,
);
expect(wrapper).toMatchSnapshot();
});

it('should render CellSelectWithMenu', () => {
const { queryByTestId } = render(
<CellSelectWithMenu {...SAMPLE_CELLSELECT_WITH_BUTTON_PROPS} />,
);
// Adjust the testID to match the one used in CellSelectWithMenu, if different
expect(queryByTestId(CellModalSelectorsIDs.MULTISELECT)).not.toBe(null);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/* eslint-disable react/prop-types */

// Third library dependencies.
import React from 'react';

// External dependencies.
import { useStyles } from '../../hooks';
import CellBase from '../../../component-library/components/Cells/Cell/foundation/CellBase';

// Internal dependencies.
import styleSheet from './CellSelectWithMenu.styles';
import { CellSelectWithMenuProps } from './CellSelectWithMenu.types';
import { CellModalSelectorsIDs } from '../../../../e2e/selectors/Modals/CellModal.selectors';
import ListItemMultiSelectButton from '../ListItemMultiSelectButton/ListItemMultiSelectButton';

const CellSelectWithMenu = ({
style,
avatarProps,
title,
secondaryText,
tertiaryText,
tagLabel,
isSelected = false,
children,
...props
}: CellSelectWithMenuProps) => {
const { styles } = useStyles(styleSheet, { style });

return (
<ListItemMultiSelectButton
isSelected={isSelected}
style={styles.base}
testID={CellModalSelectorsIDs.MULTISELECT}
{...props}
>
<CellBase
avatarProps={avatarProps}
title={title}
secondaryText={secondaryText}
tertiaryText={tertiaryText}
tagLabel={tagLabel}
style={style}
>
{children}
</CellBase>
</ListItemMultiSelectButton>
);
};

export default CellSelectWithMenu;
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// External dependencies.
import { CellBaseProps } from '../../../component-library/components/Cells/Cell/foundation/CellBase/CellBase.types';
import { ListItemMultiSelectButtonProps } from '../ListItemMultiSelectButton/ListItemMultiSelectButton.types';

/**
* Cell Account Select component props.
*/
export interface CellSelectWithMenuProps
extends CellBaseProps,
Omit<ListItemMultiSelectButtonProps, 'children'> {}

/**
* Style sheet input parameters.
*/
export type CellSelectWithMenuStyleSheetVars = Pick<
CellSelectWithMenuProps,
'style'
>;
Loading

0 comments on commit 526bfad

Please sign in to comment.