Commit eb4a8cf2 authored by tom's avatar tom

fix build, sidebar transition and network logo loading state

parent 4f654d66
...@@ -9,7 +9,12 @@ RUN ln -sf /usr/bin/python3 /usr/bin/python ...@@ -9,7 +9,12 @@ RUN ln -sf /usr/bin/python3 /usr/bin/python
### APP ### APP
# Install dependencies # Install dependencies
WORKDIR /app WORKDIR /app
COPY package.json yarn.lock ./ COPY package.json yarn.lock tsconfig.json ./
COPY types ./types
COPY lib ./lib
COPY configs/app ./configs/app
COPY toolkit/theme ./toolkit/theme
COPY ui/shared/forms/validators/url.ts ./ui/shared/forms/validators/url.ts
RUN apk add git RUN apk add git
RUN yarn --frozen-lockfile --network-timeout 100000 RUN yarn --frozen-lockfile --network-timeout 100000
...@@ -80,16 +85,14 @@ RUN yarn build ...@@ -80,16 +85,14 @@ RUN yarn build
### FEATURE REPORTER ### FEATURE REPORTER
# Copy dependencies and source code, then build # Copy dependencies and source code, then build
COPY --from=deps /feature-reporter/node_modules ./deploy/tools/feature-reporter/node_modules COPY --from=deps /feature-reporter/node_modules ./deploy/tools/feature-reporter/node_modules
# TODO @tom2drum fix feature reporter build RUN cd ./deploy/tools/feature-reporter && yarn compile_config
# RUN cd ./deploy/tools/feature-reporter && yarn compile_config RUN cd ./deploy/tools/feature-reporter && yarn build
# RUN cd ./deploy/tools/feature-reporter && yarn build
### ENV VARIABLES CHECKER ### ENV VARIABLES CHECKER
# Copy dependencies and source code, then build # Copy dependencies and source code, then build
COPY --from=deps /envs-validator/node_modules ./deploy/tools/envs-validator/node_modules COPY --from=deps /envs-validator/node_modules ./deploy/tools/envs-validator/node_modules
# TODO @tom2drum fix envs-validator build RUN cd ./deploy/tools/envs-validator && yarn build
# RUN cd ./deploy/tools/envs-validator && yarn build
### FAVICON GENERATOR ### FAVICON GENERATOR
...@@ -125,10 +128,8 @@ RUN chown nextjs:nodejs .next ...@@ -125,10 +128,8 @@ RUN chown nextjs:nodejs .next
COPY --from=builder /app/next.config.js ./ COPY --from=builder /app/next.config.js ./
COPY --from=builder /app/public ./public COPY --from=builder /app/public ./public
COPY --from=builder /app/package.json ./package.json COPY --from=builder /app/package.json ./package.json
# TODO @tom2drum fix envs-validator build COPY --from=builder /app/deploy/tools/envs-validator/index.js ./envs-validator.js
# COPY --from=builder /app/deploy/tools/envs-validator/index.js ./envs-validator.js COPY --from=builder /app/deploy/tools/feature-reporter/index.js ./feature-reporter.js
# TODO @tom2drum fix feature reporter build
# COPY --from=builder /app/deploy/tools/feature-reporter/index.js ./feature-reporter.js
# Copy scripts # Copy scripts
## Entripoint ## Entripoint
......
...@@ -9,6 +9,8 @@ NEXT_PUBLIC_APP_PORT=3000 ...@@ -9,6 +9,8 @@ NEXT_PUBLIC_APP_PORT=3000
NEXT_PUBLIC_APP_ENV=development NEXT_PUBLIC_APP_ENV=development
NEXT_PUBLIC_API_WEBSOCKET_PROTOCOL=ws NEXT_PUBLIC_API_WEBSOCKET_PROTOCOL=ws
NEXT_PUBLIC_COLOR_THEME_DEFAULT=dim
# Instance ENVs # Instance ENVs
NEXT_PUBLIC_ADMIN_SERVICE_API_HOST=https://admin-rs.services.blockscout.com NEXT_PUBLIC_ADMIN_SERVICE_API_HOST=https://admin-rs.services.blockscout.com
NEXT_PUBLIC_API_BASE_PATH=/ NEXT_PUBLIC_API_BASE_PATH=/
......
...@@ -42,16 +42,15 @@ node --no-warnings ./og_image_generator.js ...@@ -42,16 +42,15 @@ node --no-warnings ./og_image_generator.js
./download_assets.sh ./public/assets/configs ./download_assets.sh ./public/assets/configs
# Check run-time ENVs values # Check run-time ENVs values
# TODO @tom2drum fix envs-validator build if [ "$SKIP_ENVS_VALIDATION" != "true" ]; then
# if [ "$SKIP_ENVS_VALIDATION" != "true" ]; then ./validate_envs.sh
# ./validate_envs.sh if [ $? -ne 0 ]; then
# if [ $? -ne 0 ]; then exit 1
# exit 1 fi
# fi else
# else echo "😱 Skipping ENVs validation."
# echo "😱 Skipping ENVs validation." echo
# echo fi
# fi
# Generate favicons bundle # Generate favicons bundle
./favicon_generator.sh ./favicon_generator.sh
...@@ -69,8 +68,7 @@ echo ...@@ -69,8 +68,7 @@ echo
./sitemap_generator.sh ./sitemap_generator.sh
# Print list of enabled features # Print list of enabled features
# TODO @tom2drum fix feature reporter build node ./feature-reporter.js
# node ./feature-reporter.js
echo "Starting Next.js application" echo "Starting Next.js application"
exec "$@" exec "$@"
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
"noEmit": false, "noEmit": false,
"target": "es2016", "target": "es2016",
"module": "CommonJS", "module": "CommonJS",
"moduleResolution": "node",
"paths": { "paths": {
"nextjs-routes": ["./nextjs/nextjs-routes.d.ts"], "nextjs-routes": ["./nextjs/nextjs-routes.d.ts"],
} }
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
"compilerOptions": { "compilerOptions": {
"noEmit": false, "noEmit": false,
"module": "CommonJS", "module": "CommonJS",
"moduleResolution": "node",
"outDir": "./build", "outDir": "./build",
"paths": { "paths": {
"nextjs-routes": ["./nextjs/nextjs-routes.d.ts"], "nextjs-routes": ["./nextjs/nextjs-routes.d.ts"],
......
...@@ -47,7 +47,7 @@ const RESTRICTED_MODULES = { ...@@ -47,7 +47,7 @@ const RESTRICTED_MODULES = {
{ {
name: 'next/link', name: 'next/link',
importNames: [ 'default' ], importNames: [ 'default' ],
message: 'Please use ui/shared/NextLink component instead', message: 'Please use toolkit/chakra/link component instead',
}, },
], ],
patterns: [ patterns: [
......
...@@ -45,19 +45,6 @@ const moduleExports = { ...@@ -45,19 +45,6 @@ const moduleExports = {
'static': 180, 'static': 180,
}, },
}, },
typescript: {
// TODO @tom2drum remove this once we have fixed all the type errors
// !! WARN !!
// Dangerously allow production builds to successfully complete even if
// your project has type errors.
// !! WARN !!
ignoreBuildErrors: true,
},
eslint: {
// Warning: This allows production builds to successfully complete even if
// your project has ESLint errors.
ignoreDuringBuilds: true,
},
}; };
module.exports = withBundleAnalyzer(withRoutes(moduleExports)); module.exports = withBundleAnalyzer(withRoutes(moduleExports));
...@@ -181,7 +181,6 @@ export interface SelectProps extends SelectRootProps { ...@@ -181,7 +181,6 @@ export interface SelectProps extends SelectRootProps {
loading?: boolean; loading?: boolean;
} }
// TODO @tom2drum refactor selects
export const Select = React.forwardRef<HTMLDivElement, SelectProps>((props, ref) => { export const Select = React.forwardRef<HTMLDivElement, SelectProps>((props, ref) => {
const { collection, placeholder, portalled = true, loading, ...rest } = props; const { collection, placeholder, portalled = true, loading, ...rest } = props;
return ( return (
......
import { createSystem, defaultConfig, defineConfig } from '@chakra-ui/react'; import { createSystem, defaultConfig, defineConfig } from '@chakra-ui/react';
// TODO @tom2drum fix postinstall in CI
// "postinstall": "chakra typegen ./toolkit/theme/theme.ts",
import { keyframes } from './foundations/animations'; import { keyframes } from './foundations/animations';
import * as borders from './foundations/borders'; import * as borders from './foundations/borders';
import breakpoints from './foundations/breakpoints'; import breakpoints from './foundations/breakpoints';
......
// eslint-disable-next-line no-restricted-imports
import NextLink, { type LinkProps as NextLinkProps } from 'next/link';
import type { ReactNode } from 'react';
type LinkProps = NextLinkProps & { children?: ReactNode };
// TODO @tom2drum remove this file in favor of toolkit/chakra/link
const Link = ({ prefetch = false, children, ...rest }: LinkProps) => {
return (
<NextLink prefetch={ prefetch } { ...rest }>
{ children }
</NextLink>
);
};
export default Link;
...@@ -7,10 +7,10 @@ import { route, type Route } from 'nextjs-routes'; ...@@ -7,10 +7,10 @@ import { route, type Route } from 'nextjs-routes';
import config from 'configs/app'; import config from 'configs/app';
import { IconButton } from 'toolkit/chakra/icon-button'; import { IconButton } from 'toolkit/chakra/icon-button';
import { Link } from 'toolkit/chakra/link';
import { Skeleton } from 'toolkit/chakra/skeleton'; import { Skeleton } from 'toolkit/chakra/skeleton';
import { Tooltip } from 'toolkit/chakra/tooltip'; import { Tooltip } from 'toolkit/chakra/tooltip';
import IconSvg from 'ui/shared/IconSvg'; import IconSvg from 'ui/shared/IconSvg';
import NextLink from 'ui/shared/NextLink';
import ChartMenu from './ChartMenu'; import ChartMenu from './ChartMenu';
import ChartWidgetContent from './ChartWidgetContent'; import ChartWidgetContent from './ChartWidgetContent';
...@@ -102,9 +102,9 @@ const ChartWidget = ({ ...@@ -102,9 +102,9 @@ const ChartWidget = ({
> >
<Flex columnGap={ 6 } mb={ 2 } alignItems="flex-start"> <Flex columnGap={ 6 } mb={ 2 } alignItems="flex-start">
{ href ? ( { href ? (
<NextLink href={ href } passHref legacyBehavior > <Link href={ route(href) } variant="plain">
{ chartHeader } { chartHeader }
</NextLink> </Link>
) : chartHeader } ) : chartHeader }
<Flex ml="auto" columnGap={ 2 }> <Flex ml="auto" columnGap={ 2 }>
<Tooltip content="Reset zoom"> <Tooltip content="Reset zoom">
......
...@@ -2,11 +2,12 @@ import { Box, Flex, Text, chakra } from '@chakra-ui/react'; ...@@ -2,11 +2,12 @@ import { Box, Flex, Text, chakra } from '@chakra-ui/react';
import React from 'react'; import React from 'react';
import type { Route } from 'nextjs-routes'; import type { Route } from 'nextjs-routes';
import { route } from 'nextjs-routes';
import { Link } from 'toolkit/chakra/link';
import { Skeleton } from 'toolkit/chakra/skeleton'; import { Skeleton } from 'toolkit/chakra/skeleton';
import Hint from 'ui/shared/Hint'; import Hint from 'ui/shared/Hint';
import IconSvg, { type IconName } from 'ui/shared/IconSvg'; import IconSvg, { type IconName } from 'ui/shared/IconSvg';
import NextLink from 'ui/shared/NextLink';
import TruncatedValue from 'ui/shared/TruncatedValue'; import TruncatedValue from 'ui/shared/TruncatedValue';
export type Props = { export type Props = {
...@@ -28,9 +29,9 @@ export type Props = { ...@@ -28,9 +29,9 @@ export type Props = {
const Container = ({ href, children }: { href?: Route; children: React.JSX.Element }) => { const Container = ({ href, children }: { href?: Route; children: React.JSX.Element }) => {
if (href) { if (href) {
return ( return (
<NextLink href={ href } passHref legacyBehavior> <Link href={ route(href) } variant="plain">
{ children } { children }
</NextLink> </Link>
); );
} }
...@@ -62,10 +63,7 @@ const StatsWidget = ({ ...@@ -62,10 +63,7 @@ const StatsWidget = ({
borderRadius="base" borderRadius="base"
justifyContent="space-between" justifyContent="space-between"
columnGap={ 2 } columnGap={ 2 }
{ ...(href && !isLoading ? { w="100%"
as: 'a',
href,
} : {}) }
> >
{ icon && ( { icon && (
<IconSvg <IconSvg
......
...@@ -35,6 +35,9 @@ const LightningLabel = ({ className, iconColor, isCollapsed }: Props) => { ...@@ -35,6 +35,9 @@ const LightningLabel = ({ className, iconColor, isCollapsed }: Props) => {
top={{ lg: isExpanded ? '0' : '10px', xl: isCollapsed ? '10px' : '0' }} top={{ lg: isExpanded ? '0' : '10px', xl: isCollapsed ? '10px' : '0' }}
right={{ lg: isExpanded ? '0' : '15px', xl: isCollapsed ? '15px' : '0' }} right={{ lg: isExpanded ? '0' : '15px', xl: isCollapsed ? '15px' : '0' }}
color={ color } color={ color }
transitionProperty="color, margin-left"
transitionDuration="normal"
transitionTimingFunction="ease"
/> />
); );
}; };
......
...@@ -26,7 +26,7 @@ const NavigationDesktop = () => { ...@@ -26,7 +26,7 @@ const NavigationDesktop = () => {
maxW={ `${ CONTENT_MAX_WIDTH }px` } maxW={ `${ CONTENT_MAX_WIDTH }px` }
m="0 auto" m="0 auto"
> >
<NetworkLogo isCollapsed={ false } w={{ lg: 'auto' }} maxW="120px"/> <NetworkLogo isCollapsed={ false } w={{ lg: '100%' }} maxW="120px"/>
<TestnetBadge ml={ 3 }/> <TestnetBadge ml={ 3 }/>
<chakra.nav ml="auto" mr={ config.features.account.isEnabled || config.features.blockchainInteraction.isEnabled ? 8 : 0 }> <chakra.nav ml="auto" mr={ config.features.account.isEnabled || config.features.blockchainInteraction.isEnabled ? 8 : 0 }>
<Flex as="ul" columnGap={ 3 }> <Flex as="ul" columnGap={ 3 }>
......
...@@ -12,6 +12,9 @@ export default function useNavLinkStyleProps({ isExpanded, isCollapsed, isActive ...@@ -12,6 +12,9 @@ export default function useNavLinkStyleProps({ isExpanded, isCollapsed, isActive
display: 'flex', display: 'flex',
...(isActive ? { 'data-selected': true } : {}), ...(isActive ? { 'data-selected': true } : {}),
borderRadius: 'base', borderRadius: 'base',
transitionProperty: 'width, padding',
transitionDuration: 'normal',
transitionTimingFunction: 'ease',
}, },
textProps: { textProps: {
variant: 'inherit', variant: 'inherit',
......
...@@ -60,6 +60,9 @@ const NavigationDesktop = () => { ...@@ -60,6 +60,9 @@ const NavigationDesktop = () => {
py={ 12 } py={ 12 }
width={{ lg: isExpanded ? '229px' : '92px', xl: isCollapsed ? '92px' : '229px' }} width={{ lg: isExpanded ? '229px' : '92px', xl: isCollapsed ? '92px' : '229px' }}
onClick={ handleContainerClick } onClick={ handleContainerClick }
transitionProperty="width, padding"
transitionDuration="normal"
transitionTimingFunction="ease"
> >
<TestnetBadge position="absolute" pl={ 3 } w="49px" top="34px"/> <TestnetBadge position="absolute" pl={ 3 } w="49px" top="34px"/>
<Box <Box
...@@ -118,6 +121,9 @@ const NavigationDesktop = () => { ...@@ -118,6 +121,9 @@ const NavigationDesktop = () => {
aria-label="Expand/Collapse menu" aria-label="Expand/Collapse menu"
display="none" display="none"
_groupHover={{ display: 'block' }} _groupHover={{ display: 'block' }}
transitionProperty="transform, left"
transitionDuration="normal"
transitionTimingFunction="ease"
/> />
</Flex> </Flex>
); );
......
...@@ -38,7 +38,6 @@ const LogoFallback = ({ isCollapsed, isSmall }: { isCollapsed?: boolean; isSmall ...@@ -38,7 +38,6 @@ const LogoFallback = ({ isCollapsed, isSmall }: { isCollapsed?: boolean; isSmall
const INVERT_FILTER = 'brightness(0) invert(1)'; const INVERT_FILTER = 'brightness(0) invert(1)';
// TODO @tom2drum check loading state
const NetworkLogo = ({ isCollapsed, onClick, className }: Props) => { const NetworkLogo = ({ isCollapsed, onClick, className }: Props) => {
const logoSrc = useColorModeValue(config.UI.navigation.logo.default, config.UI.navigation.logo.dark || config.UI.navigation.logo.default); const logoSrc = useColorModeValue(config.UI.navigation.logo.default, config.UI.navigation.logo.dark || config.UI.navigation.logo.default);
...@@ -58,23 +57,27 @@ const NetworkLogo = ({ isCollapsed, onClick, className }: Props) => { ...@@ -58,23 +57,27 @@ const NetworkLogo = ({ isCollapsed, onClick, className }: Props) => {
> >
{ /* big logo */ } { /* big logo */ }
<Image <Image
w="auto" w="100%"
h="100%" h="100%"
src={ logoSrc } src={ logoSrc }
alt={ `${ config.chain.name } network logo` } alt={ `${ config.chain.name } network logo` }
fallback={ <LogoFallback isCollapsed={ isCollapsed }/> } fallback={ <LogoFallback isCollapsed={ isCollapsed }/> }
display={{ base: 'block', lg: isCollapsed === false ? 'block' : 'none', xl: isCollapsed ? 'none' : 'block' }} display={{ base: 'block', lg: isCollapsed === false ? 'block' : 'none', xl: isCollapsed ? 'none' : 'block' }}
filter={{ _dark: INVERT_FILTER }} filter={{ _dark: INVERT_FILTER }}
objectFit="contain"
objectPosition="left"
/> />
{ /* small logo */ } { /* small logo */ }
<Image <Image
w="auto" w="100%"
h="100%" h="100%"
src={ iconSrc } src={ iconSrc }
alt={ `${ config.chain.name } network logo` } alt={ `${ config.chain.name } network logo` }
fallback={ <LogoFallback isCollapsed={ isCollapsed } isSmall/> } fallback={ <LogoFallback isCollapsed={ isCollapsed } isSmall/> }
display={{ base: 'none', lg: isCollapsed === false ? 'none' : 'block', xl: isCollapsed ? 'block' : 'none' }} display={{ base: 'none', lg: isCollapsed === false ? 'none' : 'block', xl: isCollapsed ? 'block' : 'none' }}
filter={{ _dark: INVERT_FILTER }} filter={{ _dark: INVERT_FILTER }}
objectFit="contain"
objectPosition="left"
/> />
</chakra.a> </chakra.a>
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment