Skip to content

Commit

Permalink
feat: basic test with Apollo Client
Browse files Browse the repository at this point in the history
  • Loading branch information
martapanc committed Aug 15, 2023
1 parent 9bf3c12 commit 514e990
Show file tree
Hide file tree
Showing 4 changed files with 157 additions and 1 deletion.
8 changes: 8 additions & 0 deletions apollo/apollo-client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { ApolloClient, InMemoryCache } from '@apollo/client';

const apolloClient = new ApolloClient({
uri: 'https://martacodes-it-strapi.up.railway.app/graphql',
cache: new InMemoryCache(),
});

export default apolloClient;
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"sanity:prod": "sanity build && sanity start"
},
"dependencies": {
"@apollo/client": "^3.8.1",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@mui/material": "^5.13.5",
Expand All @@ -40,6 +41,7 @@
"clsx": "^1.2.1",
"focus-trap-react": "^10.1.4",
"framer-motion": "^10.12.18",
"graphql": "^16.8.0",
"inquirer-fuzzy-path": "^2.3.0",
"next": "^13.4.9",
"next-sanity": "5.1.0",
Expand All @@ -54,6 +56,7 @@
"sanity": "^3.0.0",
"sanity-plugin-internationalized-array": "^1.7.0",
"sanity-plugin-media": "^2.2.1",
"strapi-flatten-graphql": "^0.1.0",
"styled-components": "^5.2.0",
"tailwind-merge": "^1.12.0",
"typed.js": "^2.0.16"
Expand Down
45 changes: 45 additions & 0 deletions src/app/(public)/about/work/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { gql } from '@apollo/client';
import { PortableText } from '@portabletext/react';
import Image from 'next/image';
import * as React from 'react';
import { flattenEntityResponseCollection } from 'strapi-flatten-graphql';

import Education from '@/components/organisms/about-work/Education';
import Languages from '@/components/organisms/about-work/Languages';
Expand All @@ -14,6 +16,7 @@ import { schoolsQuery } from '@/queries/schools';
import { shortTextQuery } from '@/queries/short-texts';
import { skillQuery } from '@/queries/skills';

import apolloClient from '../../../../../apollo/apollo-client';
import { sanityClient } from '../../../../../sanity/lib/client';

import { Icon } from '@/types/Icon';
Expand Down Expand Up @@ -54,10 +57,49 @@ const getData = async () => {
};
};

const queryData = async () => {
const { data } = await apolloClient.query({
query: gql`
query {
jobs(locale: "en") {
data {
id
attributes {
CompanyName
Icon {
data {
id
attributes {
name
url
alternativeText
}
}
}
Title
Location
Description
From
To
CurrentJob
}
}
}
}
`,
});

return {
jobs: flattenEntityResponseCollection(data.jobs),
};
};

const AboutPage = async () => {
const { jobs, languages, publications, schools, shortTexts, skills } =
await getData();

const js = await queryData();

const softwareDevelopment: ShortText | undefined = shortTexts.find(
(item) => item.name === 'software-development'
);
Expand All @@ -67,6 +109,9 @@ const AboutPage = async () => {
const iconDimension = 36;
const titleIconDimension = 42;

// eslint-disable-next-line no-console
console.log(js);

return (
<main className='min-h-main'>
<section className='dark:bg-dark bg-white'>
Expand Down
102 changes: 101 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,25 @@
"@jridgewell/gen-mapping" "^0.3.0"
"@jridgewell/trace-mapping" "^0.3.9"

"@apollo/client@^3.8.1":
version "3.8.1"
resolved "https://verdaccio.mein-recycling.de/@apollo%2fclient/-/client-3.8.1.tgz#a1e3045a5fb276c08e38f7b5f930551d79741257"
integrity sha512-JGGj/9bdoLEqzatRikDeN8etseY5qeFAY0vSAx/Pd0ePNsaflKzHx6V2NZ0NsGkInq+9IXXX3RLVDf0EotizMA==
dependencies:
"@graphql-typed-document-node/core" "^3.1.1"
"@wry/context" "^0.7.3"
"@wry/equality" "^0.5.6"
"@wry/trie" "^0.4.3"
graphql-tag "^2.12.6"
hoist-non-react-statics "^3.3.2"
optimism "^0.17.5"
prop-types "^15.7.2"
response-iterator "^0.2.6"
symbol-observable "^4.0.0"
ts-invariant "^0.10.3"
tslib "^2.3.0"
zen-observable-ts "^1.2.5"

"@aw-web-design/x-default-browser@1.4.126":
version "1.4.126"
resolved "https://verdaccio.mein-recycling.de/@aw-web-design%2fx-default-browser/-/x-default-browser-1.4.126.tgz#43e4bd8f0314ed907a8718d7e862a203af79bc16"
Expand Down Expand Up @@ -2198,6 +2217,11 @@
dependencies:
"@floating-ui/dom" "^1.2.7"

"@graphql-typed-document-node/core@^3.1.1":
version "3.2.0"
resolved "https://verdaccio.mein-recycling.de/@graphql-typed-document-node%2fcore/-/core-3.2.0.tgz#5f3d96ec6b2354ad6d8a28bf216a1d97b5426861"
integrity sha512-mB9oAsNCm9aM3/SOv4YtBMqZbYj10R7dkq8byBqxGY/ncFwhf2oQzMV+LCRlWoDSEBJ3COiR1yeDvMtsoOsuFQ==

"@hookform/resolvers@^3.1.1":
version "3.1.1"
resolved "https://verdaccio.mein-recycling.de/@hookform%2fresolvers/-/resolvers-3.1.1.tgz#b374d33e356428fff9c6ef3c933441fe15e40784"
Expand Down Expand Up @@ -5258,6 +5282,27 @@
"@webassemblyjs/ast" "1.11.6"
"@xtuc/long" "4.2.2"

"@wry/context@^0.7.0", "@wry/context@^0.7.3":
version "0.7.3"
resolved "https://verdaccio.mein-recycling.de/@wry%2fcontext/-/context-0.7.3.tgz#240f6dfd4db5ef54f81f6597f6714e58d4f476a1"
integrity sha512-Nl8WTesHp89RF803Se9X3IiHjdmLBrIvPMaJkl+rKVJAYyPsz1TEUbu89943HpvujtSJgDUx9W4vZw3K1Mr3sA==
dependencies:
tslib "^2.3.0"

"@wry/equality@^0.5.6":
version "0.5.6"
resolved "https://verdaccio.mein-recycling.de/@wry%2fequality/-/equality-0.5.6.tgz#cd4a533c72c3752993ab8cbf682d3d20e3cb601e"
integrity sha512-D46sfMTngaYlrH+OspKf8mIJETntFnf6Hsjb0V41jAXJ7Bx2kB8Rv8RCUujuVWYttFtHkUNp7g+FwxNQAr6mXA==
dependencies:
tslib "^2.3.0"

"@wry/trie@^0.4.3":
version "0.4.3"
resolved "https://verdaccio.mein-recycling.de/@wry%2ftrie/-/trie-0.4.3.tgz#077d52c22365871bf3ffcbab8e95cb8bc5689af4"
integrity sha512-I6bHwH0fSf6RqQcnnXLJKhkSXG45MFral3GxPaY4uAl0LYDZM+YDVDAiU9bYwjTuysy1S0IeecWtmq1SZA3M1w==
dependencies:
tslib "^2.3.0"

"@xtuc/ieee754@^1.2.0":
version "1.2.0"
resolved "https://verdaccio.mein-recycling.de/@xtuc%2fieee754/-/ieee754-1.2.0.tgz#eef014a3145ae477a1cbc00cd1e552336dceb790"
Expand Down Expand Up @@ -9089,6 +9134,18 @@ graphemer@^1.4.0:
resolved "https://verdaccio.mein-recycling.de/graphemer/-/graphemer-1.4.0.tgz#fb2f1d55e0e3a1849aeffc90c4fa0dd53a0e66c6"
integrity sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==

graphql-tag@^2.12.6:
version "2.12.6"
resolved "https://verdaccio.mein-recycling.de/graphql-tag/-/graphql-tag-2.12.6.tgz#d441a569c1d2537ef10ca3d1633b48725329b5f1"
integrity sha512-FdSNcu2QQcWnM2VNvSCCDCVS5PpPqpzgFT8+GXzqJuoDd0CBncxCY278u4mhRO7tMgo2JjgJA5aZ+nWSQ/Z+xg==
dependencies:
tslib "^2.1.0"

graphql@^16.8.0:
version "16.8.0"
resolved "https://verdaccio.mein-recycling.de/graphql/-/graphql-16.8.0.tgz#374478b7f27b2dc6153c8f42c1b80157f79d79d4"
integrity sha512-0oKGaR+y3qcS5mCu1vb7KG+a89vjn06C7Ihq/dDl3jA+A8B3TKomvi3CiEcVLJQGalbu8F52LxkOym7U5sSfbg==

groq-js@1, groq-js@^1.0.0:
version "1.1.9"
resolved "https://verdaccio.mein-recycling.de/groq-js/-/groq-js-1.1.9.tgz#e32498d3a0eff01da1dd2fb63db754d9e76fbb04"
Expand Down Expand Up @@ -11880,6 +11937,15 @@ open@^9.1.0:
is-inside-container "^1.0.0"
is-wsl "^2.2.0"

optimism@^0.17.5:
version "0.17.5"
resolved "https://verdaccio.mein-recycling.de/optimism/-/optimism-0.17.5.tgz#a4c78b3ad12c58623abedbebb4f2f2c19b8e8816"
integrity sha512-TEcp8ZwK1RczmvMnvktxHSF2tKgMWjJ71xEFGX5ApLh67VsMSTy1ZUlipJw8W+KaqgOmQ+4pqwkeivY89j+4Vw==
dependencies:
"@wry/context" "^0.7.0"
"@wry/trie" "^0.4.3"
tslib "^2.3.0"

optionator@^0.9.3:
version "0.9.3"
resolved "https://verdaccio.mein-recycling.de/optionator/-/optionator-0.9.3.tgz#007397d44ed1872fdc6ed31360190f81814e2c64"
Expand Down Expand Up @@ -13307,6 +13373,11 @@ resolve@^2.0.0-next.4:
path-parse "^1.0.7"
supports-preserve-symlinks-flag "^1.0.0"

response-iterator@^0.2.6:
version "0.2.6"
resolved "https://verdaccio.mein-recycling.de/response-iterator/-/response-iterator-0.2.6.tgz#249005fb14d2e4eeb478a3f735a28fd8b4c9f3da"
integrity sha512-pVzEEzrsg23Sh053rmDUvLSkGXluZio0qu8VT6ukrYuvtjVfCbDZH9d6PGXb8HZfzdNZt8feXv/jvUzlhRgLnw==

restore-cursor@^2.0.0:
version "2.0.0"
resolved "https://verdaccio.mein-recycling.de/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf"
Expand Down Expand Up @@ -14053,6 +14124,11 @@ storybook@^7.0.20:
dependencies:
"@storybook/cli" "7.1.1"

strapi-flatten-graphql@^0.1.0:
version "0.1.0"
resolved "https://verdaccio.mein-recycling.de/strapi-flatten-graphql/-/strapi-flatten-graphql-0.1.0.tgz#9d45d050202a610ef2a5cefc6271e37e5c6a5b55"
integrity sha512-P9htHRgLZ05EjWTrr8hilekpct04fyLxFnwAAsVxyrrbho6hVi8gRZLHkcM3Zk0TyjcL3KdFCBYstlcRHiMfyg==

stream-browserify@^3.0.0:
version "3.0.0"
resolved "https://verdaccio.mein-recycling.de/stream-browserify/-/stream-browserify-3.0.0.tgz#22b0a2850cdf6503e73085da1fc7b7d0c2122f2f"
Expand Down Expand Up @@ -14366,6 +14442,11 @@ swc-loader@^0.2.3:
resolved "https://verdaccio.mein-recycling.de/swc-loader/-/swc-loader-0.2.3.tgz#6792f1c2e4c9ae9bf9b933b3e010210e270c186d"
integrity sha512-D1p6XXURfSPleZZA/Lipb3A8pZ17fP4NObZvFCDjK/OKljroqDpPmsBdTraWhVBqUNpcWBQY1imWdoPScRlQ7A==

symbol-observable@^4.0.0:
version "4.0.0"
resolved "https://verdaccio.mein-recycling.de/symbol-observable/-/symbol-observable-4.0.0.tgz#5b425f192279e87f2f9b937ac8540d1984b39205"
integrity sha512-b19dMThMV4HVFynSAM1++gBHAbk2Tc/osgLIBZMKsyqh34jb2e8Os7T6ZW/Bt3pJFdBTd2JwAnAAEQV7rSNvcQ==

symbol-tree@^3.2.4:
version "3.2.4"
resolved "https://verdaccio.mein-recycling.de/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2"
Expand Down Expand Up @@ -14708,6 +14789,13 @@ ts-interface-checker@^0.1.9:
resolved "https://verdaccio.mein-recycling.de/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz#784fd3d679722bc103b1b4b8030bcddb5db2a699"
integrity sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==

ts-invariant@^0.10.3:
version "0.10.3"
resolved "https://verdaccio.mein-recycling.de/ts-invariant/-/ts-invariant-0.10.3.tgz#3e048ff96e91459ffca01304dbc7f61c1f642f6c"
integrity sha512-uivwYcQaxAucv1CzRp2n/QdYPo4ILf9VXgH19zEIjFx2EJufV16P0JtJVpYHy89DItG6Kwj2oIUjrcK5au+4tQ==
dependencies:
tslib "^2.1.0"

ts-node@^10.8.1:
version "10.9.1"
resolved "https://verdaccio.mein-recycling.de/ts-node/-/ts-node-10.9.1.tgz#e73de9102958af9e1f0b168a6ff320e25adcff4b"
Expand Down Expand Up @@ -14770,7 +14858,7 @@ tslib@^2.0.0, tslib@^2.0.3, tslib@^2.1.0, tslib@^2.3.1, tslib@^2.5.0, tslib@^2.6
resolved "https://verdaccio.mein-recycling.de/tslib/-/tslib-2.6.0.tgz#b295854684dbda164e181d259a22cd779dcd7bc3"
integrity sha512-7At1WUettjcSRHXCyYtTselblcHl9PJFFVKiCAy/bY97+BPZXSQ2wbq0P9s8tK2G7dFQfNnlJnPAiArVBVBsfA==

tslib@^2.0.1, tslib@^2.4.0:
tslib@^2.0.1, tslib@^2.3.0, tslib@^2.4.0:
version "2.6.1"
resolved "https://verdaccio.mein-recycling.de/tslib/-/tslib-2.6.1.tgz#fd8c9a0ff42590b25703c0acb3de3d3f4ede0410"
integrity sha512-t0hLfiEKfMUoqhG+U1oid7Pva4bbDPHYfJNiB7BiIjRkj1pyC++4N3huJfqY6aRH6VTB0rvtzQwjM4K6qpfOig==
Expand Down Expand Up @@ -15609,6 +15697,18 @@ yocto-queue@^1.0.0:
resolved "https://verdaccio.mein-recycling.de/yocto-queue/-/yocto-queue-1.0.0.tgz#7f816433fb2cbc511ec8bf7d263c3b58a1a3c251"
integrity sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==

zen-observable-ts@^1.2.5:
version "1.2.5"
resolved "https://verdaccio.mein-recycling.de/zen-observable-ts/-/zen-observable-ts-1.2.5.tgz#6c6d9ea3d3a842812c6e9519209365a122ba8b58"
integrity sha512-QZWQekv6iB72Naeake9hS1KxHlotfRpe+WGNbNx5/ta+R3DNjVO2bswf63gXlWDcs+EMd7XY8HfVQyP1X6T4Zg==
dependencies:
zen-observable "0.8.15"

zen-observable@0.8.15:
version "0.8.15"
resolved "https://verdaccio.mein-recycling.de/zen-observable/-/zen-observable-0.8.15.tgz#96415c512d8e3ffd920afd3889604e30b9eaac15"
integrity sha512-PQ2PC7R9rslx84ndNBZB/Dkv8V8fZEpk83RLgXtYd0fwUgEjseMn1Dgajh2x6S8QbZAFa9p2qVCEuYZNgve0dQ==

zip-stream@^4.1.0:
version "4.1.0"
resolved "https://verdaccio.mein-recycling.de/zip-stream/-/zip-stream-4.1.0.tgz#51dd326571544e36aa3f756430b313576dc8fc79"
Expand Down

0 comments on commit 514e990

Please sign in to comment.