Skip to content

refactor(cms): types-for-responsiveness #71

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@
"useCaseDescription": {
"type": "string"
},
"useCaseBanner": {
"type": "media",
"multiple": false,
"required": true
},
"keyChallenges": {
"type": "component",
"repeatable": false,
Expand All @@ -45,6 +40,11 @@
"type": "component",
"repeatable": false,
"component": "content.button-link"
},
"useCaseBanner": {
"type": "component",
"repeatable": false,
"component": "content.responsive-media"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,6 @@
"repeatable": false,
"component": "content.highlight-text"
},
"processDiagram": {
"type": "media",
"multiple": false,
"required": false,
"allowedTypes": [
"images",
"files",
"videos",
"audios"
]
},
"processDiagramDesktop": {
"type": "media",
"multiple": false,
"required": false,
"allowedTypes": [
"images",
"files",
"videos",
"audios"
]
},
"table": {
"type": "component",
"repeatable": false,
Expand All @@ -64,6 +42,11 @@
"type": "component",
"repeatable": false,
"component": "content.button-link"
},
"processDiagram": {
"type": "component",
"repeatable": false,
"component": "content.responsive-media"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,15 @@
"type": "string",
"required": true
},
"explainer": {
"type": "media",
"multiple": false,
"required": true,
"allowedTypes": [
"images",
"files",
"videos",
"audios"
]
"token_stats": {
"type": "relation",
"relation": "oneToMany",
"target": "api::token-stat.token-stat"
},
"explainer_desktop": {
"allowedTypes": [
"images",
"files",
"videos",
"audios"
],
"type": "media",
"multiple": false
"explainer": {
"type": "component",
"repeatable": false,
"component": "content.responsive-media"
}
}
}
29 changes: 29 additions & 0 deletions cms-backend/src/components/content/responsive-media.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"collectionName": "components_content_responsive_medias",
"info": {
"displayName": "ResponsiveMedia"
},
"options": {},
"attributes": {
"mobile": {
"allowedTypes": [
"images",
"files",
"videos",
"audios"
],
"type": "media",
"multiple": false
},
"desktop": {
"allowedTypes": [
"images",
"files",
"videos",
"audios"
],
"type": "media",
"multiple": false
}
}
}
12 changes: 12 additions & 0 deletions cms-backend/types/generated/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,17 @@ export interface ContentNavlink extends Struct.ComponentSchema {
};
}

export interface ContentResponsiveMedia extends Struct.ComponentSchema {
collectionName: 'components_content_responsive_medias';
info: {
displayName: 'ResponsiveMedia';
};
attributes: {
desktop: Schema.Attribute.Media<'images' | 'files' | 'videos' | 'audios'>;
mobile: Schema.Attribute.Media<'images' | 'files' | 'videos' | 'audios'>;
};
}

export interface ContentSection extends Struct.ComponentSchema {
collectionName: 'components_content_sections';
info: {
Expand Down Expand Up @@ -403,6 +414,7 @@ declare module '@strapi/strapi' {
'content.highlight-text': ContentHighlightText;
'content.link-card': ContentLinkCard;
'content.navlink': ContentNavlink;
'content.responsive-media': ContentResponsiveMedia;
'content.section': ContentSection;
'content.stat-display': ContentStatDisplay;
'cooperative-report-page.learn-more-section': CooperativeReportPageLearnMoreSection;
Expand Down
25 changes: 12 additions & 13 deletions cms-backend/types/generated/contentTypes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1255,7 +1255,10 @@ export interface ApiForBuildersPageUseCasesSectionForBuildersPageUseCasesSection
updatedAt: Schema.Attribute.DateTime;
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> &
Schema.Attribute.Private;
useCaseBanner: Schema.Attribute.Media & Schema.Attribute.Required;
useCaseBanner: Schema.Attribute.Component<
'content.responsive-media',
false
>;
useCaseDescription: Schema.Attribute.String;
useCases: Schema.Attribute.Relation<'oneToMany', 'api::use-case.use-case'>;
useCaseTitle: Schema.Attribute.String;
Expand Down Expand Up @@ -1408,11 +1411,9 @@ export interface ApiForLawyersPageKlerosEnterpriseSectionForLawyersPageKlerosEnt
'api::for-lawyers-page-kleros-enterprise-section.for-lawyers-page-kleros-enterprise-section'
> &
Schema.Attribute.Private;
processDiagram: Schema.Attribute.Media<
'images' | 'files' | 'videos' | 'audios'
>;
processDiagramDesktop: Schema.Attribute.Media<
'images' | 'files' | 'videos' | 'audios'
processDiagram: Schema.Attribute.Component<
'content.responsive-media',
false
>;
publishedAt: Schema.Attribute.DateTime;
subtitle: Schema.Attribute.Component<'content.highlight-text', false>;
Expand Down Expand Up @@ -1611,13 +1612,7 @@ export interface ApiHomeHowKlerosWorksSectionHomeHowKlerosWorksSection
createdAt: Schema.Attribute.DateTime;
createdBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> &
Schema.Attribute.Private;
explainer: Schema.Attribute.Media<
'images' | 'files' | 'videos' | 'audios'
> &
Schema.Attribute.Required;
explainer_desktop: Schema.Attribute.Media<
'images' | 'files' | 'videos' | 'audios'
>;
explainer: Schema.Attribute.Component<'content.responsive-media', false>;
label: Schema.Attribute.String & Schema.Attribute.Required;
locale: Schema.Attribute.String & Schema.Attribute.Private;
localizations: Schema.Attribute.Relation<
Expand All @@ -1628,6 +1623,10 @@ export interface ApiHomeHowKlerosWorksSectionHomeHowKlerosWorksSection
publishedAt: Schema.Attribute.DateTime;
subtitle: Schema.Attribute.String & Schema.Attribute.Required;
title: Schema.Attribute.String & Schema.Attribute.Required;
token_stats: Schema.Attribute.Relation<
'oneToMany',
'api::token-stat.token-stat'
>;
updatedAt: Schema.Attribute.DateTime;
updatedBy: Schema.Attribute.Relation<'oneToOne', 'admin::user'> &
Schema.Attribute.Private;
Expand Down