Skip to content

feat(Wallet): add page#1001

Merged
tomjeatt merged 22 commits intomasterfrom
feature/wallet-page
Apr 4, 2023
Merged

feat(Wallet): add page#1001
tomjeatt merged 22 commits intomasterfrom
feature/wallet-page

Conversation

@danielsimao
Copy link
Member

@danielsimao danielsimao commented Mar 7, 2023

Interbtc UI Pull Request Template

Description

Changes to component-library:

  • CTALink: add react-aria useLink + allow external query parameters
  • Divider: add default variant because we do not have a variant that mimics our border style. Also added size feature to allow thinner borders
  • Flex: added margin related props to allow: <Flex margin="spacing2"/>
  • List: added card variant (used in Wallet mobile)
  • Switch: fix accessibility warning
  • WalletIcon: new component

Change to components:

  • Added generic Table under DataGrid.
  • Added cells related component that can be found in LoansBaseTable and made them reusable under DataGrid

Disclaimer: solely Wallet page is using DataGrid.

Change to Loans:

  • moved out and refactored BorrowsPositionsTable + LendPositionsTable into a single component LoanPositionsTable.
  • removed LoansBaseTable in favor of creating a generic approach this component that can be found in DataGrid/Table (same components, just better names and reusable)

Changes to AMM/Pools:

  • similar to Loans, moved out PoolsTable

Added Wallet page

NOTE: Wallet page is fully tested

@vercel
Copy link

vercel bot commented Mar 7, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
interbtc-ui-interlay ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 3, 2023 2:34pm
interbtc-ui-interlay-testnet ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 3, 2023 2:34pm
interbtc-ui-kintsugi ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 3, 2023 2:34pm
interbtc-ui-kintsugi-hub ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 3, 2023 2:34pm
interbtc-ui-kintsugi-testnet ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 3, 2023 2:34pm

@github-actions
Copy link

github-actions bot commented Mar 7, 2023

Running Lighthouse audit...

@danielsimao danielsimao force-pushed the feature/wallet-page branch 2 times, most recently from d14814c to 4bd7f40 Compare March 10, 2023 16:30
Copy link
Collaborator

@tomjeatt tomjeatt left a comment

Choose a reason for hiding this comment

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

Few comments, no blockers (considering it's your last day tomorrow!). Most of the comments relate to things we'll want to consider when we start using the patterns in this feature across the app, but while they're scoped to a single feature they can all be thought of as minor.

type CTALinkProps = Props & NativeAttrs & InheritAttrs;
type InheritAttrs = Omit<BaseCTAProps, (keyof AriaAttrs & NativeAttrs & Props) | 'elementType'>;

type CTALinkProps = Props & NativeAttrs & AriaAttrs & InheritAttrs;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nothing to change here immediately, but I'd like us to have a think about whether there's anything here that could be simplified. Looking at the before and after of the changes to this file, although the changes make sense in terms of utility, the component itself has become harder to follow.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's never easy to create these kind of components. What is the hardest part to follow about this component and what do you suggest simplifying?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Nothing at the moment—as I said, I'd like to review it at a later date, when we have enough time to go through it properly.

type WalletComponent = ForwardRefExoticComponent<IconProps & RefAttributes<SVGSVGElement>>;

const wallet: Record<string, WalletComponent> = {
'polkadot-js': PolkadotJS,
Copy link
Collaborator

Choose a reason for hiding this comment

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

why the js suffixes for polkadot and subwallet? Very very minor, but would be nice if we could lose it (Polkadot refer to it in their docs as the polkadot extension, so I don't think we need to include the js part).

Copy link
Member Author

Choose a reason for hiding this comment

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

xl: 1536 // large screen
};

const breakpoints = {
Copy link
Collaborator

@tomjeatt tomjeatt Apr 3, 2023

Choose a reason for hiding this comment

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

I find this terminology confusing (up and down suggests vertical movement). I'd prefer some variation of max and min width: Better to keep our terminology as close to standard (i.e. css) as possible).

@@ -1,3 +1,5 @@
import { breakpoints } from '../utils/breakpoints';
Copy link
Collaborator

Choose a reason for hiding this comment

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

This can stay as it is for now, but I'd like to review it before we use it in any other places—the theme file is intended to be very simple, and this is moving away from that. Might be that we have to live with the complexity, but I'd prefer to explore other approaches first.

Copy link
Member Author

Choose a reason for hiding this comment

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

I understand but it's also hard to reduce to 2-3 breakpoints. We need to realistic specially when it comes to small screens. We could reduce breakpoints that are above tablet, but under tablet, its where things get problematic on some screens

@@ -0,0 +1,30 @@
import { StyledMarginProps } from '../css/margin';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure about this—again, leave it for now as it's only being used in a single place, but I'd like to review this before using it more widely. Using a hook to return props (and therefore having props returned in the component body) isn't very intuitive. I like the intention—it's a good problem to solve—but would like to consider alternatives.

Copy link
Member Author

Choose a reason for hiding this comment

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

The hook is necessary to map props to styled props. This hook will be used across the component library. I find myself a lot of times trying to apply some spacing and I would like to avoid creating a stylesheet just to add some margins here and there or even apply flex just so I could use gap. We should not create stylesheets for things that could be an existing feature, such as margin/padding.

@@ -0,0 +1,24 @@
import { CoinIcon, Flex, FlexProps, FontSize, IconSize, Span } from '@/component-library';
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think there's a mismatch here between the component name and the sub-component names. DataGrid is very generic, but AssetCell, BalanceCell etc. are very specific. I don't think we need to overgeneralise, so I would suggest renaming DataGrid to something more specific (i.e., something which indicates what data is being shown).

Copy link
Member Author

Choose a reason for hiding this comment

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

There are a variety of Cells repeated in all tables. There could be moved away from the DataGrid.

variant='text'
size='x-small'
>
<PencilSquare size='s' color='tertiary' />
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not a code issue, but the pencil for switching accounts feels wrong—would ask Jay if there's a better icon for switch, e.g. like the icon polkadot use for switching between chains and parachains.

Screenshot 2023-04-03 at 13 43 27

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants