add tina and config of tina for news
This commit is contained in:
parent
f4ab194b2b
commit
bcac9d79ab
|
|
@ -7,6 +7,7 @@ import icon from "astro-icon";
|
||||||
import node from "@astrojs/node";
|
import node from "@astrojs/node";
|
||||||
|
|
||||||
import vue from "@astrojs/vue";
|
import vue from "@astrojs/vue";
|
||||||
|
import react from "@astrojs/react";
|
||||||
|
|
||||||
// https://astro.build/config
|
// https://astro.build/config
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
|
|
@ -16,7 +17,7 @@ export default defineConfig({
|
||||||
site: "https://centrodelreinodepazyjusticia.com/",
|
site: "https://centrodelreinodepazyjusticia.com/",
|
||||||
//base: '/mockup/',
|
//base: '/mockup/',
|
||||||
|
|
||||||
integrations: [markdoc(), icon(), vue()],
|
integrations: [markdoc(), icon(), vue(), react()],
|
||||||
|
|
||||||
i18n: {
|
i18n: {
|
||||||
locales: ["es", "en", "fr", "he", "uk", "pt-br"],
|
locales: ["es", "en", "fr", "he", "uk", "pt-br"],
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -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",
|
||||||
"preview": "astro preview",
|
"preview": "astro preview",
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/markdoc": "^0.15.10",
|
"@astrojs/markdoc": "^0.15.10",
|
||||||
"@astrojs/node": "^9.5.3",
|
"@astrojs/node": "^9.5.3",
|
||||||
|
"@astrojs/react": "^5.0.3",
|
||||||
"@astrojs/vue": "^5.1.4",
|
"@astrojs/vue": "^5.1.4",
|
||||||
"@coreui/icons": "^3.0.1",
|
"@coreui/icons": "^3.0.1",
|
||||||
"@dotenvx/dotenvx": "^1.52.0",
|
"@dotenvx/dotenvx": "^1.52.0",
|
||||||
|
|
@ -30,9 +31,13 @@
|
||||||
"dayjs": "^1.11.19",
|
"dayjs": "^1.11.19",
|
||||||
"googleapis": "^171.4.0",
|
"googleapis": "^171.4.0",
|
||||||
"prisma": "^6.19.2",
|
"prisma": "^6.19.2",
|
||||||
|
"react": "^19.2.5",
|
||||||
|
"react-dom": "^19.2.5",
|
||||||
"swiper": "^12.1.0",
|
"swiper": "^12.1.0",
|
||||||
"tailwindcss": "^4.1.18",
|
"tailwindcss": "^4.1.18",
|
||||||
"vue": "^3.5.28"
|
"vue": "^3.5.28",
|
||||||
|
"@tinacms/cli": "^2.2.2",
|
||||||
|
"tinacms": "^2.2.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@tailwindcss/typography": "^0.5.19",
|
"@tailwindcss/typography": "^0.5.19",
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
index.html
|
||||||
|
assets/
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1 @@
|
||||||
|
{"DocumentConnection":{"type":"DocumentConnection","resolveType":"multiCollectionDocumentList","collections":["news"]},"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"}}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
{"version":{"fullVersion":"2.2.3","major":"2","minor":"2","patch":"3"},"meta":{"flags":["experimentalData"]},"collections":[{"name":"news","label":"News","path":"src/content/news","format":"md","fields":[{"type":"string","name":"locale","label":"Language","options":[{"label":"Español","value":"es"},{"label":"English","value":"en"}],"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":"thumbnail","label":"Thumbnail URL","namespace":["news","thumbnail"],"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"]}],"config":{"media":{"tina":{"publicFolder":"public","mediaRoot":"public/images"}}}}
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
import { createClient } from "tinacms/dist/client";
|
||||||
|
import { queries } from "./types";
|
||||||
|
export const client = createClient({ url: 'http://localhost:4001/graphql', token: 'null', queries, });
|
||||||
|
export default client;
|
||||||
|
|
||||||
|
|
@ -0,0 +1,86 @@
|
||||||
|
// 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",
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
type: "string",
|
||||||
|
name: "locale",
|
||||||
|
label: "Language",
|
||||||
|
options: [
|
||||||
|
{ label: "Espa\xF1ol", value: "es" },
|
||||||
|
{ label: "English", value: "en" }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
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: "thumbnail",
|
||||||
|
label: "Thumbnail URL"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
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
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
fragment NewsParts on News {
|
||||||
|
__typename
|
||||||
|
locale
|
||||||
|
title
|
||||||
|
date
|
||||||
|
slug
|
||||||
|
place
|
||||||
|
thumbnail
|
||||||
|
youtube
|
||||||
|
draft
|
||||||
|
body
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,188 @@
|
||||||
|
# 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!
|
||||||
|
}
|
||||||
|
|
||||||
|
input DocumentFilter {
|
||||||
|
news: NewsFilter
|
||||||
|
}
|
||||||
|
|
||||||
|
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 | Folder
|
||||||
|
|
||||||
|
type News implements Node & Document {
|
||||||
|
locale: String
|
||||||
|
title: String!
|
||||||
|
date: String!
|
||||||
|
slug: String
|
||||||
|
place: String
|
||||||
|
thumbnail: String
|
||||||
|
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 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
|
||||||
|
thumbnail: StringFilter
|
||||||
|
youtube: StringFilter
|
||||||
|
draft: BooleanFilter
|
||||||
|
body: RichTextFilter
|
||||||
|
}
|
||||||
|
|
||||||
|
type NewsConnectionEdges {
|
||||||
|
cursor: String!
|
||||||
|
node: News
|
||||||
|
}
|
||||||
|
|
||||||
|
type NewsConnection implements Connection {
|
||||||
|
pageInfo: PageInfo!
|
||||||
|
totalCount: Float!
|
||||||
|
edges: [NewsConnectionEdges]
|
||||||
|
}
|
||||||
|
|
||||||
|
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!
|
||||||
|
}
|
||||||
|
|
||||||
|
input DocumentUpdateMutation {
|
||||||
|
news: NewsMutation
|
||||||
|
relativePath: String
|
||||||
|
}
|
||||||
|
|
||||||
|
input DocumentMutation {
|
||||||
|
news: NewsMutation
|
||||||
|
}
|
||||||
|
|
||||||
|
input NewsMutation {
|
||||||
|
locale: String
|
||||||
|
title: String
|
||||||
|
date: String
|
||||||
|
slug: String
|
||||||
|
place: String
|
||||||
|
thumbnail: String
|
||||||
|
youtube: String
|
||||||
|
draft: Boolean
|
||||||
|
body: JSON
|
||||||
|
}
|
||||||
|
|
||||||
|
schema {
|
||||||
|
query: Query
|
||||||
|
mutation: Mutation
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
[]
|
||||||
|
|
@ -0,0 +1,473 @@
|
||||||
|
//@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;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
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 DocumentFilter = {
|
||||||
|
news?: InputMaybe<NewsFilter>;
|
||||||
|
};
|
||||||
|
|
||||||
|
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 | Folder;
|
||||||
|
|
||||||
|
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']>;
|
||||||
|
thumbnail?: Maybe<Scalars['String']['output']>;
|
||||||
|
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 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>;
|
||||||
|
thumbnail?: InputMaybe<StringFilter>;
|
||||||
|
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 Mutation = {
|
||||||
|
__typename?: 'Mutation';
|
||||||
|
addPendingDocument: DocumentNode;
|
||||||
|
updateDocument: DocumentNode;
|
||||||
|
deleteDocument: DocumentNode;
|
||||||
|
createDocument: DocumentNode;
|
||||||
|
createFolder: DocumentNode;
|
||||||
|
updateNews: News;
|
||||||
|
createNews: News;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
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 DocumentUpdateMutation = {
|
||||||
|
news?: InputMaybe<NewsMutation>;
|
||||||
|
relativePath?: InputMaybe<Scalars['String']['input']>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type DocumentMutation = {
|
||||||
|
news?: InputMaybe<NewsMutation>;
|
||||||
|
};
|
||||||
|
|
||||||
|
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']>;
|
||||||
|
thumbnail?: InputMaybe<Scalars['String']['input']>;
|
||||||
|
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, thumbnail?: string | null, youtube?: string | null, draft?: boolean | null, body?: any | 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, thumbnail?: string | 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 } } };
|
||||||
|
|
||||||
|
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, thumbnail?: string | 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 } } | null } | null> | null } };
|
||||||
|
|
||||||
|
export const NewsPartsFragmentDoc = gql`
|
||||||
|
fragment NewsParts on News {
|
||||||
|
__typename
|
||||||
|
locale
|
||||||
|
title
|
||||||
|
date
|
||||||
|
slug
|
||||||
|
place
|
||||||
|
thumbnail
|
||||||
|
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 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);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -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,
|
||||||
|
});
|
||||||
|
|
@ -0,0 +1,84 @@
|
||||||
|
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",
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
type: "string",
|
||||||
|
name: "locale",
|
||||||
|
label: "Language",
|
||||||
|
options: [
|
||||||
|
{ label: "Español", value: "es" },
|
||||||
|
{ label: "English", value: "en" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
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: "thumbnail",
|
||||||
|
label: "Thumbnail URL",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
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
Loading…
Reference in New Issue