From 891bca17d43887f27da7c5d4a16abcca11b6f242 Mon Sep 17 00:00:00 2001 From: Dalia Date: Fri, 23 Aug 2024 11:51:18 +0200 Subject: [PATCH 1/8] initial commit --- .eslintignore | 2 - .eslintrc.js | 64 - .eslintrc.json | 26 +- .gitignore | 12 +- .prettierignore | 3 - components/Announcement.js | 20 - components/Card.js | 62 - components/Footer.js | 113 - components/Header.js | 84 - components/blog-post/BlogPostAuthor.js | 10 - components/blog-post/BlogPostFeaturedImage.js | 18 - components/blog-post/BlogPostMetaDetails.js | 19 - .../BlogPostMetaDetailsPresentation.js | 16 - components/blog-post/BlogPostNavigation.js | 41 - components/blog-post/BlogPostTags.js | 18 - jsconfig.json | 7 + layouts/layout.js | 20 - lib/blogPosts.js | 48 - lib/config.js | 13 - lib/flotiqImage.js | 13 - lib/gtag.js | 17 - next.config.js | 31 - next.config.mjs | 4 + package.json | 42 +- pages/404.js | 26 - pages/[page].js | 69 - pages/_app.js | 44 - pages/post/[slug].js | 57 - postcss.config.js | 6 - postcss.config.mjs | 8 + public/assets/audio/horse.mp3 | Bin 28915 -> 0 bytes public/assets/blog-image-1.jpg | Bin 157270 -> 0 bytes public/assets/favicons/favicon-16x16.png | Bin 597 -> 0 bytes public/assets/favicons/favicon-32x32.png | Bin 1104 -> 0 bytes public/assets/flotiq-logo-badge.svg | 1 - public/assets/flotiq-logo.svg | 9 - public/assets/kyan-logo.png | Bin 5100 -> 0 bytes public/next.svg | 1 + public/vercel.svg | 1 + sections/BlogCards.js | 23 - src/app/favicon.ico | Bin 0 -> 25931 bytes {styles => src/app}/globals.css | 0 src/app/layout.js | 17 + src/app/page.js | 113 + templates/blog-post.js | 61 - yarn.lock | 3006 ++--------------- 46 files changed, 428 insertions(+), 3717 deletions(-) delete mode 100644 .eslintignore delete mode 100644 .eslintrc.js delete mode 100644 .prettierignore delete mode 100644 components/Announcement.js delete mode 100644 components/Card.js delete mode 100644 components/Footer.js delete mode 100644 components/Header.js delete mode 100644 components/blog-post/BlogPostAuthor.js delete mode 100644 components/blog-post/BlogPostFeaturedImage.js delete mode 100644 components/blog-post/BlogPostMetaDetails.js delete mode 100644 components/blog-post/BlogPostMetaDetailsPresentation.js delete mode 100644 components/blog-post/BlogPostNavigation.js delete mode 100644 components/blog-post/BlogPostTags.js create mode 100644 jsconfig.json delete mode 100644 layouts/layout.js delete mode 100644 lib/blogPosts.js delete mode 100644 lib/config.js delete mode 100644 lib/flotiqImage.js delete mode 100644 lib/gtag.js delete mode 100644 next.config.js create mode 100644 next.config.mjs delete mode 100644 pages/404.js delete mode 100644 pages/[page].js delete mode 100644 pages/_app.js delete mode 100644 pages/post/[slug].js delete mode 100644 postcss.config.js create mode 100644 postcss.config.mjs delete mode 100644 public/assets/audio/horse.mp3 delete mode 100644 public/assets/blog-image-1.jpg delete mode 100644 public/assets/favicons/favicon-16x16.png delete mode 100644 public/assets/favicons/favicon-32x32.png delete mode 100644 public/assets/flotiq-logo-badge.svg delete mode 100644 public/assets/flotiq-logo.svg delete mode 100644 public/assets/kyan-logo.png create mode 100644 public/next.svg create mode 100644 public/vercel.svg delete mode 100644 sections/BlogCards.js create mode 100644 src/app/favicon.ico rename {styles => src/app}/globals.css (100%) create mode 100644 src/app/layout.js create mode 100644 src/app/page.js delete mode 100644 templates/blog-post.js diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index aa78b38..0000000 --- a/.eslintignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules -flotiqApi \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index d4aeb95..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1,64 +0,0 @@ -module.exports = { - root: true, - env: { - node: true, - es6: true, - }, - parser: '@babel/eslint-parser', - parserOptions: { - requireConfigFile: false, - babelOptions: { - presets: ['@babel/preset-react'], - }, - }, - extends: [ - 'airbnb', - 'eslint:recommended', - 'next', - ], - plugins: [ - 'jsx-a11y', - 'react-hooks', - 'import', - ], - rules: { - /* Restrict file extensions that may contain JSX */ - 'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }], - /* This rule will warn when it encounters a reference to an identifier that has not yet been declared. */ - 'no-use-before-define': ['error', { variables: false }], - /* This rule enforces consistent line breaks inside braces of object literals or destructuring assignments. */ - 'object-curly-newline': ['error', { ImportDeclaration: 'never' }], - /* Enforce consistent usage of destructuring assignment of props, state, and context */ - 'react/destructuring-assignment': 0, - /* Prevent missing props validation in a React component definition */ - 'react/prop-types': 0, - /* Enforce require() on the top-level module scope */ - 'global-require': 0, - indent: ['error', 4], - /* This rule is aimed to enforce consistent indentation style */ - 'react/jsx-indent': ['error', 4], - /* This rule is aimed to enforce consistent indentation style */ - 'react/jsx-indent-props': ['error', 4], - /* Enforces that there is no spreading for any JSX attribute. - This enhances readability of code by being more explicit about what props are received by the component. */ - 'react/jsx-props-no-spreading': 'off', - 'max-len': ['error', { code: 120 }], - /* Enforces the rule of https://reactjs.org/docs/hooks-rules.html */ - 'react-hooks/rules-of-hooks': 'error', - /* This is a new ESLint rule that verifies the list of dependencies for Hooks like useEffect and similar, - protecting against the stale closure pitfalls. For most cases it has an autofix. */ - 'react-hooks/exhaustive-deps': 'warn', - /* This rules enforces an explicit type attribute for all the button elements - and checks that its value is valid per spec */ - 'react/button-has-type': 0, - 'react/state-in-constructor': 0, - 'react/jsx-fragments': 0, - 'guard-for-in': 0, - 'no-underscore-dangle': 0, - 'jsx-a11y/click-events-have-key-events': 0, - 'jsx-a11y/no-static-element-interactions': 0, - 'react/function-component-definition': [1, { - namedComponents: 'arrow-function', - }], - }, -}; diff --git a/.eslintrc.json b/.eslintrc.json index 5d705d2..bffb357 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,27 +1,3 @@ { - "env": { - "browser": true, - "es6": true - }, - "extends": [ - "plugin:react/recommended", - "airbnb", - "next" - ], - "globals": { - "Atomics": "readonly", - "SharedArrayBuffer": "readonly" - }, - "parserOptions": { - "ecmaFeatures": { - "jsx": true - }, - "ecmaVersion": 2018, - "sourceType": "module" - }, - "plugins": [ - "react" - ], - "rules": { - } + "extends": "next/core-web-vitals" } diff --git a/.gitignore b/.gitignore index 08b9faf..2532d6a 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ /node_modules /.pnp .pnp.js +.yarn/install-state.gz # testing /coverage @@ -25,14 +26,15 @@ yarn-debug.log* yarn-error.log* # local env files -.env -.env.local -.env.development.local -.env.test.local -.env.production.local +.env*.local # vercel .vercel +# typescript +*.tsbuildinfo +next-env.d.ts + # IDE .idea +.vscode \ No newline at end of file diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index 5c18675..0000000 --- a/.prettierignore +++ /dev/null @@ -1,3 +0,0 @@ -package.json -package-lock.json -.next diff --git a/components/Announcement.js b/components/Announcement.js deleted file mode 100644 index 3a4d77f..0000000 --- a/components/Announcement.js +++ /dev/null @@ -1,20 +0,0 @@ -import React from 'react'; -import { Announcement as FlotiqAnnouncement } from 'flotiq-components-react'; - -const Announcement = ({ content }) => ( -
- - {content} - - )} - additionalClasses={['bg-gradient-to-r', 'from-primary', 'to-secondary']} - textAlignment="center" - textSize="xl" - rounded="lg" - /> -
-); - -export default Announcement; diff --git a/components/Card.js b/components/Card.js deleted file mode 100644 index f02a6a8..0000000 --- a/components/Card.js +++ /dev/null @@ -1,62 +0,0 @@ -import React from 'react'; -import { Card } from 'flotiq-components-react'; -import Link from 'next/link'; -import Image from 'next/image'; -import BlogPostMetaDetailsPresentation from './blog-post/BlogPostMetaDetailsPresentation'; -import BlogPostTags from './blog-post/BlogPostTags'; -import FlotiqImage from '../lib/flotiqImage'; - -const CustomCard = ({ title, excerpt, date, readingTime, tags, withTags = false, image, slug }) => ( - - {/* eslint-disable-next-line jsx-a11y/anchor-is-valid */} - - - - - {title} - - - {excerpt} - -
-
- {withTags && ( - - )} -
- -
-
- - {image - && ( -
- {title} -
- )} - -
- -); - -export default CustomCard; diff --git a/components/Footer.js b/components/Footer.js deleted file mode 100644 index 3deb2a6..0000000 --- a/components/Footer.js +++ /dev/null @@ -1,113 +0,0 @@ -import React from 'react'; -import Image from 'next/image'; -import { PoweredByFlotiq } from 'flotiq-components-react'; -import Link from 'next/link'; -import Logo from '../public/assets/kyan-logo.png'; - -const navigation = { - social: [ - { - name: 'Facebook', - href: 'https://www.facebook.com/flotiq', - icon: (props) => ( - - - - ), - }, - { - name: 'LinkedIn', - href: 'https://www.linkedin.com/company/flotiq/', - icon: (props) => ( - - - - - - ), - }, - { - name: 'Link', - href: 'https://flotiq.com', - icon: (props) => ( - - - - - ), - }, - ], -}; - -const Footer = () => ( -
-
-
- - {/* eslint-disable-next-line jsx-a11y/anchor-is-valid */} - - Flotiq - - - -
- {navigation.social.map((item) => ( - - {item.name} - - ))} -
-
-
- -

- Copyright © Flotiq 2022 -

-
-
-
-); - -export default Footer; diff --git a/components/Header.js b/components/Header.js deleted file mode 100644 index f2fdf01..0000000 --- a/components/Header.js +++ /dev/null @@ -1,84 +0,0 @@ -import React from 'react'; -import Image from 'next/image'; -import { Disclosure } from '@headlessui/react'; -import { MenuIcon, XIcon } from '@heroicons/react/outline'; -import Link from 'next/link'; -import Logo from '../public/assets/kyan-logo.png'; - -const Header = () => ( - - {({ open }) => ( - <> -
-
-
-
- - Open main menu - {open ? ( - -
-
- - {/* eslint-disable-next-line jsx-a11y/anchor-is-valid */} - - Flotiq - - -
-
-
-

Blog About Everything

-
-
-
- - Say Hi! - -
-
-
-

Blog About Everything

-
-
-
- - -
-
-

Menu content here...

-
-
-
- - )} -
-); - -export default Header; diff --git a/components/blog-post/BlogPostAuthor.js b/components/blog-post/BlogPostAuthor.js deleted file mode 100644 index 98f1de3..0000000 --- a/components/blog-post/BlogPostAuthor.js +++ /dev/null @@ -1,10 +0,0 @@ -import React from 'react'; - -const BlogPostAuthor = ({ additionalClass, authorName }) => ( -

- Author: - {authorName} -

-); - -export default BlogPostAuthor; diff --git a/components/blog-post/BlogPostFeaturedImage.js b/components/blog-post/BlogPostFeaturedImage.js deleted file mode 100644 index 8e0771f..0000000 --- a/components/blog-post/BlogPostFeaturedImage.js +++ /dev/null @@ -1,18 +0,0 @@ -import React from 'react'; -import Image from 'next/image'; -import FlotiqImage from '../../lib/flotiqImage'; - -const BlogPostFeaturedImage = ({ headerImage, title }) => ( -
- {title} -
-); - -export default BlogPostFeaturedImage; diff --git a/components/blog-post/BlogPostMetaDetails.js b/components/blog-post/BlogPostMetaDetails.js deleted file mode 100644 index 2d0fe3c..0000000 --- a/components/blog-post/BlogPostMetaDetails.js +++ /dev/null @@ -1,19 +0,0 @@ -import React from 'react'; -import BlogPostTags from './BlogPostTags'; -import BlogPostMetaDetailsPresentation from './BlogPostMetaDetailsPresentation'; - -const BlogPostMetaDetails = ({ date, readingTime, withTags = false, tags, additionalClass }) => ( -
-
- -
-
- {withTags && ( - - )} -
-); - -export default BlogPostMetaDetails; diff --git a/components/blog-post/BlogPostMetaDetailsPresentation.js b/components/blog-post/BlogPostMetaDetailsPresentation.js deleted file mode 100644 index 0bfdc7e..0000000 --- a/components/blog-post/BlogPostMetaDetailsPresentation.js +++ /dev/null @@ -1,16 +0,0 @@ -import React from 'react'; - -const BlogPostMetaDetailsPresentation = ({ date, readingTime }) => ( - <> -

- Date:  - {date} -

-

- Reading Time:  - {readingTime} -

- -); - -export default BlogPostMetaDetailsPresentation; diff --git a/components/blog-post/BlogPostNavigation.js b/components/blog-post/BlogPostNavigation.js deleted file mode 100644 index 0384cd8..0000000 --- a/components/blog-post/BlogPostNavigation.js +++ /dev/null @@ -1,41 +0,0 @@ -import React from 'react'; -import { ArrowNarrowLeftIcon, ArrowNarrowRightIcon } from '@heroicons/react/solid'; - -const BlogPostNavigation = ({ additionalClass, prevText, nextText, pageContext }) => { - const previousSlug = pageContext.pageContext.previous; - const nextSlug = pageContext.pageContext.next; - return ( - - ); -}; - -export default BlogPostNavigation; diff --git a/components/blog-post/BlogPostTags.js b/components/blog-post/BlogPostTags.js deleted file mode 100644 index badff48..0000000 --- a/components/blog-post/BlogPostTags.js +++ /dev/null @@ -1,18 +0,0 @@ -import React from 'react'; - -const BlogPostTags = ({ tags }) => ( -
- {tags && tags.map((tag) => ( - - {tag} - - ))} -
-); -export default BlogPostTags; diff --git a/jsconfig.json b/jsconfig.json new file mode 100644 index 0000000..b8d6842 --- /dev/null +++ b/jsconfig.json @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "paths": { + "@/*": ["./src/*"] + } + } +} diff --git a/layouts/layout.js b/layouts/layout.js deleted file mode 100644 index 37733df..0000000 --- a/layouts/layout.js +++ /dev/null @@ -1,20 +0,0 @@ -import React from 'react'; -import Head from 'next/head'; -import Header from '../components/Header'; -import Footer from '../components/Footer'; - -const Layout = ({ children, additionalClass = [], title, description }) => ( -
- - {title} - - - - -
- {children} -
-
-); - -export default Layout; diff --git a/lib/blogPosts.js b/lib/blogPosts.js deleted file mode 100644 index d705b76..0000000 --- a/lib/blogPosts.js +++ /dev/null @@ -1,48 +0,0 @@ -import { FlotiqApi } from '../flotiqApi'; - -const apiKey = process.env.FLOTIQ_API_KEY; -const DEFAULT_ORDER = 'internal.createdAt'; -const DEFAULT_DIRECTION = 'desc'; -const api = new FlotiqApi(apiKey); - -export async function getBlogPosts(page = 1, limit = 10) { - return api.BlogPostAPI.list({ - page, - limit, - order_by: DEFAULT_ORDER, - order_direction: DEFAULT_DIRECTION, - }); -} - -export async function getBlogPostBySlug(slug) { - const filters = `{"slug":{"type":"contains","filter":"${slug}"}}`; - return api.BlogPostAPI.list({ - page: 1, - limit: 1, - order_by: DEFAULT_ORDER, - order_direction: DEFAULT_DIRECTION, - filters, - }); -} - -export async function getPreviousBlogPost(date) { - const filters = `{"internal.createdAt":{"type":"lessThan", "filter": "${date}"}}`; - return api.BlogPostAPI.list({ - page: 1, - limit: 1, - order_by: DEFAULT_ORDER, - order_direction: DEFAULT_DIRECTION, - filters, - }); -} - -export async function getNextBlogPost(date) { - const filters = `{"internal.createdAt":{"type":"greaterThan","filter":"${date}"}}`; - return api.BlogPostAPI.list({ - page: 1, - limit: 1, - order_by: DEFAULT_ORDER, - order_direction: 'asc', - filters, - }); -} diff --git a/lib/config.js b/lib/config.js deleted file mode 100644 index e455916..0000000 --- a/lib/config.js +++ /dev/null @@ -1,13 +0,0 @@ -const config = { - siteMetadata: { - title: 'Flotiq NextJs starter for blog', - description: 'Flotiq NextJs starter for blog', - }, - blog: { - postPerPage: 4, - }, - api: { - url: 'https://api.flotiq.com', - }, -}; -export default config; diff --git a/lib/flotiqImage.js b/lib/flotiqImage.js deleted file mode 100644 index a58ff50..0000000 --- a/lib/flotiqImage.js +++ /dev/null @@ -1,13 +0,0 @@ -import config from './config'; - -const getSrc = ( - imageObject, - width, - height, -) => `${config.api.url}/image/${width}x${height}/${imageObject.id}.${imageObject.extension}`; - -const FlotiqImage = { - getSrc, -}; - -export default FlotiqImage; diff --git a/lib/gtag.js b/lib/gtag.js deleted file mode 100644 index 2fbe360..0000000 --- a/lib/gtag.js +++ /dev/null @@ -1,17 +0,0 @@ -export const GA_TRACKING_ID = process.env.NEXT_PUBLIC_GA_ID; - -// https://developers.google.com/analytics/devguides/collection/gtagjs/pages -export const pageview = (url) => { - window.gtag('config', GA_TRACKING_ID, { - page_path: url, - }); -}; - -// https://developers.google.com/analytics/devguides/collection/gtagjs/events -export const event = ({ action, category, label, value }) => { - window.gtag('event', action, { - event_category: category, - event_label: label, - value, - }); -}; diff --git a/next.config.js b/next.config.js deleted file mode 100644 index 9c4708e..0000000 --- a/next.config.js +++ /dev/null @@ -1,31 +0,0 @@ -const withImages = require('next-images'); -const withTM = require('next-transpile-modules')(['flotiq-components-react']); - -const nextConfig = { - async rewrites() { - return [ - { - source: '/', - destination: '/1', - }, - ]; - }, - images: { - dangerouslyAllowSVG: true, - disableStaticImages: true, - domains: ['api.flotiq.com'], - }, - webpack: (config, options) => { - if (!options.isServer) { - config.resolve.alias['@sentry/node'] = '@sentry/browser'; - } - config.module.rules.push({ - test: /\.svg$/, - issuer: { and: [/\.(js|ts)x?$/] }, - use: ['@svgr/webpack'], - }); - return config; - }, -}; - -module.exports = withTM(withImages(nextConfig)); diff --git a/next.config.mjs b/next.config.mjs new file mode 100644 index 0000000..4678774 --- /dev/null +++ b/next.config.mjs @@ -0,0 +1,4 @@ +/** @type {import('next').NextConfig} */ +const nextConfig = {}; + +export default nextConfig; diff --git a/package.json b/package.json index 985ee78..ad3d2e6 100644 --- a/package.json +++ b/package.json @@ -12,45 +12,19 @@ "lint": "next lint" }, "dependencies": { - "@babel/core": "^7.25.2", - "@babel/eslint-parser": "^7.25.1", - "@babel/plugin-syntax-flow": "^7.24.7", - "@babel/plugin-transform-react-jsx": "^7.25.2", - "@babel/preset-react": "^7.24.7", - "@fontsource/sora": "^5.0.18", - "@headlessui/react": "^1.7.19", - "@heroicons/react": "v1", + "@fontsource/sora": "^5.0.19", "@tailwindcss/typography": "^0.5.14", - "@zeit/next-source-maps": "^0.0.3", - "dotenv": "^16.4.5", "flotiq-components-react": "^1.2.2", - "highlight.js": "^11.10.0", - "moment": "^2.30.1", - "next": "12.3.4", - "next-images": "^1.8.5", - "next-runtime-dotenv": "^1.5.1", - "next-transpile-modules": "^10.0.1", - "prop-types": "^15.8.1", - "react": "18.3.1", - "react-dom": "18.3.1", - "sharp": "^0.33.4", - "typescript": "^5.5.4", - "webpack": "^5.93.0" + "next": "14.2.6", + "react": "^18", + "react-dom": "^18" }, "devDependencies": { - "@next/eslint-plugin-next": "^14.2.5", - "@svgr/webpack": "^8.1.0", - "autoprefixer": "^10.4.20", - "eslint": "^8.57.0", - "eslint-config-airbnb": "^19.0.4", - "eslint-config-next": "12.3.4", - "eslint-plugin-import": "^2.29.1", - "eslint-plugin-jsx-a11y": "^6.9.0", - "eslint-plugin-react": "^7.35.0", - "eslint-plugin-react-hooks": "^4.6.2", - "postcss": "^8.4.41", + "eslint": "^8", + "eslint-config-next": "14.2.6", + "postcss": "^8", "prettier": "^3.3.3", - "tailwindcss": "^3.4.10" + "tailwindcss": "^3.4.1" }, "repository": { "type": "git", diff --git a/pages/404.js b/pages/404.js deleted file mode 100644 index b95a42f..0000000 --- a/pages/404.js +++ /dev/null @@ -1,26 +0,0 @@ -import { Header } from 'flotiq-components-react'; -import React, { useRef } from 'react'; -import Link from 'next/link'; -import Button from 'flotiq-components-react/dist/components/Button/Button'; -import Layout from '../layouts/layout'; - -const title = 'Page not found'; -const NotFoundPage = () => { - const ref = useRef(); - return ( - -
-
- Page not found, sorry -
-
- -
-
-
- ); -}; - -export default NotFoundPage; diff --git a/pages/[page].js b/pages/[page].js deleted file mode 100644 index 721affe..0000000 --- a/pages/[page].js +++ /dev/null @@ -1,69 +0,0 @@ -import Pagination from 'flotiq-components-react/dist/components/Pagination/Pagination'; -import React from 'react'; -import Layout from '../layouts/layout'; -import Announcement from '../components/Announcement'; -import { getBlogPosts } from '../lib/blogPosts'; -import BlogCards from '../sections/BlogCards'; -import config from '../lib/config'; - -const Home = ({ posts, pageContext }) => ( - - - - {pageContext.numPages > 1 && ( - - )} - -); - -export async function getStaticProps({ params }) { - const posts = await getBlogPosts(params.page, config.blog.postPerPage); - - /** - * This function is used to sanitize the API responses, without it the getStaticProps() - * methods are not working properly as Next tries to serialize values which are possibly - * `undefined` (which results in an error). - */ - const sanitizedPosts = JSON.parse(JSON.stringify(posts)); - - return { - props: { - posts: sanitizedPosts.data, - pageContext: { - currentPage: sanitizedPosts.current_page, - numPages: sanitizedPosts.total_pages, - }, - }, - }; -} - -export async function getStaticPaths() { - const fetcher = await getBlogPosts(1, config.blog.postPerPage); - const pages = fetcher.total_pages; - const pathRule = (number) => `${number + 1}`; - let paths = {}; - - if (pages > 1) { - paths = Array.from(Array(pages - 1).keys()).map((i) => ({ - params: { page: pathRule(i) }, - })); - } else { - paths = Array.from(Array(pages).keys()).map((i) => ({ - params: { page: pathRule(i) }, - })); - } - - return { - paths, - fallback: false, - }; -} - -export default Home; diff --git a/pages/_app.js b/pages/_app.js deleted file mode 100644 index 9dff9aa..0000000 --- a/pages/_app.js +++ /dev/null @@ -1,44 +0,0 @@ -import '../styles/globals.css'; -import { React, useEffect } from 'react'; -import Script from 'next/script'; -import { useRouter } from 'next/router'; -import * as gtag from '../lib/gtag'; - -const MyApp = ({ Component, pageProps }) => { - const router = useRouter(); - useEffect(() => { - const handleRouteChange = (url) => { - gtag.pageview(url); - }; - router.events.on('routeChangeComplete', handleRouteChange); - return () => { - router.events.off('routeChangeComplete', handleRouteChange); - }; - }, [router.events]); - - return ( -
-