Added support for an Advertisement Banner on the homepage

made home publish/draft
This commit is contained in:
Joao Ramos
2024-04-08 18:48:35 +01:00
parent 5dbe466dff
commit 3d4005a62a
8 changed files with 429 additions and 59 deletions

1
.gitignore vendored
View File

@@ -112,3 +112,4 @@ exports
dist
build
.strapi-updater.json
.history

View File

@@ -21,5 +21,24 @@ module.exports = ({ env }) => {
},
},
},
publisher: {
enabled: true,
config: {
hooks: {
beforePublish: async ({ strapi, uid, entity }) => {
console.log("beforePublish");
},
afterPublish: async ({ strapi, uid, entity }) => {
console.log("afterPublish");
},
beforeUnpublish: async ({ strapi, uid, entity }) => {
console.log("beforeUnpublish");
},
afterUnpublish: async ({ strapi, uid, entity }) => {
console.log("afterUnpublish");
},
},
},
},
};
};

View File

@@ -1,10 +1,17 @@
module.exports = ({ env }) => ({
host: env('HOST', '0.0.0.0'),
port: env.int('PORT', 1337),
app: {
keys: env.array('APP_KEYS'),
},
webhooks: {
populateRelations: env.bool('WEBHOOKS_POPULATE_RELATIONS', false),
},
});
module.exports = ({ env }) => {
const cronEnabled = env.bool("CRON_ENABLED", true)
console.log('cronEnabled', cronEnabled);
return {
host: env("HOST", "0.0.0.0"),
port: env.int("PORT", 1337),
app: {
keys: env.array("APP_KEYS"),
},
webhooks: {
populateRelations: env.bool("WEBHOOKS_POPULATE_RELATIONS", false),
},
cron: {
enabled: cronEnabled,
},
};
};

View File

@@ -1,42 +1,43 @@
{
"name": "encoach-cms",
"private": true,
"version": "0.1.0",
"description": "The Content Management System for the EnCoach website, developed by eCrop",
"scripts": {
"develop": "strapi develop",
"start": "strapi start",
"build": "strapi build",
"strapi": "strapi"
},
"devDependencies": {},
"dependencies": {
"@strapi-community/strapi-provider-upload-google-cloud-storage": "^4.10.5",
"@strapi/plugin-cloud": "^4.21.1",
"@strapi/plugin-color-picker": "^4.21.1",
"@strapi/plugin-documentation": "^4.20.5",
"@strapi/plugin-i18n": "^4.21.1",
"@strapi/plugin-users-permissions": "^4.21.1",
"@strapi/strapi": "^4.21.1",
"better-sqlite3": "8.6.0",
"esbuild": "^0.20.2",
"mysql2": "^3.9.2",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-router-dom": "5.3.4",
"strapi-plugin-import-export-entries": "^1.23.1",
"strapi-plugin-populate-deep": "^3.0.1",
"styled-components": "5.3.3"
},
"author": {
"name": "eCrop"
},
"strapi": {
"uuid": "5a0eb038-39c9-4d64-8f41-78376e285f85"
},
"engines": {
"node": ">=18.0.0 <=20.x.x",
"npm": ">=6.0.0"
},
"license": "MIT"
"name": "encoach-cms",
"private": true,
"version": "0.1.0",
"description": "The Content Management System for the EnCoach website, developed by eCrop",
"scripts": {
"develop": "strapi develop",
"start": "strapi start",
"build": "strapi build",
"strapi": "strapi"
},
"devDependencies": {},
"dependencies": {
"@strapi-community/strapi-provider-upload-google-cloud-storage": "^4.10.5",
"@strapi/plugin-cloud": "^4.21.1",
"@strapi/plugin-color-picker": "^4.21.1",
"@strapi/plugin-documentation": "^4.20.5",
"@strapi/plugin-i18n": "^4.21.1",
"@strapi/plugin-users-permissions": "^4.21.1",
"@strapi/strapi": "^4.21.1",
"better-sqlite3": "8.6.0",
"esbuild": "^0.20.2",
"mysql2": "^3.9.2",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-router-dom": "5.3.4",
"strapi-plugin-import-export-entries": "^1.23.1",
"strapi-plugin-populate-deep": "^3.0.1",
"strapi-plugin-publisher": "^1.5.7",
"styled-components": "5.3.3"
},
"author": {
"name": "eCrop"
},
"strapi": {
"uuid": "5a0eb038-39c9-4d64-8f41-78376e285f85"
},
"engines": {
"node": ">=18.0.0 <=20.x.x",
"npm": ">=6.0.0"
},
"license": "MIT"
}

View File

@@ -8,7 +8,7 @@
"description": ""
},
"options": {
"draftAndPublish": false
"draftAndPublish": true
},
"pluginOptions": {
"i18n": {
@@ -113,6 +113,21 @@
"localized": false
}
}
},
"AdvertisementBanner": {
"allowedTypes": [
"images",
"files",
"videos",
"audios"
],
"type": "media",
"multiple": false,
"pluginOptions": {
"i18n": {
"localized": true
}
}
}
}
}

View File

@@ -14,7 +14,7 @@
"name": "Apache 2.0",
"url": "https://www.apache.org/licenses/LICENSE-2.0.html"
},
"x-generation-date": "2024-03-28T15:09:45.262Z"
"x-generation-date": "2024-04-08T17:39:54.183Z"
},
"x-strapi-config": {
"path": "/documentation",
@@ -3096,6 +3096,17 @@
],
"example": "string or id"
},
"AdvertisementBanner": {
"oneOf": [
{
"type": "integer"
},
{
"type": "string"
}
],
"example": "string or id"
},
"locale": {
"type": "string"
}
@@ -3148,6 +3159,17 @@
],
"example": "string or id"
},
"AdvertisementBanner": {
"oneOf": [
{
"type": "integer"
},
{
"type": "string"
}
],
"example": "string or id"
},
"locale": {
"type": "string"
}
@@ -3921,6 +3943,145 @@
}
}
},
"AdvertisementBanner": {
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"id": {
"type": "number"
},
"attributes": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"alternativeText": {
"type": "string"
},
"caption": {
"type": "string"
},
"width": {
"type": "integer"
},
"height": {
"type": "integer"
},
"formats": {},
"hash": {
"type": "string"
},
"ext": {
"type": "string"
},
"mime": {
"type": "string"
},
"size": {
"type": "number",
"format": "float"
},
"url": {
"type": "string"
},
"previewUrl": {
"type": "string"
},
"provider": {
"type": "string"
},
"provider_metadata": {},
"related": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "number"
},
"attributes": {
"type": "object",
"properties": {}
}
}
}
}
}
},
"folder": {
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"id": {
"type": "number"
},
"attributes": {
"type": "object",
"properties": {}
}
}
}
}
},
"folderPath": {
"type": "string"
},
"createdAt": {
"type": "string",
"format": "date-time"
},
"updatedAt": {
"type": "string",
"format": "date-time"
},
"createdBy": {
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"id": {
"type": "number"
},
"attributes": {
"type": "object",
"properties": {}
}
}
}
}
},
"updatedBy": {
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"id": {
"type": "number"
},
"attributes": {
"type": "object",
"properties": {}
}
}
}
}
}
}
}
}
}
}
},
"createdAt": {
"type": "string",
"format": "date-time"
@@ -3929,6 +4090,10 @@
"type": "string",
"format": "date-time"
},
"publishedAt": {
"type": "string",
"format": "date-time"
},
"createdBy": {
"type": "object",
"properties": {

View File

@@ -590,6 +590,47 @@ export interface PluginContentReleasesReleaseAction
};
}
export interface PluginPublisherAction extends Schema.CollectionType {
collectionName: 'actions';
info: {
singularName: 'action';
pluralName: 'actions';
displayName: 'actions';
};
options: {
draftAndPublish: false;
comment: '';
};
pluginOptions: {
'content-manager': {
visible: false;
};
'content-type-builder': {
visible: false;
};
};
attributes: {
executeAt: Attribute.DateTime;
mode: Attribute.String;
entityId: Attribute.Integer;
entitySlug: Attribute.String;
createdAt: Attribute.DateTime;
updatedAt: Attribute.DateTime;
createdBy: Attribute.Relation<
'plugin::publisher.action',
'oneToOne',
'admin::user'
> &
Attribute.Private;
updatedBy: Attribute.Relation<
'plugin::publisher.action',
'oneToOne',
'admin::user'
> &
Attribute.Private;
};
}
export interface PluginI18NLocale extends Schema.CollectionType {
collectionName: 'i18n_locale';
info: {
@@ -1177,7 +1218,7 @@ export interface ApiHomeHome extends Schema.SingleType {
description: '';
};
options: {
draftAndPublish: false;
draftAndPublish: true;
};
pluginOptions: {
i18n: {
@@ -1245,8 +1286,15 @@ export interface ApiHomeHome extends Schema.SingleType {
localized: false;
};
}>;
AdvertisementBanner: Attribute.Media &
Attribute.SetPluginOptions<{
i18n: {
localized: true;
};
}>;
createdAt: Attribute.DateTime;
updatedAt: Attribute.DateTime;
publishedAt: Attribute.DateTime;
createdBy: Attribute.Relation<'api::home.home', 'oneToOne', 'admin::user'> &
Attribute.Private;
updatedBy: Attribute.Relation<'api::home.home', 'oneToOne', 'admin::user'> &
@@ -1668,6 +1716,7 @@ declare module '@strapi/types' {
'plugin::upload.folder': PluginUploadFolder;
'plugin::content-releases.release': PluginContentReleasesRelease;
'plugin::content-releases.release-action': PluginContentReleasesReleaseAction;
'plugin::publisher.action': PluginPublisherAction;
'plugin::i18n.locale': PluginI18NLocale;
'plugin::users-permissions.permission': PluginUsersPermissionsPermission;
'plugin::users-permissions.role': PluginUsersPermissionsRole;

123
yarn.lock
View File

@@ -113,6 +113,13 @@
dependencies:
regenerator-runtime "^0.14.0"
"@babel/runtime@^7.15.4":
version "7.24.4"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.24.4.tgz#de795accd698007a66ba44add6cc86542aff1edd"
integrity sha512-dkxf7+hn8mFBwKjs9bvBlArzLVxVbS8usaPUDd5p2a9JCL9tB8OaOVN1isD4+Xyk4ns89/xeOmbQvgdK7IIVdA==
dependencies:
regenerator-runtime "^0.14.0"
"@babel/template@^7.22.15":
version "7.24.0"
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.24.0.tgz#c6a524aa93a4a05d66aaf31654258fae69d87d50"
@@ -1901,6 +1908,25 @@
prop-types "^15.8.1"
react-remove-scroll "^2.5.7"
"@strapi/design-system@^1.13.1":
version "1.17.0"
resolved "https://registry.yarnpkg.com/@strapi/design-system/-/design-system-1.17.0.tgz#1d9772e0d542621cc24e7e5b64c703107b02ee49"
integrity sha512-DMzYkUviJYl0FRoxGDzwQHKPLxKsda/bwlZUO4w3+7hnyrAJ76Me/VfLqzGBeE9R9u4MldTgObM3SNFiH91oYQ==
dependencies:
"@codemirror/lang-json" "^6.0.1"
"@floating-ui/react-dom" "^2.0.8"
"@internationalized/date" "^3.5.2"
"@internationalized/number" "^3.5.1"
"@radix-ui/react-dismissable-layer" "^1.0.5"
"@radix-ui/react-dropdown-menu" "^2.0.6"
"@radix-ui/react-focus-scope" "1.0.4"
"@strapi/ui-primitives" "^1.17.0"
"@uiw/react-codemirror" "^4.21.25"
aria-hidden "^1.2.4"
compute-scroll-into-view "^3.1.0"
prop-types "^15.8.1"
react-remove-scroll "^2.5.9"
"@strapi/generate-new@4.21.1":
version "4.21.1"
resolved "https://registry.yarnpkg.com/@strapi/generate-new/-/generate-new-4.21.1.tgz#5e1580caebbdd01e3e3f60c8621c06d803fe6ef1"
@@ -1949,11 +1975,32 @@
react-query "3.39.3"
react-select "5.7.0"
"@strapi/helper-plugin@^4.0.0":
version "4.22.1"
resolved "https://registry.yarnpkg.com/@strapi/helper-plugin/-/helper-plugin-4.22.1.tgz#71e17498b6fbe9cd5bf1915181d7b59de3ef6ca9"
integrity sha512-WrJymL17dogx1rW4cPB5/ncChEV5PqDmLTi77mwtpm1g/jSViBD631Xhy7kdQ8L7uqBzuG1M/qePlOPHH4hYDw==
dependencies:
axios "1.6.0"
date-fns "2.30.0"
formik "2.4.0"
immer "9.0.19"
lodash "4.17.21"
qs "6.11.1"
react-helmet "6.1.0"
react-intl "6.4.1"
react-query "3.39.3"
react-select "5.7.0"
"@strapi/icons@1.16.0":
version "1.16.0"
resolved "https://registry.yarnpkg.com/@strapi/icons/-/icons-1.16.0.tgz#0b98dfa805a370423ad945208c07d00962209bd3"
integrity sha512-sa7MTlhHpbpFCS5ZIlgLQQtG4s5W7ojGFr6CsjwtFdezrvBLbY5ZGmVByghK7b3XoZ1bNYk1AiGdcxMQvCu+vw==
"@strapi/icons@^1.13.1":
version "1.17.0"
resolved "https://registry.yarnpkg.com/@strapi/icons/-/icons-1.17.0.tgz#a9c877b3dacca52a1978e9f4e28fdd8600cbbec5"
integrity sha512-RmV03BEECWmMlv0LpcZpwOZStcw9s6nQKqYg4jLZu7c+nDsOBZl+o6PNUnKnVeEtb7dVKliYykjZnLEVw72CGA==
"@strapi/logger@4.21.1":
version "4.21.1"
resolved "https://registry.yarnpkg.com/@strapi/logger/-/logger-4.21.1.tgz#90a74afce3ac2b326053c2f8bc35d9c3c333cd8c"
@@ -2327,6 +2374,33 @@
aria-hidden "^1.2.3"
react-remove-scroll "^2.5.7"
"@strapi/ui-primitives@^1.17.0":
version "1.17.0"
resolved "https://registry.yarnpkg.com/@strapi/ui-primitives/-/ui-primitives-1.17.0.tgz#c8d88ceb03d896b7a9a2f00d07a326284aede24d"
integrity sha512-u5ao5RaOqVD7HUDOdUpBqIOtvw57nV7jpSlckFzyP3Uqv3OGgTvno7Wnr0uAA7ppHISxXcFxQTbWzDbN7ycoQA==
dependencies:
"@radix-ui/number" "^1.0.1"
"@radix-ui/primitive" "^1.0.1"
"@radix-ui/react-collection" "1.0.3"
"@radix-ui/react-compose-refs" "^1.0.1"
"@radix-ui/react-context" "^1.0.1"
"@radix-ui/react-direction" "1.0.1"
"@radix-ui/react-dismissable-layer" "^1.0.5"
"@radix-ui/react-focus-guards" "1.0.1"
"@radix-ui/react-focus-scope" "1.0.4"
"@radix-ui/react-id" "^1.0.1"
"@radix-ui/react-popper" "^1.1.3"
"@radix-ui/react-portal" "^1.0.4"
"@radix-ui/react-primitive" "^1.0.3"
"@radix-ui/react-slot" "^1.0.2"
"@radix-ui/react-use-callback-ref" "^1.0.1"
"@radix-ui/react-use-controllable-state" "^1.0.1"
"@radix-ui/react-use-layout-effect" "1.0.1"
"@radix-ui/react-use-previous" "^1.0.1"
"@radix-ui/react-visually-hidden" "^1.0.3"
aria-hidden "^1.2.4"
react-remove-scroll "^2.5.9"
"@strapi/utils@4.21.1":
version "4.21.1"
resolved "https://registry.yarnpkg.com/@strapi/utils/-/utils-4.21.1.tgz#490236b2e1a7703b10d9bf785e8841a834f61aaa"
@@ -2339,6 +2413,18 @@
p-map "4.0.0"
yup "0.32.9"
"@strapi/utils@^4.0.0":
version "4.22.1"
resolved "https://registry.yarnpkg.com/@strapi/utils/-/utils-4.22.1.tgz#22b1c9f222e3da4ca3add0c1ac772fd17db17022"
integrity sha512-4M91MH27xFcJGElkm16JOiHtudaTNGG0HK7nUTPKljWB94SDC9BGK3piXLt5qFYhky9bfDqeb9sKpo6a5NOqkg==
dependencies:
"@sindresorhus/slugify" "1.1.0"
date-fns "2.30.0"
http-errors "1.8.1"
lodash "4.17.21"
p-map "4.0.0"
yup "0.32.9"
"@swc/core-darwin-arm64@1.4.11":
version "1.4.11"
resolved "https://registry.yarnpkg.com/@swc/core-darwin-arm64/-/core-darwin-arm64-1.4.11.tgz#91ef40816e10495a4038a98dc6c8dfcc85d9c59b"
@@ -2554,7 +2640,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.0"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.17.0.tgz#d774355e41f372d5350a4d0714abb48194a489c3"
integrity sha512-t7dhREVv6dbNj0q17X12j7yDG4bD/DHYX7o5/DbDxobP0HnGPgpRz2Ej77aL7TZT3DSw13fqUTj8J4mMnqa7WA==
@@ -2666,7 +2752,7 @@
"@codemirror/state" "^6.0.0"
"@codemirror/view" "^6.0.0"
"@uiw/react-codemirror@^4.21.24":
"@uiw/react-codemirror@^4.21.24", "@uiw/react-codemirror@^4.21.25":
version "4.21.25"
resolved "https://registry.yarnpkg.com/@uiw/react-codemirror/-/react-codemirror-4.21.25.tgz#1efb7737b907fde6f8f7552b5f43b33eec0b7a86"
integrity sha512-mBrCoiffQ+hbTqV1JoixFEcH7BHXkS3PjTyNH7dE8Gzf3GSBRazhtSM5HrAFIiQ5FIRGFs8Gznc4UAdhtevMmw==
@@ -2988,7 +3074,7 @@ argparse@~1.0.9:
dependencies:
sprintf-js "~1.0.2"
aria-hidden@^1.1.1, aria-hidden@^1.2.3:
aria-hidden@^1.1.1, aria-hidden@^1.2.3, aria-hidden@^1.2.4:
version "1.2.4"
resolved "https://registry.yarnpkg.com/aria-hidden/-/aria-hidden-1.2.4.tgz#b78e383fdbc04d05762c78b4a25a501e736c4522"
integrity sha512-y+CcFFwelSXpLZk/7fMB2mUbGtX9lKycf1MWJ7CaTIERyitVlyQx6C+sxcROU2BAJ24OiZyK+8wj2i8AlBoS3A==
@@ -8330,7 +8416,7 @@ react-is@^18.0.0, react-is@^18.2.0:
resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.2.0.tgz#199431eeaaa2e09f86427efbb4f1473edb47609b"
integrity sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==
react-query@3.39.3:
react-query@3.39.3, react-query@^3.39.3:
version "3.39.3"
resolved "https://registry.yarnpkg.com/react-query/-/react-query-3.39.3.tgz#4cea7127c6c26bdea2de5fb63e51044330b03f35"
integrity sha512-nLfLz7GiohKTJDuT4us4X3h/8unOh+00MLb2yJoGTPjxKs2bc1iDhkNx2bd5MKklXnOD3NrVZ+J2UXujA5In4g==
@@ -8375,7 +8461,7 @@ react-remove-scroll@2.5.5:
use-callback-ref "^1.3.0"
use-sidecar "^1.1.2"
react-remove-scroll@^2.5.7:
react-remove-scroll@^2.5.7, react-remove-scroll@^2.5.9:
version "2.5.9"
resolved "https://registry.yarnpkg.com/react-remove-scroll/-/react-remove-scroll-2.5.9.tgz#6a38e7d46043abc2c6b0fb39db650b9f2e38be3e"
integrity sha512-bvHCLBrFfM2OgcrpPY2YW84sPdS2o2HKWJUf1xGyGLnSoEnOTOBpahIarjRuYtN0ryahCeP242yf+5TrBX/pZA==
@@ -9356,6 +9442,20 @@ strapi-plugin-populate-deep@^3.0.1:
resolved "https://registry.yarnpkg.com/strapi-plugin-populate-deep/-/strapi-plugin-populate-deep-3.0.1.tgz#cd8f9853dc6e9a1859bdcc0176323a29bd2b8509"
integrity sha512-7t1bPPBN1AGKZlFT/6qsqmwgd7SzTA9CNzEBSzeYEjL/e0GKD2lf4wF11C2vMkfsQW2GhRAXZQRCGlLnV2XHFQ==
strapi-plugin-publisher@^1.5.7:
version "1.5.7"
resolved "https://registry.yarnpkg.com/strapi-plugin-publisher/-/strapi-plugin-publisher-1.5.7.tgz#7732c026a09de9db7aaaee128532ba677c2765e7"
integrity sha512-gz27iJXTtxZJLFbOo1sS2sTNBfiuy3CurNkd1pXq8gIMBRi5FPctMvK61AfQcLTzy7drc/igLGyxc0b4dvdyJQ==
dependencies:
"@strapi/design-system" "^1.13.1"
"@strapi/helper-plugin" "^4.0.0"
"@strapi/icons" "^1.13.1"
"@strapi/utils" "^4.0.0"
lodash "^4.17.21"
prop-types "^15.8.1"
react-query "^3.39.3"
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"
@@ -10404,6 +10504,19 @@ yup@0.32.9:
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"
z-schema@~5.0.2:
version "5.0.6"
resolved "https://registry.yarnpkg.com/z-schema/-/z-schema-5.0.6.tgz#46d6a687b15e4a4369e18d6cb1c7b8618fc256c5"