From 8a48b0dc4d5a95d22c041833c32758a8d21df430 Mon Sep 17 00:00:00 2001 From: Tesimune Date: Tue, 10 Oct 2023 09:02:34 +0100 Subject: [PATCH] View page updated --- .github/workflows/main.yml | 2 +- gatsby-config.js | 12 ++ gatsby-node.js | 19 +++ package-lock.json | 173 ++++++++++++++++----- package.json | 1 + src/pages/jobs/{[viewId].js => display.js} | 57 +++---- src/pages/jobs/index.js | 10 +- 7 files changed, 192 insertions(+), 82 deletions(-) rename src/pages/jobs/{[viewId].js => display.js} (70%) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3ad6a9e8..c770f016 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,4 +18,4 @@ jobs: server: ${{ secrets.FTP_SERVER }} username: ${{ secrets.FTP_USERNAME }} password: ${{ secrets.FTP_PASSWORD }} - server-dir: ./public/ + local-dir: ./public/ diff --git a/gatsby-config.js b/gatsby-config.js index f592e5c8..cd2a70f0 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -15,6 +15,18 @@ module.exports = { siteUrl: `https://analogueshifts.com/`, }, plugins: [ + { + resolve: `gatsby-plugin-page-creator`, + options: { + path: `${__dirname}/src/pages/jobs`, + }, + }, + { + resolve: `gatsby-plugin-page-creator`, + options: { + path: `${__dirname}/src/pages/job`, + }, + }, "gatsby-plugin-postcss", `gatsby-plugin-image`, { diff --git a/gatsby-node.js b/gatsby-node.js index fc11b596..d799aaab 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -7,8 +7,27 @@ /** * @type {import('gatsby').GatsbyNode['createPages']} */ +const path = require('path'); +const axios = require('axios'); + exports.createPages = async ({ actions }) => { const { createPage } = actions + + try { + const response = await axios.get("https://api.analogueshifts.com/api/jobs") + const data = response.data.jobs + + data.map(job => { + createPage({ + path: `/jobs/${job.display}`, + component: path.resolve("./src/pages/jobs/display.js"), // Replace with your template path + context: job, + }) + }) + } catch (error) { + console.error("Error fetching data from the API:", error) + } + createPage({ path: "/using-dsg", component: require.resolve("./src/templates/using-dsg.js"), diff --git a/package-lock.json b/package-lock.json index 2245c4a5..9dbf97d8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,6 +12,7 @@ "gatsby": "^5.12.4", "gatsby-plugin-image": "^3.12.0", "gatsby-plugin-manifest": "^5.12.0", + "gatsby-plugin-page-creator": "^5.12.1", "gatsby-plugin-sharp": "^5.12.0", "gatsby-source-filesystem": "^5.12.0", "gatsby-transformer-sharp": "^5.12.0", @@ -4738,6 +4739,11 @@ "deep-equal": "^2.0.5" } }, + "node_modules/b4a": { + "version": "1.6.4", + "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.6.4.tgz", + "integrity": "sha512-fpWrvyVHEKyeEvbKZTVOeZF3VSKKWtJxFIxX/jaVPf+cLbGUSitjb49pHLqPV2BUNNZ0LcoeEGfE/YCpyDYHIw==" + }, "node_modules/babel-eslint": { "version": "10.1.0", "resolved": "https://registry.npmjs.org/babel-eslint/-/babel-eslint-10.1.0.tgz", @@ -7785,6 +7791,11 @@ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, + "node_modules/fast-fifo": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz", + "integrity": "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==" + }, "node_modules/fast-glob": { "version": "3.2.12", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", @@ -8715,9 +8726,9 @@ } }, "node_modules/gatsby-plugin-page-creator": { - "version": "5.12.0", - "resolved": "https://registry.npmjs.org/gatsby-plugin-page-creator/-/gatsby-plugin-page-creator-5.12.0.tgz", - "integrity": "sha512-CwpI0Bp20+t7D8CVMD3R09df4eDo2RVB6Z6vgpmNdNzcRzk8GojuLSrdlA2s/RzwyCuxpDGyGGu5Ocnp4xJEhQ==", + "version": "5.12.1", + "resolved": "https://registry.npmjs.org/gatsby-plugin-page-creator/-/gatsby-plugin-page-creator-5.12.1.tgz", + "integrity": "sha512-qyGfxNG5D0ICxgGBeK6vgAIyj+xaHXc/fXLElHmfB0G+IauywMAFY9GKg6Kd0VYGqtDNTrtLlNaquI6DNJZw8Q==", "dependencies": { "@babel/runtime": "^7.20.13", "@babel/traverse": "^7.20.13", @@ -8727,7 +8738,7 @@ "fs-extra": "^11.1.1", "gatsby-core-utils": "^4.12.0", "gatsby-page-utils": "^3.12.0", - "gatsby-plugin-utils": "^4.12.0", + "gatsby-plugin-utils": "^4.12.1", "gatsby-telemetry": "^4.12.0", "globby": "^11.1.0", "lodash": "^4.17.21" @@ -8894,15 +8905,15 @@ } }, "node_modules/gatsby-plugin-utils": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/gatsby-plugin-utils/-/gatsby-plugin-utils-4.12.0.tgz", - "integrity": "sha512-lU84VmWC9qGojROMZkBgGjCAzxcAUlyGAsd75vjj2y3yqGYtyvqInvK5tZvDyNNVvU21u040Ps4AKIvRVgMV/Q==", + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/gatsby-plugin-utils/-/gatsby-plugin-utils-4.12.1.tgz", + "integrity": "sha512-WL8x0E4CkmP1m61aaIa23lhoOOpxH7PIlZCzly2ehcsZmyL/7dxfpm09B/IAkLYbSMzi6Uln1vmQAN7qvBan4A==", "dependencies": { "@babel/runtime": "^7.20.13", "fastq": "^1.15.0", "fs-extra": "^11.1.1", "gatsby-core-utils": "^4.12.0", - "gatsby-sharp": "^1.12.0", + "gatsby-sharp": "^1.12.1", "graphql-compose": "^9.0.10", "import-from": "^4.0.0", "joi": "^17.9.2", @@ -8947,11 +8958,11 @@ } }, "node_modules/gatsby-sharp": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/gatsby-sharp/-/gatsby-sharp-1.12.0.tgz", - "integrity": "sha512-5MbTPKfzkOCtwT74+FZTUFKaul/2UyF10apvMcmIKomq71/jHf6wJx+rHtSdgyq19r4VWL8DGG2CKgSpe0z9GQ==", + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/gatsby-sharp/-/gatsby-sharp-1.12.1.tgz", + "integrity": "sha512-e7lqA74UZau7MOktc9V+sNh86a8oNZPFIsY5Atk+C0sGlzHx0IcivsJjwLHJ6OF11SIC38a9z2wE8Nl6YiG/Ig==", "dependencies": { - "sharp": "^0.32.1" + "sharp": "^0.32.6" }, "engines": { "node": ">=18.0.0" @@ -13089,6 +13100,11 @@ } ] }, + "node_modules/queue-tick": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/queue-tick/-/queue-tick-1.0.1.tgz", + "integrity": "sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag==" + }, "node_modules/quick-lru": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz", @@ -13949,18 +13965,18 @@ "integrity": "sha512-LUMFi+RppPlrHzbqmFnINTrazo0lPNwhcgzuAXVVcfy/mqPDrQmHAyz5bvV0gDAuRFrk804V0HpQ6u9sZ0tBeg==" }, "node_modules/sharp": { - "version": "0.32.1", - "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.32.1.tgz", - "integrity": "sha512-kQTFtj7ldpUqSe8kDxoGLZc1rnMFU0AO2pqbX6pLy3b7Oj8ivJIdoKNwxHVQG2HN6XpHPJqCSM2nsma2gOXvOg==", + "version": "0.32.6", + "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.32.6.tgz", + "integrity": "sha512-KyLTWwgcR9Oe4d9HwCwNM2l7+J0dUQwn/yf7S0EnTtb0eVS4RxO0eUSvxPtzT4F3SY+C4K6fqdv/DO27sJ/v/w==", "hasInstallScript": true, "dependencies": { "color": "^4.2.3", - "detect-libc": "^2.0.1", + "detect-libc": "^2.0.2", "node-addon-api": "^6.1.0", "prebuild-install": "^7.1.1", - "semver": "^7.5.0", + "semver": "^7.5.4", "simple-get": "^4.0.1", - "tar-fs": "^2.1.1", + "tar-fs": "^3.0.4", "tunnel-agent": "^0.6.0" }, "engines": { @@ -13971,9 +13987,9 @@ } }, "node_modules/sharp/node_modules/detect-libc": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.1.tgz", - "integrity": "sha512-463v3ZeIrcWtdgIg6vI6XUncguvr2TnGl4SzDXinkt9mSLpBJKXT3mW6xT3VQdDN11+WVs29pgvivTc4Lp8v+w==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.2.tgz", + "integrity": "sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw==", "engines": { "node": ">=8" } @@ -13983,6 +13999,26 @@ "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-6.1.0.tgz", "integrity": "sha512-+eawOlIgy680F0kBzPUNFhMZGtJ1YmqM6l4+Crf4IkImjYrO/mqPwRMh352g23uIaQKFItcQ64I7KMaJxHgAVA==" }, + "node_modules/sharp/node_modules/tar-fs": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-3.0.4.tgz", + "integrity": "sha512-5AFQU8b9qLfZCX9zp2duONhPmZv0hGYiBPJsyUdqMjzq/mqVpy/rEUSeHk1+YitmxugaptgBh5oDGU3VsAJq4w==", + "dependencies": { + "mkdirp-classic": "^0.5.2", + "pump": "^3.0.0", + "tar-stream": "^3.1.5" + } + }, + "node_modules/sharp/node_modules/tar-stream": { + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-3.1.6.tgz", + "integrity": "sha512-B/UyjYwPpMBv+PaFSWAmtYjwdrlEaZQEhMIBFNC5oEG8lpiW8XjcSdmEaClj28ArfKScKHs2nshz3k2le6crsg==", + "dependencies": { + "b4a": "^1.6.4", + "fast-fifo": "^1.2.0", + "streamx": "^2.15.0" + } + }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -14375,6 +14411,15 @@ "node": ">=10.0.0" } }, + "node_modules/streamx": { + "version": "2.15.1", + "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.15.1.tgz", + "integrity": "sha512-fQMzy2O/Q47rgwErk/eGeLu/roaFWV0jVsogDmrszM9uIw8L5OA+t+V93MgYlufNptfjmYR1tOMWhei/Eh7TQA==", + "dependencies": { + "fast-fifo": "^1.1.0", + "queue-tick": "^1.0.1" + } + }, "node_modules/strict-uri-encode": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz", @@ -19431,6 +19476,11 @@ "deep-equal": "^2.0.5" } }, + "b4a": { + "version": "1.6.4", + "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.6.4.tgz", + "integrity": "sha512-fpWrvyVHEKyeEvbKZTVOeZF3VSKKWtJxFIxX/jaVPf+cLbGUSitjb49pHLqPV2BUNNZ0LcoeEGfE/YCpyDYHIw==" + }, "babel-eslint": { "version": "10.1.0", "resolved": "https://registry.npmjs.org/babel-eslint/-/babel-eslint-10.1.0.tgz", @@ -21725,6 +21775,11 @@ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, + "fast-fifo": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz", + "integrity": "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==" + }, "fast-glob": { "version": "3.2.12", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", @@ -22564,9 +22619,9 @@ } }, "gatsby-plugin-page-creator": { - "version": "5.12.0", - "resolved": "https://registry.npmjs.org/gatsby-plugin-page-creator/-/gatsby-plugin-page-creator-5.12.0.tgz", - "integrity": "sha512-CwpI0Bp20+t7D8CVMD3R09df4eDo2RVB6Z6vgpmNdNzcRzk8GojuLSrdlA2s/RzwyCuxpDGyGGu5Ocnp4xJEhQ==", + "version": "5.12.1", + "resolved": "https://registry.npmjs.org/gatsby-plugin-page-creator/-/gatsby-plugin-page-creator-5.12.1.tgz", + "integrity": "sha512-qyGfxNG5D0ICxgGBeK6vgAIyj+xaHXc/fXLElHmfB0G+IauywMAFY9GKg6Kd0VYGqtDNTrtLlNaquI6DNJZw8Q==", "requires": { "@babel/runtime": "^7.20.13", "@babel/traverse": "^7.20.13", @@ -22576,7 +22631,7 @@ "fs-extra": "^11.1.1", "gatsby-core-utils": "^4.12.0", "gatsby-page-utils": "^3.12.0", - "gatsby-plugin-utils": "^4.12.0", + "gatsby-plugin-utils": "^4.12.1", "gatsby-telemetry": "^4.12.0", "globby": "^11.1.0", "lodash": "^4.17.21" @@ -22686,15 +22741,15 @@ } }, "gatsby-plugin-utils": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/gatsby-plugin-utils/-/gatsby-plugin-utils-4.12.0.tgz", - "integrity": "sha512-lU84VmWC9qGojROMZkBgGjCAzxcAUlyGAsd75vjj2y3yqGYtyvqInvK5tZvDyNNVvU21u040Ps4AKIvRVgMV/Q==", + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/gatsby-plugin-utils/-/gatsby-plugin-utils-4.12.1.tgz", + "integrity": "sha512-WL8x0E4CkmP1m61aaIa23lhoOOpxH7PIlZCzly2ehcsZmyL/7dxfpm09B/IAkLYbSMzi6Uln1vmQAN7qvBan4A==", "requires": { "@babel/runtime": "^7.20.13", "fastq": "^1.15.0", "fs-extra": "^11.1.1", "gatsby-core-utils": "^4.12.0", - "gatsby-sharp": "^1.12.0", + "gatsby-sharp": "^1.12.1", "graphql-compose": "^9.0.10", "import-from": "^4.0.0", "joi": "^17.9.2", @@ -22717,11 +22772,11 @@ "requires": {} }, "gatsby-sharp": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/gatsby-sharp/-/gatsby-sharp-1.12.0.tgz", - "integrity": "sha512-5MbTPKfzkOCtwT74+FZTUFKaul/2UyF10apvMcmIKomq71/jHf6wJx+rHtSdgyq19r4VWL8DGG2CKgSpe0z9GQ==", + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/gatsby-sharp/-/gatsby-sharp-1.12.1.tgz", + "integrity": "sha512-e7lqA74UZau7MOktc9V+sNh86a8oNZPFIsY5Atk+C0sGlzHx0IcivsJjwLHJ6OF11SIC38a9z2wE8Nl6YiG/Ig==", "requires": { - "sharp": "^0.32.1" + "sharp": "^0.32.6" } }, "gatsby-source-filesystem": { @@ -25461,6 +25516,11 @@ "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==" }, + "queue-tick": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/queue-tick/-/queue-tick-1.0.1.tgz", + "integrity": "sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag==" + }, "quick-lru": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz", @@ -26118,29 +26178,49 @@ "integrity": "sha512-LUMFi+RppPlrHzbqmFnINTrazo0lPNwhcgzuAXVVcfy/mqPDrQmHAyz5bvV0gDAuRFrk804V0HpQ6u9sZ0tBeg==" }, "sharp": { - "version": "0.32.1", - "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.32.1.tgz", - "integrity": "sha512-kQTFtj7ldpUqSe8kDxoGLZc1rnMFU0AO2pqbX6pLy3b7Oj8ivJIdoKNwxHVQG2HN6XpHPJqCSM2nsma2gOXvOg==", + "version": "0.32.6", + "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.32.6.tgz", + "integrity": "sha512-KyLTWwgcR9Oe4d9HwCwNM2l7+J0dUQwn/yf7S0EnTtb0eVS4RxO0eUSvxPtzT4F3SY+C4K6fqdv/DO27sJ/v/w==", "requires": { "color": "^4.2.3", - "detect-libc": "^2.0.1", + "detect-libc": "^2.0.2", "node-addon-api": "^6.1.0", "prebuild-install": "^7.1.1", - "semver": "^7.5.0", + "semver": "^7.5.4", "simple-get": "^4.0.1", - "tar-fs": "^2.1.1", + "tar-fs": "^3.0.4", "tunnel-agent": "^0.6.0" }, "dependencies": { "detect-libc": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.1.tgz", - "integrity": "sha512-463v3ZeIrcWtdgIg6vI6XUncguvr2TnGl4SzDXinkt9mSLpBJKXT3mW6xT3VQdDN11+WVs29pgvivTc4Lp8v+w==" + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.2.tgz", + "integrity": "sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw==" }, "node-addon-api": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-6.1.0.tgz", "integrity": "sha512-+eawOlIgy680F0kBzPUNFhMZGtJ1YmqM6l4+Crf4IkImjYrO/mqPwRMh352g23uIaQKFItcQ64I7KMaJxHgAVA==" + }, + "tar-fs": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-3.0.4.tgz", + "integrity": "sha512-5AFQU8b9qLfZCX9zp2duONhPmZv0hGYiBPJsyUdqMjzq/mqVpy/rEUSeHk1+YitmxugaptgBh5oDGU3VsAJq4w==", + "requires": { + "mkdirp-classic": "^0.5.2", + "pump": "^3.0.0", + "tar-stream": "^3.1.5" + } + }, + "tar-stream": { + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-3.1.6.tgz", + "integrity": "sha512-B/UyjYwPpMBv+PaFSWAmtYjwdrlEaZQEhMIBFNC5oEG8lpiW8XjcSdmEaClj28ArfKScKHs2nshz3k2le6crsg==", + "requires": { + "b4a": "^1.6.4", + "fast-fifo": "^1.2.0", + "streamx": "^2.15.0" + } } } }, @@ -26438,6 +26518,15 @@ "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==" }, + "streamx": { + "version": "2.15.1", + "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.15.1.tgz", + "integrity": "sha512-fQMzy2O/Q47rgwErk/eGeLu/roaFWV0jVsogDmrszM9uIw8L5OA+t+V93MgYlufNptfjmYR1tOMWhei/Eh7TQA==", + "requires": { + "fast-fifo": "^1.1.0", + "queue-tick": "^1.0.1" + } + }, "strict-uri-encode": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz", diff --git a/package.json b/package.json index 1fd65f92..c94e8adf 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "gatsby": "^5.12.4", "gatsby-plugin-image": "^3.12.0", "gatsby-plugin-manifest": "^5.12.0", + "gatsby-plugin-page-creator": "^5.12.1", "gatsby-plugin-sharp": "^5.12.0", "gatsby-source-filesystem": "^5.12.0", "gatsby-transformer-sharp": "^5.12.0", diff --git a/src/pages/jobs/[viewId].js b/src/pages/jobs/display.js similarity index 70% rename from src/pages/jobs/[viewId].js rename to src/pages/jobs/display.js index c7de1eb3..ae875613 100644 --- a/src/pages/jobs/[viewId].js +++ b/src/pages/jobs/display.js @@ -6,33 +6,18 @@ import SeoController from '../../lib/SeoController' export const Head = () => - const seoData = { - title: 'Jobs in Tech', - description: - 'Looking for the best tech jobs worldwide? AnalogueShifts has you covered. We work with top employers to bring you the latest opportunities in the tech industry. Visit our jobs page today to start your search.', - // canonical: `https://www.analogueshifts.com/jobs/${display}`, - ogImage: '/images/a4.jpg', - } - -export default function View(props) { - const [job, setJob] = useState([]) - - const display = props.params.viewId - - useEffect(() => { - if (display) { - axios - .get(`/jobs/${display}`) - .then(res => { - const data = res.data - setJob(data) - }) - .catch(error => { - alert(error) - }) - } - }, [display]) +const seoData = { + title: "Jobs in Tech", + description: + "Looking for the best tech jobs worldwide? AnalogueShifts has you covered. We work with top employers to bring you the latest opportunities in the tech industry. Visit our jobs page today to start your search.", + // canonical: `https://www.analogueshifts.com/jobs/${display}`, + ogImage: "/images/a4.jpg", +} +export default function View({ pageContext }) { + + const { role, created_at, hire_type, experience, range, duration, description, application } = pageContext + useEffect(() => { // Define animations const fadeIn = gsap.from(".fade-in", { @@ -58,27 +43,27 @@ export default function View(props) {
{/* Post title */}

- {job.role} + {role}

{/* Post meta content */}
- {job.created_at} + {created_at}
Job - Location: {job.hire_type} + Location: {hire_type} - Experience: {job.experience} + Experience: {experience} - Salary: {job.range} + Salary: {range} - Duration: {job.duration} + Duration: {duration}
@@ -87,21 +72,21 @@ export default function View(props) {
- {job.application === "" ? ( + {application === "" ? ( Apply here ) : ( Apply here diff --git a/src/pages/jobs/index.js b/src/pages/jobs/index.js index 532cd9c0..d52c4d09 100644 --- a/src/pages/jobs/index.js +++ b/src/pages/jobs/index.js @@ -1,10 +1,10 @@ -import { Link } from "gatsby" import React, { useEffect, useState } from "react" +import { Link } from "gatsby" import { gsap } from "gsap" import axios from "../../lib/axios" import AppLayout from "../../components/Layouts/AppLayout" -import LandImg from "../../images/jobs/1.jpg" import SeoController from "../../lib/SeoController" +import LandImg from "../../images/jobs/1.jpg" export const Head = () => const seoData = { @@ -88,7 +88,11 @@ export default function Jobs() {
- Jobs + Jobs