PageSourceSearch

https://noory-finance-control.lovable.app/assets/sos-history-ngt78r9M.js

js noory-finance-control.lovable.app collected 2026-10-03 03:34:57 UTC 12,093 bytes, 42 lines download raw bytes

1import{j as e,r as w,e as S}from"./vendor-react-41ueo3pJ.js";import{h as n,bK as j,cq as M,q as b,X as F,co as d,cn as A,cr as L,y as C,A as T,cs as D,a5 as E}from"./index-CKzo9_OF.js";import{m as v}from"./vendor-motion-PFo9Tjgl.js";import"./vendor-supabase-CHhSiU8o.js";import"./vendor-query-BWsz63tc.js";import"./vendor-ui-FfbaQZZa.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const P=n("Dumbbell",[["path",{d:"M14.4 14.4 9.6 9.6",key:"ic80wn"}],["path",{d:"M18.657 21.485a2 2 0 1 1-2.829-2.828l-1.767 1.768a2 2 0 1 1-2.829-2.829l6.364-6.364a2 2 0 1 1 2.829 2.829l-1.768 1.767a2 2 0 1 1 2.828 2.829z",key:"nnl7wr"}],["path",{d:"m21.5 21.5-1.4-1.4",key:"1f1ice"}],["path",{d:"M3.9 3.9 2.5 2.5",key:"1evmna"}],["path",{d:"M6.404 12.768a2 2 0 1 1-2.829-2.829l1.768-1.767a2 2 0 1 1-2.828-2.829l2.828-2.828a2 2 0 1 1 2.829 2.828l1.767-1.768a2 2 0 1 1 2.829 2.829z",key:"yhosts"}]]);/**
7 * @license lucide-react v0.462.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const H=n("House",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);/**
12 * @license lucide-react v0.462.0 - ISC
13 *
14 * This source code is licensed under the ISC license.
15 * See the LICENSE file in the root directory of this source tree.
16 */const z=n("Package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7",key:"yx3hmr"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);/**
17 * @license lucide-react v0.462.0 - ISC
18 *
19 * This source code is licensed under the ISC license.
20 * See the LICENSE file in the root directory of this source tree.
21 */const R=n("PartyPopper",[["path",{d:"M5.8 11.3 2 22l10.7-3.79",key:"gwxi1d"}],["path",{d:"M4 3h.01",key:"1vcuye"}],["path",{d:"M22 8h.01",key:"1mrtc2"}],["path",{d:"M15 2h.01",key:"1cjtqr"}],["path",{d:"M22 20h.01",key:"1mrys2"}],["path",{d:"m22 2-2.24.75a2.9 2.9 0 0 0-1.96 3.12c.1.86-.57 1.63-1.45 1.63h-.38c-.86 0-1.6.6-1.76 1.44L14 10",key:"hbicv8"}],["path",{d:"m22 13-.82-.33c-.86-.34-1.82.2-1.98 1.11c-.11.7-.72 1.22-1.43 1.22H17",key:"1i94pl"}],["path",{d:"m11 2 .33.82c.34.86-.2 1.82-1.11 1.98C9.52 4.9 9 5.52 9 6.23V7",key:"1cofks"}],["path",{d:"M11 13c1.93 1.93 2.83 4.17 2 5-.83.83-3.07-.07-5-2-1.93-1.93-2.83-4.17-2-5 .83-.83 3.07.07 5 2Z",key:"4kbmks"}]]);/**
22 * @license lucide-react v0.462.0 - ISC
23 *
24 * This source code is licensed under the ISC license.
25 * See the LICENSE file in the root directory of this source tree.
26 */const q=n("Shirt",[["path",{d:"M20.38 3.46 16 2a4 4 0 0 1-8 0L3.62 3.46a2 2 0 0 0-1.34 2.23l.58 3.47a1 1 0 0 0 .99.84H6v10c0 1.1.9 2 2 2h8a2 2 0 0 0 2-2V10h2.15a1 1 0 0 0 .99-.84l.58-3.47a2 2 0 0 0-1.34-2.23z",key:"1wgbhj"}]]);/**
27 * @license lucide-react v0.462.0 - ISC
28 *
29 * This source code is licensed under the ISC license.
30 * See the LICENSE file in the root directory of this source tree.
31 */const O=n("ShoppingBag",[["path",{d:"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z",key:"hou9p0"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}]]);/**
32 * @license lucide-react v0.462.0 - ISC
33 *
34 * This source code is licensed under the ISC license.
35 * See the LICENSE file in the root directory of this source tree.
36 */const V=n("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/**
37 * @license lucide-react v0.462.0 - ISC
38 *
39 * This source code is licensed under the ISC license.
40 * See the LICENSE file in the root directory of this source tree.
41 */const $=n("UtensilsCrossed",[["path",{d:"m16 2-2.3 2.3a3 3 0 0 0 0 4.2l1.8 1.8a3 3 0 0 0 4.2 0L22 8",key:"n7qcjb"}],["path",{d:"M15 15 3.3 3.3a4.2 4.2 0 0 0 0 6l7.3 7.3c.7.7 2 .7 2.8 0L15 15Zm0 0 7 7",key:"d0u48b"}],["path",{d:"m2.1 21.8 6.4-6.3",key:"yn04lh"}],["path",{d:"m19 5-7 7",key:"194lzd"}]]);function B({stats:t}){const a=j(t.totalSaved);return e.jsxs("div",{className:"rounded-2xl bg-[#FFF8F0] border border-gray-100 p-5 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-emerald-100 flex items-center justify-center shrink-0",children:e.jsx(M,{className:"w-5 h-5 text-emerald-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-gray-500",children:"Total économisé"}),e.jsxs("p",{className:"text-xl font-bold text-emerald-600",children:[a," €"]})]})]}),e.jsx("div",{className:"h-px bg-gray-100"}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 text-center",children:[e.jsxs("div",{className:"flex flex-col items-center gap-1",children:[e.jsx(O,{className:"w-4 h-4 text-gray-400"}),e.jsx("p",{className:"text-lg font-bold text-gray-700",children:t.totalAnalyzed}),e.jsx("p",{className:"text-xs text-gray-500",children:"analysés"})]}),e.jsxs("div",{className:"flex flex-col items-center gap-1",children:[e.jsx(b,{className:"w-4 h-4 text-emerald-500"}),e.jsx("p",{className:"text-lg font-bold text-emerald-600",children:t.countAvoided}),e.jsx("p",{className:"text-xs text-gray-500",children:"évités"})]}),e.jsxs("div",{className:"flex flex-col items-center gap-1",children:[e.jsx(F,{className:"w-4 h-4 text-gray-400"}),e.jsx("p",{className:"text-lg font-bold text-gray-400",children:t.countPurchased}),e.jsx("p",{className:"text-xs text-gray-500",children:"achetés"})]}),e.jsxs("div",{className:"flex flex-col items-center gap-1",children:[e.jsx(d,{className:"w-4 h-4 text-amber-500"}),e.jsx("p",{className:"text-lg font-bold text-amber-600",children:t.countPending}),e.jsx("p",{className:"text-xs text-gray-500",children:"en pause"})]})]})]})}const _={tech:e.jsx(V,{className:"w-3.5 h-3.5 inline"}),vetements:e.jsx(q,{className:"w-3.5 h-3.5 inline"}),food:e.jsx($,{className:"w-3.5 h-3.5 inline"}),sorties:e.jsx(R,{className:"w-3.5 h-3.5 inline"}),deco:e.jsx(H,{className:"w-3.5 h-3.5 inline"}),beauty:e.jsx(C,{className:"w-3.5 h-3.5 inline"}),sport:e.jsx(P,{className:"w-3.5 h-3.5 inline"}),other:e.jsx(z,{className:"w-3.5 h-3.5 inline"})},I={tech:"Tech",vetements:"Vêtements",food:"Nourriture",sorties:"Sorties",deco:"Déco",beauty:"Beauté",sport:"Sport",other:"Autre"},K={ennui:"Ennui",stress:"Stress",fatigue:"Fatigue",recompense:"Récompense",frustration:"Frustration",neutral:"Neutre"},Z={all:"Tu n'as pas encore utilisé le SOS.",pending:"Aucun achat en pause. C'est une bonne nouvelle !",avoided:"Tu n'as pas encore évité d'achat. Le SOS t'aidera !",purchased:"Aucun achat impulsif enregistré ici."};function G(t){return new Date(t).toLocaleDateString("fr-FR",{day:"numeric",month:"short",year:"numeric"})}function U(t){const a=new Date(t).getTime()-Date.now();if(a<=0)return"expiré";const l=Math.floor(a/(1e3*60*60)),r=Math.floor(l/24);if(r>0)return`${r}j ${l%24}h`;const s=Math.floor(a%(1e3*60*60)/(1e3*60));return l>0?`${l}h ${s}min`:`${s}min`}function W({entries:t,statusFilter:a}){const[l,r]=w.useState(null);return t.length===0?e.jsx("div",{className:"text-center py-10",children:e.jsx("p",{className:"text-sm text-gray-500",children:Z[a]})}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-3",children:t.map((s,o)=>{var y,g,f;const i=((y=s.metadata)==null?void 0:y.purchase_name)||s.note||s.description||"Achat",x=j(s.amount_cents/100),c=(g=s.metadata)==null?void 0:g.category,m=(f=s.metadata)==null?void 0:f.emotion,N=c?_[c]:null,h=c?I[c]:null,p=m?K[m]:null,u=s.status==="pending"&&new Date(s.expire_at).getTime()<Date.now(),k=s.status==="pending"&&!u;return e.jsxs(v.div,{initial:{opacity:0,y:10}
41,animate:{opacity:1,y:0},transition:{delay:o*.04,duration:.25},className:"rounded-2xl bg-[#FFF8F0] border border-gray-100 p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2 mb-1",children:[e.jsx("p",{className:"text-sm font-semibold text-gray-700 truncate flex-1",children:i}),e.jsxs("p",{className:"text-sm font-bold text-gray-700 shrink-0",children:[x," €"]})]}),(h||p)&&e.jsxs("p",{className:"text-xs text-gray-400 mb-1 flex items-center gap-1",children:[N,[h,p].filter(Boolean).join(" · ")]}),e.jsx("p",{className:"text-xs text-gray-400 mb-2.5",children:G(s.created_at)}),s.status==="avoided"&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs font-medium px-2.5 py-1 rounded-full bg-emerald-100 text-emerald-700",children:[e.jsx(b,{className:"w-3 h-3"})," Évité — ",x," € économisés"]}),s.status==="purchased"&&e.jsx("span",{className:"inline-block text-xs font-medium px-2.5 py-1 rounded-full bg-gray-100 text-gray-500",children:"Acheté"}),k&&e.jsxs("div",{children:[e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs font-medium px-2.5 py-1 rounded-full bg-amber-100 text-amber-700",children:[e.jsx(d,{className:"w-3 h-3"})," En pause"]}),e.jsxs("p",{className:"text-xs text-amber-600 mt-1.5 flex items-center gap-1",children:[e.jsx(d,{className:"w-3 h-3"})," Expire dans ",U(s.expire_at)]})]}),u&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs font-medium px-2.5 py-1 rounded-full bg-red-100 text-red-700",children:[e.jsx(A,{className:"w-3 h-3"})," Gel expiré"]}),e.jsx("button",{type:"button",onClick:()=>r(s),className:"text-xs font-semibold text-primary underline",children:"Résoudre →"})]})]},s.id)})}),e.jsx(L,{entry:l,onClose:()=>r(null)})]})}const X=[{value:"all",label:"Tous"},{value:"pending",label:"En pause"},{value:"avoided",label:"Évités"},{value:"purchased",label:"Achetés"}];function J(){const t=S(),{entries:a,stats:l,isLoading:r,statusFilter:s,setStatusFilter:o}=D();return e.jsxs("div",{className:"fixed inset-0 bg-[#FFF8F0] flex flex-col",children:[e.jsx("div",{className:"flex-shrink-0 bg-[#FFF8F0]/95 backdrop-blur-sm border-b border-gray-100",style:{paddingTop:"env(safe-area-inset-top)"},children:e.jsxs("div",{className:"flex items-center gap-3 px-4 py-3",children:[e.jsx("button",{type:"button",onClick:()=>t(-1),className:"w-9 h-9 rounded-full bg-gray-100 flex items-center justify-center active:scale-95 transition",children:e.jsx(E,{className:"w-5 h-5 text-gray-600"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-bold text-gray-700 font-display",children:"Mon suivi SOS"}),e.jsx("p",{className:"text-xs text-gray-400",children:"Tes achats impulsifs sous contrôle"})]})]})}),e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto px-4 pt-4 pb-24 space-y-4",style:{WebkitOverflowScrolling:"touch"},children:r?e.jsx("div",{className:"flex items-center justify-center py-20",children:e.jsx("div",{className:"w-6 h-6 border-2 border-primary border-t-transparent rounded-full animate-spin"})}):e.jsxs(v.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.3},className:"space-y-4",children:[e.jsx(B,{stats:l}),l.totalAnalyzed===0?e.jsxs("div",{className:"text-center py-10 space-y-3",children:[e.jsxs("p",{className:"text-sm text-gray-500",children:["Tu n'as pas encore utilisé le SOS.",`
42`,"La prochaine fois que tu hésites avant un achat, utilise-le !"]}),e.jsx("button",{type:"button",onClick:()=>t("/"),className:"mx-auto px-5 py-2.5 rounded-full bg-primary text-white text-sm font-semibold active:scale-95 transition",children:"Essayer le SOS →"})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex gap-2 overflow-x-auto no-scrollbar",children:X.map(i=>e.jsx("button",{type:"button",onClick:()=>o(i.value),className:`shrink-0 px-3.5 py-1.5 rounded-full text-xs font-medium transition ${s===i.value?"bg-primary text-white":"bg-gray-100 text-gray-500"}`,children:i.label},i.value))}),e.jsx(W,{entries:a,statusFilter:s})]})]})})]})}function le(){return e.jsx(T,{children:e.jsx(J,{})})}
42export{le as default};

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.