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

feat(dcellar-web-ui): add pricing calculator page #192

Closed
wants to merge 15 commits into from
Closed
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
271 changes: 271 additions & 0 deletions apps/dcellar-web-ui/public/images/price/bg.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 46 additions & 0 deletions apps/dcellar-web-ui/public/images/price/bg_2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions apps/dcellar-web-ui/public/images/price/start_bg.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion apps/dcellar-web-ui/src/base/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const {
NEXT_PUBLIC_BSC_EXPLORER_URL,
} = publicRuntimeConfig || {};

export type TRuntimeEnv = 'prod' | 'qa' | 'development';
export type TRuntimeEnv = 'development' | 'qa' | 'testnet' | 'mainnet';

export const NODE_ENV = process.env.NODE_ENV;
export const runtimeEnv: TRuntimeEnv = NEXT_PUBLIC_ENV || 'qa';
Expand Down
2 changes: 1 addition & 1 deletion apps/dcellar-web-ui/src/base/theme/dark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@ export const dark = {
shadows: {
normal: '0px 2px 8px rgba(11, 14, 17, 1)',
},
},
}
};
4 changes: 4 additions & 0 deletions apps/dcellar-web-ui/src/base/theme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ export const theme = {
...light.colors,
},
},
breakpoints: {
md: '768px',
lg: '1440px',
},
config: {
useSystemColorMode: false, // true | false
initialColorMode: 'light', // light | dark | system
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ import { useCallback, useEffect, useState } from 'react';
import { ConnectorNotFoundError } from 'wagmi';
import { useAppLogin } from '@/modules/welcome/hooks/useAppLogin';
import { useAppSelector } from '@/store';
import { useRouter } from 'next/router';
import { InternalRoutePaths } from '@/constants/paths';
import { ssrLandingRoutes } from '@/pages/_app';

export interface WalletConnectModalProps extends DCModalProps {}

export function WalletConnectModal(props: WalletConnectModalProps) {
const router = useRouter();
const { isOpen, onClose } = props;

const [hasTrigger, setHasTrigger] = useState(false);
const { loginAccount: address } = useAppSelector((root) => root.persist);
const [currentAddress, setCurrentAddress] = useState<string | undefined>(address);

Expand All @@ -26,6 +29,17 @@ export function WalletConnectModal(props: WalletConnectModalProps) {
setCurrentAddress(address);
}, []);

useEffect(() => {
if (
hasTrigger &&
!isAuthPending &&
!!address &&
ssrLandingRoutes.some((item) => item === router.pathname)
) {
setTimeout(() => router.push(InternalRoutePaths.buckets), 100);
}
}, [address, hasTrigger, isAuthPending, isOpen, router]);

const onConnectError = useCallback((err: Error, args: any) => {
if (err instanceof ConnectorNotFoundError) {
const { connector } = args;
Expand All @@ -52,11 +66,11 @@ export function WalletConnectModal(props: WalletConnectModalProps) {

const isLoading = isWalletConnecting || isAuthPending;

useEffect(() => {
if (isOpen) {
disconnect();
}
}, [disconnect, isOpen]);
// useEffect(() => {
// if (isOpen) {
// disconnect();
// }
// }, [disconnect, isOpen]);

return (
<DCModal
Expand All @@ -80,7 +94,10 @@ export function WalletConnectModal(props: WalletConnectModalProps) {
name={item.name}
isActive={isActive}
isDisabled={isLoading}
onClick={() => onChangeConnector(item)}
onClick={() => {
setHasTrigger(true);
!address && onChangeConnector(item);
}}
/>
</GAClick>
);
Expand Down
11 changes: 7 additions & 4 deletions apps/dcellar-web-ui/src/components/ConnectWallet/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ import { DCButton, DCButtonProps } from '@/components/common/DCButton';
import { WalletConnectModal } from '@/components/ConnectWallet/WalletConnectModal';
import { useDisclosure } from '@totejs/uikit';

export const ConnectWallet = memo<Partial<DCButtonProps>>(function ConnectButton(props) {
type ConnectWalletProps = DCButtonProps & {
text?: string;
};
export const ConnectWallet = memo<Partial<ConnectWalletProps>>(function ConnectButton(props) {
const { isOpen, onClose, onOpen } = useDisclosure();

const { text, ...restProps } = props;
return (
<>
<WalletConnectModal isOpen={isOpen} onClose={onClose} />
Expand All @@ -16,10 +19,10 @@ export const ConnectWallet = memo<Partial<DCButtonProps>>(function ConnectButton
fontSize={18}
lineHeight="22px"
fontWeight={600}
{...props}
{...restProps}
onClick={onOpen}
>
Connect Wallet
{text ? text : 'Connect Wallet'}
</DCButton>
</>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const DCDrawer = (props: DCDrawerProps) => {
w={568}
padding="16px 24px"
onClose={onBeforeClose}
rootProps={{ top: 64.5 }}
rootProps={{ top: 65 }}
{...restProps}
>
{showCloseBtn && <QDrawerCloseButton top={16} right={24} color="readable.tertiary" />}
Expand Down
Loading