Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add warning update on bridge #188

Merged
merged 5 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/app-portal/src/systems/Core/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Pages } from '~/types';
export function Header() {
return (
<Nav>
<Nav.Desktop>
<Nav.Desktop css={{ zIndex: 10 }}>
<Nav.Logo />
<Nav.Spacer />
<Nav.Menu>
Expand All @@ -22,7 +22,7 @@ export function Header() {
</Nav.Menu>
<Nav.ThemeToggle />
</Nav.Desktop>
<Nav.Mobile>
<Nav.Mobile css={{ zIndex: 10 }}>
<Nav.MobileContent>
<Nav.Logo />
<Nav.ThemeToggle />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function FuelConnectProvider({ children }: ProvidersProps) {
theme={theme}
fuelConfig={{
devMode: IS_DEV,
connnectors: defaultConnectors(),
connectors: defaultConnectors(),
Copy link
Member

Choose a reason for hiding this comment

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

We need to remove Fuelet for now to import the connectors use FuelWalletConnector and FuelWalletDevelopmenConnector here.

}}
>
{children}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import { cssObj, globalCss } from '@fuel-ui/css';
import {
Box,
Button,
Dialog,
Icon,
Link,
ThemeProvider,
darkTheme,
lightTheme,
loadIcons,
setFuelThemes,
} from '@fuel-ui/react';
import type { PropsWithChildren } from 'react';
import { PropsWithChildren, useState } from 'react';

import { useQuery } from '@tanstack/react-query';
// eslint-disable-next-line import/no-unresolved
import icons from '/icons/sprite.svg';

Expand All @@ -30,10 +36,84 @@ setFuelThemes({
});

export function FuelUiProvider({ children }: PropsWithChildren) {
const [founded, setFounded] = useState(false);
const { data: isOldWallet, isLoading } = useQuery(
['network'],
async () => {
const oldWindowFuel = (window as any).fuel as any;
const fuelet = (window as any).fuelet;
if (!oldWindowFuel && !founded) {
throw new Error('No Fuel Wallet found');
}
if (!oldWindowFuel && founded) {
setFounded(true);
return;
}
const version = window.fuel?.connectorName;
return fuelet ? false : Boolean(version);
},
{
retry: 5,
retryDelay: 1000,
},
);

return (
<ThemeProvider>
{!isLoading && isOldWallet && (
<Box css={styles.dialog}>
<Box css={styles.content}>
Your wallet version is incompatible with this application. Please
update your wallet for version 0.15.2.
<Button
as="a"
size="sm"
variant="solid"
intent="primary"
href="https://chromewebstore.google.com/detail/fuel-wallet/dldjpboieedgcmpkchcjcbijingjcgok"
target="_blank"
rel="noreferrer"
>
Update Wallet
</Button>
</Box>
</Box>
)}

{globalCss(globalStyles)()}
{children}
</ThemeProvider>
);
}

const OVERLAY_HEIGHT = 100;
const OVERLAY_WIDTH = 300;

const styles = {
dialog: cssObj({
zIndex: 1,
top: 64,
bottom: 0,
left: 0,
right: 0,
position: 'fixed',
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
backdropFilter: 'blur(15px)',
}),
content: cssObj({
borderRadius: '$md',
padding: '$4',
display: 'flex',
flexDirection: 'column',
gap: '$4',
width: OVERLAY_WIDTH,
minHeight: OVERLAY_HEIGHT,
maxWidth: OVERLAY_WIDTH,
maxHeight: 'none',
backgroundColor: '$cardBg',
textAlign: 'center',
boxShadow: '$md',
}),
};
Loading