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

Develop #2

Merged
merged 7 commits into from
Jan 2, 2024
Merged
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
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
NEXT_PUBLIC_APP_ENV=develop
NEXT_PUBLIC_DOMAIN_URL="http://localhost:3000"
NEXT_PUBLIC_DOMAIN_URL=https://dev.bvm.network
NEXT_PUBLIC_CDN_URL=https://cdn.newbitcoincity.com
NEXT_PUBLIC_API_URL=
2 changes: 1 addition & 1 deletion envs/.env.develop
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
NEXT_PUBLIC_APP_ENV=develop
NEXT_PUBLIC_DOMAIN_URL="http://localhost:3000"
NEXT_PUBLIC_DOMAIN_URL=https://dev.bvm.network
NEXT_PUBLIC_CDN_URL=https://cdn.newbitcoincity.com
NEXT_PUBLIC_API_URL=
2 changes: 1 addition & 1 deletion envs/.env.production
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
NEXT_PUBLIC_APP_ENV=production
NEXT_PUBLIC_DOMAIN_URL="http://localhost:3000"
NEXT_PUBLIC_DOMAIN_URL=https://bvm.network
NEXT_PUBLIC_CDN_URL=https://cdn.newbitcoincity.com
NEXT_PUBLIC_API_URL=
2 changes: 1 addition & 1 deletion envs/.env.staging
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
NEXT_PUBLIC_APP_ENV=staging
NEXT_PUBLIC_DOMAIN_URL="http://localhost:3000"
NEXT_PUBLIC_DOMAIN_URL=https://bvm.network
NEXT_PUBLIC_CDN_URL=https://cdn.newbitcoincity.com
NEXT_PUBLIC_API_URL=
24 changes: 24 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,30 @@ const nextConfig = {
`,
},

async redirects() {
return [
{
source: '/trustless-computers',
destination: '/blockchains',
permanent: false,
},
{
source: '/blockchains/dashboard',
destination: '/blockchains/computers',
permanent: false,
},
];
},

async rewrites() {
return [
{
source: '/tc',
destination: '/blockchains',
},
];
},

webpack: (config, { isServer, dev }) => {
// Note: we provide webpack above so you should not `require` it
// Perform customizations to webpack config
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.1.0",
"private": true,
"scripts": {
"local": "cp ./envs/.env.local .env && next dev",
"dev": "cp ./envs/.env.develop .env && next dev",
"ld": "export PORT=3001 && cp ./envs/.env.develop .env && rm -rf .next && next dev",
"ls": "export PORT=3002 && cp ./envs/.env.staging .env && rm -rf .next && next dev",
Expand Down
Binary file added public/icons/bvm-logo-short-orange.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
116 changes: 116 additions & 0 deletions public/icons/bvm-logo-short-orange.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions src/app/blockchains/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
'use client';

import { isProduction } from '@/config';
import MainLayout from '@/layouts/MainLayout';
import IframeTC from '@/modules/iframe-tc';

const pathUrl = '/trustless-computers-iframe/';
// const IframeURLExtend = DOMAIN_URL + MAIN_PATH;
const IframeURLExtend =
'https://dev.newbitcoincity.com/trustless-computers-iframe/';

const iframeDomain = isProduction
? 'https://newbitcoincity.com'
: 'https://dev.newbitcoincity.com';

const TCPage = () => {
return (
<MainLayout
headerProps={{
color: 'black',
position: 'relative',
bgColor: 'white',
}}
>
{typeof document !== 'undefined' ? (
<IframeTC iframeURL={`${iframeDomain}${pathUrl}`} />
) : null}
</MainLayout>
);
};

export default TCPage;
2 changes: 1 addition & 1 deletion src/app/building-blocks/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const BuildingBlocksPage = () => {
return (
<MainLayout
headerProps={{
primaryColor: 'black',
color: 'black',
}}
>
<BuildingBlockModule />
Expand Down
32 changes: 32 additions & 0 deletions src/app/tc/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
'use client';

import { isProduction } from '@/config';
import MainLayout from '@/layouts/MainLayout';
import IframeTC from '@/modules/iframe-tc';

const pathUrl = '/trustless-computers-iframe/';
// const IframeURLExtend = DOMAIN_URL + MAIN_PATH;
const IframeURLExtend =
'https://dev.newbitcoincity.com/trustless-computers-iframe/';

const iframeDomain = isProduction
? 'https://newbitcoincity.com'
: 'https://dev.newbitcoincity.com';

const TCPage = () => {
return (
<MainLayout
headerProps={{
color: 'black',
position: 'relative',
bgColor: 'white',
}}
>
{typeof document !== 'undefined' ? (
<IframeTC iframeURL={`${iframeDomain}${pathUrl}`} />
) : null}
</MainLayout>
);
};

export default TCPage;
3 changes: 3 additions & 0 deletions src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ export const API_UR: string = process.env.NEXT_PUBLIC_API_URL!;
export const DOMAIN_URL: string = process.env.NEXT_PUBLIC_DOMAIN_URL!;
export const CDN_URL: string = process.env.NEXT_PUBLIC_CDN_URL!;

export const isProduction: boolean = APP_ENV === 'production';
export const isDevelop: boolean = APP_ENV === 'develop';

export const CDN_URL_ICONS: string = CDN_URL + '/nbc/icons';

export { MetadataConfig, ViewportConfig };
4 changes: 4 additions & 0 deletions src/constants/breakpoint.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export const XS_MOBILE_SCREEN = 500;
export const MOBILE_SCREEN = 768;
export const TABLET_SCREEN = 1024;
export const QHD_SCREEN = 2048;
90 changes: 90 additions & 0 deletions src/hooks/useWindowSize.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import {
MOBILE_SCREEN,
QHD_SCREEN,
TABLET_SCREEN,
XS_MOBILE_SCREEN,
} from '@/constants/breakpoint';
import { useEffect, useState } from 'react';

interface Size {
sreenWidth: number;
heightWidth: number;
}

interface CheckMobile {
xSMobileScreen: boolean;
mobileScreen: boolean;
tabletScreen: boolean | undefined;
desktopScreen: boolean;
QHDScreen: boolean;
}

function useWindowSize(): Size & CheckMobile {
const [windowSize, setWindowSize] = useState<Size>({
sreenWidth: 0,
heightWidth: 0,
});
const [xSMobileScreen, setXSMobileScreen] = useState(true);
const [mobileScreen, setMobileScreen] = useState(true);
const [tabletScreen, setTabletScreen] = useState<boolean | undefined>(
undefined,
);
const [desktopScreen, setDesktopScreen] = useState(true);
const [QHDScreen, setQHDScreen] = useState(true);

useEffect(() => {
function handleResize() {
setWindowSize({
sreenWidth: window.innerWidth,
heightWidth: window.innerHeight,
});
}
window.addEventListener('resize', handleResize);
handleResize();
return () => window.removeEventListener('resize', handleResize);
}, []);

useEffect(() => {
if (windowSize?.sreenWidth && windowSize.sreenWidth <= XS_MOBILE_SCREEN) {
setXSMobileScreen(true);
} else {
setXSMobileScreen(false);
}

if (windowSize?.sreenWidth && windowSize.sreenWidth <= MOBILE_SCREEN) {
setMobileScreen(true);
} else {
setMobileScreen(false);
}

if (windowSize?.sreenWidth && windowSize.sreenWidth <= TABLET_SCREEN) {
setTabletScreen(true);
} else {
setTabletScreen(false);
}

if (windowSize?.sreenWidth && windowSize.sreenWidth >= QHD_SCREEN) {
setQHDScreen(true);
} else {
setQHDScreen(false);
}
}, [windowSize.sreenWidth]);

useEffect(() => {
setDesktopScreen(
!mobileScreen && !tabletScreen && !xSMobileScreen && !QHDScreen,
);
}, [tabletScreen, mobileScreen, xSMobileScreen, QHDScreen]);

return {
sreenWidth: windowSize.sreenWidth,
heightWidth: windowSize.heightWidth,
mobileScreen,
tabletScreen,
desktopScreen,
QHDScreen,
xSMobileScreen,
};
}

export default useWindowSize;
2 changes: 1 addition & 1 deletion src/layouts/Footer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Box, Container, Stack, Text } from '@chakra-ui/react';

const Footer = () => {
return (
<Box bgColor={'black'}>
<Box bgColor={'black'} id="footer">
<Container
as={Stack}
maxW={'2xl'}
Expand Down
29 changes: 23 additions & 6 deletions src/layouts/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,16 @@ import { MobileNav } from './components/MobileNav';
import Link from 'next/link';

export type HeaderProps = {
primaryColor?: 'black' | 'white';
color?: 'black' | 'white';
position?: 'absolute' | 'relative';
bgColor?: string;
};

const Header = (props: HeaderProps) => {
const primaryColor = props.primaryColor || 'white';
const primaryColor = props.color || 'white';
const position = props.position || 'absolute';
const bgColor = props.bgColor || 'transparent';

const { isOpen, onToggle } = useDisclosure();
const isMobile = useBreakpointValue({ base: true, md: false }) as boolean;

Expand All @@ -48,7 +53,8 @@ const Header = (props: HeaderProps) => {
return (
<>
<Box
position={'absolute'}
position={position === 'absolute' ? 'absolute' : 'relative'}
bgColor={bgColor}
display={'flex'}
justifyContent={'center'}
alignItems={'center'}
Expand All @@ -59,13 +65,14 @@ const Header = (props: HeaderProps) => {
>
<Flex
minH={'60px'}
maxWidth={'1600px'}
className="maxWidth"
alignSelf={'center'}
py={{ base: 2 }}
px={[4, null]}
display={'flex'}
flex={1}
align={'center'}
id="header"
>
{/* Left View */}
<Flex
Expand All @@ -76,13 +83,23 @@ const Header = (props: HeaderProps) => {
}}
>
<Link href="/">
<SvgInset
{/* <SvgInset
svgUrl={`${CDN_URL_ICONS}/logo_bvm.svg`}
size={200}
style={{
filter: primaryColor === 'white' ? 'invert(1)' : 'black',
}}
/>
/> */}

{/* <SvgInset
svgUrl={`/bvm-logo-short-orange.svg`}
size={200}
style={{
filter: primaryColor === 'white' ? 'invert(1)' : 'black',
}}
/> */}

<Image src={'/icons/bvm-logo-short-orange.svg'} />
</Link>
</Flex>

Expand Down
2 changes: 1 addition & 1 deletion src/layouts/Header/menuConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export interface NavItem {
export const NAV_ITEMS: Array<NavItem> = [
{
label: 'Blockchains',
href: '/tc',
href: '/blockchains',
isNewWindow: false,
isHide: false,
},
Expand Down
5 changes: 3 additions & 2 deletions src/modules/building-blocks/Section_1/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@ import { Flex, Box, Text } from '@chakra-ui/react';

const Section1 = () => {
return (
<Flex w={'100%'}>
<Flex w={'100%'} flexDir={['column', 'row']}>
<Text
flex={1}
fontSize={['28px', '48px']}
fontWeight={400}
lineHeight={'110%'}
textAlign={['center', 'left']}
color={'#000'}
>
Building Blocks
</Text>
<Box w={['200px', null]} />
<Box boxSize={['20px', null]} />
<Text
maxW={'650px'}
fontSize={['14px', '22px']}
Expand Down
4 changes: 2 additions & 2 deletions src/modules/building-blocks/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const BuildingBlockModule = () => {
return (
<Box className={s.container}>
<Flex
maxW={'1600px'}
className="maxWidth"
w={'100%'}
h={'100%'}
marginTop={'120px'}
Expand All @@ -22,7 +22,7 @@ const BuildingBlockModule = () => {
alignSelf={'center'}
>
<Section1 />
<Box height={'80px'} />
<Box h={['30px', '80px']} />
<Section2 />
</Flex>
</Box>
Expand Down
5 changes: 2 additions & 3 deletions src/modules/home/Section_1/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const Section_1 = () => {
bgSize={'cover'}
bgColor={'#006440'}
bgImg={`${CDN_URL_ICONS}/lego_bg.svg`}
h={'100vh'}
h={'90vh'}
display={'flex'}
>
<AbsoluteCenter>
Expand All @@ -31,8 +31,7 @@ const Section_1 = () => {
wordBreak={'break-word'}
whiteSpace="pre-line"
>
{`Bitcoin
Virtual Machine`}
{`Bitcoin Virtual Machine`}
</Text>

<Text
Expand Down
Loading