PageSourceSearch

https://roots-officiel.com/assets/PillarTextsManager-CFhPfw3O.js

js roots-officiel.com collected 2026-10-09 05:09:36 UTC 18,574 bytes, 1 lines download raw bytes

1import{r as h,j as e,q as M,B as d,A as ae,ap as te,a$ as re,cs as le,o as f,p as C,ad as ne,ae as oe,ce as ie,l as P,e2 as ce,eB as de,a3 as me,cp as ue,as as pe,x as S,cb as O,s as A,J as he,an as xe}from"./index-BTrKqWIn.js";import{C as ge,b as ve,c as fe,a as je}from"./card-vCGE_HIz.js";import{B as Ne}from"./badge-BICT-3y_.js";import{g as be,e as H,B as J,f as we,M as ye,A as $,c as Ce,h as Se,p as ke,i as Ae,n as qe,j as U,k as F,l as E,m as Le}from"./PillarArticleLayout-B6dUTd_Y.js";import{L as y}from"./label-t1-XzSMS.js";import{M as ze}from"./MediaLibraryDialog-Dd_5G5O4.js";import"./DonationBox-DidNUs81.js";import"./TabBar-CeFlKNWM.js";import"./tabs-Dl7mwtDU.js";import"./scroll-area-ChWVu9zF.js";import"./index-BdQq_4o_.js";const G={title:"",description:"",eyebrow:"",h1:"",lead:"",geo:"",coverMode:"design",cover:"",coverAlt:"",coverCredit:"",coverSourceUrl:""},Ee="Formats : JPG, PNG ou WebP · poids idéal < 500 Ko";function K({url:t,onUrl:j,help:n}){const[l,u]=h.useState(!1),[p,c]=h.useState(!1),r=async x=>{c(!0);try{const o=x.name.split(".").pop(),m=`piliers/${Date.now()}-${Math.random().toString(36).slice(2,8)}.${o}`,{error:g}=await A.storage.from("public-assets").upload(m,x,{upsert:!0});if(g)throw g;const{data:w}=A.storage.from("public-assets").getPublicUrl(m);j(w.publicUrl),S.success("Image envoyée")}catch(o){S.error(o.message||"Envoi impossible")}finally{c(!1)}};return e.jsxs("div",{className:"space-y-2 rounded-md border border-dashed p-3",children:[t?e.jsxs("div",{className:"relative",children:[e.jsx("img",{src:t,alt:"",className:"max-h-48 w-full rounded border object-cover"}),e.jsx(d,{size:"icon",variant:"secondary",className:"absolute right-2 top-2 h-7 w-7",title:"Retirer l'image",onClick:()=>j(""),children:e.jsx(me,{className:"h-4 w-4"})})]}):e.jsx("p",{className:"text-xs text-muted-foreground",children:"Aucune image pour l'instant."}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(d,{size:"sm",variant:"outline",onClick:()=>u(!0),children:[e.jsx(ue,{className:"mr-1 h-4 w-4"}),"Bibliothèque"]}),e.jsxs("label",{children:[e.jsx("input",{type:"file",accept:"image/jpeg,image/png,image/webp",className:"hidden",disabled:p,onChange:x=>{var m;const o=(m=x.target.files)==null?void 0:m[0];o&&r(o),x.currentTarget.value=""}}),e.jsx(d,{size:"sm",variant:"outline",disabled:p,asChild:!0,children:e.jsxs("span",{className:"cursor-pointer",children:[p?e.jsx(M,{className:"mr-1 h-4 w-4 animate-spin"}):e.jsx(pe,{className:"mr-1 h-4 w-4"}),"Depuis mon ordinateur"]})})]})]}),e.jsx(f,{value:t,placeholder:"…ou collez l'adresse d'une image (le crédit se remplit tout seul)",onChange:x=>j(x.target.value)}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[n," · ",Ee]}),e.jsx(ze,{open:l,onOpenChange:u,accept:"image",onSelect:x=>{const o=x[0];o!=null&&o.url&&(j(o.url),S.success("Image choisie"))}})]})}function V({onAdd:t}){const[j,n]=h.useState(!1);return e.jsx("div",{className:"flex flex-col items-center py-1",children:j?e.jsxs("div",{className:"flex flex-wrap justify-center gap-1 rounded-md border bg-muted/40 p-2",children:[Se.map(l=>e.jsx(d,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>{t(l),n(!1)},children:J[l]},l)),e.jsx(d,{size:"sm",variant:"ghost",className:"h-7 text-xs",onClick:()=>n(!1),children:"Fermer"})]}):e.jsxs("button",{onClick:()=>n(!0),className:"flex items-center gap-1 rounded-full px-3 py-0.5 text-xs text-muted-foreground hover:bg-muted hover:text-foreground",children:[e.jsx(O,{className:"h-3.5 w-3.5"})," Ajouter"]})})}function Me({block:t,onChange:j}){const n=l=>j({...t,...l});switch(t.type){case"heading":return e.jsx(f,{value:t.text||"",onChange:l=>n({text:l.target.value}),placeholder:"Intertitre",className:"font-bold"});case"subheading":return e.jsx(f,{value:t.text||"",onChange:l=>n({text:l.target.value}),placeholder:"Sous-titre"});case"paragraph":case"quote":return e.jsx(C,{rows:t.type==="quote"?2:4,value:t.text||"",onChange:l=>n({text:l.target.value}),placeholder:t.type==="quote"?"Citation":"Texte. [lien](adresse), **gras**, *italique*"});case"list":return e.jsxs("div",{className:"space-y-1.5",children:[(t.items||[]).map((l,u)=>e.jsxs("div",{className:"flex gap-1",children:[e.jsx(f,{value:l,onCh
1ange:p=>{const c=[...t.items||[]];c[u]=p.target.value,n({items:c})},placeholder:`Élément ${u+1}`}),e.jsx(d,{size:"icon",variant:"ghost",onClick:()=>n({items:(t.items||[]).filter((p,c)=>c!==u)}),children:e.jsx(P,{className:"h-4 w-4"})})]},u)),e.jsxs(d,{size:"sm",variant:"ghost",onClick:()=>n({items:[...t.items||[],""]}),children:[e.jsx(O,{className:"mr-1 h-3.5 w-3.5"}),"Élément"]})]});case"image":return e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(K,{url:t.url||"",help:"Largeur conseillée : 1200 px",onUrl:l=>n({url:l,credit:t.credit?t.credit:H(l)})}),e.jsx(f,{value:t.alt||"",placeholder:"Légende : ce que montre la photo",onChange:l=>n({alt:l.target.value})}),e.jsx(f,{value:t.credit||"",placeholder:"Crédit (rempli automatiquement)",onChange:l=>n({credit:l.target.value})})]});case"box":case"support":return e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(f,{value:t.title||"",placeholder:"Titre de l'encadré",onChange:l=>n({title:l.target.value})}),e.jsx(C,{rows:3,value:t.text||"",placeholder:"Texte",onChange:l=>n({text:l.target.value})}),t.type==="support"&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"Affiche un bouton « Soutenir ROOTS » vers la page de don."})]});case"faq":return e.jsxs("div",{className:"space-y-2",children:[(t.faq||[]).map((l,u)=>e.jsxs("div",{className:"space-y-1 rounded border p-2",children:[e.jsxs("div",{className:"flex gap-1",children:[e.jsx(f,{value:l.q,placeholder:"Question",onChange:p=>{const c=[...t.faq||[]];c[u]={...l,q:p.target.value},n({faq:c})}}),e.jsx(d,{size:"icon",variant:"ghost",onClick:()=>n({faq:(t.faq||[]).filter((p,c)=>c!==u)}),children:e.jsx(P,{className:"h-4 w-4"})})]}),e.jsx(C,{rows:2,value:l.a,placeholder:"Réponse",onChange:p=>{const c=[...t.faq||[]];c[u]={...l,a:p.target.value},n({faq:c})}})]},u)),e.jsxs(d,{size:"sm",variant:"ghost",onClick:()=>n({faq:[...t.faq||[],{q:"",a:""}]}),children:[e.jsx(O,{className:"mr-1 h-3.5 w-3.5"}),"Question"]})]});case"original":return e.jsx("p",{className:"text-sm text-muted-foreground",children:"Cette partie contient des éléments interactifs (recherche, tableaux, cartes) qui restent tels quels. Vous pouvez ajouter des blocs avant ou après, la déplacer ou la supprimer."});default:return null}}function Pe({page:t,onClose:j}){const n=h.useMemo(()=>be(t.path),[t.path]),[l,u]=h.useState(!0),[p,c]=h.useState(!1),[r,x]=h.useState(G),[o,m]=h.useState([]),[g,w]=h.useState(""),[q,B]=h.useState("desktop"),[R,Q]=h.useState(!1),L=(s,a)=>JSON.stringify({h:s,b:a}),k=!l&&L(r,o)!==g,z=async()=>{u(!0);const{data:s}=await A.from("portal_settings").select("key,value").like("key",`pillar.${t.path.replace(/^\//,"")}.%`),a={};for(const I of s||[])a[I.key.split(".").pop()]=I.value??"";const i={...G,title:a.title||"",description:a.description||"",eyebrow:a.eyebrow||n.eyebrow,h1:a.h1||n.h1,lead:a.lead||n.lead,geo:a.geo||"",coverMode:a.coverMode||(a.cover?"photo":"design"),cover:a.cover||"",coverAlt:a.coverAlt||"",coverCredit:a.coverCredit||"",coverSourceUrl:a.coverSourceUrl||""},v=a.blocks?ke(a.blocks):null,b=v&&v.length?v:n.blocks;x(i),m(b),w(L(i,b)),u(!1)};h.useEffect(()=>{z()},[t.path]),h.useEffect(()=>{const s=a=>{k&&(a.preventDefault(),a.returnValue="")};return window.addEventListener("beforeunload",s),()=>window.removeEventListener("beforeunload",s)},[k]);const N=(s,a)=>x(i=>({...i,[s]:a})),W=(s,a)=>m(i=>i.map((v,b)=>b===s?a:v)),_=(s,a)=>m(i=>{const v=s+a;if(v<0||v>=i.length)return i;const b=[...i];return[b[s],b[v]]=[b[v],b[s]],b}),D=(s,a)=>m(i=>[...i.slice(0,s),Ae(a),...i.slice(s)]),X=s=>m(a=>[...a.slice(0,s+1),{...JSON.parse(JSON.stringify(a[s])),id:qe()},...a.slice(s+1)]),Y=s=>m(a=>a.filter((i,v)=>v!==s)),Z=async()=>{c(!0);try{const s={...r,eyebrow:r.eyebrow===n.eyebrow?"":r.eyebrow,h1:r.h1===n.h1?"":r.h1,lead:r.lead===n.lead?"":r.lead,blocks:JSON.stringify(o),body:"",faq:""},a=U.map(v=>({key:F(t.path,v),value:(s[v]??"").trim()})),{error:i}=await A.from("portal_settings").upsert(a,{onConflict:"key"});if(i)throw i;w(L(r,o)),S.success(`Page enregistrée — ${t.label}`)}catch(s){S.error("Enregistrement impossible",{description:(s==null?void 0:s.message)??String(s)})}finally{c(!1)}},ee=async()=>
1{if(!confirm("Revenir au contenu d'origine ? Toutes les modifications de cette page seront effacées."))return;c(!0);const s=U.map(i=>({key:F(t.path,i),value:""})),{error:a}=await A.from("portal_settings").upsert(s,{onConflict:"key"});if(c(!1),a){S.error("Impossible",{description:a.message});return}S.success("Contenu d'origine rétabli"),await z()},se=()=>{k&&!confirm("Des modifications ne sont pas enregistrées. Quitter quand même ?")||j()};if(l)return e.jsxs("p",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(M,{className:"h-4 w-4 animate-spin"})," Chargement…"]});const T=r.description.length;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"sticky top-0 z-20 flex flex-wrap items-center gap-2 border-b bg-background/95 py-3 backdrop-blur",children:[e.jsxs(d,{size:"sm",variant:"ghost",onClick:se,children:[e.jsx(ae,{className:"mr-1 h-4 w-4"}),"Toutes les pages"]}),e.jsxs("div",{className:"mr-auto min-w-0",children:[e.jsx("p",{className:"truncate font-semibold",children:t.label}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[t.path,k?" · modifications non enregistrées":""]})]}),e.jsx(d,{size:"sm",variant:"outline",asChild:!0,children:e.jsxs("a",{href:t.path,target:"_blank",rel:"noreferrer",children:[e.jsx(te,{className:"mr-1 h-4 w-4"}),"Voir"]})}),e.jsxs(d,{size:"sm",variant:"ghost",onClick:ee,disabled:p,children:[e.jsx(re,{className:"mr-1 h-4 w-4"}),"Revenir à l'original"]}),e.jsx(d,{size:"sm",variant:"ghost",onClick:()=>z(),disabled:!k||p,children:"Annuler"}),e.jsxs(d,{size:"sm",onClick:Z,disabled:!k||p,children:[p?e.jsx(M,{className:"mr-1 h-4 w-4 animate-spin"}):e.jsx(le,{className:"mr-1 h-4 w-4"}),"Enregistrer"]})]}),e.jsxs("div",{className:"grid gap-6 xl:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("section",{className:"space-y-3 rounded-lg border p-4",children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"En-tête"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(y,{children:"Surtitre (petit mot rouge)"}),e.jsx(f,{value:r.eyebrow,onChange:s=>N("eyebrow",s.target.value)})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(y,{children:"Grand titre"}),e.jsx(C,{rows:2,value:r.h1,onChange:s=>N("h1",s.target.value)})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(y,{children:"Chapô"}),e.jsx(C,{rows:3,value:r.lead,onChange:s=>N("lead",s.target.value)})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(y,{children:"Encadré « ROOTS répond »"}),e.jsx(C,{rows:3,value:r.geo,placeholder:"Réponse factuelle de moins de 60 mots. Vide = pas d'encadré.",onChange:s=>N("geo",s.target.value)}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[r.geo.trim().split(/\s+/).filter(Boolean).length," mots"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(y,{children:"Couverture"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:[["design","Design"],["photo","Photo"],["none","Aucune"]].map(([s,a])=>e.jsx(d,{size:"sm",variant:r.coverMode===s?"default":"outline",onClick:()=>N("coverMode",s),children:a},s))}),r.coverMode==="photo"&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(K,{url:r.cover,help:"Format paysage conseillé : 1600 × 900",onUrl:s=>x(a=>({...a,cover:s,coverCredit:a.coverCredit||H(s)}))}),e.jsx(f,{value:r.coverAlt,placeholder:"Ce que montre la photo",onChange:s=>N("coverAlt",s.target.value)}),e.jsx(f,{value:r.coverCredit,placeholder:"Crédit (rempli automatiquement)",onChange:s=>N("coverCredit",s.target.value)}),e.jsx(f,{value:r.coverSourceUrl,placeholder:"Lien de la page source (facultatif)",onChange:s=>N("coverSourceUrl",s.target.value)})]})]})]}),e.jsxs("section",{className:"rounded-lg border p-4",children:[e.jsxs("p",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:["Contenu de la page · ",o.length," blocs"]}),e.jsx(V,{onAdd:s=>D(0,s)}),o.map((s,a)=>e.jsxs("div",{children:[e.jsxs("div",{className:"rounded-md border bg-card p-3",children:[e.jsxs("div",{className:"mb-2 flex items-center gap-1",children:[e.jsx("span",{className:"mr-auto text-xs font-semibold uppercase text-primary",children:J[s.type]}
1),e.jsx(d,{size:"icon",variant:"ghost",className:"h-7 w-7",title:"Monter",onClick:()=>_(a,-1),disabled:a===0,children:e.jsx(ne,{className:"h-3.5 w-3.5"})}),e.jsx(d,{size:"icon",variant:"ghost",className:"h-7 w-7",title:"Descendre",onClick:()=>_(a,1),disabled:a===o.length-1,children:e.jsx(oe,{className:"h-3.5 w-3.5"})}),s.type!=="original"&&e.jsx(d,{size:"icon",variant:"ghost",className:"h-7 w-7",title:"Dupliquer",onClick:()=>X(a),children:e.jsx(ie,{className:"h-3.5 w-3.5"})}),e.jsx(d,{size:"icon",variant:"ghost",className:"h-7 w-7 text-destructive",title:"Supprimer",onClick:()=>Y(a),children:e.jsx(P,{className:"h-3.5 w-3.5"})})]}),e.jsx(Me,{block:s,onChange:i=>W(a,i)})]}),e.jsx(V,{onAdd:i=>D(a+1,i)})]},s.id))]}),e.jsxs("section",{className:"rounded-lg border p-4",children:[e.jsxs("button",{className:"w-full text-left text-xs font-semibold uppercase tracking-wide text-muted-foreground",onClick:()=>Q(s=>!s),children:["Référencement Google ",R?"▲":"▼"]}),R&&e.jsxs("div",{className:"mt-3 space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(y,{children:"Titre Google"}),e.jsx(f,{value:r.title,placeholder:"Vide = titre d'origine",onChange:s=>N("title",s.target.value)}),e.jsxs("p",{className:`text-xs ${r.title.length>60?"text-destructive":"text-muted-foreground"}`,children:[r.title.length," / 60"]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(y,{children:"Description Google"}),e.jsx(C,{rows:3,value:r.description,placeholder:"Vide = description d'origine",onChange:s=>N("description",s.target.value)}),e.jsxs("p",{className:`text-xs ${T>160?"text-destructive":"text-muted-foreground"}`,children:[T," / 160 (idéal 140 à 155)"]})]})]})]})]}),e.jsxs("div",{className:"xl:sticky xl:top-20 xl:self-start",children:[e.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[e.jsx("p",{className:"mr-auto text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Aperçu"}),e.jsx(d,{size:"sm",variant:q==="desktop"?"default":"outline",onClick:()=>B("desktop"),children:e.jsx(ce,{className:"h-4 w-4"})}),e.jsx(d,{size:"sm",variant:q==="mobile"?"default":"outline",onClick:()=>B("mobile"),children:e.jsx(de,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"max-h-[80vh] overflow-y-auto rounded-lg border",children:e.jsxs("div",{className:`mx-auto bg-[hsl(var(--chabbat-paper))] px-5 py-8 text-[hsl(var(--chabbat-ink))] ${q==="mobile"?"max-w-[390px]":""}`,style:{...we,fontFamily:ye,fontSize:16,lineHeight:1.8},children:[e.jsx("p",{className:"font-sans text-xs font-black uppercase text-[hsl(var(--chabbat-red))]",children:r.eyebrow}),e.jsx("h1",{className:"mt-3 text-4xl font-normal uppercase leading-[0.95]",style:{fontFamily:$,letterSpacing:0},children:r.h1}),r.lead&&e.jsx("p",{className:"mt-5 text-lg leading-8",children:r.lead}),r.geo&&e.jsxs("section",{className:"mt-6 border-l-4 border-[hsl(var(--chabbat-red))] bg-[hsl(var(--chabbat-ink))] p-5 text-[hsl(var(--chabbat-paper))]",children:[e.jsx("p",{className:"mb-2 font-sans text-xs font-black uppercase text-[hsl(var(--chabbat-paper-deep))]",children:"ROOTS répond"}),e.jsx("p",{className:"font-bold leading-7",children:r.geo})]}),r.coverMode==="photo"&&r.cover&&e.jsx("img",{src:r.cover,alt:"",className:"mt-8 w-full"}),r.coverMode==="design"&&e.jsxs("div",{className:"mt-8 bg-[hsl(var(--chabbat-paper-deep))] px-5 py-8",children:[e.jsx("p",{className:"text-3xl font-normal uppercase leading-none",style:{fontFamily:$},children:r.eyebrow}),e.jsx("span",{className:"mt-4 block h-1 w-20 bg-[hsl(var(--chabbat-red))]"})]}),e.jsx("div",{className:"mt-8",children:e.jsx(Ce,{blocks:o})})]})})]})]})]})}function Ve(){const[t,j]=h.useState(""),[n,l]=h.useState(null),[u,p]=h.useState(new Set),c=async()=>{var g;const{data:o}=await A.from("portal_settings").select("key,value").like("key","pillar.%"),m=new Set;for(const w of o||[])(g=w.value)!=null&&g.trim()&&m.add("/"+w.key.slice(7).split(".").slice(0,-1).join("."));p(m)};h.useEffect(()=>{n||c()},[n]);const r=h.useMemo(()=>{const o=t.trim().toLowerCase();return o?E.filter(m=>`${m.label} ${m.path}`.toLowerCase().includes(o)):E},[t]),x=E.find(o=>o.path===n);return x?e.jsx(Pe,{page:x,onClose:()=>l(null)}):e.jsxs(ge,{children:[e.jsxs(ve,{className:"pb-3",children:[e.jsx(fe,{className:"text-lg",children:"Pages durables"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Ouvrez une page pour voir tout son contenu, bloc par bloc : modifier, ajouter, déplacer ou supprimer textes et photos."})]}),e.jsxs(je,{className:"space-y-6",children:[e.jsxs("div",{className:"relative max-w-sm",children:[e.jsx(he,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(f,{className:"pl-9",placeholder:"Chercher une page…",value:t,onChange:o=>j(o.target.value)})]}),Le.map(o=>{const m=r.filter(g=>g.family===o);return m.length?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:o}),e.jsx("div",{className:"grid gap-2 sm:grid-cols-2 lg:grid-cols-3",children:m.map(g=>e.jsxs("button",{onClick:()=>l(g.path),className:"grid grid-cols-[minmax(0,1fr)_auto] items-start gap-x-3 gap-y-2 rounded-lg border p-3 text-left transition-colors hover:border-primary hover:bg-muted/40",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"whitespace-normal break-words font-medium leading-snug",children:g.label}),e.jsx("p",{className:"mt-1 break-all text-xs text-muted-foreground",children:g.path})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[e.jsx(Ne,{variant:u.has(g.path)?"default":"outline",children:u.has(g.path)?"Modifiée":"D'origine"}),e.jsx(xe,{className:"h-4 w-4 text-muted-foreground"})]})]},g.path))})]},o):null}),e.jsx(d,{variant:"ghost",size:"sm",className:"hidden",children:"."})]})]})}export{Ve as PillarTextsManager};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.