Work on CMS (#65)

* Work on CMS
This commit is contained in:
Fede Álvarez
2022-05-18 23:57:44 +02:00
committed by GitHub
parent ebeb481e50
commit 91b47f439d
41 changed files with 2289 additions and 1593 deletions
+1158 -915
View File
File diff suppressed because it is too large Load Diff
+44
View File
@@ -0,0 +1,44 @@
const AboutHero = {
query: `
{
aboutPage {
heroCtaLabel
heroCtaLink
heroDescB01
heroDescB02
heroHeading
heroTitle
}
}`
}
const AboutTeam = {
query: `
{
aboutPage {
teamHeading
teamDescB01
teamDescB02
}
}`
}
const Teams = {
query: `
{
allTeams(orderBy: [id_ASC]) {
id
memberGithub
memberImage {
url
}
memberLinkedin
memberName
memberPosition
memberTeam
memberTwitter
}
}`
}
export { AboutHero, AboutTeam, Teams }
+65
View File
@@ -0,0 +1,65 @@
const CommunityHero = {
query: `
{
communityPage {
heroButton01
heroButton02
heroDescription
heroHeading
heroB01Link
heroB02Link
}
}
`
}
const Events = {
query: `
{
allEvents(orderBy: [eventDatetime_ASC]) {
eventDatetime
eventDesc
eventImage {
url
}
eventLink
eventLocation
eventTitle
id
}
}
`
}
const CommunityEvents = {
query: `
{
communityPage {
eventsHeading
eventsDescription
}
}`
}
const CommunitySocials = {
query: `
{
communityPage {
socialsHeading
socialsLine
socialsImage {
url
}
socialsTwitter
socialsDiscord
socialsDiscourse
socialsReddit
socialsTelegram
socialsLinkedin
socialsFacebook
socialsInstagram
}
}`
}
export { CommunityEvents, CommunityHero, CommunitySocials, Events }
+81
View File
@@ -0,0 +1,81 @@
const HomeHero = {
query: `
{
homePage {
heroHeading
heroButton01
heroB01Link
heroButton02
heroB02Link
heroSlogan
}
}
`
}
const HomeBenefits = {
query: `
{
homePage {
benefitsDesc
benefitsHeading
benefitsS01Desc
benefitsS01Heading
benefitsS01Item01
benefitsS01Item02
benefitsS01Item03
benefitsS01Item04
benefitsS01Item05
benefitsS01Item06
benefitsS02Desc
benefitsS02Heading
benefitsS02Item01
benefitsS02Item02
benefitsS02Item03
benefitsS02Item04
benefitsS02Item05
benefitsS02Item06
benefitsButton
benefitsButtonLink
}
}
`
}
const HomeOthers = {
query: `
{
homePage {
othersHeading
}
}
`
}
const Testimonials = {
query: `
{
allTestimonials {
id
testimonialImage {
url
}
testimonialPosition
testimonialText
testimonialUsername
}
}
`
}
const HomeLatest = {
query: `
{
homePage {
latestHeading
}
}
`
}
export { HomeBenefits, HomeHero, HomeLatest, HomeOthers, Testimonials }
+27
View File
@@ -0,0 +1,27 @@
const Terms = {
query: `
{
termsPage {
termsContent {
value
blocks
}
_updatedAt
}
}`
}
const Privacy = {
query: `
{
privacyPage {
privacyContent {
value
blocks
}
_updatedAt
}
}`
}
export { Privacy, Terms }
+125
View File
@@ -0,0 +1,125 @@
const ProductsHero = {
query: `
{
productsPage {
heroDescription
heroHeading
heroItem01
heroItem02
heroItem03
heroItem04
heroItem05
heroS01Desc
heroS01Heading
heroS02Desc
heroS02Heading
}
}
`
}
const ProductsWatchers = {
query: `
{
productsPage {
watchersHeading
watchersImage {
url
}
watchersMobileImage {
url
}
watchersItem01
watchersItem02
watchersItem03
watchersListHead
watchersP01
watchersP02
}
}
`
}
const ProductsStack = {
query: `
{
productsPage {
stackDescription
stackHeading
stackListData
stackImage {
url
}
stackSvgImg {
url
}
}
}
`
}
const ProductsNetwork = {
query: `
{
productsPage {
networkDesc
networkHeading
networkListItem01
networkListItem02
networkListItem03
networkImg {
url
}
networkMobileImg {
url
}
}
}
`
}
const ProductsApp = {
query: `
{
productsPage {
appDescription
appHeading
appImg {
url
}
appMobileImg {
url
}
}
}
`
}
const ProductsToken = {
query: `
{
productsPage {
tokenHeading
tokenDesc
tokenImg {
url
}
tokenItem01
tokenItem02
tokenItem03
tokenMobileImg {
url
}
}
}
`
}
export {
ProductsApp,
ProductsHero,
ProductsNetwork,
ProductsStack,
ProductsToken,
ProductsWatchers
}
+33
View File
@@ -0,0 +1,33 @@
import tiny from 'tiny-json-http'
interface props {
query: string
variables?: string
preview?: string
}
export async function request({ query, variables, preview }: props) {
let endpoint = 'https://graphql.datocms.com'
if (preview) {
endpoint += `/preview`
}
const { body } = await tiny.post({
url: endpoint,
headers: {
authorization: `Bearer ${process.env.NEXT_PUBLIC_CMS_ACCESS_TOKEN}`
},
data: {
query,
variables
}
})
if (body.errors) {
console.error('The query has errors!')
throw body.errors
}
return body.data
}