Changed to payload CMS

Amended content collections to TS
Amended content definition to include all fields
Amended content display to use correct url's
Added testing URL for R2 bucket
This commit is contained in:
Julio Ruiz 2026-07-01 12:29:40 -05:00
parent 9a9a6826af
commit 7431087d7a
26 changed files with 11664 additions and 1997 deletions

View File

@ -25,7 +25,7 @@ export default defineConfig({
},
image: {
domains: ['placehold.co', 'ik.imagekit.io', 'picsum.photos'],
domains: ['placehold.co', 'ik.imagekit.io', 'picsum.photos', 'pub-910ed90860804520b9202194cf43c0a6.r2.dev'],
service: imageService(),
},
output: "server",

11609
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@
"type": "module",
"version": "0.0.1",
"scripts": {
"dev": "tinacms dev -c \"astro dev\"",
"dev": "astro dev",
"build": "astro build",
"postbuild": "node scripts/send-to-n8n.js",
"preview": "astro preview",
@ -22,9 +22,7 @@
"@fontsource/poppins": "^5.2.7",
"@iconify-json/ph": "^1.2.2",
"@iconify/vue": "^5.0.0",
"@prisma/client": "^6.19.2",
"@tailwindcss/vite": "^4.1.18",
"@tinacms/cli": "^2.2.2",
"@unpic/astro": "^1.0.2",
"astro": "^5.17.1",
"astro-embed": "^0.12.0",
@ -32,13 +30,12 @@
"astro-icon": "^1.1.5",
"dayjs": "^1.11.19",
"googleapis": "^171.4.0",
"prisma": "^6.19.2",
"marked": "^18.0.5",
"react": "^19.2.5",
"react-dom": "^19.2.5",
"sharp": "^0.34.5",
"swiper": "^12.1.0",
"tailwindcss": "^4.1.18",
"tinacms": "^2.2.2",
"vue": "^3.5.28"
},
"devDependencies": {

View File

@ -1,8 +0,0 @@
-- CreateTable
CREATE TABLE "Contact" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"nombre" TEXT NOT NULL,
"email" TEXT NOT NULL,
"mensaje" TEXT NOT NULL,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
);

View File

@ -1,2 +0,0 @@
-- CreateIndex
CREATE INDEX "Contact_email_createdAt_idx" ON "Contact"("email", "createdAt");

View File

@ -1,24 +0,0 @@
/*
Warnings:
- Added the required column `updatedAt` to the `Contact` table without a default value. This is not possible if the table is not empty.
*/
-- RedefineTables
PRAGMA defer_foreign_keys=ON;
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_Contact" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"nombre" TEXT NOT NULL,
"email" TEXT NOT NULL,
"mensaje" TEXT NOT NULL,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL
);
INSERT INTO "new_Contact" ("createdAt", "email", "id", "mensaje", "nombre") SELECT "createdAt", "email", "id", "mensaje", "nombre" FROM "Contact";
DROP TABLE "Contact";
ALTER TABLE "new_Contact" RENAME TO "Contact";
CREATE UNIQUE INDEX "Contact_email_key" ON "Contact"("email");
CREATE INDEX "Contact_email_createdAt_idx" ON "Contact"("email", "createdAt");
PRAGMA foreign_keys=ON;
PRAGMA defer_foreign_keys=OFF;

View File

@ -1,3 +0,0 @@
# Please do not edit this file manually
# It should be added in your version-control system (e.g., Git)
provider = "sqlite"

View File

@ -1,19 +0,0 @@
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "sqlite"
url = env("DATABASE_URL")
}
model Contact {
id Int @id @default(autoincrement())
nombre String
email String @unique
mensaje String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([email, createdAt])
}

View File

@ -32,12 +32,12 @@ locationArray.filter(Boolean).join(', ');
{locationArray.filter(Boolean).join(', ')}<br />
({nicedate}):
</p>
<h3 class="md:text-2xl text-lg mb-4 font-bold md:mb-8 hover:underline"><a href={`/${locale}/${getLocalizedRoute(routeKey, locale)}/${data.id}`}>{data.data.title}</a></h3>
<h3 class="md:text-2xl text-lg mb-4 font-bold md:mb-8 hover:underline"><a href={`/${locale}/${getLocalizedRoute(routeKey, locale)}/${data.data.slug}`}>{data.data.title}</a></h3>
<div class="overflow-hidden">
<a href={`/${locale}/${getLocalizedRoute(routeKey, locale)}/${data.id}`}>
<a href={`/${locale}/${getLocalizedRoute(routeKey, locale)}/${data.data.slug}`}>
<Image
src={data.data.thumbnail}
src={data.data.thumbnail.url}
alt={data.data.title}
class="aspect-square object-cover transition-transform duration-300 hover:scale-110"
/>
@ -45,7 +45,7 @@ locationArray.filter(Boolean).join(', ');
</div>
<div class="mt-8">
<a href={`/${locale}/${getLocalizedRoute(routeKey, locale)}/${data.id}`} class="inline-flex items-center gap-2 px-6 py-3 bg-white text-[#22523F] hover:bg-[#22523F] hover:text-[#EBE6D2] hover:underline font-bold transition text-sm rounded-none uppercase">
<a href={`/${locale}/${getLocalizedRoute(routeKey, locale)}/${data.data.slug}`} class="inline-flex items-center gap-2 px-6 py-3 bg-white text-[#22523F] hover:bg-[#22523F] hover:text-[#EBE6D2] hover:underline font-bold transition text-sm rounded-none uppercase">
{tl(routeKey + ".fullnew")}
<Icon name="ph:arrow-right" class="transform group-hover:translate-x-1 transition-transform" />
</a>

View File

@ -23,7 +23,7 @@ const { images, class: className, imgClass } = Astro.props;
)}
<img
class={`w-full ${imgClass || ''}`}
src={image.image}
src={image.image.url}
alt={image.text}
/>
{image.text_alt && (

View File

@ -3,26 +3,41 @@ import { glob, file } from 'astro/loaders';
import { z } from 'astro/zod';
const news = defineCollection({
loader: glob({ pattern: "**/*.md", base: "./src/content/news" }),
//loader: glob({ pattern: "**/*.md", base: "./src/content/news" }),
loader: async () => {
const response = await fetch("http://localhost:3000/api/news?depth=1&draft=false&locale=es&trash=false");
const rawData = await response.json();
return rawData.docs.map((item: any) => {
item.id = item.id.toString()
return item
});
},
schema: ({ image }) => z.object({
locale: z.string().describe("News main language"),
title: z.string(),
date: z.date(),
draft: z.boolean().optional(),
place: z.string().optional(),
order: z.number().optional(),
city: z.string().optional(),
state: z.string().optional(),
country: z.string().optional(),
thumbnail: image().optional().describe("Main news thumbnail image"),
thumbnail_square: image().optional().describe("Main news thumbnail square image"),
date: z.string(),
slug: z.string(),
draft: z.boolean().optional().nullable(),
place: z.string().optional().nullable(),
order: z.number().optional().nullable(),
city: z.string().optional().nullable(),
state: z.string().optional().nullable(),
country: z.string().optional().nullable(),
thumbnail: z.object({
image: image().optional().nullable(),
url: z.string().optional().nullable()
}).optional().nullable().describe("Main news thumbnail image"),
//thumbnail_square: image().optional().describe("Main news thumbnail square image"),
youtube: z.string().optional(),
tags: z.array(z.string()).optional().describe("News tags"),
gallery: z.array(z.object({
image: image().optional(),
text: z.string().optional(),
text_alt: z.string().optional(),
})).optional().nullable()
image: z.object({
url: z.string().optional().nullable()
}).optional().nullable()
})).optional().nullable(),
body: z.string().nullable().optional()
}),
});
@ -32,6 +47,7 @@ const editorial = defineCollection({
locale: z.string().describe("Editorial main language"),
title: z.string(),
date: z.date(),
slug: z.string(),
draft: z.boolean().optional(),
place: z.string().optional(),
order: z.number().optional(),

View File

@ -8,6 +8,9 @@ import { getCollection, render } from "astro:content";
import TitleSection from "../../../components/section/TitleSection.astro";
import FooterSection from "../../../components/section/FooterSection.astro";
import { getLocalizedRoute } from "@/i18n";
import { marked } from 'marked';
export const prerender = true;
export async function getStaticPaths() {
@ -17,7 +20,7 @@ export async function getStaticPaths() {
for (const post of posts) {
paths.push({
params: {
id: post.id,
slug: post.data.slug,
locale: post.data.locale,
section: getLocalizedRoute(collection, post.data.locale),
},
@ -55,17 +58,20 @@ const canonicalUrl = new URL(`/${locale}/${section}/${post.id}`, Astro.site);
const imageUrl = post.data.thumbnail
? new URL(post.data.thumbnail, Astro.site).toString()
: null;
const fixedData = new Date(post.data.date)
const localeDate = new Intl.DateTimeFormat(locale || "es", {
year: "numeric",
month: "long",
day: "numeric",
}).format(post.data.date);
const y = post.data.date.getFullYear();
const m = String(post.data.date.getMonth() + 1).padStart(2, "0");
const d = String(post.data.date.getDate()).padStart(2, "0");
}).format(fixedData);
const y = fixedData.getFullYear();
const m = String(fixedData.getMonth() + 1).padStart(2, "0");
const d = String(fixedData.getDate()).padStart(2, "0");
const dateISO = `${y}-${m}-${d}`;
const schemaType = routeKey === "news" ? "NewsArticle" : "Article";
const htmlContent = marked.parse(post.data.body);
---
<MainLayout
@ -73,7 +79,7 @@ const schemaType = routeKey === "news" ? "NewsArticle" : "Article";
description={excerpt}
image={post.data.thumbnail}
url={canonicalUrl.toString()}
date={post.data.date}
date={fixedData}
>
<script
type="application/ld+json"
@ -81,7 +87,7 @@ const schemaType = routeKey === "news" ? "NewsArticle" : "Article";
"@context": "https://schema.org",
"@type": schemaType,
headline: post.data.title,
datePublished: post.data.date,
datePublished: fixedData,
description: excerpt,
image: imageUrl,
url: canonicalUrl.toString(),
@ -104,9 +110,9 @@ const schemaType = routeKey === "news" ? "NewsArticle" : "Article";
{
post.data.gallery?.length ? (
<CarouselSection images={post.data.gallery} />
) : post.data.thumbnail ? (
) : post.data.thumbnail?.url ? (
<Image
src={post.data.thumbnail}
src={post.data.thumbnail?.url}
alt={post.data.title}
class="hover:opacity-90 transition-opacity"
/>
@ -128,6 +134,7 @@ const schemaType = routeKey === "news" ? "NewsArticle" : "Article";
{localeDate}
</time>
<Content />
<div set:html={htmlContent} />
</article>
</div>
<div class="md:col-span-3 bg-tertiary md:sticky top-0 self-start">
@ -137,7 +144,7 @@ const schemaType = routeKey === "news" ? "NewsArticle" : "Article";
post.data.gallery &&
post.data.gallery.map((galleryImage, i) => (
<button type="button" data-lightbox-index={i} data-lightbox-src={galleryImage.image} data-lightbox-alt={galleryImage.text} class="cursor-pointer block w-full text-left">
<Image src={galleryImage.image} alt={galleryImage.text} />
<Image src={galleryImage.image?.url} alt={galleryImage.text} />
</button>
))
}

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
{"DocumentConnection":{"type":"DocumentConnection","resolveType":"multiCollectionDocumentList","collections":["news","editorial"]},"Node":{"type":"Node","resolveType":"nodeDocument"},"DocumentNode":{"type":"DocumentNode","resolveType":"multiCollectionDocument","createDocument":"create","updateDocument":"update"},"News":{"type":"News","resolveType":"collectionDocument","collection":"news","createNews":"create","updateNews":"update"},"NewsConnection":{"type":"NewsConnection","resolveType":"collectionDocumentList","collection":"news"},"Editorial":{"type":"Editorial","resolveType":"collectionDocument","collection":"editorial","createEditorial":"create","updateEditorial":"update"},"EditorialConnection":{"type":"EditorialConnection","resolveType":"collectionDocumentList","collection":"editorial"}}

View File

@ -1 +0,0 @@
{"version":{"fullVersion":"2.4.2","major":"2","minor":"4","patch":"2"},"meta":{"flags":["experimentalData"]},"collections":[{"name":"news","label":"News","path":"src/content/news","format":"md","match":{"include":"**/*"},"ui":{"filename":{"readonly":false}},"fields":[{"type":"string","name":"locale","label":"Language","options":[{"label":"Español","value":"es"},{"label":"English","value":"en"},{"label":"Português","value":"pt"},{"label":"Kinyarwanda","value":"rw"},{"label":"Frances","value":"fr"}],"namespace":["news","locale"],"searchable":true,"uid":false},{"type":"string","name":"title","label":"Title","isTitle":true,"required":true,"namespace":["news","title"],"searchable":true,"uid":false},{"type":"datetime","name":"date","label":"Date","required":true,"namespace":["news","date"],"searchable":true,"uid":false},{"type":"string","name":"slug","label":"Slug","namespace":["news","slug"],"searchable":true,"uid":false},{"type":"string","name":"place","label":"Place","namespace":["news","place"],"searchable":true,"uid":false},{"type":"string","name":"country","label":"Country","namespace":["news","country"],"searchable":true,"uid":false},{"type":"string","name":"city","label":"City","namespace":["news","city"],"searchable":true,"uid":false},{"type":"image","name":"thumbnail","label":"Thumbnail URL","namespace":["news","thumbnail"],"searchable":false,"uid":false},{"type":"image","name":"thumbnail_square","label":"Thumbnail Square URL","namespace":["news","thumbnail_square"],"searchable":false,"uid":false},{"type":"string","name":"tags","label":"Tags","list":true,"namespace":["news","tags"],"searchable":true,"uid":false},{"type":"object","name":"gallery","label":"Gallery","list":true,"fields":[{"type":"image","name":"image","label":"Image","namespace":["news","gallery","image"],"searchable":false,"uid":false}],"namespace":["news","gallery"],"searchable":true,"uid":false},{"type":"string","name":"youtube","label":"YouTube ID","namespace":["news","youtube"],"searchable":true,"uid":false},{"type":"boolean","name":"draft","label":"Draft","namespace":["news","draft"],"searchable":true,"uid":false},{"type":"rich-text","name":"body","label":"Content","isBody":true,"namespace":["news","body"],"searchable":true,"parser":{"type":"markdown"},"uid":false}],"namespace":["news"]},{"name":"editorial","label":"Editorial","path":"src/content/editorial","format":"md","match":{"include":"**/*"},"ui":{"filename":{"readonly":false}},"fields":[{"type":"string","name":"locale","label":"Language","options":[{"label":"Español","value":"es"},{"label":"English","value":"en"},{"label":"Português","value":"pt"},{"label":"Kinyarwanda","value":"rw"},{"label":"Frances","value":"fr"}],"namespace":["editorial","locale"],"searchable":true,"uid":false},{"type":"string","name":"title","label":"Title","isTitle":true,"required":true,"namespace":["editorial","title"],"searchable":true,"uid":false},{"type":"datetime","name":"date","label":"Date","required":true,"namespace":["editorial","date"],"searchable":true,"uid":false},{"type":"string","name":"slug","label":"Slug","namespace":["editorial","slug"],"searchable":true,"uid":false},{"type":"string","name":"place","label":"Place","namespace":["editorial","place"],"searchable":true,"uid":false},{"type":"string","name":"country","label":"Country","namespace":["editorial","country"],"searchable":true,"uid":false},{"type":"string","name":"city","label":"City","namespace":["editorial","city"],"searchable":true,"uid":false},{"type":"image","name":"thumbnail","label":"Thumbnail URL","namespace":["editorial","thumbnail"],"searchable":false,"uid":false},{"type":"image","name":"thumbnail_square","label":"Thumbnail Square URL","namespace":["editorial","thumbnail_square"],"searchable":false,"uid":false},{"type":"string","name":"tags","label":"Tags","list":true,"namespace":["editorial","tags"],"searchable":true,"uid":false},{"type":"object","name":"gallery","label":"Gallery","list":true,"fields":[{"type":"image","name":"image","label":"Image","namespace":["editorial","gallery","image"],"searchable":false,"uid":false}],"namespace":["editorial","gallery"],"searchable":true,"uid":false},{"type":"string","name":"youtube","label":"YouTube ID","namespace":["editorial","youtube"],"searchable":true,"uid":false},{"type":"boolean","name":"draft","label":"Draft","namespace":["editorial","draft"],"searchable":true,"uid":false},{"type":"rich-text","name":"body","label":"Content","isBody":true,"namespace":["editorial","body"],"searchable":true,"parser":{"type":"markdown"},"uid":false}],"namespace":["editorial"]}],"config":{"media":{"tina":{"publicFolder":"public","mediaRoot":"public/images"}}}}

View File

@ -1,5 +0,0 @@
import { createClient } from "tinacms/dist/client";
import { queries } from "./types.js";
export const client = createClient({ url: 'http://localhost:4001/graphql', token: 'null', queries, });
export default client;

View File

@ -1,243 +0,0 @@
// tina/config.ts
import { defineConfig } from "tinacms";
var branch = process.env.HEAD || process.env.VERCEL_GIT_COMMIT_REF || "main";
var config_default = defineConfig({
branch,
clientId: null,
token: null,
build: {
outputFolder: "admin",
publicFolder: "public"
},
media: {
tina: {
mediaRoot: "public/images",
publicFolder: "public"
}
},
schema: {
collections: [
{
name: "news",
label: "News",
path: "src/content/news",
format: "md",
match: {
include: "**/*"
},
ui: {
filename: {
readonly: false,
slugify: (values) => {
return values?.slug?.toLowerCase() || values?.title?.toLowerCase().replace(/ /g, "-");
}
}
},
fields: [
{
type: "string",
name: "locale",
label: "Language",
options: [
{ label: "Espa\xF1ol", value: "es" },
{ label: "English", value: "en" },
{ label: "Portugu\xEAs", value: "pt" },
{ label: "Kinyarwanda", value: "rw" },
{ label: "Frances", value: "fr" }
]
},
{
type: "string",
name: "title",
label: "Title",
isTitle: true,
required: true
},
{
type: "datetime",
name: "date",
label: "Date",
required: true
},
{
type: "string",
name: "slug",
label: "Slug"
},
{
type: "string",
name: "place",
label: "Place"
},
{
type: "string",
name: "country",
label: "Country"
},
{
type: "string",
name: "city",
label: "City"
},
{
type: "image",
name: "thumbnail",
label: "Thumbnail URL"
},
{
type: "image",
name: "thumbnail_square",
label: "Thumbnail Square URL"
},
{
type: "string",
name: "tags",
label: "Tags",
list: true
},
{
type: "object",
name: "gallery",
label: "Gallery",
list: true,
fields: [
{
type: "image",
name: "image",
label: "Image"
}
]
},
{
type: "string",
name: "youtube",
label: "YouTube ID"
},
{
type: "boolean",
name: "draft",
label: "Draft"
},
{
type: "rich-text",
name: "body",
label: "Content",
isBody: true
}
]
},
{
name: "editorial",
label: "Editorial",
path: "src/content/editorial",
format: "md",
match: {
include: "**/*"
},
ui: {
filename: {
readonly: false,
slugify: (values) => {
return values?.slug?.toLowerCase() || values?.title?.toLowerCase().replace(/ /g, "-");
}
}
},
fields: [
{
type: "string",
name: "locale",
label: "Language",
options: [
{ label: "Espa\xF1ol", value: "es" },
{ label: "English", value: "en" },
{ label: "Portugu\xEAs", value: "pt" },
{ label: "Kinyarwanda", value: "rw" },
{ label: "Frances", value: "fr" }
]
},
{
type: "string",
name: "title",
label: "Title",
isTitle: true,
required: true
},
{
type: "datetime",
name: "date",
label: "Date",
required: true
},
{
type: "string",
name: "slug",
label: "Slug"
},
{
type: "string",
name: "place",
label: "Place"
},
{
type: "string",
name: "country",
label: "Country"
},
{
type: "string",
name: "city",
label: "City"
},
{
type: "image",
name: "thumbnail",
label: "Thumbnail URL"
},
{
type: "image",
name: "thumbnail_square",
label: "Thumbnail Square URL"
},
{
type: "string",
name: "tags",
label: "Tags",
list: true
},
{
type: "object",
name: "gallery",
label: "Gallery",
list: true,
fields: [
{
type: "image",
name: "image",
label: "Image"
}
]
},
{
type: "string",
name: "youtube",
label: "YouTube ID"
},
{
type: "boolean",
name: "draft",
label: "Draft"
},
{
type: "rich-text",
name: "body",
label: "Content",
isBody: true
}
]
}
]
}
});
export {
config_default as default
};

View File

@ -1,41 +0,0 @@
fragment NewsParts on News {
__typename
locale
title
date
slug
place
country
city
thumbnail
thumbnail_square
tags
gallery {
__typename
image
}
youtube
draft
body
}
fragment EditorialParts on Editorial {
__typename
locale
title
date
slug
place
country
city
thumbnail
thumbnail_square
tags
gallery {
__typename
image
}
youtube
draft
body
}

View File

@ -1,109 +0,0 @@
query news($relativePath: String!) {
news(relativePath: $relativePath) {
... on Document {
_sys {
filename
basename
hasReferences
breadcrumbs
path
relativePath
extension
}
id
}
...NewsParts
}
}
query newsConnection($before: String, $after: String, $first: Float, $last: Float, $sort: String, $filter: NewsFilter) {
newsConnection(
before: $before
after: $after
first: $first
last: $last
sort: $sort
filter: $filter
) {
pageInfo {
hasPreviousPage
hasNextPage
startCursor
endCursor
}
totalCount
edges {
cursor
node {
... on Document {
_sys {
filename
basename
hasReferences
breadcrumbs
path
relativePath
extension
}
id
}
...NewsParts
}
}
}
}
query editorial($relativePath: String!) {
editorial(relativePath: $relativePath) {
... on Document {
_sys {
filename
basename
hasReferences
breadcrumbs
path
relativePath
extension
}
id
}
...EditorialParts
}
}
query editorialConnection($before: String, $after: String, $first: Float, $last: Float, $sort: String, $filter: EditorialFilter) {
editorialConnection(
before: $before
after: $after
first: $first
last: $last
sort: $sort
filter: $filter
) {
pageInfo {
hasPreviousPage
hasNextPage
startCursor
endCursor
}
totalCount
edges {
cursor
node {
... on Document {
_sys {
filename
basename
hasReferences
breadcrumbs
path
relativePath
extension
}
id
}
...EditorialParts
}
}
}
}

View File

@ -1,306 +0,0 @@
# DO NOT MODIFY THIS FILE. This file is automatically generated by Tina
"""References another document, used as a foreign key"""
scalar Reference
""""""
scalar JSON
type SystemInfo {
filename: String!
title: String
basename: String!
hasReferences: Boolean
breadcrumbs(excludeExtension: Boolean): [String!]!
path: String!
relativePath: String!
extension: String!
template: String!
collection: Collection!
}
type Folder {
name: String!
path: String!
}
type PageInfo {
hasPreviousPage: Boolean!
hasNextPage: Boolean!
startCursor: String!
endCursor: String!
}
""""""
interface Node {
id: ID!
}
""""""
interface Document {
id: ID!
_sys: SystemInfo
_values: JSON!
}
"""A relay-compliant pagination connection"""
interface Connection {
totalCount: Float!
pageInfo: PageInfo!
}
type Query {
getOptimizedQuery(queryString: String!): String
collection(collection: String): Collection!
collections: [Collection!]!
node(id: String): Node!
document(collection: String, relativePath: String): DocumentNode!
news(relativePath: String): News!
newsConnection(before: String, after: String, first: Float, last: Float, sort: String, filter: NewsFilter): NewsConnection!
editorial(relativePath: String): Editorial!
editorialConnection(before: String, after: String, first: Float, last: Float, sort: String, filter: EditorialFilter): EditorialConnection!
}
input DocumentFilter {
news: NewsFilter
editorial: EditorialFilter
}
type DocumentConnectionEdges {
cursor: String!
node: DocumentNode
}
type DocumentConnection implements Connection {
pageInfo: PageInfo!
totalCount: Float!
edges: [DocumentConnectionEdges]
}
type Collection {
name: String!
slug: String!
label: String
path: String!
format: String
matches: String
templates: [JSON]
fields: [JSON]
documents(before: String, after: String, first: Float, last: Float, sort: String, filter: DocumentFilter, folder: String): DocumentConnection!
}
union DocumentNode = News | Editorial | Folder
type NewsGallery {
image: String
}
type News implements Node & Document {
locale: String
title: String!
date: String!
slug: String
place: String
country: String
city: String
thumbnail: String
thumbnail_square: String
tags: [String]
gallery: [NewsGallery]
youtube: String
draft: Boolean
body: JSON
id: ID!
_sys: SystemInfo!
_values: JSON!
}
input StringFilter {
startsWith: String
eq: String
exists: Boolean
in: [String]
}
input DatetimeFilter {
after: String
before: String
eq: String
exists: Boolean
in: [String]
}
input ImageFilter {
startsWith: String
eq: String
exists: Boolean
in: [String]
}
input NewsGalleryFilter {
image: ImageFilter
}
input BooleanFilter {
eq: Boolean
exists: Boolean
}
input RichTextFilter {
startsWith: String
eq: String
exists: Boolean
}
input NewsFilter {
locale: StringFilter
title: StringFilter
date: DatetimeFilter
slug: StringFilter
place: StringFilter
country: StringFilter
city: StringFilter
thumbnail: ImageFilter
thumbnail_square: ImageFilter
tags: StringFilter
gallery: NewsGalleryFilter
youtube: StringFilter
draft: BooleanFilter
body: RichTextFilter
}
type NewsConnectionEdges {
cursor: String!
node: News
}
type NewsConnection implements Connection {
pageInfo: PageInfo!
totalCount: Float!
edges: [NewsConnectionEdges]
}
type EditorialGallery {
image: String
}
type Editorial implements Node & Document {
locale: String
title: String!
date: String!
slug: String
place: String
country: String
city: String
thumbnail: String
thumbnail_square: String
tags: [String]
gallery: [EditorialGallery]
youtube: String
draft: Boolean
body: JSON
id: ID!
_sys: SystemInfo!
_values: JSON!
}
input EditorialGalleryFilter {
image: ImageFilter
}
input EditorialFilter {
locale: StringFilter
title: StringFilter
date: DatetimeFilter
slug: StringFilter
place: StringFilter
country: StringFilter
city: StringFilter
thumbnail: ImageFilter
thumbnail_square: ImageFilter
tags: StringFilter
gallery: EditorialGalleryFilter
youtube: StringFilter
draft: BooleanFilter
body: RichTextFilter
}
type EditorialConnectionEdges {
cursor: String!
node: Editorial
}
type EditorialConnection implements Connection {
pageInfo: PageInfo!
totalCount: Float!
edges: [EditorialConnectionEdges]
}
type Mutation {
addPendingDocument(collection: String!, relativePath: String!, template: String): DocumentNode!
updateDocument(collection: String, relativePath: String!, params: DocumentUpdateMutation!): DocumentNode!
deleteDocument(collection: String, relativePath: String!): DocumentNode!
createDocument(collection: String, relativePath: String!, params: DocumentMutation!): DocumentNode!
createFolder(collection: String, relativePath: String!): DocumentNode!
updateNews(relativePath: String!, params: NewsMutation!): News!
createNews(relativePath: String!, params: NewsMutation!): News!
updateEditorial(relativePath: String!, params: EditorialMutation!): Editorial!
createEditorial(relativePath: String!, params: EditorialMutation!): Editorial!
}
input DocumentUpdateMutation {
news: NewsMutation
editorial: EditorialMutation
relativePath: String
}
input DocumentMutation {
news: NewsMutation
editorial: EditorialMutation
}
input NewsGalleryMutation {
image: String
}
input NewsMutation {
locale: String
title: String
date: String
slug: String
place: String
country: String
city: String
thumbnail: String
thumbnail_square: String
tags: [String]
gallery: [NewsGalleryMutation]
youtube: String
draft: Boolean
body: JSON
}
input EditorialGalleryMutation {
image: String
}
input EditorialMutation {
locale: String
title: String
date: String
slug: String
place: String
country: String
city: String
thumbnail: String
thumbnail_square: String
tags: [String]
gallery: [EditorialGalleryMutation]
youtube: String
draft: Boolean
body: JSON
}
schema {
query: Query
mutation: Mutation
}

View File

@ -1 +0,0 @@
[]

View File

@ -1,210 +0,0 @@
export function gql(strings, ...args) {
let str = "";
strings.forEach((string, i) => {
str += string + (args[i] || "");
});
return str;
}
export const NewsPartsFragmentDoc = gql`
fragment NewsParts on News {
__typename
locale
title
date
slug
place
country
city
thumbnail
thumbnail_square
tags
gallery {
__typename
image
}
youtube
draft
body
}
`;
export const EditorialPartsFragmentDoc = gql`
fragment EditorialParts on Editorial {
__typename
locale
title
date
slug
place
country
city
thumbnail
thumbnail_square
tags
gallery {
__typename
image
}
youtube
draft
body
}
`;
export const NewsDocument = gql`
query news($relativePath: String!) {
news(relativePath: $relativePath) {
... on Document {
_sys {
filename
basename
hasReferences
breadcrumbs
path
relativePath
extension
}
id
}
...NewsParts
}
}
${NewsPartsFragmentDoc}`;
export const NewsConnectionDocument = gql`
query newsConnection($before: String, $after: String, $first: Float, $last: Float, $sort: String, $filter: NewsFilter) {
newsConnection(
before: $before
after: $after
first: $first
last: $last
sort: $sort
filter: $filter
) {
pageInfo {
hasPreviousPage
hasNextPage
startCursor
endCursor
}
totalCount
edges {
cursor
node {
... on Document {
_sys {
filename
basename
hasReferences
breadcrumbs
path
relativePath
extension
}
id
}
...NewsParts
}
}
}
}
${NewsPartsFragmentDoc}`;
export const EditorialDocument = gql`
query editorial($relativePath: String!) {
editorial(relativePath: $relativePath) {
... on Document {
_sys {
filename
basename
hasReferences
breadcrumbs
path
relativePath
extension
}
id
}
...EditorialParts
}
}
${EditorialPartsFragmentDoc}`;
export const EditorialConnectionDocument = gql`
query editorialConnection($before: String, $after: String, $first: Float, $last: Float, $sort: String, $filter: EditorialFilter) {
editorialConnection(
before: $before
after: $after
first: $first
last: $last
sort: $sort
filter: $filter
) {
pageInfo {
hasPreviousPage
hasNextPage
startCursor
endCursor
}
totalCount
edges {
cursor
node {
... on Document {
_sys {
filename
basename
hasReferences
breadcrumbs
path
relativePath
extension
}
id
}
...EditorialParts
}
}
}
}
${EditorialPartsFragmentDoc}`;
export function getSdk(requester) {
return {
news(variables, options) {
return requester(NewsDocument, variables, options);
},
newsConnection(variables, options) {
return requester(NewsConnectionDocument, variables, options);
},
editorial(variables, options) {
return requester(EditorialDocument, variables, options);
},
editorialConnection(variables, options) {
return requester(EditorialConnectionDocument, variables, options);
}
};
}
import { createClient } from "tinacms/dist/client";
const generateRequester = (client) => {
const requester = async (doc, vars, options) => {
let url = client.apiUrl;
if (options?.branch) {
const index = client.apiUrl.lastIndexOf("/");
url = client.apiUrl.substring(0, index + 1) + options.branch;
}
const data = await client.request({
query: doc,
variables: vars,
url
}, options);
return { data: data?.data, errors: data?.errors, query: doc, variables: vars || {} };
};
return requester;
};
export const ExperimentalGetTinaClient = () => getSdk(
generateRequester(
createClient({
url: "http://localhost:4001/graphql",
queries
})
)
);
export const queries = (client) => {
const requester = generateRequester(client);
return getSdk(requester);
};

View File

@ -1,737 +0,0 @@
//@ts-nocheck
// DO NOT MODIFY THIS FILE. This file is automatically generated by Tina
export function gql(strings: TemplateStringsArray, ...args: string[]): string {
let str = ''
strings.forEach((string, i) => {
str += string + (args[i] || '')
})
return str
}
export type Maybe<T> = T | null;
export type InputMaybe<T> = Maybe<T>;
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };
export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
/** All built-in and custom scalars, mapped to their actual values */
export type Scalars = {
ID: { input: string; output: string; }
String: { input: string; output: string; }
Boolean: { input: boolean; output: boolean; }
Int: { input: number; output: number; }
Float: { input: number; output: number; }
/** References another document, used as a foreign key */
Reference: { input: any; output: any; }
JSON: { input: any; output: any; }
};
export type SystemInfo = {
__typename?: 'SystemInfo';
filename: Scalars['String']['output'];
title?: Maybe<Scalars['String']['output']>;
basename: Scalars['String']['output'];
hasReferences?: Maybe<Scalars['Boolean']['output']>;
breadcrumbs: Array<Scalars['String']['output']>;
path: Scalars['String']['output'];
relativePath: Scalars['String']['output'];
extension: Scalars['String']['output'];
template: Scalars['String']['output'];
collection: Collection;
};
export type SystemInfoBreadcrumbsArgs = {
excludeExtension?: InputMaybe<Scalars['Boolean']['input']>;
};
export type Folder = {
__typename?: 'Folder';
name: Scalars['String']['output'];
path: Scalars['String']['output'];
};
export type PageInfo = {
__typename?: 'PageInfo';
hasPreviousPage: Scalars['Boolean']['output'];
hasNextPage: Scalars['Boolean']['output'];
startCursor: Scalars['String']['output'];
endCursor: Scalars['String']['output'];
};
export type Node = {
id: Scalars['ID']['output'];
};
export type Document = {
id: Scalars['ID']['output'];
_sys?: Maybe<SystemInfo>;
_values: Scalars['JSON']['output'];
};
/** A relay-compliant pagination connection */
export type Connection = {
totalCount: Scalars['Float']['output'];
pageInfo: PageInfo;
};
export type Query = {
__typename?: 'Query';
getOptimizedQuery?: Maybe<Scalars['String']['output']>;
collection: Collection;
collections: Array<Collection>;
node: Node;
document: DocumentNode;
news: News;
newsConnection: NewsConnection;
editorial: Editorial;
editorialConnection: EditorialConnection;
};
export type QueryGetOptimizedQueryArgs = {
queryString: Scalars['String']['input'];
};
export type QueryCollectionArgs = {
collection?: InputMaybe<Scalars['String']['input']>;
};
export type QueryNodeArgs = {
id?: InputMaybe<Scalars['String']['input']>;
};
export type QueryDocumentArgs = {
collection?: InputMaybe<Scalars['String']['input']>;
relativePath?: InputMaybe<Scalars['String']['input']>;
};
export type QueryNewsArgs = {
relativePath?: InputMaybe<Scalars['String']['input']>;
};
export type QueryNewsConnectionArgs = {
before?: InputMaybe<Scalars['String']['input']>;
after?: InputMaybe<Scalars['String']['input']>;
first?: InputMaybe<Scalars['Float']['input']>;
last?: InputMaybe<Scalars['Float']['input']>;
sort?: InputMaybe<Scalars['String']['input']>;
filter?: InputMaybe<NewsFilter>;
};
export type QueryEditorialArgs = {
relativePath?: InputMaybe<Scalars['String']['input']>;
};
export type QueryEditorialConnectionArgs = {
before?: InputMaybe<Scalars['String']['input']>;
after?: InputMaybe<Scalars['String']['input']>;
first?: InputMaybe<Scalars['Float']['input']>;
last?: InputMaybe<Scalars['Float']['input']>;
sort?: InputMaybe<Scalars['String']['input']>;
filter?: InputMaybe<EditorialFilter>;
};
export type DocumentFilter = {
news?: InputMaybe<NewsFilter>;
editorial?: InputMaybe<EditorialFilter>;
};
export type DocumentConnectionEdges = {
__typename?: 'DocumentConnectionEdges';
cursor: Scalars['String']['output'];
node?: Maybe<DocumentNode>;
};
export type DocumentConnection = Connection & {
__typename?: 'DocumentConnection';
pageInfo: PageInfo;
totalCount: Scalars['Float']['output'];
edges?: Maybe<Array<Maybe<DocumentConnectionEdges>>>;
};
export type Collection = {
__typename?: 'Collection';
name: Scalars['String']['output'];
slug: Scalars['String']['output'];
label?: Maybe<Scalars['String']['output']>;
path: Scalars['String']['output'];
format?: Maybe<Scalars['String']['output']>;
matches?: Maybe<Scalars['String']['output']>;
templates?: Maybe<Array<Maybe<Scalars['JSON']['output']>>>;
fields?: Maybe<Array<Maybe<Scalars['JSON']['output']>>>;
documents: DocumentConnection;
};
export type CollectionDocumentsArgs = {
before?: InputMaybe<Scalars['String']['input']>;
after?: InputMaybe<Scalars['String']['input']>;
first?: InputMaybe<Scalars['Float']['input']>;
last?: InputMaybe<Scalars['Float']['input']>;
sort?: InputMaybe<Scalars['String']['input']>;
filter?: InputMaybe<DocumentFilter>;
folder?: InputMaybe<Scalars['String']['input']>;
};
export type DocumentNode = News | Editorial | Folder;
export type NewsGallery = {
__typename?: 'NewsGallery';
image?: Maybe<Scalars['String']['output']>;
};
export type News = Node & Document & {
__typename?: 'News';
locale?: Maybe<Scalars['String']['output']>;
title: Scalars['String']['output'];
date: Scalars['String']['output'];
slug?: Maybe<Scalars['String']['output']>;
place?: Maybe<Scalars['String']['output']>;
country?: Maybe<Scalars['String']['output']>;
city?: Maybe<Scalars['String']['output']>;
thumbnail?: Maybe<Scalars['String']['output']>;
thumbnail_square?: Maybe<Scalars['String']['output']>;
tags?: Maybe<Array<Maybe<Scalars['String']['output']>>>;
gallery?: Maybe<Array<Maybe<NewsGallery>>>;
youtube?: Maybe<Scalars['String']['output']>;
draft?: Maybe<Scalars['Boolean']['output']>;
body?: Maybe<Scalars['JSON']['output']>;
id: Scalars['ID']['output'];
_sys: SystemInfo;
_values: Scalars['JSON']['output'];
};
export type StringFilter = {
startsWith?: InputMaybe<Scalars['String']['input']>;
eq?: InputMaybe<Scalars['String']['input']>;
exists?: InputMaybe<Scalars['Boolean']['input']>;
in?: InputMaybe<Array<InputMaybe<Scalars['String']['input']>>>;
};
export type DatetimeFilter = {
after?: InputMaybe<Scalars['String']['input']>;
before?: InputMaybe<Scalars['String']['input']>;
eq?: InputMaybe<Scalars['String']['input']>;
exists?: InputMaybe<Scalars['Boolean']['input']>;
in?: InputMaybe<Array<InputMaybe<Scalars['String']['input']>>>;
};
export type ImageFilter = {
startsWith?: InputMaybe<Scalars['String']['input']>;
eq?: InputMaybe<Scalars['String']['input']>;
exists?: InputMaybe<Scalars['Boolean']['input']>;
in?: InputMaybe<Array<InputMaybe<Scalars['String']['input']>>>;
};
export type NewsGalleryFilter = {
image?: InputMaybe<ImageFilter>;
};
export type BooleanFilter = {
eq?: InputMaybe<Scalars['Boolean']['input']>;
exists?: InputMaybe<Scalars['Boolean']['input']>;
};
export type RichTextFilter = {
startsWith?: InputMaybe<Scalars['String']['input']>;
eq?: InputMaybe<Scalars['String']['input']>;
exists?: InputMaybe<Scalars['Boolean']['input']>;
};
export type NewsFilter = {
locale?: InputMaybe<StringFilter>;
title?: InputMaybe<StringFilter>;
date?: InputMaybe<DatetimeFilter>;
slug?: InputMaybe<StringFilter>;
place?: InputMaybe<StringFilter>;
country?: InputMaybe<StringFilter>;
city?: InputMaybe<StringFilter>;
thumbnail?: InputMaybe<ImageFilter>;
thumbnail_square?: InputMaybe<ImageFilter>;
tags?: InputMaybe<StringFilter>;
gallery?: InputMaybe<NewsGalleryFilter>;
youtube?: InputMaybe<StringFilter>;
draft?: InputMaybe<BooleanFilter>;
body?: InputMaybe<RichTextFilter>;
};
export type NewsConnectionEdges = {
__typename?: 'NewsConnectionEdges';
cursor: Scalars['String']['output'];
node?: Maybe<News>;
};
export type NewsConnection = Connection & {
__typename?: 'NewsConnection';
pageInfo: PageInfo;
totalCount: Scalars['Float']['output'];
edges?: Maybe<Array<Maybe<NewsConnectionEdges>>>;
};
export type EditorialGallery = {
__typename?: 'EditorialGallery';
image?: Maybe<Scalars['String']['output']>;
};
export type Editorial = Node & Document & {
__typename?: 'Editorial';
locale?: Maybe<Scalars['String']['output']>;
title: Scalars['String']['output'];
date: Scalars['String']['output'];
slug?: Maybe<Scalars['String']['output']>;
place?: Maybe<Scalars['String']['output']>;
country?: Maybe<Scalars['String']['output']>;
city?: Maybe<Scalars['String']['output']>;
thumbnail?: Maybe<Scalars['String']['output']>;
thumbnail_square?: Maybe<Scalars['String']['output']>;
tags?: Maybe<Array<Maybe<Scalars['String']['output']>>>;
gallery?: Maybe<Array<Maybe<EditorialGallery>>>;
youtube?: Maybe<Scalars['String']['output']>;
draft?: Maybe<Scalars['Boolean']['output']>;
body?: Maybe<Scalars['JSON']['output']>;
id: Scalars['ID']['output'];
_sys: SystemInfo;
_values: Scalars['JSON']['output'];
};
export type EditorialGalleryFilter = {
image?: InputMaybe<ImageFilter>;
};
export type EditorialFilter = {
locale?: InputMaybe<StringFilter>;
title?: InputMaybe<StringFilter>;
date?: InputMaybe<DatetimeFilter>;
slug?: InputMaybe<StringFilter>;
place?: InputMaybe<StringFilter>;
country?: InputMaybe<StringFilter>;
city?: InputMaybe<StringFilter>;
thumbnail?: InputMaybe<ImageFilter>;
thumbnail_square?: InputMaybe<ImageFilter>;
tags?: InputMaybe<StringFilter>;
gallery?: InputMaybe<EditorialGalleryFilter>;
youtube?: InputMaybe<StringFilter>;
draft?: InputMaybe<BooleanFilter>;
body?: InputMaybe<RichTextFilter>;
};
export type EditorialConnectionEdges = {
__typename?: 'EditorialConnectionEdges';
cursor: Scalars['String']['output'];
node?: Maybe<Editorial>;
};
export type EditorialConnection = Connection & {
__typename?: 'EditorialConnection';
pageInfo: PageInfo;
totalCount: Scalars['Float']['output'];
edges?: Maybe<Array<Maybe<EditorialConnectionEdges>>>;
};
export type Mutation = {
__typename?: 'Mutation';
addPendingDocument: DocumentNode;
updateDocument: DocumentNode;
deleteDocument: DocumentNode;
createDocument: DocumentNode;
createFolder: DocumentNode;
updateNews: News;
createNews: News;
updateEditorial: Editorial;
createEditorial: Editorial;
};
export type MutationAddPendingDocumentArgs = {
collection: Scalars['String']['input'];
relativePath: Scalars['String']['input'];
template?: InputMaybe<Scalars['String']['input']>;
};
export type MutationUpdateDocumentArgs = {
collection?: InputMaybe<Scalars['String']['input']>;
relativePath: Scalars['String']['input'];
params: DocumentUpdateMutation;
};
export type MutationDeleteDocumentArgs = {
collection?: InputMaybe<Scalars['String']['input']>;
relativePath: Scalars['String']['input'];
};
export type MutationCreateDocumentArgs = {
collection?: InputMaybe<Scalars['String']['input']>;
relativePath: Scalars['String']['input'];
params: DocumentMutation;
};
export type MutationCreateFolderArgs = {
collection?: InputMaybe<Scalars['String']['input']>;
relativePath: Scalars['String']['input'];
};
export type MutationUpdateNewsArgs = {
relativePath: Scalars['String']['input'];
params: NewsMutation;
};
export type MutationCreateNewsArgs = {
relativePath: Scalars['String']['input'];
params: NewsMutation;
};
export type MutationUpdateEditorialArgs = {
relativePath: Scalars['String']['input'];
params: EditorialMutation;
};
export type MutationCreateEditorialArgs = {
relativePath: Scalars['String']['input'];
params: EditorialMutation;
};
export type DocumentUpdateMutation = {
news?: InputMaybe<NewsMutation>;
editorial?: InputMaybe<EditorialMutation>;
relativePath?: InputMaybe<Scalars['String']['input']>;
};
export type DocumentMutation = {
news?: InputMaybe<NewsMutation>;
editorial?: InputMaybe<EditorialMutation>;
};
export type NewsGalleryMutation = {
image?: InputMaybe<Scalars['String']['input']>;
};
export type NewsMutation = {
locale?: InputMaybe<Scalars['String']['input']>;
title?: InputMaybe<Scalars['String']['input']>;
date?: InputMaybe<Scalars['String']['input']>;
slug?: InputMaybe<Scalars['String']['input']>;
place?: InputMaybe<Scalars['String']['input']>;
country?: InputMaybe<Scalars['String']['input']>;
city?: InputMaybe<Scalars['String']['input']>;
thumbnail?: InputMaybe<Scalars['String']['input']>;
thumbnail_square?: InputMaybe<Scalars['String']['input']>;
tags?: InputMaybe<Array<InputMaybe<Scalars['String']['input']>>>;
gallery?: InputMaybe<Array<InputMaybe<NewsGalleryMutation>>>;
youtube?: InputMaybe<Scalars['String']['input']>;
draft?: InputMaybe<Scalars['Boolean']['input']>;
body?: InputMaybe<Scalars['JSON']['input']>;
};
export type EditorialGalleryMutation = {
image?: InputMaybe<Scalars['String']['input']>;
};
export type EditorialMutation = {
locale?: InputMaybe<Scalars['String']['input']>;
title?: InputMaybe<Scalars['String']['input']>;
date?: InputMaybe<Scalars['String']['input']>;
slug?: InputMaybe<Scalars['String']['input']>;
place?: InputMaybe<Scalars['String']['input']>;
country?: InputMaybe<Scalars['String']['input']>;
city?: InputMaybe<Scalars['String']['input']>;
thumbnail?: InputMaybe<Scalars['String']['input']>;
thumbnail_square?: InputMaybe<Scalars['String']['input']>;
tags?: InputMaybe<Array<InputMaybe<Scalars['String']['input']>>>;
gallery?: InputMaybe<Array<InputMaybe<EditorialGalleryMutation>>>;
youtube?: InputMaybe<Scalars['String']['input']>;
draft?: InputMaybe<Scalars['Boolean']['input']>;
body?: InputMaybe<Scalars['JSON']['input']>;
};
export type NewsPartsFragment = { __typename: 'News', locale?: string | null, title: string, date: string, slug?: string | null, place?: string | null, country?: string | null, city?: string | null, thumbnail?: string | null, thumbnail_square?: string | null, tags?: Array<string | null> | null, youtube?: string | null, draft?: boolean | null, body?: any | null, gallery?: Array<{ __typename: 'NewsGallery', image?: string | null } | null> | null };
export type EditorialPartsFragment = { __typename: 'Editorial', locale?: string | null, title: string, date: string, slug?: string | null, place?: string | null, country?: string | null, city?: string | null, thumbnail?: string | null, thumbnail_square?: string | null, tags?: Array<string | null> | null, youtube?: string | null, draft?: boolean | null, body?: any | null, gallery?: Array<{ __typename: 'EditorialGallery', image?: string | null } | null> | null };
export type NewsQueryVariables = Exact<{
relativePath: Scalars['String']['input'];
}>;
export type NewsQuery = { __typename?: 'Query', news: { __typename: 'News', id: string, locale?: string | null, title: string, date: string, slug?: string | null, place?: string | null, country?: string | null, city?: string | null, thumbnail?: string | null, thumbnail_square?: string | null, tags?: Array<string | null> | null, youtube?: string | null, draft?: boolean | null, body?: any | null, _sys: { __typename?: 'SystemInfo', filename: string, basename: string, hasReferences?: boolean | null, breadcrumbs: Array<string>, path: string, relativePath: string, extension: string }, gallery?: Array<{ __typename: 'NewsGallery', image?: string | null } | null> | null } };
export type NewsConnectionQueryVariables = Exact<{
before?: InputMaybe<Scalars['String']['input']>;
after?: InputMaybe<Scalars['String']['input']>;
first?: InputMaybe<Scalars['Float']['input']>;
last?: InputMaybe<Scalars['Float']['input']>;
sort?: InputMaybe<Scalars['String']['input']>;
filter?: InputMaybe<NewsFilter>;
}>;
export type NewsConnectionQuery = { __typename?: 'Query', newsConnection: { __typename?: 'NewsConnection', totalCount: number, pageInfo: { __typename?: 'PageInfo', hasPreviousPage: boolean, hasNextPage: boolean, startCursor: string, endCursor: string }, edges?: Array<{ __typename?: 'NewsConnectionEdges', cursor: string, node?: { __typename: 'News', id: string, locale?: string | null, title: string, date: string, slug?: string | null, place?: string | null, country?: string | null, city?: string | null, thumbnail?: string | null, thumbnail_square?: string | null, tags?: Array<string | null> | null, youtube?: string | null, draft?: boolean | null, body?: any | null, _sys: { __typename?: 'SystemInfo', filename: string, basename: string, hasReferences?: boolean | null, breadcrumbs: Array<string>, path: string, relativePath: string, extension: string }, gallery?: Array<{ __typename: 'NewsGallery', image?: string | null } | null> | null } | null } | null> | null } };
export type EditorialQueryVariables = Exact<{
relativePath: Scalars['String']['input'];
}>;
export type EditorialQuery = { __typename?: 'Query', editorial: { __typename: 'Editorial', id: string, locale?: string | null, title: string, date: string, slug?: string | null, place?: string | null, country?: string | null, city?: string | null, thumbnail?: string | null, thumbnail_square?: string | null, tags?: Array<string | null> | null, youtube?: string | null, draft?: boolean | null, body?: any | null, _sys: { __typename?: 'SystemInfo', filename: string, basename: string, hasReferences?: boolean | null, breadcrumbs: Array<string>, path: string, relativePath: string, extension: string }, gallery?: Array<{ __typename: 'EditorialGallery', image?: string | null } | null> | null } };
export type EditorialConnectionQueryVariables = Exact<{
before?: InputMaybe<Scalars['String']['input']>;
after?: InputMaybe<Scalars['String']['input']>;
first?: InputMaybe<Scalars['Float']['input']>;
last?: InputMaybe<Scalars['Float']['input']>;
sort?: InputMaybe<Scalars['String']['input']>;
filter?: InputMaybe<EditorialFilter>;
}>;
export type EditorialConnectionQuery = { __typename?: 'Query', editorialConnection: { __typename?: 'EditorialConnection', totalCount: number, pageInfo: { __typename?: 'PageInfo', hasPreviousPage: boolean, hasNextPage: boolean, startCursor: string, endCursor: string }, edges?: Array<{ __typename?: 'EditorialConnectionEdges', cursor: string, node?: { __typename: 'Editorial', id: string, locale?: string | null, title: string, date: string, slug?: string | null, place?: string | null, country?: string | null, city?: string | null, thumbnail?: string | null, thumbnail_square?: string | null, tags?: Array<string | null> | null, youtube?: string | null, draft?: boolean | null, body?: any | null, _sys: { __typename?: 'SystemInfo', filename: string, basename: string, hasReferences?: boolean | null, breadcrumbs: Array<string>, path: string, relativePath: string, extension: string }, gallery?: Array<{ __typename: 'EditorialGallery', image?: string | null } | null> | null } | null } | null> | null } };
export const NewsPartsFragmentDoc = gql`
fragment NewsParts on News {
__typename
locale
title
date
slug
place
country
city
thumbnail
thumbnail_square
tags
gallery {
__typename
image
}
youtube
draft
body
}
`;
export const EditorialPartsFragmentDoc = gql`
fragment EditorialParts on Editorial {
__typename
locale
title
date
slug
place
country
city
thumbnail
thumbnail_square
tags
gallery {
__typename
image
}
youtube
draft
body
}
`;
export const NewsDocument = gql`
query news($relativePath: String!) {
news(relativePath: $relativePath) {
... on Document {
_sys {
filename
basename
hasReferences
breadcrumbs
path
relativePath
extension
}
id
}
...NewsParts
}
}
${NewsPartsFragmentDoc}`;
export const NewsConnectionDocument = gql`
query newsConnection($before: String, $after: String, $first: Float, $last: Float, $sort: String, $filter: NewsFilter) {
newsConnection(
before: $before
after: $after
first: $first
last: $last
sort: $sort
filter: $filter
) {
pageInfo {
hasPreviousPage
hasNextPage
startCursor
endCursor
}
totalCount
edges {
cursor
node {
... on Document {
_sys {
filename
basename
hasReferences
breadcrumbs
path
relativePath
extension
}
id
}
...NewsParts
}
}
}
}
${NewsPartsFragmentDoc}`;
export const EditorialDocument = gql`
query editorial($relativePath: String!) {
editorial(relativePath: $relativePath) {
... on Document {
_sys {
filename
basename
hasReferences
breadcrumbs
path
relativePath
extension
}
id
}
...EditorialParts
}
}
${EditorialPartsFragmentDoc}`;
export const EditorialConnectionDocument = gql`
query editorialConnection($before: String, $after: String, $first: Float, $last: Float, $sort: String, $filter: EditorialFilter) {
editorialConnection(
before: $before
after: $after
first: $first
last: $last
sort: $sort
filter: $filter
) {
pageInfo {
hasPreviousPage
hasNextPage
startCursor
endCursor
}
totalCount
edges {
cursor
node {
... on Document {
_sys {
filename
basename
hasReferences
breadcrumbs
path
relativePath
extension
}
id
}
...EditorialParts
}
}
}
}
${EditorialPartsFragmentDoc}`;
export type Requester<C= {}> = <R, V>(doc: DocumentNode, vars?: V, options?: C) => Promise<R>
export function getSdk<C>(requester: Requester<C>) {
return {
news(variables: NewsQueryVariables, options?: C): Promise<{data: NewsQuery, errors?: { message: string, locations: { line: number, column: number }[], path: string[] }[], variables: NewsQueryVariables, query: string}> {
return requester<{data: NewsQuery, errors?: { message: string, locations: { line: number, column: number }[], path: string[] }[], variables: NewsQueryVariables, query: string}, NewsQueryVariables>(NewsDocument, variables, options);
},
newsConnection(variables?: NewsConnectionQueryVariables, options?: C): Promise<{data: NewsConnectionQuery, errors?: { message: string, locations: { line: number, column: number }[], path: string[] }[], variables: NewsConnectionQueryVariables, query: string}> {
return requester<{data: NewsConnectionQuery, errors?: { message: string, locations: { line: number, column: number }[], path: string[] }[], variables: NewsConnectionQueryVariables, query: string}, NewsConnectionQueryVariables>(NewsConnectionDocument, variables, options);
},
editorial(variables: EditorialQueryVariables, options?: C): Promise<{data: EditorialQuery, errors?: { message: string, locations: { line: number, column: number }[], path: string[] }[], variables: EditorialQueryVariables, query: string}> {
return requester<{data: EditorialQuery, errors?: { message: string, locations: { line: number, column: number }[], path: string[] }[], variables: EditorialQueryVariables, query: string}, EditorialQueryVariables>(EditorialDocument, variables, options);
},
editorialConnection(variables?: EditorialConnectionQueryVariables, options?: C): Promise<{data: EditorialConnectionQuery, errors?: { message: string, locations: { line: number, column: number }[], path: string[] }[], variables: EditorialConnectionQueryVariables, query: string}> {
return requester<{data: EditorialConnectionQuery, errors?: { message: string, locations: { line: number, column: number }[], path: string[] }[], variables: EditorialConnectionQueryVariables, query: string}, EditorialConnectionQueryVariables>(EditorialConnectionDocument, variables, options);
}
};
}
export type Sdk = ReturnType<typeof getSdk>;
// TinaSDK generated code
import { createClient, TinaClient } from "tinacms/dist/client";
const generateRequester = (
client: TinaClient,
) => {
const requester: (
doc: any,
vars?: any,
options?: {
branch?: string,
/**
* Aside from `method` and `body`, all fetch options are passed
* through to underlying fetch request
*/
fetchOptions?: Omit<Parameters<typeof fetch>[1], 'body' | 'method'>,
},
client
) => Promise<any> = async (doc, vars, options) => {
let url = client.apiUrl
if (options?.branch) {
const index = client.apiUrl.lastIndexOf('/')
url = client.apiUrl.substring(0, index + 1) + options.branch
}
const data = await client.request({
query: doc,
variables: vars,
url,
}, options)
return { data: data?.data, errors: data?.errors, query: doc, variables: vars || {} }
}
return requester
}
/**
* @experimental this class can be used but may change in the future
**/
export const ExperimentalGetTinaClient = () =>
getSdk(
generateRequester(
createClient({
url: "http://localhost:4001/graphql",
queries,
})
)
)
export const queries = (
client: TinaClient,
) => {
const requester = generateRequester(client)
return getSdk(requester)
}

View File

@ -1,9 +0,0 @@
import { TinaAuth } from "tinacms";
const branch = process.env.HEAD || process.env.VERCEL_GIT_COMMIT_REF || "main";
export const auth = TinaAuth({
branch,
clientId: null,
token: null,
});

View File

@ -1,241 +0,0 @@
import { defineConfig } from "tinacms";
const branch = process.env.HEAD || process.env.VERCEL_GIT_COMMIT_REF || "main";
export default defineConfig({
branch,
clientId: null,
token: null,
build: {
outputFolder: "admin",
publicFolder: "public",
},
media: {
tina: {
mediaRoot: "public/images",
publicFolder: "public",
},
},
schema: {
collections: [
{
name: "news",
label: "News",
path: "src/content/news",
format: "md",
match: {
include: "**/*",
},
ui: {
filename: {
readonly: false,
slugify: (values) => {
return values?.slug?.toLowerCase() || values?.title?.toLowerCase().replace(/ /g, '-');
},
},
},
fields: [
{
type: "string",
name: "locale",
label: "Language",
options: [
{ label: "Español", value: "es" },
{ label: "English", value: "en" },
{ label: "Português", value: "pt" },
{ label: "Kinyarwanda", value: "rw" },
{ label: "Frances", value: "fr" }
],
},
{
type: "string",
name: "title",
label: "Title",
isTitle: true,
required: true,
},
{
type: "datetime",
name: "date",
label: "Date",
required: true,
},
{
type: "string",
name: "slug",
label: "Slug",
},
{
type: "string",
name: "place",
label: "Place",
},
{
type: "string",
name: "country",
label: "Country",
},
{
type: "string",
name: "city",
label: "City",
},
{
type: "image",
name: "thumbnail",
label: "Thumbnail URL",
},
{
type: "image",
name: "thumbnail_square",
label: "Thumbnail Square URL",
},
{
type: "string",
name: "tags",
label: "Tags",
list: true,
},
{
type: "object",
name: "gallery",
label: "Gallery",
list: true,
fields: [
{
type: "image",
name: "image",
label: "Image",
},
],
},
{
type: "string",
name: "youtube",
label: "YouTube ID",
},
{
type: "boolean",
name: "draft",
label: "Draft",
},
{
type: "rich-text",
name: "body",
label: "Content",
isBody: true,
},
],
},
{
name: "editorial",
label: "Editorial",
path: "src/content/editorial",
format: "md",
match: {
include: "**/*",
},
ui: {
filename: {
readonly: false,
slugify: (values) => {
return values?.slug?.toLowerCase() || values?.title?.toLowerCase().replace(/ /g, '-');
},
},
},
fields: [
{
type: "string",
name: "locale",
label: "Language",
options: [
{ label: "Español", value: "es" },
{ label: "English", value: "en" },
{ label: "Português", value: "pt" },
{ label: "Kinyarwanda", value: "rw" },
{ label: "Frances", value: "fr" }
],
},
{
type: "string",
name: "title",
label: "Title",
isTitle: true,
required: true,
},
{
type: "datetime",
name: "date",
label: "Date",
required: true,
},
{
type: "string",
name: "slug",
label: "Slug",
},
{
type: "string",
name: "place",
label: "Place",
},
{
type: "string",
name: "country",
label: "Country",
},
{
type: "string",
name: "city",
label: "City",
},
{
type: "image",
name: "thumbnail",
label: "Thumbnail URL",
},
{
type: "image",
name: "thumbnail_square",
label: "Thumbnail Square URL",
},
{
type: "string",
name: "tags",
label: "Tags",
list: true,
},
{
type: "object",
name: "gallery",
label: "Gallery",
list: true,
fields: [
{
type: "image",
name: "image",
label: "Image",
},
],
},
{
type: "string",
name: "youtube",
label: "YouTube ID",
},
{
type: "boolean",
name: "draft",
label: "Draft",
},
{
type: "rich-text",
name: "body",
label: "Content",
isBody: true,
},
],
},
],
},
});

File diff suppressed because one or more lines are too long