From c86eff323c537b183ea468a585ac1583bd1d1f93 Mon Sep 17 00:00:00 2001 From: Lyudmil Ivanov <55487633+flmel@users.noreply.github.com> Date: Mon, 14 Oct 2024 19:54:47 +0300 Subject: [PATCH 01/10] fix: css issue --- src/styles/globals.css | 1 + 1 file changed, 1 insertion(+) diff --git a/src/styles/globals.css b/src/styles/globals.css index c2e5b046e..bffbe4cdc 100644 --- a/src/styles/globals.css +++ b/src/styles/globals.css @@ -3,6 +3,7 @@ :root { --gateway-page-container-padding-y: 2rem; --gateway-page-container-padding-x: 1rem; + scrollbar-gutter: stable; } p, From 4946aee9822e3590bbc0fb91a6ffd968d4ee5d0d Mon Sep 17 00:00:00 2001 From: Lyudmil Ivanov <55487633+flmel@users.noreply.github.com> Date: Mon, 14 Oct 2024 19:55:23 +0300 Subject: [PATCH 02/10] fix: tools page layout --- src/pages/tools.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/tools.tsx b/src/pages/tools.tsx index 6ee8b987b..70b54d66b 100644 --- a/src/pages/tools.tsx +++ b/src/pages/tools.tsx @@ -133,13 +133,13 @@ const ToolsPage: NextPageWithLayout = () => { return (
- + Tools - + From b2ba3ee78edb40aa1791567096951ed5d419af2e Mon Sep 17 00:00:00 2001 From: Lyudmil Ivanov <55487633+flmel@users.noreply.github.com> Date: Mon, 14 Oct 2024 19:55:57 +0300 Subject: [PATCH 03/10] fix: add validation for ft_total_supply --- src/components/tools/FungibleToken/CreateTokenForm.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/tools/FungibleToken/CreateTokenForm.tsx b/src/components/tools/FungibleToken/CreateTokenForm.tsx index 238c2f9ed..46a4b27d9 100644 --- a/src/components/tools/FungibleToken/CreateTokenForm.tsx +++ b/src/components/tools/FungibleToken/CreateTokenForm.tsx @@ -173,7 +173,13 @@ const CreateTokenForm = ({ reload }: { reload: (delay: number) => void }) => { label="Total Supply" placeholder="e.g. 1000" error={errors.total_supply?.message} - {...register('total_supply', { required: 'Total supply is required' })} + {...register('total_supply', { + required: 'Total supply is required', + pattern: { + value: /^[1-9][0-9]*$/, + message: 'Total supply must be a whole number greater than 0', + }, + })} disabled={!signedAccountId} /> Date: Tue, 15 Oct 2024 14:16:48 -0300 Subject: [PATCH 04/10] fix: styles issue on home page for Safari 17 --- src/components/home/Contracts/index.tsx | 4 ++-- src/components/home/DecentralizedApps/index.tsx | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/home/Contracts/index.tsx b/src/components/home/Contracts/index.tsx index ab15b5ede..92c1a84af 100644 --- a/src/components/home/Contracts/index.tsx +++ b/src/components/home/Contracts/index.tsx @@ -87,7 +87,7 @@ export const Contracts = () => { gap="xl" columnsPhone="minmax(0, 1fr)" columnsTablet="minmax(0, 1fr)" - style={{ flexGrow: 1 }} + style={{ height: '88%' }} > @@ -119,7 +119,7 @@ export const Contracts = () => { - + One Command Setup diff --git a/src/components/home/DecentralizedApps/index.tsx b/src/components/home/DecentralizedApps/index.tsx index 631892092..7f377d45c 100644 --- a/src/components/home/DecentralizedApps/index.tsx +++ b/src/components/home/DecentralizedApps/index.tsx @@ -67,6 +67,7 @@ const Carousel = styled.div` const WalletImg = styled(Image)` margin: 0 2px; height: 40px; + width: 40px; border-radius: 4px; `; @@ -80,7 +81,7 @@ export const DecentralizedApps = () => { gapTablet="xl" columnsPhone="minmax(0, 1fr)" columnsTablet="minmax(0, 1fr)" - style={{ flex: 1 }} + style={{ height: '88%' }} > @@ -97,7 +98,7 @@ export const DecentralizedApps = () => { - + NEAR React App From f2cd496eb921a7934b3519a5ea7321352a94e1fa Mon Sep 17 00:00:00 2001 From: Matias Benary Date: Wed, 16 Oct 2024 12:48:13 -0300 Subject: [PATCH 05/10] feat: network selector added --- src/components/sidebar-navigation/Sidebar.tsx | 66 ++++++++++++++++++- .../sidebar-navigation/SmallScreenHeader.tsx | 55 +++++++++++++--- src/components/sidebar-navigation/styles.ts | 6 +- 3 files changed, 113 insertions(+), 14 deletions(-) diff --git a/src/components/sidebar-navigation/Sidebar.tsx b/src/components/sidebar-navigation/Sidebar.tsx index 17bb8abea..2be959590 100644 --- a/src/components/sidebar-navigation/Sidebar.tsx +++ b/src/components/sidebar-navigation/Sidebar.tsx @@ -1,9 +1,12 @@ -import { Tooltip } from '@near-pagoda/ui'; +import { Dropdown, SvgIcon, Tooltip } from '@near-pagoda/ui'; +import { CaretDown } from '@phosphor-icons/react'; import Image from 'next/image'; import { useRouter } from 'next/router'; -import { useCallback, useEffect, useRef } from 'react'; +import { useCallback, useEffect, useRef, useState } from 'react'; import { useContext } from 'react'; +import styled from 'styled-components'; +import { networkId } from '@/config'; import { useSignInRedirect } from '@/hooks/useSignInRedirect'; import { NearContext } from '../wallet-selector/WalletSelector'; @@ -14,6 +17,26 @@ import * as S from './styles'; import { UserDropdownMenu } from './UserDropdownMenu'; import { currentPathMatchesRoute } from './utils'; +const Redirect = styled.a<{ selected?: boolean }>` + text-decoration: none; + color: #444; +`; + +const Badge = styled.div` + display: flex; + align-items: center; + justify-content: center; + padding: 0.25rem 0.5rem; + gap: 4px; + font-size: 0.75rem; + font-weight: 600; + color: ${() => (networkId === 'mainnet' ? '#0072de' : '#d14e00')}; + background-color: ${() => (networkId === 'mainnet' ? '#0084f116' : '#f9900026')}; + text-transform: capitalize; + border-radius: 0.25rem; + letter-spacing: 0.05em; +`; + export const Sidebar = () => { const router = useRouter(); const expandedDrawer = useNavigationStore((store) => store.expandedDrawer); @@ -25,6 +48,13 @@ export const Sidebar = () => { const { signedAccountId } = useContext(NearContext); const { requestAuthentication } = useSignInRedirect(); const inputRef = useRef(null); + const [isOpenNetwork, setIsOpenNetwork] = useState(false); + + const preventRedirect = (network: string) => (e: React.MouseEvent) => { + if (networkId == network) { + e.preventDefault(); + } + }; const handleCreateAccount = () => { requestAuthentication(true); @@ -53,6 +83,38 @@ export const Sidebar = () => { NEAR + + setIsOpenNetwork(open)}> + + + {networkId}{' '} + } + size="xs" + style={{ + marginBottom: '2px', + transform: isOpenNetwork ? 'rotate(180deg)' : 'rotate(0deg)', + transition: 'all 200ms', + }} + /> + + + + + + + Mainnet + + + + + Testnet + + + + + + diff --git a/src/components/sidebar-navigation/SmallScreenHeader.tsx b/src/components/sidebar-navigation/SmallScreenHeader.tsx index 0f40941d7..facf3a5c6 100644 --- a/src/components/sidebar-navigation/SmallScreenHeader.tsx +++ b/src/components/sidebar-navigation/SmallScreenHeader.tsx @@ -1,9 +1,11 @@ -import { Button } from '@near-pagoda/ui'; -import { MagnifyingGlass } from '@phosphor-icons/react'; +import { Button, Dropdown } from '@near-pagoda/ui'; +import { MagnifyingGlass, WifiHigh } from '@phosphor-icons/react'; import Image from 'next/image'; import { useRouter } from 'next/router'; import { useContext } from 'react'; +import styled from 'styled-components'; +import { networkId } from '@/config'; import { useSignInRedirect } from '@/hooks/useSignInRedirect'; import { NearContext } from '../wallet-selector/WalletSelector'; @@ -12,6 +14,11 @@ import { useNavigationStore } from './store'; import * as S from './styles'; import { UserDropdownMenu } from './UserDropdownMenu'; +const Redirect = styled.a<{ selected?: boolean }>` + text-decoration: none; + color: #444; +`; + export const SmallScreenHeader = () => { const router = useRouter(); const redirect = (url: string) => () => router.push(url); @@ -23,6 +30,12 @@ export const SmallScreenHeader = () => { const { signedAccountId } = useContext(NearContext); const { requestAuthentication } = useSignInRedirect(); + const preventRedirect = (network: string) => (e: React.MouseEvent) => { + if (networkId == network) { + e.preventDefault(); + } + }; + const handleCreateAccount = () => { requestAuthentication(true); }; @@ -50,23 +63,45 @@ export const SmallScreenHeader = () => { NEAR )} - {signedAccountId ? (