PageSourceSearch

https://sciaccainrete.it/build/assets/MissionsModule.g4XiTFHC.js

js sciaccainrete.it collected 2026-10-02 01:59:34 UTC 5,742 bytes, 1 lines download raw bytes

1import{r as p,o as j,w as M,c as _,d as a,f as l,g as t,e as d,h as i,t as r,F as x,i as g,n as z,x as B}from"./app.Btm2sMGp.js";const N={class:"space-y-6"},T={class:"flex flex-wrap items-center gap-3 text-xs text-slate-500"},A={class:"inline-flex items-center gap-2 rounded-full bg-slate-100 px-3 py-1 font-semibold text-slate-600"},I={key:0,class:"inline-flex items-center gap-2 rounded-full bg-slate-100 px-3 py-1 font-semibold text-slate-600"},S={class:"inline-flex items-center gap-2 rounded-full bg-slate-100 px-3 py-1 font-semibold text-slate-600"},D={key:0,class:"rounded-2xl border border-rose-200 bg-rose-50 px-4 py-3 text-sm text-rose-600"},V={key:1,class:"space-y-3"},C={key:0,class:"rounded-2xl border border-amber-100 bg-amber-50/70 p-5 shadow-sm"},L={class:"mt-3 flex flex-wrap gap-2 text-sm"},$={key:1,class:"space-y-4"},F={class:"flex flex-wrap items-start justify-between gap-4"},E={class:"text-lg font-semibold text-slate-900"},O={key:0,class:"text-sm text-slate-500"},R={class:"inline-flex items-center gap-2 rounded-full bg-primary-50 px-3 py-1 text-xs font-semibold uppercase tracking-wide text-primary-700"},U={class:"space-y-2"},q={class:"flex items-center justify-between text-xs text-slate-500"},G={class:"h-2 w-full overflow-hidden rounded-full bg-slate-100"},H={class:"flex flex-wrap items-center gap-3 text-xs text-slate-500"},J={key:0,class:"inline-flex items-center gap-1 text-emerald-600"},K={key:1,class:"inline-flex items-center gap-1"},P={key:2,class:"inline-flex items-center gap-1"},Q={key:3,class:"inline-flex items-center gap-1 text-amber-600"},W={key:2,class:"rounded-2xl border border-slate-200 bg-slate-50/70 p-6 text-sm text-slate-500"},Y={__name:"MissionsModule",props:{subjectType:{type:String,default:"user"},subjectId:{type:[String,Number,null],default:null}},setup(h){const o=h,b=p([]),m=p([]),u=p({id:null,type:"user",name:null,reputation_score:0}),y=p(!1),c=p(""),f=n=>{if(!n)return"";try{return new Date(n).toLocaleDateString("it-IT",{day:"2-digit",month:"short",year:"numeric"})}catch{return n}},v=async()=>{y.value=!0,c.value="";try{const n={subject_type:o.subjectType};o.subjectId&&(n.subject_id=o.subjectId);const{data:e}=await B.get("/api/missions",{params:n});b.value=Array.isArray(e?.missions)?e.missions:[],m.value=Array.isArray(e?.badges)?e.badges:[];const s=e?.subject??{};u.value={id:s.id??null,type:s.type??o.subjectType??"user",name:s.name??null,reputation_score:Number(s.reputation_score??0)}}catch(n){console.error(n),c.value="Impossibile recuperare lo stato delle missioni."}finally{y.value=!1}};j(()=>{v()}),M(()=>[o.subjectType,o.subjectId],()=>{v()});const w=_(()=>{switch(u.value?.type){case"activity":return"Attività";case"organizer":return"Organizzatore";default:return"Utente"}}),k=_(()=>Math.max(0,Number(u.value?.reputation_score??0)));return(n,e)=>(l(),a("div",N,[e[11]||(e[11]=t("header",{class:"space-y-2"},[t("h2",{class:"text-2xl font-semibold text-slate-900"},"Missioni e obiettivi"),t("p",{class:"text-sm text-slate-500"},"Monitora i progressi delle missioni attive e sblocca badge reputazionali in base al tuo contributo.")],-1)),t("div",T,[t("span",A,[e[0]||(e[0]=t("span",{"aria-hidden":"true"},"👤",-1)),i(" "+r(w.value),1)]),u.value?.name?(l(),a("span",I,[e[1]||(e[1]=t("span",{"aria-hidden":"true"},"🏷️",-1)),i(" "+r(u.value.name),1)])):d("",!0),t("span",S,[e[2]||(e[2]=t("span",{"aria-hidden":"true"},"⭐",-1)),i(" Reputazione: "+r(k.value),1)])]),c.value?(l(),a("div",D,r(c.value),1)):d("",!0),y.value?(l(),a("div",V,[(l(),a(x,null,g(3,s=>t("div",{key:`mission-skeleton-${s}`,class:"animate-pulse space-y-3 rounded-2xl border border-slate-200 bg-white/70 p-5"},[...e[3]||(e[3]=[t("div",{class:"h-4 w-1/3 rounded bg-slate-200"},null,-1),t("div",{class:"h-3 w-full rounded bg-slate-100"},null,-1),t("div",{class:"h-2 w-full rounded bg-slate-100"},null,-1)])])),64))])):(l(),a(x,{key:2},[m.value.length?(l(),a("section",C,[e[5]||(e[5]=t("h3",{class:"text-sm font-semibold text-amber-900"},"Badge attivi",-1)),t("div",L,[(l(!0),a(x,null,g(m.value,s=>(l(),a("span",{key:`badge-${s.mission_id}`,class:"inline-flex items-center gap-2 rounded-full bg-amber-100 px-3 py-1 text-xs font-semibold uppercase tracking-wide text-amber-800"},[e[4]||(e[4]=t("span",{"aria-hidden":"true"},"🏅",-1)),i(" "+r(s.title),1)]))),128))])])):d("",!0),b.value.length?(l(),a("section",$,[(l(!0),a(x,null,g(b.value,s=>(l(),a("article",{key:s.id,class:"space-y-3 rounded-2xl border border-slate-200 bg-white p-5 shadow-sm"},[t("div",F,[t("div",null,[t("h3",E,r(s.title),1),s.description?(l(),a("p",O,r(s.description),1)):d("",!0)]),t("span",R,r(s.reward.type==="reputation_badge"?"Badge reputazione":"Badge visibilità"),1)]),t("div",U,[t("div",q,[e[6]||(e[6]=t("span",null,"Avanzamento",-1)),t("span",null,r(s.progress)+" / "+r(s.threshold),1)]),t("div",G,[t("div",{class:"h-full rounded-full bg-primary-500 transition-all",style:z({width:`${Math.min(100,s.percentage)}%`})},null,4)])]),t("div",H,[s.completed?(l(),a("span",J,[e[7]||(e[7]=t("span",{"aria-hidden":"true"},"✔",-1)),i(" Completata il "+r(f(s.completed_at)),1)])):(l(),a("span",K,[e[8]||(e[8]=t("span",{"aria-hidden":"true"},"⏳",-1)),i(" Mancano "+r(Math.max(s.threshold-s.progress,0))+" azioni per completare la missione. ",1)])),s.ends_at?(l(),a("span",P,[e[9]||(e[9]=t("span",{"aria-hidden":"true"},"📅",-1)),i(" Valida fino al "+r(f(s.ends_at)),1)])):d("",!0),s.reward_expires_at?(l(),a("span",Q,[e[10]||(e[10]=t("span",{"aria-hidden":"true"},"🔥",-1)),i(" Badge valido fino al "+r(f(s.reward_expires_at)),1)])):d("",!0)])]))),128))])):(l(),a("div",W," Nessuna missione attiva per il momento. Continua a contribuire: nuove sfide verranno pubblicate presto! "))],64))]))}};export{Y 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.