@huma-finance/widgets 0.0.43-beta.108 → 0.0.43-beta.112

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,7 +6,7 @@ import {
6
6
  PoolInfoType,
7
7
  toBigNumber,
8
8
  } from '@huma-finance/shared'
9
- import { Button } from '@mui/material'
9
+ import { Button, useTheme } from '@mui/material'
10
10
  import { useWeb3React } from '@web3-react/core'
11
11
  import React, { useCallback, useEffect, useState } from 'react'
12
12
 
@@ -100,6 +100,7 @@ export function SuperfluidUpcomingList({
100
100
  loading,
101
101
  handleGetPaid,
102
102
  }: Props): React.ReactElement {
103
+ const theme = useTheme()
103
104
  const { account, isActive } = useWeb3React()
104
105
  const [streams, setStreams] = useState<StreamItem[] | undefined>()
105
106
  const { data } = useQuery<{ streams: Stream[] }>(GET_RECEIVED_STREAMS, {
@@ -154,7 +155,7 @@ export function SuperfluidUpcomingList({
154
155
  type='link'
155
156
  size='small'
156
157
  variant='contained'
157
- sx={{ marginTop: '20px' }}
158
+ sx={{ marginTop: theme.spacing(2) }}
158
159
  href='https://app.superfluid.finance/'
159
160
  target='_blank'
160
161
  >
@@ -1,4 +1,4 @@
1
- import { Box } from '@mui/material'
1
+ import { Box, useTheme } from '@mui/material'
2
2
  import { useWeb3React } from '@web3-react/core'
3
3
  import {
4
4
  CreditEvent,
@@ -17,6 +17,7 @@ import { SuperfluidFactoredList } from './SuperfluidFactoredList'
17
17
  import { StreamItem, SuperfluidUpcomingList } from './SuperfluidUpcomingList'
18
18
 
19
19
  export function SuperfluidFactoring(): React.ReactElement {
20
+ const theme = useTheme()
20
21
  const poolName = POOL_NAME.Superfluid
21
22
  const { chainId } = useWeb3React()
22
23
  const {
@@ -37,7 +38,7 @@ export function SuperfluidFactoring(): React.ReactElement {
37
38
  return (
38
39
  <Box css={styles.wrapper}>
39
40
  <Box css={styles.title}>Stream Factoring</Box>
40
- <Box css={styles.description} marginBottom='47px'>
41
+ <Box css={styles.description} marginBottom={theme.spacing(6)}>
41
42
  {PoolMap.Stream[poolName]?.borrowDesc}
42
43
  </Box>
43
44
  {poolInfo && (
@@ -29,20 +29,20 @@ export function TxDoneModal({
29
29
  `,
30
30
  header: css`
31
31
  ${theme.cssMixins.rowHCentered};
32
- margin-top: -5px;
32
+ margin-top: ${theme.spacing(-0.5)};
33
33
  `,
34
34
  content: css`
35
35
  ${theme.cssMixins.colVCentered};
36
36
  font-family: 'Uni-Neue-Regular';
37
37
  font-size: 18px;
38
38
  color: #423b46;
39
- margin-top: 64px;
39
+ margin-top: ${theme.spacing(8)};
40
40
  text-align: center;
41
41
  `,
42
42
  check: css`
43
43
  width: 100%;
44
44
  ${theme.cssMixins.rowHCentered};
45
- margin-top: 82px;
45
+ margin-top: ${theme.spacing(10)};
46
46
  `,
47
47
  doneButton: css`
48
48
  width: 100%;
@@ -67,7 +67,7 @@ export function TxDoneModal({
67
67
  </Box>
68
68
  <Box css={styles.content}>
69
69
  {content.map((item) => (
70
- <Box sx={{ marginTop: '10px' }} key={item}>
70
+ <Box sx={{ marginTop: theme.spacing(1) }} key={item}>
71
71
  {item}
72
72
  </Box>
73
73
  ))}
@@ -3,6 +3,7 @@ import { useAtom } from 'jotai'
3
3
  import { useResetAtom } from 'jotai/utils'
4
4
  import React, { useCallback, useEffect } from 'react'
5
5
 
6
+ import { useTheme } from '@mui/material'
6
7
  import { useAppDispatch, useAppSelector } from '../hooks/useRedux'
7
8
  import { resetState, setError } from '../store/widgets.reducers'
8
9
  import { selectWidgetState } from '../store/widgets.selectors'
@@ -27,6 +28,7 @@ export function WidgetWrapper({
27
28
  handleSuccess,
28
29
  children,
29
30
  }: WCProps<Props>): React.ReactElement | null {
31
+ const theme = useTheme()
30
32
  const dispatch = useAppDispatch()
31
33
  const { step } = useAppSelector(selectWidgetState)
32
34
  const [{ state, failReason, txReceipt }] = useAtom(sendTxAtom)
@@ -63,7 +65,7 @@ export function WidgetWrapper({
63
65
  overflowY='auto'
64
66
  onClose={handleCloseModal}
65
67
  width='480px'
66
- padding='30px 40px'
68
+ padding={theme.spacing(4, 5)}
67
69
  disableBackdropClick
68
70
  >
69
71
  <HumaModalHeader onClose={handleCloseModal} height={0} />
@@ -23,11 +23,11 @@ export function WrapperModal({
23
23
  ${theme.cssMixins.rowHCentered};
24
24
  font-family: 'Uni-Neue-Bold';
25
25
  font-size: 20px;
26
- margin-top: -5px;
26
+ margin-top: ${theme.spacing(-0.5)};
27
27
  `,
28
28
  content: css`
29
29
  ${theme.cssMixins.rowHCentered};
30
- margin-top: 30px;
30
+ margin-top: ${theme.spacing(4)};
31
31
  font-family: 'Uni-Neue-Regular';
32
32
  font-size: 16px;
33
33
  line-height: 24px;
@@ -23,7 +23,7 @@ export function HumaModal({
23
23
  overflow,
24
24
  overflowY,
25
25
  width = '480px',
26
- padding = '30px',
26
+ padding = '32px',
27
27
  disableBackdropClick = false,
28
28
  }: HumaModalType): React.ReactElement {
29
29
  const { isXsSize } = useMQ()
@@ -1,4 +1,5 @@
1
1
  import {
2
+ checkIsDev,
2
3
  EAPayload,
3
4
  EARejectionError,
4
5
  EARejectMessage,
@@ -11,7 +12,6 @@ import { useCallback } from 'react'
11
12
 
12
13
  import { setApproval, setError } from '../store/widgets.reducers'
13
14
  import { WIDGET_STEP } from '../store/widgets.store'
14
- import { envUtil } from '../utils/env'
15
15
  import { useAppDispatch } from './useRedux'
16
16
 
17
17
  const useEA = () => {
@@ -21,16 +21,12 @@ const useEA = () => {
21
21
  isWalletOwnershipVerificationRequired,
22
22
  isWalletOwnershipVerified,
23
23
  setError: setAuthError,
24
- } = useAuthErrorHandling(envUtil.checkIsDev())
24
+ } = useAuthErrorHandling(checkIsDev())
25
25
 
26
26
  const checkingEA = useCallback(
27
27
  async (payload: EAPayload, nextStep: WIDGET_STEP) => {
28
28
  try {
29
- const result = await EAService.approve(
30
- payload,
31
- chainId!,
32
- envUtil.checkIsDev(),
33
- )
29
+ const result = await EAService.approve(payload, chainId!, checkIsDev())
34
30
  dispatch(setApproval({ ...result, nextStep }))
35
31
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
36
32
  } catch (e: any) {
@@ -1,10 +1,10 @@
1
1
  import { useEffect, useState } from 'react'
2
2
  import {
3
+ checkIsDev,
3
4
  doesChainSupportNotifi,
4
5
  getBlockchainConfigFromChain,
5
6
  } from '@huma-finance/shared'
6
7
  import { newFrontendClient } from '@notifi-network/notifi-frontend-client'
7
- import { envUtil } from '../utils/env'
8
8
 
9
9
  export const useIsFirstTimeNotifiUser = (
10
10
  account: string | undefined,
@@ -18,7 +18,7 @@ export const useIsFirstTimeNotifiUser = (
18
18
  const client = newFrontendClient({
19
19
  account: { publicKey: account },
20
20
  tenantId: 'humadapp',
21
- env: envUtil.checkIsDev() ? 'Development' : 'Production',
21
+ env: checkIsDev() ? 'Development' : 'Production',
22
22
  walletBlockchain: getBlockchainConfigFromChain(chainId),
23
23
  })
24
24
 
@@ -59,7 +59,7 @@ export const useDoesChainSupportNotifi = (
59
59
  const checkNotifiChainSupported = async () => {
60
60
  if (account != null && chainId != null) {
61
61
  setNotifiChainSupported(
62
- doesChainSupportNotifi(chainId, envUtil.checkIsDev(), account),
62
+ doesChainSupportNotifi(chainId, checkIsDev(), account),
63
63
  )
64
64
  }
65
65
  }
package/src/utils/env.ts DELETED
@@ -1,8 +0,0 @@
1
- const checkIsDev = () =>
2
- window.location.hostname.startsWith('dev') ||
3
- window.location.hostname.startsWith('deploy-preview') ||
4
- process.env.NODE_ENV === 'development'
5
-
6
- export const envUtil = {
7
- checkIsDev,
8
- }