Fix use home folder and not root folder endpoint
This commit is contained in:
parent
a7b3c530a0
commit
d64010e77c
12
TODO.md
12
TODO.md
|
@ -2,12 +2,16 @@
|
||||||
|
|
||||||
## Short term
|
## Short term
|
||||||
|
|
||||||
- [Collectibles] Create page for gallery
|
- [Payload] Fix SDK endpoint not working in prod
|
||||||
- [Collectibles] Create page for scans
|
- [Folder] Add parent pages
|
||||||
|
- Support for scene break blocks
|
||||||
- Add hover/active styling for settings options in topbar + language override
|
- Add hover/active styling for settings options in topbar + language override
|
||||||
- Highlight currently selected language option in language override tooltip
|
- Highlight currently selected language option in language override tooltip
|
||||||
- Support for scene break blocks
|
|
||||||
- [Folder] Add parent pages
|
## Mid term
|
||||||
|
|
||||||
|
- [Collectibles] Create page for gallery
|
||||||
|
- [Collectibles] Create page for scans
|
||||||
- When the tags overflow, the tag group name should be align start (see http://localhost:12499/en/pages/magnitude-negative-chapter-1)
|
- When the tags overflow, the tag group name should be align start (see http://localhost:12499/en/pages/magnitude-negative-chapter-1)
|
||||||
- [SDK] create a initPayload() that return a payload sdk (and stop hard wirring to ENV or node-cache)
|
- [SDK] create a initPayload() that return a payload sdk (and stop hard wirring to ENV or node-cache)
|
||||||
- [Payload] Compare current package.json with fresh install of create-payload-app
|
- [Payload] Compare current package.json with fresh install of create-payload-app
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { payload } from "src/shared/payload/payload-sdk";
|
||||||
import CategoryCard from "./CategoryCard.astro";
|
import CategoryCard from "./CategoryCard.astro";
|
||||||
import { getI18n } from "src/i18n/i18n";
|
import { getI18n } from "src/i18n/i18n";
|
||||||
|
|
||||||
const folders = await payload.getRootFolders();
|
const folders = await payload.getHomeFolders();
|
||||||
const { getLocalizedUrl, getLocalizedMatch } = await getI18n(Astro.locals.currentLocale);
|
const { getLocalizedUrl, getLocalizedMatch } = await getI18n(Astro.locals.currentLocale);
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,6 @@ const meta = getLocalizedMatch(folder.translations);
|
||||||
openGraph={{
|
openGraph={{
|
||||||
title: meta.name,
|
title: meta.name,
|
||||||
description: meta.description && formatRichTextToString(meta.description),
|
description: meta.description && formatRichTextToString(meta.description),
|
||||||
thumbnail: folder.lightThumbnail?.url ?? folder.darkThumbnail?.url,
|
|
||||||
}}>
|
}}>
|
||||||
{
|
{
|
||||||
meta.description && (
|
meta.description && (
|
||||||
|
|
|
@ -43,29 +43,244 @@ export type CategoryTranslations = {
|
||||||
|
|
||||||
export interface Config {
|
export interface Config {
|
||||||
collections: {
|
collections: {
|
||||||
folders: Folder;
|
|
||||||
'folders-thumbnails': FoldersThumbnail;
|
|
||||||
pages: Page;
|
pages: Page;
|
||||||
|
collectibles: Collectible;
|
||||||
|
folders: Folder;
|
||||||
'chronology-items': ChronologyItem;
|
'chronology-items': ChronologyItem;
|
||||||
'chronology-eras': ChronologyEra;
|
'chronology-eras': ChronologyEra;
|
||||||
'recorders-thumbnails': RecordersThumbnail;
|
|
||||||
notes: Note;
|
notes: Note;
|
||||||
|
images: Image;
|
||||||
|
'background-images': BackgroundImage;
|
||||||
|
'recorders-thumbnails': RecordersThumbnail;
|
||||||
videos: Video;
|
videos: Video;
|
||||||
'videos-channels': VideosChannel;
|
'videos-channels': VideosChannel;
|
||||||
languages: Language;
|
|
||||||
currencies: Currency;
|
|
||||||
recorders: Recorder;
|
|
||||||
tags: Tag;
|
tags: Tag;
|
||||||
'tags-groups': TagsGroup;
|
'tags-groups': TagsGroup;
|
||||||
images: Image;
|
recorders: Recorder;
|
||||||
|
languages: Language;
|
||||||
|
currencies: Currency;
|
||||||
wordings: Wording;
|
wordings: Wording;
|
||||||
collectibles: Collectible;
|
|
||||||
'generic-contents': GenericContent;
|
'generic-contents': GenericContent;
|
||||||
'background-images': BackgroundImage;
|
|
||||||
'payload-preferences': PayloadPreference;
|
'payload-preferences': PayloadPreference;
|
||||||
'payload-migrations': PayloadMigration;
|
'payload-migrations': PayloadMigration;
|
||||||
};
|
};
|
||||||
globals: {};
|
globals: {
|
||||||
|
'home-folders': HomeFolder;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* This interface was referenced by `Config`'s JSON-Schema
|
||||||
|
* via the `definition` "pages".
|
||||||
|
*/
|
||||||
|
export interface Page {
|
||||||
|
id: string;
|
||||||
|
slug: string;
|
||||||
|
type: 'Content' | 'Post' | 'Generic';
|
||||||
|
thumbnail?: string | Image | null;
|
||||||
|
backgroundImage?: string | BackgroundImage | null;
|
||||||
|
tags?: (string | Tag)[] | null;
|
||||||
|
authors?: (string | Recorder)[] | null;
|
||||||
|
translations: {
|
||||||
|
language: string | Language;
|
||||||
|
sourceLanguage: string | Language;
|
||||||
|
pretitle?: string | null;
|
||||||
|
title: string;
|
||||||
|
subtitle?: string | null;
|
||||||
|
summary?: {
|
||||||
|
root: {
|
||||||
|
children: {
|
||||||
|
type: string;
|
||||||
|
version: number;
|
||||||
|
[k: string]: unknown;
|
||||||
|
}[];
|
||||||
|
direction: ('ltr' | 'rtl') | null;
|
||||||
|
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
|
||||||
|
indent: number;
|
||||||
|
type: string;
|
||||||
|
version: number;
|
||||||
|
};
|
||||||
|
[k: string]: unknown;
|
||||||
|
} | null;
|
||||||
|
content: {
|
||||||
|
root: {
|
||||||
|
children: {
|
||||||
|
type: string;
|
||||||
|
version: number;
|
||||||
|
[k: string]: unknown;
|
||||||
|
}[];
|
||||||
|
direction: ('ltr' | 'rtl') | null;
|
||||||
|
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
|
||||||
|
indent: number;
|
||||||
|
type: string;
|
||||||
|
version: number;
|
||||||
|
};
|
||||||
|
[k: string]: unknown;
|
||||||
|
};
|
||||||
|
transcribers?: (string | Recorder)[] | null;
|
||||||
|
translators?: (string | Recorder)[] | null;
|
||||||
|
proofreaders?: (string | Recorder)[] | null;
|
||||||
|
id?: string | null;
|
||||||
|
}[];
|
||||||
|
folders?: (string | Folder)[] | null;
|
||||||
|
collectibles?: (string | Collectible)[] | null;
|
||||||
|
updatedBy: string | Recorder;
|
||||||
|
updatedAt: string;
|
||||||
|
createdAt: string;
|
||||||
|
_status?: ('draft' | 'published') | null;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* This interface was referenced by `Config`'s JSON-Schema
|
||||||
|
* via the `definition` "images".
|
||||||
|
*/
|
||||||
|
export interface Image {
|
||||||
|
id: string;
|
||||||
|
updatedAt: string;
|
||||||
|
createdAt: string;
|
||||||
|
url?: string | null;
|
||||||
|
filename?: string | null;
|
||||||
|
mimeType?: string | null;
|
||||||
|
filesize?: number | null;
|
||||||
|
width?: number | null;
|
||||||
|
height?: number | null;
|
||||||
|
sizes?: {
|
||||||
|
thumb?: {
|
||||||
|
url?: string | null;
|
||||||
|
width?: number | null;
|
||||||
|
height?: number | null;
|
||||||
|
mimeType?: string | null;
|
||||||
|
filesize?: number | null;
|
||||||
|
filename?: string | null;
|
||||||
|
};
|
||||||
|
og?: {
|
||||||
|
url?: string | null;
|
||||||
|
width?: number | null;
|
||||||
|
height?: number | null;
|
||||||
|
mimeType?: string | null;
|
||||||
|
filesize?: number | null;
|
||||||
|
filename?: string | null;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* This interface was referenced by `Config`'s JSON-Schema
|
||||||
|
* via the `definition` "background-images".
|
||||||
|
*/
|
||||||
|
export interface BackgroundImage {
|
||||||
|
id: string;
|
||||||
|
updatedAt: string;
|
||||||
|
createdAt: string;
|
||||||
|
url?: string | null;
|
||||||
|
filename?: string | null;
|
||||||
|
mimeType?: string | null;
|
||||||
|
filesize?: number | null;
|
||||||
|
width?: number | null;
|
||||||
|
height?: number | null;
|
||||||
|
sizes?: {
|
||||||
|
thumb?: {
|
||||||
|
url?: string | null;
|
||||||
|
width?: number | null;
|
||||||
|
height?: number | null;
|
||||||
|
mimeType?: string | null;
|
||||||
|
filesize?: number | null;
|
||||||
|
filename?: string | null;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* This interface was referenced by `Config`'s JSON-Schema
|
||||||
|
* via the `definition` "tags".
|
||||||
|
*/
|
||||||
|
export interface Tag {
|
||||||
|
id: string;
|
||||||
|
name?: string | null;
|
||||||
|
slug: string;
|
||||||
|
translations: {
|
||||||
|
language: string | Language;
|
||||||
|
name: string;
|
||||||
|
id?: string | null;
|
||||||
|
}[];
|
||||||
|
group: string | TagsGroup;
|
||||||
|
updatedAt: string;
|
||||||
|
createdAt: string;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* This interface was referenced by `Config`'s JSON-Schema
|
||||||
|
* via the `definition` "languages".
|
||||||
|
*/
|
||||||
|
export interface Language {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* This interface was referenced by `Config`'s JSON-Schema
|
||||||
|
* via the `definition` "tags-groups".
|
||||||
|
*/
|
||||||
|
export interface TagsGroup {
|
||||||
|
id: string;
|
||||||
|
slug: string;
|
||||||
|
icon?: string | null;
|
||||||
|
translations: {
|
||||||
|
language: string | Language;
|
||||||
|
name: string;
|
||||||
|
id?: string | null;
|
||||||
|
}[];
|
||||||
|
updatedAt: string;
|
||||||
|
createdAt: string;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* This interface was referenced by `Config`'s JSON-Schema
|
||||||
|
* via the `definition` "recorders".
|
||||||
|
*/
|
||||||
|
export interface Recorder {
|
||||||
|
id: string;
|
||||||
|
username: string;
|
||||||
|
avatar?: string | RecordersThumbnail | null;
|
||||||
|
languages?: (string | Language)[] | null;
|
||||||
|
biographies?: RecorderBiographies;
|
||||||
|
role?: ('Admin' | 'Recorder' | 'Api')[] | null;
|
||||||
|
anonymize: boolean;
|
||||||
|
email: string;
|
||||||
|
resetPasswordToken?: string | null;
|
||||||
|
resetPasswordExpiration?: string | null;
|
||||||
|
salt?: string | null;
|
||||||
|
hash?: string | null;
|
||||||
|
loginAttempts?: number | null;
|
||||||
|
lockUntil?: string | null;
|
||||||
|
password?: string | null;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* This interface was referenced by `Config`'s JSON-Schema
|
||||||
|
* via the `definition` "recorders-thumbnails".
|
||||||
|
*/
|
||||||
|
export interface RecordersThumbnail {
|
||||||
|
id: string;
|
||||||
|
recorder?: (string | null) | Recorder;
|
||||||
|
updatedAt: string;
|
||||||
|
createdAt: string;
|
||||||
|
url?: string | null;
|
||||||
|
filename?: string | null;
|
||||||
|
mimeType?: string | null;
|
||||||
|
filesize?: number | null;
|
||||||
|
width?: number | null;
|
||||||
|
height?: number | null;
|
||||||
|
sizes?: {
|
||||||
|
thumb?: {
|
||||||
|
url?: string | null;
|
||||||
|
width?: number | null;
|
||||||
|
height?: number | null;
|
||||||
|
mimeType?: string | null;
|
||||||
|
filesize?: number | null;
|
||||||
|
filename?: string | null;
|
||||||
|
};
|
||||||
|
square?: {
|
||||||
|
url?: string | null;
|
||||||
|
width?: number | null;
|
||||||
|
height?: number | null;
|
||||||
|
mimeType?: string | null;
|
||||||
|
filesize?: number | null;
|
||||||
|
filename?: string | null;
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* This interface was referenced by `Config`'s JSON-Schema
|
* This interface was referenced by `Config`'s JSON-Schema
|
||||||
|
@ -75,30 +290,26 @@ export interface Folder {
|
||||||
id: string;
|
id: string;
|
||||||
slug: string;
|
slug: string;
|
||||||
icon?: string | null;
|
icon?: string | null;
|
||||||
lightThumbnail?: string | FoldersThumbnail | null;
|
translations: {
|
||||||
darkThumbnail?: string | FoldersThumbnail | null;
|
language: string | Language;
|
||||||
translations?:
|
name: string;
|
||||||
| {
|
description?: {
|
||||||
language: string | Language;
|
root: {
|
||||||
name: string;
|
children: {
|
||||||
description?: {
|
type: string;
|
||||||
root: {
|
version: number;
|
||||||
children: {
|
|
||||||
type: string;
|
|
||||||
version: number;
|
|
||||||
[k: string]: unknown;
|
|
||||||
}[];
|
|
||||||
direction: ('ltr' | 'rtl') | null;
|
|
||||||
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
|
|
||||||
indent: number;
|
|
||||||
type: string;
|
|
||||||
version: number;
|
|
||||||
};
|
|
||||||
[k: string]: unknown;
|
[k: string]: unknown;
|
||||||
} | null;
|
}[];
|
||||||
id?: string | null;
|
direction: ('ltr' | 'rtl') | null;
|
||||||
}[]
|
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
|
||||||
| null;
|
indent: number;
|
||||||
|
type: string;
|
||||||
|
version: number;
|
||||||
|
};
|
||||||
|
[k: string]: unknown;
|
||||||
|
} | null;
|
||||||
|
id?: string | null;
|
||||||
|
}[];
|
||||||
sections?:
|
sections?:
|
||||||
| {
|
| {
|
||||||
translations?:
|
translations?:
|
||||||
|
@ -127,39 +338,6 @@ export interface Folder {
|
||||||
updatedAt: string;
|
updatedAt: string;
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* This interface was referenced by `Config`'s JSON-Schema
|
|
||||||
* via the `definition` "folders-thumbnails".
|
|
||||||
*/
|
|
||||||
export interface FoldersThumbnail {
|
|
||||||
id: string;
|
|
||||||
updatedAt: string;
|
|
||||||
createdAt: string;
|
|
||||||
url?: string | null;
|
|
||||||
filename?: string | null;
|
|
||||||
mimeType?: string | null;
|
|
||||||
filesize?: number | null;
|
|
||||||
width?: number | null;
|
|
||||||
height?: number | null;
|
|
||||||
sizes?: {
|
|
||||||
thumb?: {
|
|
||||||
url?: string | null;
|
|
||||||
width?: number | null;
|
|
||||||
height?: number | null;
|
|
||||||
mimeType?: string | null;
|
|
||||||
filesize?: number | null;
|
|
||||||
filename?: string | null;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* This interface was referenced by `Config`'s JSON-Schema
|
|
||||||
* via the `definition` "languages".
|
|
||||||
*/
|
|
||||||
export interface Language {
|
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* This interface was referenced by `Config`'s JSON-Schema
|
* This interface was referenced by `Config`'s JSON-Schema
|
||||||
* via the `definition` "collectibles".
|
* via the `definition` "collectibles".
|
||||||
|
@ -345,152 +523,6 @@ export interface Collectible {
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
_status?: ('draft' | 'published') | null;
|
_status?: ('draft' | 'published') | null;
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* This interface was referenced by `Config`'s JSON-Schema
|
|
||||||
* via the `definition` "images".
|
|
||||||
*/
|
|
||||||
export interface Image {
|
|
||||||
id: string;
|
|
||||||
updatedAt: string;
|
|
||||||
createdAt: string;
|
|
||||||
url?: string | null;
|
|
||||||
filename?: string | null;
|
|
||||||
mimeType?: string | null;
|
|
||||||
filesize?: number | null;
|
|
||||||
width?: number | null;
|
|
||||||
height?: number | null;
|
|
||||||
sizes?: {
|
|
||||||
thumb?: {
|
|
||||||
url?: string | null;
|
|
||||||
width?: number | null;
|
|
||||||
height?: number | null;
|
|
||||||
mimeType?: string | null;
|
|
||||||
filesize?: number | null;
|
|
||||||
filename?: string | null;
|
|
||||||
};
|
|
||||||
og?: {
|
|
||||||
url?: string | null;
|
|
||||||
width?: number | null;
|
|
||||||
height?: number | null;
|
|
||||||
mimeType?: string | null;
|
|
||||||
filesize?: number | null;
|
|
||||||
filename?: string | null;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* This interface was referenced by `Config`'s JSON-Schema
|
|
||||||
* via the `definition` "tags".
|
|
||||||
*/
|
|
||||||
export interface Tag {
|
|
||||||
id: string;
|
|
||||||
name?: string | null;
|
|
||||||
slug: string;
|
|
||||||
translations: {
|
|
||||||
language: string | Language;
|
|
||||||
name: string;
|
|
||||||
id?: string | null;
|
|
||||||
}[];
|
|
||||||
group: string | TagsGroup;
|
|
||||||
updatedAt: string;
|
|
||||||
createdAt: string;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* This interface was referenced by `Config`'s JSON-Schema
|
|
||||||
* via the `definition` "tags-groups".
|
|
||||||
*/
|
|
||||||
export interface TagsGroup {
|
|
||||||
id: string;
|
|
||||||
slug: string;
|
|
||||||
icon?: string | null;
|
|
||||||
translations: {
|
|
||||||
language: string | Language;
|
|
||||||
name: string;
|
|
||||||
id?: string | null;
|
|
||||||
}[];
|
|
||||||
updatedAt: string;
|
|
||||||
createdAt: string;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* This interface was referenced by `Config`'s JSON-Schema
|
|
||||||
* via the `definition` "background-images".
|
|
||||||
*/
|
|
||||||
export interface BackgroundImage {
|
|
||||||
id: string;
|
|
||||||
updatedAt: string;
|
|
||||||
createdAt: string;
|
|
||||||
url?: string | null;
|
|
||||||
filename?: string | null;
|
|
||||||
mimeType?: string | null;
|
|
||||||
filesize?: number | null;
|
|
||||||
width?: number | null;
|
|
||||||
height?: number | null;
|
|
||||||
sizes?: {
|
|
||||||
thumb?: {
|
|
||||||
url?: string | null;
|
|
||||||
width?: number | null;
|
|
||||||
height?: number | null;
|
|
||||||
mimeType?: string | null;
|
|
||||||
filesize?: number | null;
|
|
||||||
filename?: string | null;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* This interface was referenced by `Config`'s JSON-Schema
|
|
||||||
* via the `definition` "recorders".
|
|
||||||
*/
|
|
||||||
export interface Recorder {
|
|
||||||
id: string;
|
|
||||||
username: string;
|
|
||||||
avatar?: string | RecordersThumbnail | null;
|
|
||||||
languages?: (string | Language)[] | null;
|
|
||||||
biographies?: RecorderBiographies;
|
|
||||||
role?: ('Admin' | 'Recorder' | 'Api')[] | null;
|
|
||||||
anonymize: boolean;
|
|
||||||
email: string;
|
|
||||||
resetPasswordToken?: string | null;
|
|
||||||
resetPasswordExpiration?: string | null;
|
|
||||||
salt?: string | null;
|
|
||||||
hash?: string | null;
|
|
||||||
loginAttempts?: number | null;
|
|
||||||
lockUntil?: string | null;
|
|
||||||
password?: string | null;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* This interface was referenced by `Config`'s JSON-Schema
|
|
||||||
* via the `definition` "recorders-thumbnails".
|
|
||||||
*/
|
|
||||||
export interface RecordersThumbnail {
|
|
||||||
id: string;
|
|
||||||
recorder?: (string | null) | Recorder;
|
|
||||||
updatedAt: string;
|
|
||||||
createdAt: string;
|
|
||||||
url?: string | null;
|
|
||||||
filename?: string | null;
|
|
||||||
mimeType?: string | null;
|
|
||||||
filesize?: number | null;
|
|
||||||
width?: number | null;
|
|
||||||
height?: number | null;
|
|
||||||
sizes?: {
|
|
||||||
thumb?: {
|
|
||||||
url?: string | null;
|
|
||||||
width?: number | null;
|
|
||||||
height?: number | null;
|
|
||||||
mimeType?: string | null;
|
|
||||||
filesize?: number | null;
|
|
||||||
filename?: string | null;
|
|
||||||
};
|
|
||||||
square?: {
|
|
||||||
url?: string | null;
|
|
||||||
width?: number | null;
|
|
||||||
height?: number | null;
|
|
||||||
mimeType?: string | null;
|
|
||||||
filesize?: number | null;
|
|
||||||
filename?: string | null;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* This interface was referenced by `Config`'s JSON-Schema
|
* This interface was referenced by `Config`'s JSON-Schema
|
||||||
* via the `definition` "currencies".
|
* via the `definition` "currencies".
|
||||||
|
@ -498,66 +530,6 @@ export interface RecordersThumbnail {
|
||||||
export interface Currency {
|
export interface Currency {
|
||||||
id: string;
|
id: string;
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* This interface was referenced by `Config`'s JSON-Schema
|
|
||||||
* via the `definition` "pages".
|
|
||||||
*/
|
|
||||||
export interface Page {
|
|
||||||
id: string;
|
|
||||||
slug: string;
|
|
||||||
type: 'Content' | 'Post' | 'Generic';
|
|
||||||
thumbnail?: string | Image | null;
|
|
||||||
backgroundImage?: string | BackgroundImage | null;
|
|
||||||
tags?: (string | Tag)[] | null;
|
|
||||||
authors?: (string | Recorder)[] | null;
|
|
||||||
translations: {
|
|
||||||
language: string | Language;
|
|
||||||
sourceLanguage: string | Language;
|
|
||||||
pretitle?: string | null;
|
|
||||||
title: string;
|
|
||||||
subtitle?: string | null;
|
|
||||||
summary?: {
|
|
||||||
root: {
|
|
||||||
children: {
|
|
||||||
type: string;
|
|
||||||
version: number;
|
|
||||||
[k: string]: unknown;
|
|
||||||
}[];
|
|
||||||
direction: ('ltr' | 'rtl') | null;
|
|
||||||
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
|
|
||||||
indent: number;
|
|
||||||
type: string;
|
|
||||||
version: number;
|
|
||||||
};
|
|
||||||
[k: string]: unknown;
|
|
||||||
} | null;
|
|
||||||
content: {
|
|
||||||
root: {
|
|
||||||
children: {
|
|
||||||
type: string;
|
|
||||||
version: number;
|
|
||||||
[k: string]: unknown;
|
|
||||||
}[];
|
|
||||||
direction: ('ltr' | 'rtl') | null;
|
|
||||||
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
|
|
||||||
indent: number;
|
|
||||||
type: string;
|
|
||||||
version: number;
|
|
||||||
};
|
|
||||||
[k: string]: unknown;
|
|
||||||
};
|
|
||||||
transcribers?: (string | Recorder)[] | null;
|
|
||||||
translators?: (string | Recorder)[] | null;
|
|
||||||
proofreaders?: (string | Recorder)[] | null;
|
|
||||||
id?: string | null;
|
|
||||||
}[];
|
|
||||||
folders?: (string | Folder)[] | null;
|
|
||||||
collectibles?: (string | Collectible)[] | null;
|
|
||||||
updatedBy: string | Recorder;
|
|
||||||
updatedAt: string;
|
|
||||||
createdAt: string;
|
|
||||||
_status?: ('draft' | 'published') | null;
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* This interface was referenced by `Config`'s JSON-Schema
|
* This interface was referenced by `Config`'s JSON-Schema
|
||||||
* via the `definition` "generic-contents".
|
* via the `definition` "generic-contents".
|
||||||
|
@ -764,11 +736,20 @@ export interface PayloadMigration {
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* This interface was referenced by `Config`'s JSON-Schema
|
* This interface was referenced by `Config`'s JSON-Schema
|
||||||
* via the `definition` "SpacerBlock".
|
* via the `definition` "home-folders".
|
||||||
*/
|
*/
|
||||||
export interface SpacerBlock {
|
export interface HomeFolder {
|
||||||
size: 'Small' | 'Medium' | 'Large' | 'Extra Large';
|
id: string;
|
||||||
blockType: 'spacerBlock';
|
folders?:
|
||||||
|
| {
|
||||||
|
lightThumbnail?: string | Image | null;
|
||||||
|
darkThumbnail?: string | Image | null;
|
||||||
|
folder: string | Folder;
|
||||||
|
id?: string | null;
|
||||||
|
}[]
|
||||||
|
| null;
|
||||||
|
updatedAt?: string | null;
|
||||||
|
createdAt?: string | null;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* This interface was referenced by `Config`'s JSON-Schema
|
* This interface was referenced by `Config`'s JSON-Schema
|
||||||
|
@ -819,7 +800,7 @@ export interface CueBlock {
|
||||||
* via the `definition` "TranscriptBlock".
|
* via the `definition` "TranscriptBlock".
|
||||||
*/
|
*/
|
||||||
export interface TranscriptBlock {
|
export interface TranscriptBlock {
|
||||||
lines: (LineBlock | CueBlock | SpacerBlock)[];
|
lines: (LineBlock | CueBlock)[];
|
||||||
id?: string | null;
|
id?: string | null;
|
||||||
blockName?: string | null;
|
blockName?: string | null;
|
||||||
blockType: 'transcriptBlock';
|
blockType: 'transcriptBlock';
|
||||||
|
@ -868,7 +849,6 @@ export enum Collections {
|
||||||
VideosChannels = "videos-channels",
|
VideosChannels = "videos-channels",
|
||||||
Videos = "videos",
|
Videos = "videos",
|
||||||
Folders = "folders",
|
Folders = "folders",
|
||||||
FoldersThumbnails = "folders-thumbnails",
|
|
||||||
Tags = "tags",
|
Tags = "tags",
|
||||||
TagsGroups = "tags-groups",
|
TagsGroups = "tags-groups",
|
||||||
Images = "images",
|
Images = "images",
|
||||||
|
@ -876,6 +856,7 @@ export enum Collections {
|
||||||
Collectibles = "collectibles",
|
Collectibles = "collectibles",
|
||||||
GenericContents = "generic-contents",
|
GenericContents = "generic-contents",
|
||||||
BackgroundImages = "background-images",
|
BackgroundImages = "background-images",
|
||||||
|
HomeFolders = "home-folders",
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum CollectionGroups {
|
export enum CollectionGroups {
|
||||||
|
@ -937,13 +918,6 @@ export enum PageType {
|
||||||
Generic = "Generic",
|
Generic = "Generic",
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum SpacerSizes {
|
|
||||||
Small = "Small",
|
|
||||||
Medium = "Medium",
|
|
||||||
Large = "Large",
|
|
||||||
XLarge = "Extra Large",
|
|
||||||
}
|
|
||||||
|
|
||||||
/* RICH TEXT */
|
/* RICH TEXT */
|
||||||
|
|
||||||
export type RichTextContent = {
|
export type RichTextContent = {
|
||||||
|
@ -1057,10 +1031,6 @@ export interface RichTextTranscriptBlock extends RichTextBlockNode {
|
||||||
fields: TranscriptBlock;
|
fields: TranscriptBlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RichTextSpacerBlock extends RichTextBlockNode {
|
|
||||||
fields: SpacerBlock;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const isNodeParagraphNode = (node: RichTextNode): node is RichTextParagraphNode =>
|
export const isNodeParagraphNode = (node: RichTextNode): node is RichTextParagraphNode =>
|
||||||
node.type === "paragraph";
|
node.type === "paragraph";
|
||||||
|
|
||||||
|
@ -1110,9 +1080,6 @@ export const isBlockNodeTranscriptBlock = (
|
||||||
node: RichTextBlockNode
|
node: RichTextBlockNode
|
||||||
): node is RichTextTranscriptBlock => node.fields.blockType === "transcriptBlock";
|
): node is RichTextTranscriptBlock => node.fields.blockType === "transcriptBlock";
|
||||||
|
|
||||||
export const isBlockNodeSpacerBlock = (node: RichTextBlockNode): node is RichTextSpacerBlock =>
|
|
||||||
node.fields.blockType === "spacerBlock";
|
|
||||||
|
|
||||||
/* BLOCKS */
|
/* BLOCKS */
|
||||||
|
|
||||||
/* TODO: TO BE REMOVED WHEN https://github.com/payloadcms/payload/issues/5216 is closed */
|
/* TODO: TO BE REMOVED WHEN https://github.com/payloadcms/payload/issues/5216 is closed */
|
||||||
|
@ -1142,10 +1109,6 @@ export const isBlockCueBlock = (block: GenericBlock): block is CueBlock =>
|
||||||
export const isBlockLineBlock = (block: GenericBlock): block is LineBlock =>
|
export const isBlockLineBlock = (block: GenericBlock): block is LineBlock =>
|
||||||
block.blockType === "lineBlock";
|
block.blockType === "lineBlock";
|
||||||
|
|
||||||
export const isBlockSpacerBlock = (block: GenericBlock): block is SpacerBlock =>
|
|
||||||
block.blockType === "spacerBlock";
|
|
||||||
|
|
||||||
|
|
||||||
////////////////// SDK //////////////////
|
////////////////// SDK //////////////////
|
||||||
|
|
||||||
import NodeCache from "node-cache";
|
import NodeCache from "node-cache";
|
||||||
|
@ -1210,8 +1173,8 @@ const injectAuth = async (init?: RequestInit): Promise<RequestInit> => ({
|
||||||
|
|
||||||
const logResponse = (res: Response) => console.log(res.status, res.statusText, res.url);
|
const logResponse = (res: Response) => console.log(res.status, res.statusText, res.url);
|
||||||
|
|
||||||
const payloadApiUrl = (collection: Collections, endpoint?: string): string =>
|
const payloadApiUrl = (collection: Collections, endpoint?: string, isGlobal?: boolean): string =>
|
||||||
`${import.meta.env.PAYLOAD_API_URL}/${collection}${endpoint === undefined ? "" : `/${endpoint}`}`;
|
`${import.meta.env.PAYLOAD_API_URL}/${isGlobal === undefined ? "" : "globals/"}${collection}${endpoint === undefined ? "" : `/${endpoint}`}`;
|
||||||
|
|
||||||
const request = async (url: string, init?: RequestInit): Promise<Response> => {
|
const request = async (url: string, init?: RequestInit): Promise<Response> => {
|
||||||
const result = await fetch(url, await injectAuth(init));
|
const result = await fetch(url, await injectAuth(init));
|
||||||
|
@ -1256,6 +1219,16 @@ export type EndpointEra = {
|
||||||
}[];
|
}[];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type EndpointFolderPreview = {
|
||||||
|
slug: string;
|
||||||
|
icon?: string;
|
||||||
|
translations: {
|
||||||
|
language: string;
|
||||||
|
name: string;
|
||||||
|
description?: RichTextContent;
|
||||||
|
}[];
|
||||||
|
};
|
||||||
|
|
||||||
export type EndpointFolder = EndpointFolderPreview & {
|
export type EndpointFolder = EndpointFolderPreview & {
|
||||||
sections:
|
sections:
|
||||||
| { type: "single"; subfolders: EndpointFolderPreview[] }
|
| { type: "single"; subfolders: EndpointFolderPreview[] }
|
||||||
|
@ -1278,14 +1251,7 @@ export type EndpointFolder = EndpointFolderPreview & {
|
||||||
)[];
|
)[];
|
||||||
};
|
};
|
||||||
|
|
||||||
export type EndpointFolderPreview = {
|
export type EndpointHomeFolder = EndpointFolderPreview & {
|
||||||
slug: string;
|
|
||||||
icon?: string;
|
|
||||||
translations: {
|
|
||||||
language: string;
|
|
||||||
name: string;
|
|
||||||
description?: RichTextContent;
|
|
||||||
}[];
|
|
||||||
lightThumbnail?: PayloadImage;
|
lightThumbnail?: PayloadImage;
|
||||||
darkThumbnail?: PayloadImage;
|
darkThumbnail?: PayloadImage;
|
||||||
};
|
};
|
||||||
|
@ -1456,8 +1422,8 @@ export type PayloadImage = {
|
||||||
export const payload = {
|
export const payload = {
|
||||||
getEras: async (): Promise<EndpointEra[]> =>
|
getEras: async (): Promise<EndpointEra[]> =>
|
||||||
await (await request(payloadApiUrl(Collections.ChronologyEras, `all`))).json(),
|
await (await request(payloadApiUrl(Collections.ChronologyEras, `all`))).json(),
|
||||||
getRootFolders: async (): Promise<EndpointFolderPreview[]> =>
|
getHomeFolders: async (): Promise<EndpointHomeFolder[]> =>
|
||||||
await (await request(payloadApiUrl(Collections.Folders, `root`))).json(),
|
await (await request(payloadApiUrl(Collections.HomeFolders, `all`, true))).json(),
|
||||||
getFolder: async (slug: string): Promise<EndpointFolder> =>
|
getFolder: async (slug: string): Promise<EndpointFolder> =>
|
||||||
await (await request(payloadApiUrl(Collections.Folders, `slug/${slug}`))).json(),
|
await (await request(payloadApiUrl(Collections.Folders, `slug/${slug}`))).json(),
|
||||||
getLanguages: async (): Promise<Language[]> =>
|
getLanguages: async (): Promise<Language[]> =>
|
||||||
|
|
Loading…
Reference in New Issue