Added pretitle and subtitle to media

This commit is contained in:
DrMint 2024-05-11 01:45:17 +02:00
parent ff9c1926d5
commit d4dc7ca910
8 changed files with 39 additions and 6 deletions

View File

@ -14,7 +14,9 @@ const fields = {
filesize: "filesize",
updatedAt: "updatedAt",
translations: "translations",
translationsPretitle: "pretitle",
translationsTitle: "title",
translationsSubtitle: "subtitle",
translationsDescription: "description",
thumbnail: "thumbnail",
duration: "duration",
@ -57,7 +59,11 @@ export const Audios = buildCollectionConfig({
required: true,
minRows: 1,
fields: [
{ name: fields.translationsTitle, type: "text", required: true },
rowField([
{ name: fields.translationsPretitle, type: "text" },
{ name: fields.translationsTitle, type: "text", required: true },
{ name: fields.translationsSubtitle, type: "text" },
]),
{
name: fields.translationsDescription,
type: "richText",

View File

@ -69,9 +69,11 @@ export const convertAudioToEndpointAudio = ({
mimeType,
updatedAt,
translations:
translations?.map(({ language, title, description }) => ({
translations?.map(({ language, title, pretitle, subtitle, description }) => ({
language: getLanguageId(language),
...(isNotEmpty(pretitle) ? { pretitle } : {}),
title,
...(isNotEmpty(subtitle) ? { subtitle } : {}),
...(isNotEmpty(description) ? { description: convertRTCToEndpointRTC(description) } : {}),
})) ?? [],
duration,

View File

@ -1,5 +1,6 @@
import { Collections } from "../../constants";
import { creditsField } from "../../fields/creditsField/creditsField";
import { rowField } from "../../fields/rowField/rowField";
import { tagsField } from "../../fields/tagsField/tagsField";
import { translatedFields } from "../../fields/translatedFields/translatedFields";
import { createEditor } from "../../utils/editor";
@ -13,7 +14,9 @@ const fields = {
posts: "posts",
updatedAt: "updatedAt",
translations: "translations",
translationsPretitle: "pretitle",
translationsTitle: "title",
translationsSubtitle: "subtitle",
translationsDescription: "description",
tags: "tags",
credits: "credits",
@ -48,7 +51,11 @@ export const Images = buildImageCollectionConfig({
name: fields.translations,
admin: { useAsTitle: fields.translationsTitle },
fields: [
{ name: fields.translationsTitle, type: "text", required: true },
rowField([
{ name: fields.translationsPretitle, type: "text" },
{ name: fields.translationsTitle, type: "text", required: true },
{ name: fields.translationsSubtitle, type: "text" },
]),
{
name: fields.translationsDescription,
type: "richText",

View File

@ -71,9 +71,11 @@ export const convertImageToEndpointImage = ({
mimeType,
updatedAt,
translations:
translations?.map(({ language, title, description }) => ({
translations?.map(({ language, title, pretitle, subtitle, description }) => ({
language: getLanguageId(language),
...(isNotEmpty(pretitle) ? { pretitle } : {}),
title,
...(isNotEmpty(subtitle) ? { subtitle } : {}),
...(isNotEmpty(description) ? { description: convertRTCToEndpointRTC(description) } : {}),
})) ?? [],
credits: convertCreditsToEndpointCredits(credits),

View File

@ -15,7 +15,9 @@ const fields = {
filesize: "filesize",
updatedAt: "updatedAt",
translations: "translations",
translationsPretitle: "pretitle",
translationsTitle: "title",
translationsSubtitle: "subtitle",
translationsDescription: "description",
translationsSubfile: "subfile",
thumbnail: "thumbnail",
@ -66,7 +68,11 @@ export const Videos = buildCollectionConfig({
required: true,
minRows: 1,
fields: [
{ name: fields.translationsTitle, type: "text", required: true },
rowField([
{ name: fields.translationsPretitle, type: "text" },
{ name: fields.translationsTitle, type: "text", required: true },
{ name: fields.translationsSubtitle, type: "text" },
]),
{
name: fields.translationsDescription,
type: "richText",

View File

@ -79,9 +79,11 @@ export const convertVideoToEndpointVideo = ({
mimeType,
updatedAt,
translations:
translations?.map(({ language, title, description }) => ({
translations?.map(({ language, title, pretitle, subtitle, description }) => ({
language: getLanguageId(language),
...(isNotEmpty(pretitle) ? { pretitle } : {}),
title,
...(isNotEmpty(subtitle) ? { subtitle } : {}),
...(isNotEmpty(description) ? { description: convertRTCToEndpointRTC(description) } : {}),
})) ?? [],

View File

@ -450,7 +450,9 @@ export type EndpointMedia = {
tagGroups: EndpointTagsGroup[];
translations: {
language: string;
pretitle?: string;
title: string;
subtitle?: string;
description?: RichTextContent;
}[];
credits: EndpointCredit[];

View File

@ -111,7 +111,9 @@ export interface Image {
translations?:
| {
language: string | Language;
pretitle?: string | null;
title: string;
subtitle?: string | null;
description?: {
root: {
type: string;
@ -559,7 +561,9 @@ export interface Audio {
thumbnail?: string | MediaThumbnail | null;
translations: {
language: string | Language;
pretitle?: string | null;
title: string;
subtitle?: string | null;
description?: {
root: {
type: string;
@ -631,7 +635,9 @@ export interface Video {
thumbnail?: string | MediaThumbnail | null;
translations: {
language: string | Language;
pretitle?: string | null;
title: string;
subtitle?: string | null;
description?: {
root: {
type: string;