From fe2b500684f0fe157c804f23efa6aa25259560a4 Mon Sep 17 00:00:00 2001 From: Pascal Martineau Date: Mon, 22 Sep 2025 11:49:48 -0400 Subject: [PATCH] feat: Initial TheSections --- .../themes/ccat/acf-json/acf-translations.php | 2 ++ .../ccat/acf-json/group_abstract_builder.json | 31 ++++++++++--------- .../app/components/nodes/ThePage.fragment.gql | 5 +++ .../ccat/app/components/nodes/ThePage.vue | 2 +- .../sections/SectionTextBlock.fragment.gql | 3 ++ .../components/sections/SectionTextBlock.vue | 11 +++++++ .../sections/TheSection.fragment.gql | 6 ++++ .../app/components/sections/TheSections.vue | 10 ++++++ .../themes/ccat/app/composables/useSection.ts | 12 +++++++ wp-content/themes/ccat/server/schema.graphql | 24 +++++++------- 10 files changed, 78 insertions(+), 28 deletions(-) create mode 100644 wp-content/themes/ccat/app/components/sections/SectionTextBlock.fragment.gql create mode 100644 wp-content/themes/ccat/app/components/sections/SectionTextBlock.vue create mode 100644 wp-content/themes/ccat/app/components/sections/TheSection.fragment.gql create mode 100644 wp-content/themes/ccat/app/components/sections/TheSections.vue create mode 100644 wp-content/themes/ccat/app/composables/useSection.ts diff --git a/wp-content/themes/ccat/acf-json/acf-translations.php b/wp-content/themes/ccat/acf-json/acf-translations.php index 87363a8..48f0c47 100644 --- a/wp-content/themes/ccat/acf-json/acf-translations.php +++ b/wp-content/themes/ccat/acf-json/acf-translations.php @@ -77,6 +77,7 @@ __( "MRC", 'ccat' ); __( "Media type", 'ccat' ); __( "Media(s)", 'ccat' ); __( "Membership type", 'ccat' ); +__( "Membership(s)", 'ccat' ); __( "Message", 'ccat' ); __( "Minimum price", 'ccat' ); __( "Moral entity", 'ccat' ); @@ -139,6 +140,7 @@ __( "URI", 'ccat' ); __( "URL", 'ccat' ); __( "Universal access", 'ccat' ); __( "Upcoming", 'ccat' ); +__( "User Profile", 'ccat' ); __( "Virtual location", 'ccat' ); __( "Where", 'ccat' ); __( "Wordless", 'ccat' ); diff --git a/wp-content/themes/ccat/acf-json/group_abstract_builder.json b/wp-content/themes/ccat/acf-json/group_abstract_builder.json index 6ef8443..3cbb2f5 100644 --- a/wp-content/themes/ccat/acf-json/group_abstract_builder.json +++ b/wp-content/themes/ccat/acf-json/group_abstract_builder.json @@ -16,6 +16,7 @@ "class": "", "id": "" }, + "acfe_flexible_advanced": 0, "layouts": { "layout_6852f761e95b0": { "key": "layout_6852f761e95b0", @@ -38,18 +39,7 @@ "id": "" }, "default_value": "", - "allow_in_bindings": 0, - "tabs": "all", - "toolbar": "full", - "media_upload": 1, - "delay": 0, - "show_in_graphql": 1, - "graphql_description": "", - "graphql_field_name": "content", - "graphql_non_null": 0, - "acfe_wysiwyg_auto_init": 0, "acfe_wysiwyg_height": 300, - "acfe_wysiwyg_min_height": 300, "acfe_wysiwyg_max_height": "", "acfe_wysiwyg_valid_elements": "", "acfe_wysiwyg_custom_style": "", @@ -61,6 +51,18 @@ "acfe_wysiwyg_transparent": 0, "acfe_wysiwyg_merge_toolbar": 0, "acfe_wysiwyg_custom_toolbar": 0, + "required_message": "", + "allow_in_bindings": 0, + "tabs": "all", + "toolbar": "full", + "media_upload": 1, + "delay": 0, + "show_in_graphql": 1, + "graphql_description": "", + "graphql_field_name": "content", + "graphql_non_null": 1, + "acfe_wysiwyg_auto_init": 0, + "acfe_wysiwyg_min_height": 300, "acfe_wysiwyg_toolbar_buttons": [] } ], @@ -85,8 +87,7 @@ "show_in_graphql": 1, "graphql_description": "", "graphql_field_name": "sections", - "graphql_non_null": 0, - "acfe_flexible_advanced": false, + "graphql_non_null": 1, "acfe_flexible_stylised_button": false, "acfe_flexible_hide_empty_message": false, "acfe_flexible_empty_message": "", @@ -149,5 +150,5 @@ "graphql_types": "", "acfe_meta": "", "acfe_note": "", - "modified": 1757960606 -} \ No newline at end of file + "modified": 1758554756 +} diff --git a/wp-content/themes/ccat/app/components/nodes/ThePage.fragment.gql b/wp-content/themes/ccat/app/components/nodes/ThePage.fragment.gql index fd7e061..cab411c 100644 --- a/wp-content/themes/ccat/app/components/nodes/ThePage.fragment.gql +++ b/wp-content/themes/ccat/app/components/nodes/ThePage.fragment.gql @@ -1,3 +1,8 @@ fragment ThePage on Page { title + groupPostPage { + sections { + ...TheSection + } + } } diff --git a/wp-content/themes/ccat/app/components/nodes/ThePage.vue b/wp-content/themes/ccat/app/components/nodes/ThePage.vue index bd3164b..df27e80 100644 --- a/wp-content/themes/ccat/app/components/nodes/ThePage.vue +++ b/wp-content/themes/ccat/app/components/nodes/ThePage.vue @@ -6,6 +6,6 @@ defineProps<{ node: ThePageFragment }>(); diff --git a/wp-content/themes/ccat/app/components/sections/SectionTextBlock.fragment.gql b/wp-content/themes/ccat/app/components/sections/SectionTextBlock.fragment.gql new file mode 100644 index 0000000..ff452af --- /dev/null +++ b/wp-content/themes/ccat/app/components/sections/SectionTextBlock.fragment.gql @@ -0,0 +1,3 @@ +fragment SectionTextBlock on GroupAbstractBuilderSectionsTextBlockLayout { + content +} diff --git a/wp-content/themes/ccat/app/components/sections/SectionTextBlock.vue b/wp-content/themes/ccat/app/components/sections/SectionTextBlock.vue new file mode 100644 index 0000000..50f9174 --- /dev/null +++ b/wp-content/themes/ccat/app/components/sections/SectionTextBlock.vue @@ -0,0 +1,11 @@ + + + diff --git a/wp-content/themes/ccat/app/components/sections/TheSection.fragment.gql b/wp-content/themes/ccat/app/components/sections/TheSection.fragment.gql new file mode 100644 index 0000000..96460df --- /dev/null +++ b/wp-content/themes/ccat/app/components/sections/TheSection.fragment.gql @@ -0,0 +1,6 @@ +fragment TheSection on GroupAbstractBuilderSections_Layout { + fieldGroupName + ... on GroupAbstractBuilderSectionsTextBlockLayout { + ...SectionTextBlock + } +} \ No newline at end of file diff --git a/wp-content/themes/ccat/app/components/sections/TheSections.vue b/wp-content/themes/ccat/app/components/sections/TheSections.vue new file mode 100644 index 0000000..8bb5009 --- /dev/null +++ b/wp-content/themes/ccat/app/components/sections/TheSections.vue @@ -0,0 +1,10 @@ + + + diff --git a/wp-content/themes/ccat/app/composables/useSection.ts b/wp-content/themes/ccat/app/composables/useSection.ts new file mode 100644 index 0000000..37c4be0 --- /dev/null +++ b/wp-content/themes/ccat/app/composables/useSection.ts @@ -0,0 +1,12 @@ +import type { SectionTextBlockFragment, TheSectionFragment } from "#graphql-operations"; +import { SectionTextBlock } from "#components"; + +export function useSection(section: TheSectionFragment) { + const { fieldGroupName, ...attrs } = section; + switch (fieldGroupName) { + case "GroupAbstractBuilderSectionsTextBlockLayout": + return { component: SectionTextBlock, attrs: attrs as SectionTextBlockFragment }; + default: + throw createError({ statusCode: 500, statusMessage: "Erreur interne", message: "Type de section invalide" }); + } +} diff --git a/wp-content/themes/ccat/server/schema.graphql b/wp-content/themes/ccat/server/schema.graphql index 3ab8b94..a2bc052 100644 --- a/wp-content/themes/ccat/server/schema.graphql +++ b/wp-content/themes/ccat/server/schema.graphql @@ -6659,7 +6659,7 @@ type GroupAbstractBuilder implements AcfFieldGroup & AcfFieldGroupFields & Group """ Field of the "flexible_content" Field Type added to the schema as part of the "GroupAbstractBuilder" Field Group """ - sections: [GroupAbstractBuilderSections_Layout] + sections: [GroupAbstractBuilderSections_Layout]! } """ @@ -6669,7 +6669,7 @@ type GroupAbstractBuilderSectionsTextBlockLayout implements AcfFieldGroup & AcfF """ Field of the "wysiwyg" Field Type added to the schema as part of the "GroupAbstractBuilderSectionsTextBlockLayout" Field Group """ - content: String + content: String! """The name of the field group""" fieldGroupName: String @deprecated(reason: "Use __typename instead") @@ -6682,7 +6682,7 @@ interface GroupAbstractBuilderSectionsTextBlockLayout_Fields implements AcfField """ Field of the "wysiwyg" Field Type added to the schema as part of the "GroupAbstractBuilderSectionsTextBlockLayout" Field Group """ - content: String + content: String! """The name of the field group""" fieldGroupName: String @deprecated(reason: "Use __typename instead") @@ -6706,7 +6706,7 @@ interface GroupAbstractBuilder_Fields implements AcfFieldGroup & AcfFieldGroupFi """ Field of the "flexible_content" Field Type added to the schema as part of the "GroupAbstractBuilder" Field Group """ - sections: [GroupAbstractBuilderSections_Layout] + sections: [GroupAbstractBuilderSections_Layout]! } """ @@ -7317,7 +7317,7 @@ type GroupPostArticle implements AcfFieldGroup & AcfFieldGroupFields & GroupAbst """ Field of the "flexible_content" Field Type added to the schema as part of the "GroupAbstractBuilder" Field Group """ - sections: [GroupAbstractBuilderSections_Layout] + sections: [GroupAbstractBuilderSections_Layout]! } """ @@ -7330,7 +7330,7 @@ interface GroupPostArticle_Fields implements AcfFieldGroup & AcfFieldGroupFields """ Field of the "flexible_content" Field Type added to the schema as part of the "GroupAbstractBuilder" Field Group """ - sections: [GroupAbstractBuilderSections_Layout] + sections: [GroupAbstractBuilderSections_Layout]! } """ @@ -8131,7 +8131,7 @@ type GroupPostPage implements AcfFieldGroup & AcfFieldGroupFields & GroupAbstrac """ Field of the "flexible_content" Field Type added to the schema as part of the "GroupAbstractBuilder" Field Group """ - sections: [GroupAbstractBuilderSections_Layout] + sections: [GroupAbstractBuilderSections_Layout]! } """ @@ -8144,7 +8144,7 @@ interface GroupPostPage_Fields implements AcfFieldGroup & AcfFieldGroupFields & """ Field of the "flexible_content" Field Type added to the schema as part of the "GroupAbstractBuilder" Field Group """ - sections: [GroupAbstractBuilderSections_Layout] + sections: [GroupAbstractBuilderSections_Layout]! } """ @@ -8183,7 +8183,7 @@ type GroupPostProject implements AcfFieldGroup & AcfFieldGroupFields & GroupAbst """ Field of the "flexible_content" Field Type added to the schema as part of the "GroupAbstractBuilder" Field Group """ - sections: [GroupAbstractBuilderSections_Layout] + sections: [GroupAbstractBuilderSections_Layout]! } """ @@ -8248,7 +8248,7 @@ interface GroupPostProject_Fields implements AcfFieldGroup & AcfFieldGroupFields """ Field of the "flexible_content" Field Type added to the schema as part of the "GroupAbstractBuilder" Field Group """ - sections: [GroupAbstractBuilderSections_Layout] + sections: [GroupAbstractBuilderSections_Layout]! } """ @@ -8625,7 +8625,7 @@ type GroupPostTemplate implements AcfFieldGroup & AcfFieldGroupFields & GroupAbs """ Field of the "flexible_content" Field Type added to the schema as part of the "GroupAbstractBuilder" Field Group """ - sections: [GroupAbstractBuilderSections_Layout] + sections: [GroupAbstractBuilderSections_Layout]! } """ @@ -8638,7 +8638,7 @@ interface GroupPostTemplate_Fields implements AcfFieldGroup & AcfFieldGroupField """ Field of the "flexible_content" Field Type added to the schema as part of the "GroupAbstractBuilder" Field Group """ - sections: [GroupAbstractBuilderSections_Layout] + sections: [GroupAbstractBuilderSections_Layout]! } """