Compare commits

..

No commits in common. "payload" and "main" have entirely different histories.

27 changed files with 2000 additions and 11667 deletions

View File

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

11609
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -0,0 +1,8 @@
-- 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

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

View File

@ -0,0 +1,24 @@
/*
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

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

19
prisma/schema.prisma Normal file
View File

@ -0,0 +1,19 @@
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 /> {locationArray.filter(Boolean).join(', ')}<br />
({nicedate}): ({nicedate}):
</p> </p>
<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> <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>
<div class="overflow-hidden"> <div class="overflow-hidden">
<a href={`/${locale}/${getLocalizedRoute(routeKey, locale)}/${data.data.slug}`}> <a href={`/${locale}/${getLocalizedRoute(routeKey, locale)}/${data.id}`}>
<Image <Image
src={data.data.thumbnail.url} src={data.data.thumbnail}
alt={data.data.title} alt={data.data.title}
class="aspect-square object-cover transition-transform duration-300 hover:scale-110" class="aspect-square object-cover transition-transform duration-300 hover:scale-110"
/> />
@ -45,7 +45,7 @@ locationArray.filter(Boolean).join(', ');
</div> </div>
<div class="mt-8"> <div class="mt-8">
<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"> <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">
{tl(routeKey + ".fullnew")} {tl(routeKey + ".fullnew")}
<Icon name="ph:arrow-right" class="transform group-hover:translate-x-1 transition-transform" /> <Icon name="ph:arrow-right" class="transform group-hover:translate-x-1 transition-transform" />
</a> </a>

View File

@ -27,7 +27,7 @@ const location = [data.data.city, data.data.state, countryName].filter(Boolean).
const newsUrl = `/${locale}/${getLocalizedRoute(routeKey, locale)}/${data.id}`; const newsUrl = `/${locale}/${getLocalizedRoute(routeKey, locale)}/${data.id}`;
const rawContent = data.data?.body || ""; const rawContent = content?.body || "";
const plainText = rawContent.replace(/^#.*$/gm, "").replace(/^###.*$/gm, "").replace(/\*\*([^*]+)\*\*/g, "$1").replace(/\*([^*]+)\*/g, "$1").replace(/_([^_]+)_/g, "$1").replace(/\[([^\]]+)\]\([^)]+\)/g, "$1").replace(/^>.*$/gm, "").replace(/`[^`]+`/g, "").replace(/^[-*]\s+/gm, "").trim(); const plainText = rawContent.replace(/^#.*$/gm, "").replace(/^###.*$/gm, "").replace(/\*\*([^*]+)\*\*/g, "$1").replace(/\*([^*]+)\*/g, "$1").replace(/_([^_]+)_/g, "$1").replace(/\[([^\]]+)\]\([^)]+\)/g, "$1").replace(/^>.*$/gm, "").replace(/`[^`]+`/g, "").replace(/^[-*]\s+/gm, "").trim();
const words = plainText.split(/\s+/).filter((w) => w.length > 0).slice(0, 40); const words = plainText.split(/\s+/).filter((w) => w.length > 0).slice(0, 40);
const excerpt = words.join(" ") + (words.length === 40 ? "..." : ""); const excerpt = words.join(" ") + (words.length === 40 ? "..." : "");
@ -36,7 +36,7 @@ const excerpt = words.join(" ") + (words.length === 40 ? "..." : "");
<a href={newsUrl} class="block group"> <a href={newsUrl} class="block group">
<article class="flex flex-col md:flex-row gap-6 md:gap-8 p-4 md:p-6 border-b border-tertiary/20 hover:bg-tertiary/5 transition-colors"> <article class="flex flex-col md:flex-row gap-6 md:gap-8 p-4 md:p-6 border-b border-tertiary/20 hover:bg-tertiary/5 transition-colors">
<div class="md:w-1/3 flex-shrink-0 overflow-hidden justify-center items-center flex"> <div class="md:w-1/3 flex-shrink-0 overflow-hidden justify-center items-center flex">
<Image src={data.data.thumbnail_square || data.data.thumbnail?.url} alt={data.data.title} width={480} class="w-full h-auto object-contain transform group-hover:scale-105 transition-transform duration-300" /> <Image src={data.data.thumbnail_square || data.data.thumbnail} alt={data.data.title} width={480} class="w-full h-auto object-contain transform group-hover:scale-105 transition-transform duration-300" />
</div> </div>
<div class="md:w-2/3 flex flex-col"> <div class="md:w-2/3 flex flex-col">
@ -52,7 +52,7 @@ const excerpt = words.join(" ") + (words.length === 40 ? "..." : "");
{data.data.tags && data.data.tags.length > 0 && ( {data.data.tags && data.data.tags.length > 0 && (
<div class="flex flex-nowrap md:flex-wrap gap-2 overflow-x-auto md:overflow-visible pb-2 md:pb-0 mb-4"> <div class="flex flex-nowrap md:flex-wrap gap-2 overflow-x-auto md:overflow-visible pb-2 md:pb-0 mb-4">
{data.data.tags.map((tag: string) => ( {data.data.tags.map((tag: string) => (
<span class="badge rounded-none bg-[#EBE6D2] border-none text-[#003421] whitespace-nowrap">{Tag}</span> <span class="badge rounded-none bg-[#EBE6D2] border-none text-[#003421] whitespace-nowrap">{tag}</span>
))} ))}
</div> </div>
)} )}

View File

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

View File

@ -3,41 +3,26 @@ import { glob, file } from 'astro/loaders';
import { z } from 'astro/zod'; import { z } from 'astro/zod';
const news = defineCollection({ 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({ schema: ({ image }) => z.object({
locale: z.string().describe("News main language"), locale: z.string().describe("News main language"),
title: z.string(), title: z.string(),
date: z.string(), date: z.date(),
slug: z.string(), draft: z.boolean().optional(),
draft: z.boolean().optional().nullable(), place: z.string().optional(),
place: z.string().optional().nullable(), order: z.number().optional(),
order: z.number().optional().nullable(), city: z.string().optional(),
city: z.string().optional().nullable(), state: z.string().optional(),
state: z.string().optional().nullable(), country: z.string().optional(),
country: z.string().optional().nullable(), thumbnail: image().optional().describe("Main news thumbnail image"),
thumbnail: z.object({ thumbnail_square: image().optional().describe("Main news thumbnail square image"),
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(), youtube: z.string().optional(),
tags: z.array(z.string()).optional().describe("News tags"), tags: z.array(z.string()).optional().describe("News tags"),
gallery: z.array(z.object({ gallery: z.array(z.object({
image: z.object({ image: image().optional(),
url: z.string().optional().nullable() text: z.string().optional(),
}).optional().nullable() text_alt: z.string().optional(),
})).optional().nullable(), })).optional().nullable()
body: z.string().nullable().optional()
}), }),
}); });
@ -47,7 +32,6 @@ const editorial = defineCollection({
locale: z.string().describe("Editorial main language"), locale: z.string().describe("Editorial main language"),
title: z.string(), title: z.string(),
date: z.date(), date: z.date(),
slug: z.string(),
draft: z.boolean().optional(), draft: z.boolean().optional(),
place: z.string().optional(), place: z.string().optional(),
order: z.number().optional(), order: z.number().optional(),

View File

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

1
tina/__generated__/_graphql.json generated Normal file

File diff suppressed because one or more lines are too long

1
tina/__generated__/_lookup.json generated Normal file
View File

@ -0,0 +1 @@
{"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"}}

1
tina/__generated__/_schema.json generated Normal file
View File

@ -0,0 +1 @@
{"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"}}}}

5
tina/__generated__/client.ts generated Normal file
View File

@ -0,0 +1,5 @@
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;

243
tina/__generated__/config.prebuild.jsx generated Normal file
View File

@ -0,0 +1,243 @@
// 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
};

41
tina/__generated__/frags.gql generated Normal file
View File

@ -0,0 +1,41 @@
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
}

109
tina/__generated__/queries.gql generated Normal file
View File

@ -0,0 +1,109 @@
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
}
}
}
}

306
tina/__generated__/schema.gql generated Normal file
View File

@ -0,0 +1,306 @@
# 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
}

1
tina/__generated__/static-media.json generated Normal file
View File

@ -0,0 +1 @@
[]

210
tina/__generated__/types.js generated Normal file
View File

@ -0,0 +1,210 @@
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);
};

737
tina/__generated__/types.ts generated Normal file
View File

@ -0,0 +1,737 @@
//@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)
}

9
tina/auth.ts Normal file
View File

@ -0,0 +1,9 @@
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,
});

241
tina/config.ts Normal file
View File

@ -0,0 +1,241 @@
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,
},
],
},
],
},
});

1
tina/tina-lock.json Normal file

File diff suppressed because one or more lines are too long