Skip to content

Commit

Permalink
Merge pull request #101 from terra-money/feature/latest_updates
Browse files Browse the repository at this point in the history
feature/latest_updates
  • Loading branch information
simke9445 authored Feb 21, 2024
2 parents 6bdd3dc + 2c701c5 commit 742d030
Show file tree
Hide file tree
Showing 100 changed files with 1,497 additions and 567 deletions.
2 changes: 1 addition & 1 deletion apps/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@mui/material": "^5.10.2",
"@terra-money/feather.js": "^1.0.11",
"@terra-money/wallet-kit": "^1.0.11",
"@terra-money/warp-sdk": "^0.1.65",
"@terra-money/warp-sdk": "^0.2.2",
"assert": "^2.0.0",
"big.js": "^6.2.1",
"buffer": "^6.0.3",
Expand Down
12 changes: 12 additions & 0 deletions apps/warp-protocol-landing/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ const App = () => {
window.open('https://twitter.com/warp_protocol');
}, []);

const onGetInTouchClick = useCallback(() => {
window.open('https://forms.gle/AVfrfDStd95qjnGQ9');
}, []);

const onTelegramClick = useCallback(() => {
window.open('https://t.me/warp_protocol');
}, []);
Expand All @@ -63,6 +67,10 @@ const App = () => {
window.open('https://terra.sc/warpdiscord');
}, []);

const onSdkClick = useCallback(() => {
window.open('https://github.com/terra-money/warp-sdk');
}, []);

const onPrivacyPolicyClick = useCallback(() => {
window.open(`${baseUrl(document.location.href)}/pdfs/privacy_policy.pdf`);
}, []);
Expand All @@ -84,6 +92,8 @@ const App = () => {
onTwitterClick={onTwitterClick}
onTelegramClick={onTelegramClick}
onDiscordClick={onDiscordClick}
onSdkClick={onSdkClick}
onGetInTouchClick={onGetInTouchClick}
/>
<Routes>
<Route
Expand All @@ -92,6 +102,7 @@ const App = () => {
<Home
onDocsClick={onDocsClick}
onWebAppClick={onWebAppClick}
onGetInTouchClick={onGetInTouchClick}
featuresRef={featuresRef}
/>
}
Expand All @@ -103,6 +114,7 @@ const App = () => {
<BottomBar
onDocsClick={onDocsClick}
onFeaturesClick={onFeaturesClick}
onSdkClick={onSdkClick}
onHomeClick={onHomeClick}
onPrivacyPolicyClick={onPrivacyPolicyClick}
onTermsClick={onTermsClick}
Expand Down
3 changes: 3 additions & 0 deletions apps/warp-protocol-landing/src/bottom-bar/BottomBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type BottomBarProps = UIElementProps & {
onDiscordClick: () => void;
onTelegramClick: () => void;
onTwitterClick: () => void;
onSdkClick: () => void;
onBrandClick: () => void;
};

Expand All @@ -28,6 +29,7 @@ export const BottomBar = (props: BottomBarProps) => {
onTelegramClick,
onTwitterClick,
onBrandClick,
onSdkClick,
} = props;

const isMobile = useMediaQuery('(max-width: 768px)');
Expand All @@ -53,6 +55,7 @@ export const BottomBar = (props: BottomBarProps) => {
onTelegramClick={onTelegramClick}
onTwitterClick={onTwitterClick}
onBrandClick={onBrandClick}
onSdkClick={onSdkClick}
/>
);
};
12 changes: 11 additions & 1 deletion apps/warp-protocol-landing/src/bottom-bar/DesktopBottomBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type DesktopBottomBarProps = UIElementProps & {
onTelegramClick: () => void;
onTwitterClick: () => void;
onBrandClick: () => void;
onSdkClick: () => void;
};

export const DesktopBottomBar = (props: DesktopBottomBarProps) => {
Expand All @@ -31,7 +32,8 @@ export const DesktopBottomBar = (props: DesktopBottomBarProps) => {
onDiscordClick,
onTelegramClick,
onTwitterClick,
onBrandClick
onBrandClick,
onSdkClick
} = props;

return (
Expand All @@ -56,6 +58,14 @@ export const DesktopBottomBar = (props: DesktopBottomBarProps) => {
>
Docs
</Button>
<Button
className={classNames(styles.button, styles.btn_gray)}
variant="primary"
fill="none"
onClick={onSdkClick}
>
SDK
</Button>
<Button
className={classNames(styles.button, styles.btn_gray)}
variant="primary"
Expand Down
4 changes: 3 additions & 1 deletion apps/warp-protocol-landing/src/pages/home/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import AnimatedDisplay from 'animated-display/AnimatedDisplay';
type HomeProps = UIElementProps & {
onDocsClick: () => void;
onWebAppClick: () => void;
onGetInTouchClick: () => void;
featuresRef: any;
};

Expand All @@ -33,13 +34,14 @@ const CardContent = () => {
};

const Home = (props: HomeProps) => {
const { onDocsClick, onWebAppClick, featuresRef } = props;
const { onDocsClick, onWebAppClick, onGetInTouchClick, featuresRef } = props;

return (
<div>
<TopContent
onDocsClick={onDocsClick}
onWebAppClick={onWebAppClick}
onGetInTouchClick={onGetInTouchClick}
className={styles.top_content}
/>
<CardContent />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ import { Text } from 'text';
type TopContentProps = UIElementProps & {
onWebAppClick: () => void;
onDocsClick: () => void;
onGetInTouchClick: () => void;
};

export const TopContent = (props: TopContentProps) => {
const { onWebAppClick, onDocsClick, className } = props;
const { onWebAppClick, onGetInTouchClick, className } = props;

return (
<div className={classNames(styles.root, className)}>
Expand All @@ -31,16 +32,16 @@ export const TopContent = (props: TopContentProps) => {
<Button
className={styles.button}
variant="primary"
onClick={onWebAppClick}
onClick={onGetInTouchClick}
>
Launch app
Get in Touch
</Button>
<Button
className={styles.button}
variant="secondary"
onClick={onDocsClick}
onClick={onWebAppClick}
>
Read the docs
Launch App
</Button>
</div>
</div>
Expand Down
19 changes: 15 additions & 4 deletions apps/warp-protocol-landing/src/top-bar/DesktopTopBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ type DesktopTopBarProps = UIElementProps & {
onTelegramClick: () => void;
onDiscordClick: () => void;
onTwitterClick: () => void;
onSdkClick: () => void;
onGetInTouchClick: () => void;
};

export const DesktopTopBar = forwardRef<
Expand All @@ -26,10 +28,11 @@ export const DesktopTopBar = forwardRef<
onHomeClick,
onFeaturesClick,
onDocsClick,
onWebAppClick,
onTelegramClick,
onDiscordClick,
onTwitterClick
onTwitterClick,
onSdkClick,
onGetInTouchClick,
} = props;

return (
Expand Down Expand Up @@ -64,6 +67,14 @@ export const DesktopTopBar = forwardRef<
>
Features
</Button>
<Button
className={classNames(styles.button, styles.btn_gray)}
variant="primary"
fill="none"
onClick={onSdkClick}
>
SDK
</Button>
<DropdownMenu
menuClass={styles.menu}
className={styles.btn_gray}
Expand Down Expand Up @@ -91,9 +102,9 @@ export const DesktopTopBar = forwardRef<
<Button
className={classNames(styles.button)}
variant="primary"
onClick={onWebAppClick}
onClick={onGetInTouchClick}
>
Launch App
Get in Touch
</Button>
</Container>
</div>
Expand Down
18 changes: 18 additions & 0 deletions apps/warp-protocol-landing/src/top-bar/MobileTopBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ type MobileTopBarProps = UIElementProps & {
onTelegramClick: () => void;
onTwitterClick: () => void;
onToggleDrawer: () => void;
onSdkClick: () => void;
onGetInTouchClick: () => void;
drawerOpen: boolean;
};

Expand All @@ -36,6 +38,8 @@ export const MobileTopBar = forwardRef<
onTelegramClick,
onTwitterClick,
onToggleDrawer,
onGetInTouchClick,
onSdkClick,
drawerOpen,
} = props;

Expand Down Expand Up @@ -90,6 +94,13 @@ export const MobileTopBar = forwardRef<
>
Features
</Text>
<Text
variant="heading2"
onClick={onSdkClick}
className={styles.menu_heading}
>
SDK
</Text>
<Text
variant="heading2"
onClick={onDocsClick}
Expand All @@ -104,6 +115,13 @@ export const MobileTopBar = forwardRef<
>
App
</Text>
<Text
variant="heading2"
onClick={onGetInTouchClick}
className={styles.menu_heading}
>
Get in Touch
</Text>
</Container>
<Container className={styles.bottom} direction="column">
<Text
Expand Down
8 changes: 8 additions & 0 deletions apps/warp-protocol-landing/src/top-bar/TopBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ type TopBarProps = UIElementProps & {
onDiscordClick: () => void;
onTwitterClick: () => void;
onTelegramClick: () => void;
onSdkClick: () => void;
onGetInTouchClick: () => void;
};

export const TopBar = forwardRef<HTMLDivElement | null, TopBarProps>(
Expand All @@ -29,6 +31,8 @@ export const TopBar = forwardRef<HTMLDivElement | null, TopBarProps>(
onDiscordClick,
onTelegramClick,
onTwitterClick,
onSdkClick,
onGetInTouchClick
} = props;

const isMobile = useMediaQuery('(max-width: 768px)');
Expand All @@ -46,6 +50,8 @@ export const TopBar = forwardRef<HTMLDivElement | null, TopBarProps>(
onDocsClick={onDocsClick}
onFeaturesClick={onFeaturesClick}
onWebAppClick={onWebAppClick}
onSdkClick={onSdkClick}
onGetInTouchClick={onGetInTouchClick}
/>
);
}
Expand All @@ -60,6 +66,8 @@ export const TopBar = forwardRef<HTMLDivElement | null, TopBarProps>(
onFeaturesClick={onFeaturesClick}
onWebAppClick={onWebAppClick}
onTwitterClick={onTwitterClick}
onSdkClick={onSdkClick}
onGetInTouchClick={onGetInTouchClick}
/>
);
}
Expand Down
2 changes: 1 addition & 1 deletion apps/warp-protocol/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"@terra-money/feather.js": "^1.0.11",
"@terra-money/terra-station-mobile": "1.0.8",
"@terra-money/wallet-kit": "^1.0.11",
"@terra-money/warp-sdk": "^0.1.66",
"@terra-money/warp-sdk": "^0.2.2",
"assert": "^2.0.0",
"big.js": "^6.2.1",
"brace": "^0.11.1",
Expand Down
6 changes: 4 additions & 2 deletions apps/warp-protocol/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ import { Dashboard } from 'pages/dashboard/Dashboard';
import { Jobs } from 'pages/jobs/Jobs';
import { JobPage } from 'pages/job-page/JobPage';
import { JobNew } from 'pages/job-new/JobNew';
import { BalancesPage } from 'pages/balances';
import { Variables } from 'pages/variables/Variables';
import { TemplateNew } from 'pages/template-new/TemplateNew';
import { TemplatesPage } from 'pages/templates';
import { useWalletDefaultNetworks } from 'hooks/useWalletDefaultNetworks';
import { ChainSelectorProvider } from '@terra-money/apps/hooks';
import { BalancesPage } from 'pages/balances';
import { FundingAccounts } from 'pages/funding-accounts';
import { useTermsOfUseDialog } from 'components/dialog/terms-of-use/TermsOfUseDialog';
import TerraStationMobileWallet from '@terra-money/terra-station-mobile';
import { useEffect, useMemo } from 'react';
Expand All @@ -34,7 +35,8 @@ const Main = () => {
<Routes>
<Route path="/" element={<Navigate to="/dashboard" replace />} />
<Route path="/dashboard" element={<Dashboard />} />
<Route path="/balances" element={<BalancesPage />} />
<Route path="/funding-accounts/*" element={<FundingAccounts />} />
<Route path="/funding-accounts/:fundingAccountAddress" element={<BalancesPage />} />
<Route path="/variables" element={<Variables />} />
<Route path="/templates" element={<TemplatesPage />} />
<Route path="/template-new/*" element={<TemplateNew />} />
Expand Down
13 changes: 2 additions & 11 deletions apps/warp-protocol/src/components/action-element/ActionElement.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { cloneElement, MouseEventHandler, useCallback } from 'react';
import { useConnectWalletDialog } from '../dialog/connect-wallet';
import { sleep } from 'utils';
import { useWarpAccount } from 'queries/useWarpAccount';
import { useCreateAccountDialog } from 'components/dialog/connect-wallet/CreateAccountDialog';
import { useLocalWallet } from '@terra-money/apps/hooks';

export type ActionElementProps = {
Expand All @@ -14,14 +12,9 @@ export const ActionElement = (props: ActionElementProps) => {
const localWallet = useLocalWallet();
const openConnectDialog = useConnectWalletDialog();

const { data: warpAccount, isFetching: accountFetching } = useWarpAccount();

const openCreateAccountDialog = useCreateAccountDialog();

const handleClick: MouseEventHandler<HTMLButtonElement> = useCallback(
async (event) => {
// let connectionType: ConnectType | undefined;
let accountReady: boolean | undefined = Boolean(warpAccount) && !accountFetching;

// If wallet is not connected, open connect dialog and wait for connection
if (!localWallet.connectedWallet) {
Expand All @@ -33,20 +26,18 @@ export const ActionElement = (props: ActionElementProps) => {
// Sometimes the balance calculation is wrong
// So we wait for a bit to make sure the balance is fetched correctly
await sleep(200);
} else if (!accountReady) {
accountReady = await openCreateAccountDialog({});
}

// If the user was already connected or just connected via extension:
// Connections with extension are instant, so we can call onClick immediately
// If another connection type was selected, disregard the original action
// The user will have to press the button again after connecting
// TODO: check if this works after removing connectionType === ConnectType.EXTENSION
if (localWallet.connectedWallet && accountReady) {
if (localWallet.connectedWallet) {
action.props.onClick?.(event);
}
},
[action, localWallet.connectedWallet, openConnectDialog, warpAccount, accountFetching, openCreateAccountDialog]
[action, localWallet.connectedWallet, openConnectDialog]
);

return cloneElement(action, {
Expand Down
Loading

0 comments on commit 742d030

Please sign in to comment.