diff --git a/wp-content/themes/moonshine/acf-json/group_abstract_social.json b/wp-content/themes/moonshine/acf-json/group_abstract_social.json new file mode 100644 index 0000000..913fe51 --- /dev/null +++ b/wp-content/themes/moonshine/acf-json/group_abstract_social.json @@ -0,0 +1,86 @@ +{ + "key": "group_abstract_social", + "title": "Abstract - Social", + "fields": [ + { + "key": "field_6855a1d643408", + "label": "Médias sociaux", + "name": "profiles", + "aria-label": "", + "type": "repeater", + "instructions": "", + "required": 0, + "conditional_logic": 0, + "wrapper": { + "width": "", + "class": "", + "id": "" + }, + "acfe_repeater_stylised_button": 0, + "layout": "table", + "pagination": 0, + "min": 0, + "max": 0, + "collapsed": "", + "button_label": "Ajouter un élément", + "show_in_graphql": 1, + "graphql_description": "", + "graphql_field_name": "profiles", + "graphql_non_null": 1, + "rows_per_page": 20, + "sub_fields": [ + { + "key": "field_6855a7e143409", + "label": "URL", + "name": "url", + "aria-label": "", + "type": "url", + "instructions": "", + "required": 1, + "conditional_logic": 0, + "wrapper": { + "width": "", + "class": "", + "id": "" + }, + "default_value": "", + "allow_in_bindings": 0, + "placeholder": "", + "show_in_graphql": 1, + "graphql_description": "", + "graphql_field_name": "url", + "graphql_non_null": 1, + "parent_repeater": "field_6855a1d643408" + } + ] + } + ], + "location": [ + [ + { + "param": "abstract" + } + ] + ], + "menu_order": 0, + "position": "normal", + "style": "seamless", + "label_placement": "top", + "instruction_placement": "label", + "hide_on_screen": "", + "active": true, + "description": "", + "show_in_rest": 0, + "display_title": "", + "acfe_autosync": [ + "json" + ], + "acfe_form": 0, + "show_in_graphql": 1, + "graphql_field_name": "GroupAbstractSocial", + "map_graphql_types_from_location_rules": 0, + "graphql_types": "", + "acfe_meta": "", + "acfe_note": "", + "modified": 1769788591 +} diff --git a/wp-content/themes/moonshine/acf-json/group_options_site.json b/wp-content/themes/moonshine/acf-json/group_options_site.json index fd27b32..8b32168 100644 --- a/wp-content/themes/moonshine/acf-json/group_options_site.json +++ b/wp-content/themes/moonshine/acf-json/group_options_site.json @@ -48,6 +48,34 @@ "graphql_field_name": "phoneNumber", "graphql_non_null": 1 }, + { + "key": "field_697cd4c5fc56a", + "label": "Médias sociaux", + "name": "social", + "aria-label": "", + "type": "clone", + "instructions": "", + "required": 1, + "conditional_logic": 0, + "wrapper": { + "width": "", + "class": "", + "id": "" + }, + "graphql_field_name": "social", + "clone": [ + "group_abstract_social" + ], + "display": "seamless", + "layout": "block", + "prefix_label": 0, + "prefix_name": 0, + "acfe_seamless_style": 0, + "acfe_clone_modal": 0, + "acfe_clone_modal_close": 0, + "acfe_clone_modal_button": "", + "acfe_clone_modal_size": "large" + }, { "key": "field_697cc921234cc", "label": "Liens globaux", @@ -126,5 +154,5 @@ "graphql_types": "", "acfe_meta": "", "acfe_note": "", - "modified": 1769785750 + "modified": 1769788698 } diff --git a/wp-content/themes/moonshine/app/components/acf/AcfSocial.fragment.gql b/wp-content/themes/moonshine/app/components/acf/AcfSocial.fragment.gql new file mode 100644 index 0000000..108f299 --- /dev/null +++ b/wp-content/themes/moonshine/app/components/acf/AcfSocial.fragment.gql @@ -0,0 +1,5 @@ +fragment AcfSocial on GroupAbstractSocial_Fields { + profiles { + url + } +} diff --git a/wp-content/themes/moonshine/app/components/acf/AcfSocial.vue b/wp-content/themes/moonshine/app/components/acf/AcfSocial.vue new file mode 100644 index 0000000..b652bfd --- /dev/null +++ b/wp-content/themes/moonshine/app/components/acf/AcfSocial.vue @@ -0,0 +1,11 @@ + + + diff --git a/wp-content/themes/moonshine/app/components/site/SiteFooter.vue b/wp-content/themes/moonshine/app/components/site/SiteFooter.vue index cc2fab4..d284cbb 100644 --- a/wp-content/themes/moonshine/app/components/site/SiteFooter.vue +++ b/wp-content/themes/moonshine/app/components/site/SiteFooter.vue @@ -1,13 +1,12 @@ diff --git a/wp-content/themes/moonshine/app/components/site/SiteFooterBottom.vue b/wp-content/themes/moonshine/app/components/site/SiteFooterBottom.vue new file mode 100644 index 0000000..1fe3f7f --- /dev/null +++ b/wp-content/themes/moonshine/app/components/site/SiteFooterBottom.vue @@ -0,0 +1,9 @@ + diff --git a/wp-content/themes/moonshine/app/graphql/SiteOptions.query.gql b/wp-content/themes/moonshine/app/graphql/SiteOptions.query.gql index e5233c2..b9089dd 100644 --- a/wp-content/themes/moonshine/app/graphql/SiteOptions.query.gql +++ b/wp-content/themes/moonshine/app/graphql/SiteOptions.query.gql @@ -1,6 +1,7 @@ fragment SiteOptions on GroupSiteOptions { email phoneNumber { ... AcfPhone } + ...AcfSocial links { contact { ... AcfLink} } diff --git a/wp-content/themes/moonshine/app/utils/acf-social.ts b/wp-content/themes/moonshine/app/utils/acf-social.ts new file mode 100644 index 0000000..b0d5b81 --- /dev/null +++ b/wp-content/themes/moonshine/app/utils/acf-social.ts @@ -0,0 +1,32 @@ +import * as z from "zod"; +import type { AcfSocialFragment } from "#graphql/operations"; + +const socialProfile = z.object({ url: z.url() }).transform(({ url }) => ({ url, icon: getSocialIcon(url) })); +const acfSocialSchema = z.object({ + profiles: z.array(socialProfile), +}); +export type AcfSocialOutput = z.infer; + +export function parseAcfSocial(data?: AcfSocialFragment) { + try { + return acfSocialSchema.parse(data); + } + catch { + return undefined; + } +} + +const socialIconMap = { + "facebook.com": "i-cib-facebook-f", + "twitter.com": "i-cib-twitter", + "x.com": "i-cib-twitter", + "instagram.com": "i-cib-instagram", + "youtube.com": "i-cib-youtube", + "linkedin.com": "i-cib-linkedin", + "tiktok.com": "i-cib-tiktok", +}; + +function getSocialIcon(url: string): string { + const domain = new URL(url).hostname.toLowerCase().replace(/^www\./, ""); + return socialIconMap[domain as keyof typeof socialIconMap] ?? "i-lucide-globe"; +} diff --git a/wp-content/themes/moonshine/app/utils/map-social-icon.ts b/wp-content/themes/moonshine/app/utils/map-social-icon.ts deleted file mode 100644 index a67316e..0000000 --- a/wp-content/themes/moonshine/app/utils/map-social-icon.ts +++ /dev/null @@ -1,21 +0,0 @@ -const socialIconMap = { - "facebook.com": "i-cib-facebook-f", - "twitter.com": "i-cib-twitter", - "x.com": "i-cib-twitter", - "instagram.com": "i-cib-instagram", - "youtube.com": "i-cib-youtube", - "linkedin.com": "i-cib-linkedin", - "tiktok.com": "i-cib-tiktok", -}; - -export function mapSocialIcon(url: string) { - try { - const domain = new URL(url).hostname.toLowerCase().replace(/^www\./, ""); - const icon = socialIconMap[domain as keyof typeof socialIconMap]; - if (!icon) throw new Error(`Média social introuvable ${url}`); - return icon; - } - catch { - return "i-lucide-globe"; - } -} diff --git a/wp-content/themes/moonshine/includes/wpgraphql/term-connection.php b/wp-content/themes/moonshine/includes/wpgraphql/term-connection.php index c67a1c2..c334926 100644 --- a/wp-content/themes/moonshine/includes/wpgraphql/term-connection.php +++ b/wp-content/themes/moonshine/includes/wpgraphql/term-connection.php @@ -1,6 +1,6 @@