diff --git a/src/assets/images/wallets/fastAuth.png b/src/assets/images/wallets/fastAuth.png new file mode 100644 index 000000000..d771fe526 Binary files /dev/null and b/src/assets/images/wallets/fastAuth.png differ 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 diff --git a/src/components/sidebar-navigation/Search.tsx b/src/components/sidebar-navigation/Search.tsx index b5f3a8ed2..7cf787836 100644 --- a/src/components/sidebar-navigation/Search.tsx +++ b/src/components/sidebar-navigation/Search.tsx @@ -3,6 +3,7 @@ import * as HoverCard from '@radix-ui/react-hover-card'; import Link from 'next/link'; import React, { useCallback, useEffect, useRef, useState } from 'react'; +import { networkId } from '@/config'; import useDebounce from '@/hooks/useDebounce'; import { fetchSearchHits } from '@/utils/algoliaSearchApi'; import { fetchCatalog } from '@/utils/catalogSearchApi'; @@ -51,11 +52,15 @@ export const Search = ({ inputRef }: { inputRef: any }) => { const fetchResults = useCallback(async () => { setIsLoading(true); - const [docs, apps, components] = await Promise.all([ + const isMainnet = networkId === 'mainnet'; + + const fetchPromises = [ fetchSearchHits('Docs', debouncedSearchTerm), - fetchCatalog(debouncedSearchTerm), - fetchSearchHits('Components', debouncedSearchTerm), - ]); + isMainnet ? fetchCatalog(debouncedSearchTerm) : Promise.resolve(), + isMainnet ? fetchSearchHits('Components', debouncedSearchTerm) : Promise.resolve(), + ]; + + const [docs, apps, components] = await Promise.all(fetchPromises); setResults({ Docs: renderResults('Docs', docs), @@ -135,11 +140,20 @@ export const Search = ({ inputRef }: { inputRef: any }) => { handleTabChange('Docs')} $isFirst={true}> Docs - handleTabChange('Apps')}> - Apps + handleTabChange('Apps')} + disabled={networkId == 'testnet'} + > + Apps {networkId == 'testnet' && '(Mainnet only)'} - handleTabChange('Components')} $isLast={true}> - Components + handleTabChange('Components')} + disabled={networkId == 'testnet'} + $isLast={true} + > + Components {networkId == 'testnet' && '(Mainnet only)'} diff --git a/src/components/sidebar-navigation/Sidebar.tsx b/src/components/sidebar-navigation/Sidebar.tsx index 17bb8abea..0772e82e3 100644 --- a/src/components/sidebar-navigation/Sidebar.tsx +++ b/src/components/sidebar-navigation/Sidebar.tsx @@ -1,10 +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 { useSignInRedirect } from '@/hooks/useSignInRedirect'; +import { networkId } from '@/config'; import { NearContext } from '../wallet-selector/WalletSelector'; import NearIconSvg from './icons/near-icon.svg'; @@ -14,6 +16,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); @@ -22,12 +44,14 @@ export const Sidebar = () => { const toggleExpandedSidebar = useNavigationStore((store) => store.toggleExpandedSidebar); const handleBubbledClickInSidebar = useNavigationStore((store) => store.handleBubbledClickInSidebar); const tooltipsDisabled = isSidebarExpanded; - const { signedAccountId } = useContext(NearContext); - const { requestAuthentication } = useSignInRedirect(); + const { wallet, signedAccountId } = useContext(NearContext); const inputRef = useRef(null); + const [isOpenNetwork, setIsOpenNetwork] = useState(false); - const handleCreateAccount = () => { - requestAuthentication(true); + const preventRedirect = (network: string) => (e: React.MouseEvent) => { + if (networkId == network) { + e.preventDefault(); + } }; const isNavigationItemActive = useCallback( @@ -53,6 +77,34 @@ export const Sidebar = () => { NEAR + + setIsOpenNetwork(open)}> + + + {networkId}{' '} + } + size="xs" + style={{ + marginBottom: '1px', + transform: isOpenNetwork ? 'rotate(180deg)' : 'rotate(0deg)', + transition: 'all 200ms', + }} + /> + + + + + + Mainnet + + + Testnet + + + + + @@ -202,10 +254,10 @@ export const Sidebar = () => { {signedAccountId ? ( ) : ( - - + + - Sign-up or Login + Login )} diff --git a/src/components/sidebar-navigation/SmallScreenHeader.tsx b/src/components/sidebar-navigation/SmallScreenHeader.tsx index 0f40941d7..972a5c142 100644 --- a/src/components/sidebar-navigation/SmallScreenHeader.tsx +++ b/src/components/sidebar-navigation/SmallScreenHeader.tsx @@ -1,10 +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 { useSignInRedirect } from '@/hooks/useSignInRedirect'; +import { networkId } from '@/config'; import { NearContext } from '../wallet-selector/WalletSelector'; import NearIconSvg from './icons/near-icon.svg'; @@ -12,6 +13,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); @@ -20,11 +26,12 @@ export const SmallScreenHeader = () => { const setNavigation = useNavigationStore((store) => store.set); const showDrawerCollapse = useNavigationStore((store) => store.isOpenedOnSmallScreens && !!store.expandedDrawer); const expandedDrawerTitle = useNavigationStore((store) => store.expandedDrawerTitle); - const { signedAccountId } = useContext(NearContext); - const { requestAuthentication } = useSignInRedirect(); + const { wallet, signedAccountId } = useContext(NearContext); - const handleCreateAccount = () => { - requestAuthentication(true); + const preventRedirect = (network: string) => (e: React.MouseEvent) => { + if (networkId == network) { + e.preventDefault(); + } }; return ( @@ -50,7 +57,6 @@ export const SmallScreenHeader = () => { NEAR )} - {signedAccountId ? (