Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
14 changes: 14 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,17 @@ NEXT_PUBLIC_CURRENCIES=usd, eur, gbp, cny, jpy, krw, aud

# https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CSP
NEXT_PUBLIC_CONTENT_SECURITY_POLICY=https://app.safe.global https://*.blockscout.com

# Blocking variables must have any value that Boolean(value) returns true.

# NEXT_PUBLIC_DISABLE_STAKE=
# NEXT_PUBLIC_DISABLE_UNSTAKE=

# NEXT_PUBLIC_DISABLE_MINT=
# NEXT_PUBLIC_DISABLE_BURN=

# NEXT_PUBLIC_DISABLE_BOOST=
# NEXT_PUBLIC_DISABLE_UNBOOST=

# NEXT_PUBLIC_DISABLE_UNBOOST_QUEUE=
# NEXT_PUBLIC_DISABLE_UNSTAKE_QUEUE=
7 changes: 6 additions & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
- name: Awaiting WEB deployment to be ready
uses: UnlyEd/[email protected]
env:
VERCEL_TOKEN: ${{ secrets.VERCEl_TOKEN }}
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
with:
deployment-url: ${{ steps.preview.outputs.preview_url }}
timeout: 600
Expand All @@ -69,6 +69,11 @@ jobs:
VERCEL_AUTOMATION_BYPASS_SECRET: ${{ secrets.VERCEL_AUTOMATION_BYPASS_SECRET }}
run: npm run e2e

- name: Sanitize reports before upload
if: ${{ failure() }}
run: |
find ./playwright-report/ -name "*.html" -exec sed -i 's/${{ secrets.[A-Z_]* }}/***/g' {} \;

- uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
Expand Down
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"@ledgerhq/hw-transport-webusb": "6.29.5",
"@metamask/onboarding": "1.0.1",
"@reduxjs/toolkit": "2.8.2",
"@stakewise/v3-sdk": "3.7.1",
"@stakewise/v3-sdk": "4.1.2",
"@tailwindcss/postcss": "4.1.7",
"@types/react-redux": "7.1.34",
"@wagmi/connectors": "5.8.3",
Expand Down
2 changes: 1 addition & 1 deletion scripts/checkLocalEnv.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const getEnvList = (filePath) => {
return result
}

const validateEnv = (env) => {
const validateEnv = () => {
const isEnvExist = fs.existsSync(localEnv)

if (!isEnvExist) {
Expand Down
3 changes: 2 additions & 1 deletion scripts/generateColors/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const fs = require('fs')
const path = require('path')
const hexToRgb = require('./hexToRgb')


const themes = [ 'light', 'dark' ]

const destVariables = path.resolve(__dirname, `../../src/styles/variables.scss`)
Expand Down Expand Up @@ -93,7 +94,7 @@ const generateColors = () => {

let newBaseFile = baseFile

Object.keys(colorsBase).forEach((theme, index) => {
Object.keys(colorsBase).forEach((theme) => {
newBaseFile = newBaseFile
.replace(
new RegExp(`:root .body-${theme}-theme {[^}]*}\n`, 'g'),
Expand Down
5 changes: 3 additions & 2 deletions src/app/global-error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ import React, { useEffect } from 'react'
import cx from 'classnames'
import intl from 'modules/intl'
import { Inter } from 'next/font/google'
import theme, { ThemeColor } from 'modules/theme'
import { cookie, constants } from 'helpers'
import messages from 'views/ErrorView/messages'
import theme, { ThemeColor } from 'modules/theme'


import { Button, Text } from 'components'
import languages from 'scripts/languages'
import messages from 'views/ErrorView/messages'

import 'styles/globals.scss'
import 'styles/tailwind/config.css'
Expand Down
4 changes: 2 additions & 2 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import { commonMessages } from 'helpers'
import { getLocale } from 'modules/intl/_SSR'
import { ThemeColor } from 'modules/theme/enum'
import { getServerTheme } from 'modules/theme/_SSR'
import { getVaultBase } from 'helpers/requests/_SSR'
import { getServerDevice } from 'modules/device/_SSR'
import GlobalLayout from 'layouts/GlobalLayout/GlobalLayout'
import { getNetworkId } from 'config/core/config/_SSR'
import { getVaultBase } from 'helpers/requests/_SSR'
import GlobalLayout from 'layouts/GlobalLayout/GlobalLayout'

import 'focus-visible'
import 'styles/globals.scss'
Expand Down
2 changes: 1 addition & 1 deletion src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { default } from 'views/HomeView/HomeView'
export { default } from 'views/SwapView/SwapView'
34 changes: 34 additions & 0 deletions src/components/ApyBreakdown/ApyBreakdown.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import React, { ReactNode } from 'react'

import PopupInfo from '../PopupInfo/PopupInfo'

import Details, { DetailsProps } from './Details/Details'


export type ApyBreakdownProps = {
className?: string
data?: DetailsProps['data']
withText?: boolean
maxBoostApy: number
children: ReactNode
}

const ApyBreakdown: React.FC<ApyBreakdownProps> = (props) => {
const { className, children, data, withText, maxBoostApy } = props

return (
<PopupInfo
className={className}
headNode={children}
>
<Details
data={data || []}
withText={withText}
maxBoostApy={maxBoostApy}
/>
</PopupInfo>
)
}


export default React.memo(ApyBreakdown)
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import React, { useMemo } from 'react'
import cx from 'classnames'
import date from 'modules/date'
import intl from 'modules/intl'
import methods from 'helpers/methods'
import { useStore } from 'hooks'
import { useConfig } from 'config'
import { useSelector } from 'react-redux'
import { commonMessages } from 'helpers'
import { commonMessages, methods } from 'helpers'

import { Text, Logo } from 'components'
import Logo from '../../Logo/Logo'
import Text from '../../Text/Text'

import messages from './messages'

Expand All @@ -22,9 +22,10 @@ type Data = {
endTimestamp?: string
}

type DetailsProps = {
export type DetailsProps = {
className?: string
data: Data[]
maxBoostApy: number
withText?: boolean
}

Expand All @@ -34,16 +35,18 @@ const Details: React.FC<DetailsProps> = (props) => {
const now = date.time()
const { sdk } = useConfig()
const intlRef = intl.useIntlRef()
const { maxBoostApy } = useSelector(storeSelector)
const { maxBoostApy } = useStore(storeSelector)

const tokenList = useMemo(() => {
const SSV = sdk.config.addresses.tokens.ssv.toLocaleLowerCase()
const obol = sdk.config.addresses.tokens.obol.toLocaleLowerCase()
const SWISE = sdk.config.addresses.tokens.swise.toLocaleLowerCase()
const mintToken = sdk.config.addresses.tokens.mintToken.toLocaleLowerCase()
const depositToken = sdk.config.addresses.tokens.depositToken.toLocaleLowerCase()

return ({
[SSV]: sdk.config.tokens.ssv,
[obol]: sdk.config.tokens.obol,
[SWISE]: sdk.config.tokens.swise,
[mintToken]: sdk.config.tokens.mintToken,
[depositToken]: sdk.config.tokens.depositToken,
Expand Down
2 changes: 1 addition & 1 deletion src/components/ButtonBase/ButtonBase.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useCallback } from 'react'
import methods from 'helpers/methods'
import { methods } from 'helpers'
import cx from 'classnames'

import s from './ButtonBase.module.scss'
Expand Down
6 changes: 3 additions & 3 deletions src/components/Chart/Legend/Amount/Amount.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useRef, useCallback } from 'react'
import { createSelector } from '@reduxjs/toolkit'
import { useSelector } from 'react-redux'
import methods from 'helpers/methods'
import { methods } from 'helpers'
import { useStore } from 'hooks'
import cx from 'classnames'

import Text from '../../../Text/Text'
Expand Down Expand Up @@ -29,7 +29,7 @@ const storeSelector = createSelector([
const Amount: React.FC<AmountProps> = (props) => {
const { className, token, chart, series } = props

const { fiatRates, currency, currencySymbol } = useSelector(storeSelector)
const { fiatRates, currency, currencySymbol } = useStore(storeSelector)

const fiatTooltipRef = useRef<HTMLDivElement>(null)
const tokenValueTooltipRef = useRef<HTMLDivElement>(null)
Expand Down
2 changes: 1 addition & 1 deletion src/components/Chart/Legend/Percentage/Percentage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useRef, useCallback } from 'react'
import methods from 'helpers/methods'
import { methods } from 'helpers'
import cx from 'classnames'

import Text from '../../../Text/Text'
Expand Down
2 changes: 1 addition & 1 deletion src/components/Chart/util/useDefaultSettings.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useMemo, useCallback } from 'react'
import theme, { ThemeColor } from 'modules/theme'
import { methods } from 'helpers'
import intl from 'modules/intl'
import methods from 'helpers/methods'

import { LineStyle, LineWidth, CrosshairMode } from 'lightweight-charts'

Expand Down
24 changes: 19 additions & 5 deletions src/components/Dropdown/DropdownView/DropdownView.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { Fragment, KeyboardEventHandler, ReactElement, ReactNode } from 'react'
import React, { Fragment, KeyboardEventHandler, ReactElement, ReactNode, useRef } from 'react'
import cx from 'classnames'
import { offset, shift, VirtualElement, OffsetOptions } from '@floating-ui/react'
import type { Placement } from '@floating-ui/react'
Expand All @@ -15,6 +15,7 @@ type ButtonInput = {

export type DropdownViewProps = {
className?: string
contentClassName?: string
children: ReactNode
disabled?: boolean
// The child component must inherit the props, so be sure to make <Foo {...props} />
Expand All @@ -29,6 +30,7 @@ export type DropdownViewProps = {
autoUpdate?: boolean
offsetOptions?: Omit<OffsetOptions, 'number'>
}
onOpen?: () => void
onClose?: () => void
onChange?: (value: any) => void
onOptionsClick?: () => void
Expand All @@ -41,10 +43,12 @@ type DropdownViewComponent = React.FC<DropdownViewProps> & {

const DropdownView: DropdownViewComponent = (props: DropdownViewProps) => {
const {
className, children, button, value, disabled, withArrow, middleware,
placement = 'bottom-end', dataTestId, onClose, onChange, onOptionsClick, onOptionsKeyDown,
className, contentClassName, children, button, value, disabled, withArrow, middleware,
placement = 'bottom-end', dataTestId, onOpen, onClose, onChange, onOptionsClick, onOptionsKeyDown,
} = props

const isOpenRef = useRef(false)

const { refs, floatingStyles } = useFloating({
placement,
middleware: [
Expand Down Expand Up @@ -73,10 +77,16 @@ const DropdownView: DropdownViewComponent = (props: DropdownViewProps) => {
({ open }) => {
const arrow = open ? 'up' : 'down'

if (!open && typeof onClose === 'function') {
if (open && !isOpenRef.current && typeof onOpen === 'function') {
onOpen()
}

if (!open && isOpenRef.current && typeof onClose === 'function') {
setTimeout(onClose)
}

isOpenRef.current = open

if (typeof button === 'function') {
return button({
ref: refs.setReference,
Expand All @@ -94,7 +104,11 @@ const DropdownView: DropdownViewComponent = (props: DropdownViewProps) => {
</ListboxButton>
<ListboxOptions
ref={refs.setFloating}
className={cx(s.options, 'absolute rounded-8 bg-background border border-dark/10 overflow-x-hidden overflow-y-auto shadow-md')}
className={cx(
s.options,
contentClassName,
'absolute rounded-8 bg-background border border-dark/10 overflow-x-hidden overflow-y-auto shadow-md'
)}
style={floatingStyles}
data-testid={`${dataTestId}-options`}
onClick={onOptionsClick}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Href/Href.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { ReactNode, RefObject, useRef, useCallback } from 'react'
import { useEventListener } from 'hooks'
import { methods } from 'helpers'
import NextLink from 'next/link'
import methods from 'helpers/methods'
import intl from 'modules/intl'


Expand Down
2 changes: 1 addition & 1 deletion src/components/Input/InputView/InputView.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState, useCallback, useRef, useId, useEffect, ChangeEventHandler } from 'react'
import cx from 'classnames'
import methods from 'helpers/methods'
import { methods } from 'helpers'

import Text from '../../Text/Text'
import Icon from '../../Icon/Icon'
Expand Down
Loading