From fa4873ee824d39da9bc48cf48d786d8ab25ab078 Mon Sep 17 00:00:00 2001 From: tiendn Date: Wed, 26 Jul 2023 15:31:45 +0700 Subject: [PATCH 01/32] ci: use GITHUB_TOKEN org --- .github/workflows/dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index d4845d3..184aa48 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -10,7 +10,7 @@ jobs: secrets: secretBuildArgs: | SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }} - GITHUB_TOKEN=${{ secrets.GH_AUTH_TOKEN }} + GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} with: namespace: "solarswap-dev" ingressEnabled: "yes" From 8fbfaab78d02fe2bece729a135101420ef45e4aa Mon Sep 17 00:00:00 2001 From: tiendn Date: Thu, 27 Jul 2023 10:30:23 +0700 Subject: [PATCH 02/32] style: update margin + mobile left menu header --- src/components/Layout/Page.tsx | 5 ++++- src/components/Layout/styles.module.scss | 12 ++++++++++++ src/components/Navbar/style.module.scss | 1 + 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/components/Layout/Page.tsx b/src/components/Layout/Page.tsx index 5356c53..a7c2efc 100644 --- a/src/components/Layout/Page.tsx +++ b/src/components/Layout/Page.tsx @@ -4,6 +4,7 @@ import { useRouter } from 'next/router' import { DEFAULT_META, getCustomMeta } from 'config/constants/meta' import { useAstraUsdtPrice } from 'hooks/useUSDTPrice' import { Container } from '@astraprotocol/astra-ui' +import styles from './styles.module.scss' // const StyledPage = styled(Container)` // min-height: calc(100vh - 64px); @@ -53,7 +54,9 @@ const Page: React.FC = ({ children, symbol, ...props }) => { return ( <> - {children} + + {children} + ) } diff --git a/src/components/Layout/styles.module.scss b/src/components/Layout/styles.module.scss index 7a789f4..031b446 100644 --- a/src/components/Layout/styles.module.scss +++ b/src/components/Layout/styles.module.scss @@ -1,3 +1,8 @@ +$colums: 12; +$gutter: 24px; +$colWidth: 84px; +$maxWidth: $colWidth * 12 + $gutter * 11; + .flexLayout { display: flex; justify-content: center; @@ -10,3 +15,10 @@ margin-bottom: 32px; } } + +.container { + @media (max-width: ($maxWidth)) { + margin-left: 0 !important; + margin-right: 0 !important; + } +} \ No newline at end of file diff --git a/src/components/Navbar/style.module.scss b/src/components/Navbar/style.module.scss index 45c8143..d756c29 100644 --- a/src/components/Navbar/style.module.scss +++ b/src/components/Navbar/style.module.scss @@ -162,6 +162,7 @@ $backgroundHover: rgba(var(--contrast-color-theme--raw), 0.05); display: none; width: 22px; margin-left: 22px; + position: absolute; > div { width: 22px; height: 16px; From 81944a13bae9c413c0318c487ad13f7ff21a222f Mon Sep 17 00:00:00 2001 From: tiendn Date: Thu, 27 Jul 2023 13:53:20 +0700 Subject: [PATCH 03/32] chore: add GA tracking --- .github/workflows/dev.yml | 2 +- .github/workflows/main.yml | 2 +- Dockerfile | 2 +- package.json | 1 + src/pages/_app.tsx | 18 ++++++++++++++++-- src/pages/_document.tsx | 10 ---------- yarn.lock | 7 +++++++ 7 files changed, 27 insertions(+), 15 deletions(-) diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index 184aa48..fe86f85 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -25,7 +25,7 @@ jobs: NEXT_PUBLIC_NODE_PRODUCTION=https://rpc.astranaut.dev NEXT_PUBLIC_HOST=https://defi.astranaut.dev NEXT_PUBLIC_EXPLORER=http://explorer.astranaut.dev - NEXT_PUBLIC_GTAG='' + NEXT_PUBLIC_GA_MEASUREMENT_ID='' NEXT_PUBLIC_FEE=100 NEXT_PUBLIC_TITLE=SolarSwap NEXT_PUBLIC_WALLET_CONNECT_RELAY=relay.walletconnect.com diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fab6ed2..41cd4e3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -24,7 +24,7 @@ jobs: NEXT_PUBLIC_NODE_PRODUCTION=https://rpc.astranaut.io NEXT_PUBLIC_HOST=https://solarswap.io NEXT_PUBLIC_EXPLORER=http://explorer.astranaut.io - NEXT_PUBLIC_GTAG=G-MK9VVY7GT5 + NEXT_PUBLIC_GA_MEASUREMENT_ID=G-MK9VVY7GT5 NEXT_PUBLIC_FEE=100 NEXT_PUBLIC_TITLE=SolarSwap NEXT_PUBLIC_WALLET_CONNECT_RELAY=wc-relay.astranaut.io diff --git a/Dockerfile b/Dockerfile index 0eec042..e56018b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -50,7 +50,7 @@ RUN SENTRY_AUTH_TOKEN=${SENTRY_AUTH_TOKEN} \ NEXT_PUBLIC_NODE_PRODUCTION=${NEXT_PUBLIC_NODE_PRODUCTION} \ NEXT_PUBLIC_HOST=${NEXT_PUBLIC_HOST} \ NEXT_PUBLIC_EXPLORER=${NEXT_PUBLIC_EXPLORER} \ - NEXT_PUBLIC_GTAG=${NEXT_PUBLIC_GTAG} \ + NEXT_PUBLIC_GA_MEASUREMENT_ID=${NEXT_PUBLIC_GA_MEASUREMENT_ID} \ NEXT_PUBLIC_FEE=${NEXT_PUBLIC_FEE} \ NEXT_PUBLIC_TITLE=${NEXT_PUBLIC_TITLE} \ NEXT_PUBLIC_WALLET_CONNECT_RELAY=${NEXT_PUBLIC_WALLET_CONNECT_RELAY} \ diff --git a/package.json b/package.json index 1a355de..9988296 100644 --- a/package.json +++ b/package.json @@ -85,6 +85,7 @@ "multihashes": "^3.0.1", "next": "^12.1.0", "next-themes": "^0.1.1", + "nextjs-google-analytics": "2.3.3", "numeral": "^2.0.6", "react": "^18.2.0", "react-countup": "^6.4.0", diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index a0ef185..8340ec0 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -1,12 +1,13 @@ import BigNumber from 'bignumber.js' import { NextPage } from 'next' +import { event, GoogleAnalytics } from 'nextjs-google-analytics' // import GlobalCheckClaimStatus from "components/GlobalCheckClaimStatus"; // import FixedSubgraphHealthIndicator from "components/SubgraphHealthIndicator"; // import useEagerConnect from "hooks/useEagerConnect"; import { useInactiveListener } from 'hooks/useInactiveListener' import useSentryUser from 'hooks/useSentryUser' // import useUserAgent from "hooks/useUserAgent"; -import type { AppProps } from 'next/app' +import type { AppProps, NextWebVitalsMetric } from 'next/app' import { init, Web3OnboardProvider } from '@web3-onboard/react' import injectedModule from '@web3-onboard/injected-wallets' import walletConnectModule from '@web3-onboard/walletconnect' @@ -42,6 +43,16 @@ BigNumber.config({ DECIMAL_PLACES: 80, }) +export function reportWebVitals(metric: NextWebVitalsMetric) { + const { id, name, label, value } = metric + event(name, { + category: label === 'web-vital' ? 'Web Vitals' : 'Next.js custom metric', + value: Math.round(name === 'CLS' ? value * 1000 : value), // values must be integers + label: id, // id unique to current page load + nonInteraction: true, // avoids affecting bounce rate. + }) +} + const chainId = parseInt(CHAIN_ID || '11115') function GlobalHooks() { @@ -88,7 +99,7 @@ const astraInjected = astraInjectedModule({ }) const wallets = [injectedModule(), walletConnect, astraWallet] -if(isAstraApp()) { +if (isAstraApp()) { wallets.push(astraInjected) } @@ -202,6 +213,9 @@ const App = ({ Component, pageProps }: AppPropsWithLayout) => { {/* */} + {process.env.NODE_ENV === 'production' && process.env.NEXT_PUBLIC_GA_MEASUREMENT_ID && ( + + )} diff --git a/src/pages/_document.tsx b/src/pages/_document.tsx index 8ed7062..ea0dfa3 100644 --- a/src/pages/_document.tsx +++ b/src/pages/_document.tsx @@ -18,16 +18,6 @@ class MyDocument extends Document { -