Skip to content
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
17 changes: 16 additions & 1 deletion gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,20 @@ module.exports = {
author: `Bitlogic.io`,
},
plugins: [
{
resolve: `gatsby-plugin-google-gtag`,
options: {
// You can add multiple tracking ids and a pageview event will be fired for all of them.
trackingIds: [
"G-BKGQR6SJWV", // Google Analytics / G
],
// This object is used for configuration specific to this plugin
pluginConfig: {
// Puts tracking script in the head instead of the body
head: true,
},
},
},
"gatsby-plugin-react-helmet",

{
Expand Down Expand Up @@ -37,6 +51,7 @@ module.exports = {
`blog-page`,
`bitway-page`,
`contact-page`,
`global-config`,
],
},
},
Expand All @@ -52,7 +67,7 @@ module.exports = {
breakpoints: [750, 1080, 1366, 1920],
backgroundColor: `transparent`,
},
},
},
},
{
resolve: `gatsby-plugin-manifest`,
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"gatsby-image": "^3.11.0",
"gatsby-plugin-gatsby-cloud": "^3.0.0",
"gatsby-plugin-google-analytics": "^3.12.0",
"gatsby-plugin-google-gtag": "^3.13.0",
"gatsby-plugin-google-marketing-platform": "^0.2.0",
"gatsby-plugin-hubspot": "^1.3.5",
"gatsby-plugin-image": "^1.12.0",
Expand All @@ -34,6 +35,7 @@
"react-hubspot-form": "^1.3.7",
"react-icons": "^4.2.0",
"react-markdown": "^6.0.2",
"react-script-tag": "^1.1.2",
"react-showdown": "^2.3.1",
"sass": "^1.35.1"
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/BitwayPage/Gallery/Gallery.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react"
import "./Gallery.scss"
import { getImage, GatsbyImage } from "gatsby-plugin-image"
import { getImage } from "gatsby-plugin-image"
import { BgImage } from "gbimage-bridge"

const layouts = {
Expand Down
4 changes: 2 additions & 2 deletions src/components/ContactPage/ContactContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ const Contact = () => {


const { image, nameImage, title } = contactData?.allStrapiContactPage?.nodes[0]
const { formId, portalId } = contactData?.allStrapiContactPage?.nodes[0]?.contactForm
const { pageTitle, pageDescription, pageKeywords } = contactData?.allStrapiContactPage?.nodes[0]?.pageMetadata
const { formId, portalId } = contactData?.allStrapiContactPage?.nodes[0]?.contactForm || {}
const { pageTitle, pageDescription, pageKeywords } = contactData?.allStrapiContactPage?.nodes[0]?.pageMetadata || {}

const contactImage = getImage(image?.localFile)

Expand Down
2 changes: 1 addition & 1 deletion src/components/HomePage/HomeContainer/HomeContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const Home = () => {
const data = useHomePage()

const homeSections = data?.allStrapiHome?.nodes[0]?.sections
const { pageTitle, pageDescription, pageKeywords } = data?.allStrapiHome?.nodes[0].pageMetadata
const { pageTitle, pageDescription, pageKeywords } = data?.allStrapiHome?.nodes[0].pageMetadata || {}


return (
Expand Down
1 change: 0 additions & 1 deletion src/components/Seo/Seo.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ function Seo({ description, lang, meta, title, keywords }) {
author,
robots,
siteMetadata: { siteDesc, siteKeywords, siteTitle },
siteURL,
} = data.allStrapiGlobalSeo.nodes[0]

const metaDescription = description ? description : siteDesc
Expand Down
19 changes: 18 additions & 1 deletion src/components/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,31 @@ import * as React from "react"
import Header from "./header"
import "./layout.scss"
import Footer from "./Footer/Footer"
import ScriptTag from "react-script-tag"
import useGlobalConfig from "../hooks/useGlobalConfig"

const Layout = ({ children }) => {
const config = useGlobalConfig()
const scripts = config?.allStrapiGlobalConfig?.nodes.map(item =>
item?.script?.map(script =>
script.enable === true ? (
<ScriptTag
key={script.name}
type="text/javascript"
src={script.src}
id={script.name}
async
defer
/>
) : null
)
)
return (
<>
{scripts}
<Header />

<main>{children}</main>

<Footer />
{/*© {new Date().getFullYear()}, Built with*/}
</>
Expand Down
20 changes: 20 additions & 0 deletions src/hooks/useGlobalConfig.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { useStaticQuery, graphql } from "gatsby"

const useGlobalConfig = () => {
const query = useStaticQuery(graphql`
{
allStrapiGlobalConfig {
nodes {
script {
enable
name
src
}
}
}
}
`)
return query
}

export default useGlobalConfig
49 changes: 49 additions & 0 deletions src/schema/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,55 @@ type LocalFile {
localFile: File @link(from: "localFile___NODE")
}

type StrapiGlobalConfig implements Node {
id: ID!
parent: Node
children: [Node!]!
internal: Internal!
published_at(
formatString: String

fromNow: Boolean

# Returns the difference between this date and the current time. Defaults to "milliseconds" but you can also pass in as the measurement "years", "months", "weeks", "days", "hours", "minutes", and "seconds".
difference: String

# Configures the locale Moment.js will use to format the date.
locale: String
): Date
created_at(
formatString: String

fromNow: Boolean

# Returns the difference between this date and the current time. Defaults to "milliseconds" but you can also pass in as the measurement "years", "months", "weeks", "days", "hours", "minutes", and "seconds".
difference: String

# Configures the locale Moment.js will use to format the date.
locale: String
): Date
updated_at(
formatString: String

fromNow: Boolean

# Returns the difference between this date and the current time. Defaults to "milliseconds" but you can also pass in as the measurement "years", "months", "weeks", "days", "hours", "minutes", and "seconds".
difference: String

# Configures the locale Moment.js will use to format the date.
locale: String
): Date
script: [StrapiGlobalConfigScript]
strapiId: Int
}

type StrapiGlobalConfigScript {
id: Int
name: String
enable: Boolean
src: String
}


`

Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10775,6 +10775,11 @@ react-refresh@^0.9.0:
resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.9.0.tgz#71863337adc3e5c2f8a6bfddd12ae3bfe32aafbf"
integrity sha512-Gvzk7OZpiqKSkxsQvO/mbTN1poglhmAV7gR/DdIrRrSMXraRQQlfikRJOr3Nb9GTMPC5kof948Zy6jJZIFtDvQ==

react-script-tag@^1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/react-script-tag/-/react-script-tag-1.1.2.tgz#be0fa3a22dfae8165d083f6bc1ff6f9799b20d44"
integrity sha512-4oR9ntvGfX4igiP77vK310ru5Oa77xO7CeYB3Xi9lu0qsikpGpK1Kq1WMFocvy8U4fQFq8ovtrZS/8adfCziFw==

react-showdown@^2.3.1:
version "2.3.1"
resolved "https://registry.yarnpkg.com/react-showdown/-/react-showdown-2.3.1.tgz#c1d4644e3c351ae131da49d8ba081db812c7ca80"
Expand Down