diff --git a/.tmp2/data.db b/.tmp2/data.db new file mode 100644 index 0000000..89d0c86 Binary files /dev/null and b/.tmp2/data.db differ diff --git a/package.json b/package.json index ff9870b..fbda5c3 100644 --- a/package.json +++ b/package.json @@ -12,14 +12,15 @@ }, "devDependencies": {}, "dependencies": { - "@strapi/strapi": "4.25.1", - "@strapi/plugin-users-permissions": "4.25.1", - "@strapi/plugin-i18n": "4.25.1", "@strapi/plugin-cloud": "4.25.1", + "@strapi/plugin-i18n": "4.25.1", + "@strapi/plugin-users-permissions": "4.25.1", + "@strapi/strapi": "4.25.1", "better-sqlite3": "8.6.0", "react": "^18.0.0", "react-dom": "^18.0.0", "react-router-dom": "5.3.4", + "strapi-plugin-slugify": "^2.3.8", "styled-components": "5.3.3" }, "author": { diff --git a/src/api/author/content-types/author/schema.json b/src/api/author/content-types/author/schema.json index 61d1760..1a6ba85 100644 --- a/src/api/author/content-types/author/schema.json +++ b/src/api/author/content-types/author/schema.json @@ -4,7 +4,8 @@ "info": { "singularName": "author", "pluralName": "authors", - "displayName": "Author" + "displayName": "Author", + "description": "" }, "options": { "draftAndPublish": true @@ -15,17 +16,19 @@ "type": "string" }, "profilePicture": { + "type": "media", + "multiple": true, + "required": false, "allowedTypes": [ "images", "files", "videos", "audios" - ], - "type": "media", - "multiple": true + ] }, "slug": { - "type": "uid" + "type": "uid", + "targetField": "name" } } } diff --git a/src/api/blog-post/content-types/blog-post/schema.json b/src/api/blog-post/content-types/blog-post/schema.json index d06ebc6..4ca2eec 100644 --- a/src/api/blog-post/content-types/blog-post/schema.json +++ b/src/api/blog-post/content-types/blog-post/schema.json @@ -4,7 +4,8 @@ "info": { "singularName": "blog-post", "pluralName": "blog-posts", - "displayName": "Blog Post" + "displayName": "Blog Post", + "description": "" }, "options": { "draftAndPublish": true @@ -12,10 +13,13 @@ "pluginOptions": {}, "attributes": { "slug": { - "type": "uid" + "type": "uid", + "targetField": "title", + "required": true }, "title": { - "type": "string" + "type": "string", + "required": true }, "author": { "type": "relation", @@ -23,7 +27,13 @@ "target": "api::author.author" }, "content": { - "type": "richtext" + "type": "dynamiczone", + "components": [ + "content.gallery", + "content.image", + "content.text-markdown", + "content.infobox" + ] } } } diff --git a/src/components/content/gallery.json b/src/components/content/gallery.json new file mode 100644 index 0000000..8b55506 --- /dev/null +++ b/src/components/content/gallery.json @@ -0,0 +1,19 @@ +{ + "collectionName": "components_content_galleries", + "info": { + "displayName": "Gallery" + }, + "options": {}, + "attributes": { + "value": { + "allowedTypes": [ + "images", + "files", + "videos", + "audios" + ], + "type": "media", + "multiple": true + } + } +} diff --git a/src/components/content/image.json b/src/components/content/image.json new file mode 100644 index 0000000..d5e53bb --- /dev/null +++ b/src/components/content/image.json @@ -0,0 +1,19 @@ +{ + "collectionName": "components_content_images", + "info": { + "displayName": "Image" + }, + "options": {}, + "attributes": { + "value": { + "allowedTypes": [ + "images", + "files", + "videos", + "audios" + ], + "type": "media", + "multiple": false + } + } +} diff --git a/src/components/content/infobox.json b/src/components/content/infobox.json new file mode 100644 index 0000000..e0f489e --- /dev/null +++ b/src/components/content/infobox.json @@ -0,0 +1,12 @@ +{ + "collectionName": "components_content_infoboxes", + "info": { + "displayName": "infobox" + }, + "options": {}, + "attributes": { + "value": { + "type": "richtext" + } + } +} diff --git a/src/components/content/text-markdown.json b/src/components/content/text-markdown.json new file mode 100644 index 0000000..17a2b4d --- /dev/null +++ b/src/components/content/text-markdown.json @@ -0,0 +1,13 @@ +{ + "collectionName": "components_content_text_markdowns", + "info": { + "displayName": "Text - Markdown", + "description": "" + }, + "options": {}, + "attributes": { + "value": { + "type": "richtext" + } + } +} diff --git a/types/generated/components.d.ts b/types/generated/components.d.ts index 0cd76b4..ba2bd90 100644 --- a/types/generated/components.d.ts +++ b/types/generated/components.d.ts @@ -1,5 +1,53 @@ import type { Schema, Attribute } from '@strapi/strapi'; +export interface ContentGallery extends Schema.Component { + collectionName: 'components_content_galleries'; + info: { + displayName: 'Gallery'; + }; + attributes: { + value: Attribute.Media<'images' | 'files' | 'videos' | 'audios', true>; + }; +} + +export interface ContentImage extends Schema.Component { + collectionName: 'components_content_images'; + info: { + displayName: 'Image'; + }; + attributes: { + value: Attribute.Media<'images' | 'files' | 'videos' | 'audios'>; + }; +} + +export interface ContentInfobox extends Schema.Component { + collectionName: 'components_content_infoboxes'; + info: { + displayName: 'infobox'; + }; + attributes: { + value: Attribute.RichText; + }; +} + +export interface ContentTextMarkdown extends Schema.Component { + collectionName: 'components_content_text_markdowns'; + info: { + displayName: 'Text - Markdown'; + description: ''; + }; + attributes: { + value: Attribute.RichText; + }; +} + declare module '@strapi/types' { - export module Shared {} + export module Shared { + export interface Components { + 'content.gallery': ContentGallery; + 'content.image': ContentImage; + 'content.infobox': ContentInfobox; + 'content.text-markdown': ContentTextMarkdown; + } + } } diff --git a/types/generated/contentTypes.d.ts b/types/generated/contentTypes.d.ts index 35d72e0..d867fc7 100644 --- a/types/generated/contentTypes.d.ts +++ b/types/generated/contentTypes.d.ts @@ -362,6 +362,88 @@ export interface AdminTransferTokenPermission extends Schema.CollectionType { }; } +export interface ApiAuthorAuthor extends Schema.CollectionType { + collectionName: 'authors'; + info: { + singularName: 'author'; + pluralName: 'authors'; + displayName: 'Author'; + description: ''; + }; + options: { + draftAndPublish: true; + }; + attributes: { + name: Attribute.String; + profilePicture: Attribute.Media< + 'images' | 'files' | 'videos' | 'audios', + true + >; + slug: Attribute.UID<'api::author.author', 'name'>; + createdAt: Attribute.DateTime; + updatedAt: Attribute.DateTime; + publishedAt: Attribute.DateTime; + createdBy: Attribute.Relation< + 'api::author.author', + 'oneToOne', + 'admin::user' + > & + Attribute.Private; + updatedBy: Attribute.Relation< + 'api::author.author', + 'oneToOne', + 'admin::user' + > & + Attribute.Private; + }; +} + +export interface ApiBlogPostBlogPost extends Schema.CollectionType { + collectionName: 'blog_posts'; + info: { + singularName: 'blog-post'; + pluralName: 'blog-posts'; + displayName: 'Blog Post'; + description: ''; + }; + options: { + draftAndPublish: true; + }; + attributes: { + slug: Attribute.UID<'api::blog-post.blog-post', 'title'> & + Attribute.Required; + title: Attribute.String & Attribute.Required; + author: Attribute.Relation< + 'api::blog-post.blog-post', + 'oneToOne', + 'api::author.author' + >; + content: Attribute.DynamicZone< + [ + 'content.gallery', + 'content.image', + 'content.text-markdown', + 'content.infobox' + ] + >; + createdAt: Attribute.DateTime; + updatedAt: Attribute.DateTime; + publishedAt: Attribute.DateTime; + createdBy: Attribute.Relation< + 'api::blog-post.blog-post', + 'oneToOne', + 'admin::user' + > & + Attribute.Private; + updatedBy: Attribute.Relation< + 'api::blog-post.blog-post', + 'oneToOne', + 'admin::user' + > & + Attribute.Private; + }; +} + export interface PluginUploadFile extends Schema.CollectionType { collectionName: 'files'; info: { @@ -590,6 +672,53 @@ export interface PluginContentReleasesReleaseAction }; } +export interface PluginI18NLocale extends Schema.CollectionType { + collectionName: 'i18n_locale'; + info: { + singularName: 'locale'; + pluralName: 'locales'; + collectionName: 'locales'; + displayName: 'Locale'; + description: ''; + }; + options: { + draftAndPublish: false; + }; + pluginOptions: { + 'content-manager': { + visible: false; + }; + 'content-type-builder': { + visible: false; + }; + }; + attributes: { + name: Attribute.String & + Attribute.SetMinMax< + { + min: 1; + max: 50; + }, + number + >; + code: Attribute.String & Attribute.Unique; + createdAt: Attribute.DateTime; + updatedAt: Attribute.DateTime; + createdBy: Attribute.Relation< + 'plugin::i18n.locale', + 'oneToOne', + 'admin::user' + > & + Attribute.Private; + updatedBy: Attribute.Relation< + 'plugin::i18n.locale', + 'oneToOne', + 'admin::user' + > & + Attribute.Private; + }; +} + export interface PluginUsersPermissionsPermission extends Schema.CollectionType { collectionName: 'up_permissions'; @@ -741,17 +870,16 @@ export interface PluginUsersPermissionsUser extends Schema.CollectionType { }; } -export interface PluginI18NLocale extends Schema.CollectionType { - collectionName: 'i18n_locale'; +export interface PluginSlugifySlug extends Schema.CollectionType { + collectionName: 'slugs'; info: { - singularName: 'locale'; - pluralName: 'locales'; - collectionName: 'locales'; - displayName: 'Locale'; - description: ''; + singularName: 'slug'; + pluralName: 'slugs'; + displayName: 'slug'; }; options: { draftAndPublish: false; + comment: ''; }; pluginOptions: { 'content-manager': { @@ -762,97 +890,18 @@ export interface PluginI18NLocale extends Schema.CollectionType { }; }; attributes: { - name: Attribute.String & - Attribute.SetMinMax< - { - min: 1; - max: 50; - }, - number - >; - code: Attribute.String & Attribute.Unique; + slug: Attribute.Text; + count: Attribute.Integer; createdAt: Attribute.DateTime; updatedAt: Attribute.DateTime; createdBy: Attribute.Relation< - 'plugin::i18n.locale', + 'plugin::slugify.slug', 'oneToOne', 'admin::user' > & Attribute.Private; updatedBy: Attribute.Relation< - 'plugin::i18n.locale', - 'oneToOne', - 'admin::user' - > & - Attribute.Private; - }; -} - -export interface ApiAuthorAuthor extends Schema.CollectionType { - collectionName: 'authors'; - info: { - singularName: 'author'; - pluralName: 'authors'; - displayName: 'Author'; - }; - options: { - draftAndPublish: true; - }; - attributes: { - name: Attribute.String; - profilePicture: Attribute.Media< - 'images' | 'files' | 'videos' | 'audios', - true - >; - slug: Attribute.UID; - createdAt: Attribute.DateTime; - updatedAt: Attribute.DateTime; - publishedAt: Attribute.DateTime; - createdBy: Attribute.Relation< - 'api::author.author', - 'oneToOne', - 'admin::user' - > & - Attribute.Private; - updatedBy: Attribute.Relation< - 'api::author.author', - 'oneToOne', - 'admin::user' - > & - Attribute.Private; - }; -} - -export interface ApiBlogPostBlogPost extends Schema.CollectionType { - collectionName: 'blog_posts'; - info: { - singularName: 'blog-post'; - pluralName: 'blog-posts'; - displayName: 'Blog Post'; - }; - options: { - draftAndPublish: true; - }; - attributes: { - slug: Attribute.UID; - title: Attribute.String; - author: Attribute.Relation< - 'api::blog-post.blog-post', - 'oneToOne', - 'api::author.author' - >; - content: Attribute.RichText; - createdAt: Attribute.DateTime; - updatedAt: Attribute.DateTime; - publishedAt: Attribute.DateTime; - createdBy: Attribute.Relation< - 'api::blog-post.blog-post', - 'oneToOne', - 'admin::user' - > & - Attribute.Private; - updatedBy: Attribute.Relation< - 'api::blog-post.blog-post', + 'plugin::slugify.slug', 'oneToOne', 'admin::user' > & @@ -870,16 +919,17 @@ declare module '@strapi/types' { 'admin::api-token-permission': AdminApiTokenPermission; 'admin::transfer-token': AdminTransferToken; 'admin::transfer-token-permission': AdminTransferTokenPermission; + 'api::author.author': ApiAuthorAuthor; + 'api::blog-post.blog-post': ApiBlogPostBlogPost; 'plugin::upload.file': PluginUploadFile; 'plugin::upload.folder': PluginUploadFolder; 'plugin::content-releases.release': PluginContentReleasesRelease; 'plugin::content-releases.release-action': PluginContentReleasesReleaseAction; + 'plugin::i18n.locale': PluginI18NLocale; 'plugin::users-permissions.permission': PluginUsersPermissionsPermission; 'plugin::users-permissions.role': PluginUsersPermissionsRole; 'plugin::users-permissions.user': PluginUsersPermissionsUser; - 'plugin::i18n.locale': PluginI18NLocale; - 'api::author.author': ApiAuthorAuthor; - 'api::blog-post.blog-post': ApiBlogPostBlogPost; + 'plugin::slugify.slug': PluginSlugifySlug; } } } diff --git a/yarn.lock b/yarn.lock index 60f9100..941c130 100644 --- a/yarn.lock +++ b/yarn.lock @@ -109,7 +109,7 @@ core-js-pure "^3.30.2" regenerator-runtime "^0.14.0" -"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.10.5", "@babel/runtime@^7.12.0", "@babel/runtime@^7.12.1", "@babel/runtime@^7.12.13", "@babel/runtime@^7.12.5", "@babel/runtime@^7.13.10", "@babel/runtime@^7.18.3", "@babel/runtime@^7.18.6", "@babel/runtime@^7.21.0", "@babel/runtime@^7.23.8", "@babel/runtime@^7.5.5", "@babel/runtime@^7.6.2", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.7", "@babel/runtime@^7.9.2": +"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.10.5", "@babel/runtime@^7.12.0", "@babel/runtime@^7.12.1", "@babel/runtime@^7.12.13", "@babel/runtime@^7.12.5", "@babel/runtime@^7.13.10", "@babel/runtime@^7.15.4", "@babel/runtime@^7.18.3", "@babel/runtime@^7.18.6", "@babel/runtime@^7.21.0", "@babel/runtime@^7.23.8", "@babel/runtime@^7.5.5", "@babel/runtime@^7.6.2", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.7", "@babel/runtime@^7.9.2": version "7.24.7" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.24.7.tgz#f4f0d5530e8dbdf59b3451b9b3e594b6ba082e12" integrity sha512-UwgBRMjJP+xv857DCngvqXI3Iq6J4v0wXmwc6sapg+zyhbwmQX67LUEFrkK5tbyJ30jGuG3ZvWpBiB9LCy1kWw== @@ -2074,7 +2074,7 @@ "@strapi/utils" "4.25.1" fs-extra "10.0.0" -"@strapi/strapi@4.25.1": +"@strapi/strapi@4.25.1", "@strapi/strapi@^4.14.0": version "4.25.1" resolved "https://registry.yarnpkg.com/@strapi/strapi/-/strapi-4.25.1.tgz#3871f1786249ad65a2a8cafbc660c3320a53eeae" integrity sha512-GzsIArE/jkK78v7w/gQXQ02lfb1cnb0qyvTUotSOwh9FzZhV+nGURkNYvlSooyEtDxOIimD1RnkRP11iOW0kHA== @@ -2204,7 +2204,7 @@ aria-hidden "^1.2.4" react-remove-scroll "^2.5.9" -"@strapi/utils@4.25.1": +"@strapi/utils@4.25.1", "@strapi/utils@^4.14.0": version "4.25.1" resolved "https://registry.yarnpkg.com/@strapi/utils/-/utils-4.25.1.tgz#9df2726bae6a75b0de9a104166f0a84af51e0de1" integrity sha512-QuvGfAbHU2I1ebZThoF3GzAtLQVClP9VKrL3IaSy3MfKbH9xzLpg+ROiwUAawgR7Qi/zF8865VCCe4tdqJUB7Q== @@ -2473,7 +2473,7 @@ "@types/interpret" "*" "@types/node" "*" -"@types/lodash@^4.14.149", "@types/lodash@^4.14.165": +"@types/lodash@^4.14.149", "@types/lodash@^4.14.165", "@types/lodash@^4.14.175": version "4.17.5" resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.17.5.tgz#e6c29b58e66995d57cd170ce3e2a61926d55ee04" integrity sha512-MBIOHVZqVqgfro1euRDWX7OO0fBVUUMrN6Pwm8LQsz8cWhEpihlvR70ENj3f40j58TNxZaWv2ndSkInykNBBJw== @@ -8979,6 +8979,17 @@ statuses@2.0.1, statuses@^2.0.1: resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c" integrity sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA== +strapi-plugin-slugify@^2.3.8: + version "2.3.8" + resolved "https://registry.yarnpkg.com/strapi-plugin-slugify/-/strapi-plugin-slugify-2.3.8.tgz#feed725c6becbb0408ce601f40055aaa76b98316" + integrity sha512-lbC04NaVgy18nY0l4KI4ld6h1L5bGAvEe0H3hOdFnaksKRRu+rwTaB58oQQBqZtWu4lZ2n2dtMQJB/mSmFd8KA== + dependencies: + "@sindresorhus/slugify" "1.1.0" + "@strapi/strapi" "^4.14.0" + "@strapi/utils" "^4.14.0" + lodash "^4.17.21" + yup "^0.32.9" + stream-chain@2.2.5, stream-chain@^2.2.5: version "2.2.5" resolved "https://registry.yarnpkg.com/stream-chain/-/stream-chain-2.2.5.tgz#b30967e8f14ee033c5b9a19bbe8a2cba90ba0d09" @@ -9989,3 +10000,16 @@ yup@0.32.9: nanoclone "^0.2.1" property-expr "^2.0.4" toposort "^2.0.2" + +yup@^0.32.9: + version "0.32.11" + resolved "https://registry.yarnpkg.com/yup/-/yup-0.32.11.tgz#d67fb83eefa4698607982e63f7ca4c5ed3cf18c5" + integrity sha512-Z2Fe1bn+eLstG8DRR6FTavGD+MeAwyfmouhHsIUgaADz8jvFKbO/fXc2trJKZg+5EBjh4gGm3iU/t3onKlXHIg== + dependencies: + "@babel/runtime" "^7.15.4" + "@types/lodash" "^4.14.175" + lodash "^4.17.21" + lodash-es "^4.17.21" + nanoclone "^0.2.1" + property-expr "^2.0.4" + toposort "^2.0.2"