Skip to content

Commit

Permalink
Merge branch 'main' into add-utxo-support
Browse files Browse the repository at this point in the history
  • Loading branch information
chybisov committed Sep 11, 2024
2 parents 79ded16 + d2845b9 commit e780bd0
Show file tree
Hide file tree
Showing 13 changed files with 61 additions and 40 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [3.5.2](https://github.com/lifinance/widget/compare/v3.5.1...v3.5.2) (2024-09-11)


### Bug Fixes

* widget header with subvariant split ([#298](https://github.com/lifinance/widget/issues/298)) ([c33d42a](https://github.com/lifinance/widget/commit/c33d42abcabaa80c533caae915384dd6d2bc36ab))

### [3.5.1](https://github.com/lifinance/widget/compare/v3.5.0...v3.5.1) (2024-09-10)


### Bug Fixes

* make internal explorer optional ([a0f51c6](https://github.com/lifinance/widget/commit/a0f51c6d7664824543ad3f2a6ab672d01ca0a91b))

## [3.5.0](https://github.com/lifinance/widget/compare/v3.4.4...v3.5.0) (2024-09-10)


Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "3.5.0",
"version": "3.5.2",
"private": true,
"sideEffects": false,
"type": "module",
Expand Down
4 changes: 2 additions & 2 deletions packages/widget-embedded/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lifi/widget-embedded",
"version": "1.0.218",
"version": "1.0.220",
"type": "module",
"scripts": {
"analyze": "source-map-explorer 'dist/assets/*.js' --no-border-checks",
Expand All @@ -21,7 +21,7 @@
"dependencies": {
"@lifi/sdk": "^3.3.0-alpha.0",
"@lifi/wallet-management": "^3.1.4",
"@lifi/widget": "^3.5.0",
"@lifi/widget": "^3.5.2",
"@mui/icons-material": "^5.16.7",
"@mui/lab": "^5.0.0-alpha.173",
"@mui/material": "^5.16.7",
Expand Down
6 changes: 3 additions & 3 deletions packages/widget-playground-next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lifi/widget-playground-next",
"version": "1.0.218",
"version": "1.0.220",
"scripts": {
"dev": "next dev -p 3001",
"build": "next build",
Expand All @@ -18,8 +18,8 @@
"@emotion/styled": "^11.13.0",
"@lifi/sdk": "^3.3.0-alpha.0",
"@lifi/wallet-management": "^3.1.4",
"@lifi/widget": "^3.5.0",
"@lifi/widget-playground": "^1.0.218",
"@lifi/widget": "^3.5.2",
"@lifi/widget-playground": "^1.0.220",
"@mui/icons-material": "^5.16.7",
"@mui/material": "^5.16.7",
"@mui/material-nextjs": "^5.16.6",
Expand Down
6 changes: 3 additions & 3 deletions packages/widget-playground-vite/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lifi/widget-playground-vite",
"version": "1.0.218",
"version": "1.0.220",
"type": "module",
"scripts": {
"analyze": "source-map-explorer 'dist/assets/*.js' --no-border-checks",
Expand All @@ -20,8 +20,8 @@
"dependencies": {
"@lifi/sdk": "^3.3.0-alpha.0",
"@lifi/wallet-management": "^3.1.4",
"@lifi/widget": "^3.5.0",
"@lifi/widget-playground": "^1.0.218",
"@lifi/widget": "^3.5.2",
"@lifi/widget-playground": "^1.0.220",
"@mui/icons-material": "^5.16.7",
"@mui/material": "^5.16.7",
"@rainbow-me/rainbowkit": "^2.1.6",
Expand Down
2 changes: 1 addition & 1 deletion packages/widget-playground/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lifi/widget-playground",
"version": "1.0.218",
"version": "1.0.220",
"type": "module",
"main": "./src/index.ts",
"types": "./src/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/widget/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lifi/widget",
"version": "3.5.0",
"version": "3.5.2",
"description": "LI.FI Widget for cross-chain bridging and swapping. It will drive your multi-chain strategy and attract new users from everywhere.",
"type": "module",
"main": "./src/index.ts",
Expand Down
15 changes: 4 additions & 11 deletions packages/widget/src/components/AppContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { Box, Container, ScopedCssBaseline, styled } from '@mui/material';
import type { PropsWithChildren } from 'react';
import {
maxHeaderHeight,
minHeaderHeight,
} from '../components/Header/Header.js';
import { defaultMaxHeight } from '../config/constants.js';
import { useHeaderHeight } from '../hooks/useHeaderHeight.js';
import { useWidgetConfig } from '../providers/WidgetProvider/WidgetProvider.js';
import type { WidgetVariant } from '../types/widget.js';
import { ElementId, createElementId } from '../utils/elements.js';
Expand Down Expand Up @@ -103,14 +100,10 @@ export const FlexContainer = styled(Container)(({ theme }) => ({

export const AppContainer: React.FC<PropsWithChildren<{}>> = ({ children }) => {
// const ref = useRef<HTMLDivElement>(null);
const { variant, elementId, hiddenUI, theme } = useWidgetConfig();

const { variant, elementId, theme } = useWidgetConfig();
const { headerHeight } = useHeaderHeight();
const positionFixedAdjustment =
theme?.header?.position === 'fixed'
? hiddenUI?.includes('walletMenu')
? minHeaderHeight
: maxHeaderHeight
: 0;
theme?.header?.position === 'fixed' ? headerHeight : 0;

return (
<RelativeContainer
Expand Down
11 changes: 2 additions & 9 deletions packages/widget/src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,17 @@
import type { FC, PropsWithChildren } from 'react';
import { useLocation } from 'react-router-dom';
import { useDefaultElementId } from '../../hooks/useDefaultElementId.js';
import { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js';
import { useHeaderHeight } from '../../hooks/useHeaderHeight.js';
import { ElementId, createElementId } from '../../utils/elements.js';
import { stickyHeaderRoutes } from '../../utils/navigationRoutes.js';
import { Container } from './Header.style.js';
import { NavigationHeader } from './NavigationHeader.js';
import { WalletHeader } from './WalletHeader.js';

export const minHeaderHeight = 64;
export const maxHeaderHeight = 108;

export const HeaderContainer: FC<PropsWithChildren<{}>> = ({ children }) => {
const { pathname } = useLocation();
const elementId = useDefaultElementId();
const { hiddenUI } = useWidgetConfig();

const headerHeight = hiddenUI?.includes('walletMenu')
? minHeaderHeight
: maxHeaderHeight;
const { headerHeight } = useHeaderHeight();

return (
<Container
Expand Down
2 changes: 1 addition & 1 deletion packages/widget/src/config/version.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export const name = '@lifi/widget';
export const version = '3.5.0';
export const version = '3.5.2';
20 changes: 20 additions & 0 deletions packages/widget/src/hooks/useHeaderHeight.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { useWidgetConfig } from '../providers/WidgetProvider/WidgetProvider.js';

export const minHeaderHeight = 64;
export const maxHeaderHeight = 108;
export const maxHeaderHeightSubvariantSplit = 136;

export const useHeaderHeight = () => {
const { hiddenUI, subvariant } = useWidgetConfig();

const headerHeight =
subvariant === 'split'
? maxHeaderHeightSubvariantSplit
: hiddenUI?.includes('walletMenu')
? minHeaderHeight
: maxHeaderHeight;

return {
headerHeight,
};
};
3 changes: 2 additions & 1 deletion packages/widget/src/types/widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,8 @@ export interface WidgetConfig {
tokens?: WidgetTokens;
languages?: WidgetLanguages;
languageResources?: LanguageResources;
explorerUrls?: Record<number | 'internal', string[]>;
explorerUrls?: Record<number, string[]> &
Partial<Record<'internal', string[]>>;
}

export interface WidgetConfigProps {
Expand Down
14 changes: 7 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2558,7 +2558,7 @@ __metadata:
"@esbuild-plugins/node-globals-polyfill": "npm:^0.2.3"
"@lifi/sdk": "npm:^3.3.0-alpha.0"
"@lifi/wallet-management": "npm:^3.1.4"
"@lifi/widget": "npm:^3.5.0"
"@lifi/widget": "npm:^3.5.2"
"@mui/icons-material": "npm:^5.16.7"
"@mui/lab": "npm:^5.0.0-alpha.173"
"@mui/material": "npm:^5.16.7"
Expand Down Expand Up @@ -2589,8 +2589,8 @@ __metadata:
"@emotion/styled": "npm:^11.13.0"
"@lifi/sdk": "npm:^3.3.0-alpha.0"
"@lifi/wallet-management": "npm:^3.1.4"
"@lifi/widget": "npm:^3.5.0"
"@lifi/widget-playground": "npm:^1.0.218"
"@lifi/widget": "npm:^3.5.2"
"@lifi/widget-playground": "npm:^1.0.220"
"@mui/icons-material": "npm:^5.16.7"
"@mui/material": "npm:^5.16.7"
"@mui/material-nextjs": "npm:^5.16.6"
Expand Down Expand Up @@ -2624,8 +2624,8 @@ __metadata:
"@esbuild-plugins/node-globals-polyfill": "npm:^0.2.3"
"@lifi/sdk": "npm:^3.3.0-alpha.0"
"@lifi/wallet-management": "npm:^3.1.4"
"@lifi/widget": "npm:^3.5.0"
"@lifi/widget-playground": "npm:^1.0.218"
"@lifi/widget": "npm:^3.5.2"
"@lifi/widget-playground": "npm:^1.0.220"
"@mui/icons-material": "npm:^5.16.7"
"@mui/material": "npm:^5.16.7"
"@rainbow-me/rainbowkit": "npm:^2.1.6"
Expand All @@ -2651,7 +2651,7 @@ __metadata:
languageName: unknown
linkType: soft

"@lifi/widget-playground@npm:^1.0.218, @lifi/widget-playground@workspace:packages/widget-playground":
"@lifi/widget-playground@npm:^1.0.220, @lifi/widget-playground@workspace:packages/widget-playground":
version: 0.0.0-use.local
resolution: "@lifi/widget-playground@workspace:packages/widget-playground"
dependencies:
Expand Down Expand Up @@ -2687,7 +2687,7 @@ __metadata:
languageName: unknown
linkType: soft

"@lifi/widget@npm:^3.5.0, @lifi/widget@workspace:packages/widget":
"@lifi/widget@npm:^3.5.2, @lifi/widget@workspace:packages/widget":
version: 0.0.0-use.local
resolution: "@lifi/widget@workspace:packages/widget"
dependencies:
Expand Down

0 comments on commit e780bd0

Please sign in to comment.