PageSourceSearch

https://hooandja.ee/assets/CampaignSupporterStats-WY9q7HvB.js

js hooandja.ee collected 2026-10-02 07:20:27 UTC 3,251 bytes, 1 lines download raw bytes

1import{r as u,j as t}from"./index-DB1uCt0m.js";import{aA as y,aB as A,q as m,aC as M,k as d,aD as h,c as f}from"./index-CIpd-Oln.js";import{a as w,f as C}from"./currency-z3gkSfUF.js";import{u as j}from"./useTranslation-D9fYHQVN.js";import{t as P}from"./date-D7Ipk3UI.js";function S(s,e,n){const[i,a]=y(n?.in,s,e),c=p(i,a),l=Math.abs(A(i,a));i.setDate(i.getDate()-c*l);const o=+(p(i,a)===-c),r=c*(l-o);return r===0?0:r}function p(s,e){const n=s.getFullYear()-e.getFullYear()||s.getMonth()-e.getMonth()||s.getDate()-e.getDate()||s.getHours()-e.getHours()||s.getMinutes()-e.getMinutes()||s.getSeconds()-e.getSeconds()||s.getMilliseconds()-e.getMilliseconds();return n<0?-1:n>0?1:n}function B({goals:s,variant:e="basic",...n}){const{t:i}=j("campaign"),a=u.useMemo(()=>s.reduce((x,g)=>x+g.amount,0),[s]),c=u.useMemo(()=>s.map((x,g)=>s.slice(0,g+1).reduce((N,v)=>N+v.amount,0)),[s]),l=u.useMemo(()=>c.map(x=>x*100/a),[a,c]),o=u.useMemo(()=>c.find(x=>x>w(n.supportAmount)),[c,n.supportAmount]),r=n.supportAmount/a,b=o?o*100/a:100;return t.jsxs("div",{children:[t.jsxs("div",{className:"mb-1 flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx(m,{variant:e==="basic"?"xs":"sm",children:i("campaign.view.statistics.sum.current")}),t.jsx(m,{className:"!text-foreground",variant:e==="basic"?"xs":"sm",children:C(n.supportAmount)})]}),t.jsxs("div",{children:[t.jsx(m,{variant:e==="basic"?"xs":"sm",children:s.length>1?i("campaign.view.statistics.sum.goal.total"):i("campaign.view.statistics.sum.goal")}),t.jsxs(m,{className:"!text-foreground",variant:e==="basic"?"xs":"sm",children:[a,"€"]})]})]}),t.jsx(M,{className:n.className,points:l,value:r}),t.jsx("div",{className:"mb-1 flex items-center justify-between text-xs",children:o&&l.length>=1?t.jsx("div",{className:"flex items-center text-muted-foreground",style:{paddingLeft:`calc(${b-o.toString().length/2}% - ${o.toString().length*(1/2+5)}px)`},children:t.jsxs("span",{className:e==="basic"?"text-xs":"text-base sm:text-m-base",children:[o,"€"]})}):t.jsx("span",{className:d("invisible",e==="basic"?"text-xs":"sm:text-m-base text-base"),children:"0"})})]})}function D(s,e){return s.toFixed(e)}function H({campaign:s,support:e,variant:n="basic",...i}){const{t:a}=j("campaign"),c=u.useMemo(()=>s.goals.find(r=>r.order===0)?.amount??1,[s.goals]),l=s.endDate?S(h(P(s.endDate)),h(Date.now()))+1:0,o=c>0?e.amount/c:0;return t.jsxs("div",{className:d(i.className,"flex flex-wrap justify-between"),children:[t.jsxs(f,{children:[t.jsx(m,{variant:n==="basic"?"xs":"sm",children:a("campaign.view.statistics.sum.current")}),t.jsxs("span",{className:d("font-heading pt-1",n==="highlighted"?"text-m-2xl lg:text-2xl":"text-m-xl lg:text-xl"),children:[D(o),"%"]})]}),t.jsxs(f,{children:[t.jsx(m,{variant:n==="basic"?"xs":"sm",children:a("campaign.view.statistics.days")}),t.jsx("span",{className:d("font-heading pt-1",n==="highlighted"?"text-m-2xl lg:text-2xl":"text-m-xl lg:text-xl"),children:s.endDate&&l>0?l:0})]}),t.jsxs(f,{children:[t.jsx(m,{variant:n==="basic"?"xs":"sm",children:a("campaign.view.statistics.supporters")}),t.jsx("span",{className:d("font-heading pt-1",n==="highlighted"?"text-m-2xl lg:text-2xl":"text-m-xl lg:text-xl"),children:e.count})]})]})}export{H as C,B as P,D as f};

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.