1import{c as me,aR as xe,al as ue,u as he,a as M,Y as be,aG as ye,r as l,p as V,b as H,j as e,aw as w,B as n,av as ge,h as C,q as T,t as A,i as x,J as G,a1 as Q,v as S,ai as je,ae as pe,f as fe,$ as ke,ay as F,aE as ve,O as $}from"./index-fv-DcFj2.js";import{C as z}from"./circle-check-big-DM76MPOQ.js";/** 2 * @license lucide-react v0.453.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 I=me("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);function Ne(){return V({queryKey:["/api/daily-flow/today-status"],enabled:!!localStorage.getItem("authToken")})}function we(){const r=M();return H({mutationFn:async u=>$("POST","/api/daily-flow/complete",u),onSuccess:()=>{r.invalidateQueries({queryKey:["/api/daily-flow/today-status"]}),r.invalidateQueries({queryKey:["/api/student/dashboard-data"]}),r.invalidateQueries({queryKey:["/api/student/daily-flow-progress"]})}})}function Se(){var P,L;const{slug:r}=xe(),[,u]=ue(),{toast:h}=he(),q=M(),{user:Ce,isAuthenticated:Y}=be();ye();const{data:d,isLoading:O}=Ne(),J=we(),[b,U]=l.useState(!1),[g,D]=l.useState(!1),[j,W]=l.useState(null),[p,X]=l.useState(0),[B,Z]=l.useState(""),[f,_]=l.useState([7]),[k,ee]=l.useState([7]),[i,v]=l.useState(0),[K,te]=l.useState(!1),ae=d!=null&&d.success&&r?((P=d.data[r])==null?void 0:P.completedToday)??!1:!1,se=d!=null&&d.success&&r?(L=d.data[r])==null?void 0:L.nextResetAt:null,re=()=>{try{const t=new(window.AudioContext||window.webkitAudioContext),s=[523.25,659.25,783.99,1046.5],c=300;s.forEach((y,oe)=>{const o=t.createOscillator(),m=t.createGain();o.connect(m),m.connect(t.destination),o.frequency.setValueAtTime(y,t.currentTime),o.type="sine",m.gain.setValueAtTime(0,t.currentTime),m.gain.linearRampToValueAtTime(.3,t.currentTime+.01),m.gain.exponentialRampToValueAtTime(.01,t.currentTime+c/1e3);const R=t.currentTime+oe*c/1e3;o.start(R),o.stop(R+c/1e3)})}catch(t){console.log("Audio playback not supported:",t)}},{data:a,isLoading:ie}=V({queryKey:["/api/daily-flow-activities",r],queryFn:async()=>(await $("GET",`/api/daily-flow-activities/${r}`)).data,enabled:!!r});l.useEffect(()=>{let t;return b&&!g&&j&&(t=setInterval(()=>{const s=Math.floor((Date.now()-j)/1e3);X(s),a!=null&&a.duration&&s>=a.duration*60&&!K&&(re(),te(!0))},1e3)),()=>clearInterval(t)},[b,g,j,a,K]);const N=H({mutationFn:async t=>{if(!r)throw new Error("Activity slug not found");return J.mutateAsync({activitySlug:r,duration:t.duration,notes:t.notes,mood:t.mood,energy:t.energy})},onSuccess:t=>{h({title:"ð Tebrikler!",description:t.message||"Günlük aktivite baÅarıyla tamamlandı!",variant:"default"}),D(!0),q.invalidateQueries({queryKey:["/api/student/weekly-goals"]}),setTimeout(()=>{u("/student-dashboard")},3e3)},onError:t=>{var c,y;((c=t.message)==null?void 0:c.includes("zaten tamamladınız"))||((y=t.message)==null?void 0:y.includes("already completed"))?(h({title:"â° Günlük Limit",description:"Bu aktiviteyi bugün zaten tamamladınız. Yarın tekrar deneyebilirsiniz.",variant:"default"}),q.invalidateQueries({queryKey:["/api/daily-flow/today-status"]})):h({title:"Hata",description:t.message||"Aktivite tamamlanırken bir hata oluÅtu",variant:"destructive"})}}),le=()=>{U(!0),W(Date.now()),v(0)},ne=()=>{a&&i<a.instructions.steps.length-1&&v(i+1)},de=()=>{i>0&&v(i-1)},ce=()=>{if(!Y){h({title:"GiriÅ Yapmalısınız",description:"Bu aktiviteyi tamamlamak için giriÅ yapmalısınız",variant:"destructive"});return}N.mutate({duration:p,notes:B.trim()||void 0,mood:f[0],energy:k[0]})},E=t=>{const s=Math.floor(t/60),c=t%60;return`${s}:${c.toString().padStart(2,"0")}`};return ie?e.jsx("div",{className:"min-h-screen bg-gradient-to-br dark:from-slate-900 dark:via-blue-900 dark:to-slate-900 from-blue-50 via-white to-blue-50 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin w-12 h-12 border-4 border-blue-400 border-t-transparent roun
6ded-full mx-auto mb-4"}),e.jsx("p",{className:"text-gray-900 dark:text-white",children:"Aktivite yükleniyor..."})]})}):a?e.jsx("div",{className:"min-h-screen bg-gradient-to-br dark:from-slate-900 dark:via-blue-900 dark:to-slate-900 from-blue-50 via-white to-blue-50 text-gray-900 dark:text-white",children:e.jsxs("div",{className:"container mx-auto px-4 py-8",children:[e.jsxs("div",{className:"flex items-center justify-between mb-8",children:[e.jsx(w,{to:"/student-dashboard",children:e.jsxs(n,{variant:"ghost",className:"text-gray-700 dark:text-white hover:bg-gray-100 dark:hover:bg-white/10",children:[e.jsx(ge,{className:"w-4 h-4 mr-2"}),"Dashboard'a Dön"]})}),b&&e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsxs("div",{className:"flex items-center space-x-3 bg-white/90 dark:bg-slate-800/60 px-6 py-3 rounded-xl shadow-lg",children:[e.jsx(I,{className:"w-6 h-6 text-blue-600 dark:text-blue-400"}),e.jsx("span",{className:"font-mono text-3xl font-bold text-blue-600 dark:text-blue-400",children:E(p)})]}),a.duration&&e.jsxs("div",{className:"text-xs text-gray-500 dark:text-slate-400 mt-2",children:["Ãnerilen süre: ",a.duration," dakika"]})]})]}),b?g?e.jsx("div",{className:"max-w-2xl mx-auto",children:e.jsxs(C,{className:"bg-gradient-to-br from-green-50 to-blue-50 dark:from-green-900/50 dark:to-blue-900/50 border-green-300 dark:border-green-700",children:[e.jsxs(T,{className:"text-center",children:[e.jsx("div",{className:"w-16 h-16 bg-green-600 rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx(z,{className:"w-8 h-8 text-white"})}),e.jsx(A,{className:"text-2xl text-gray-900 dark:text-white",children:"Tebrikler! ð"}),e.jsxs("p",{className:"text-green-700 dark:text-green-300",children:[a.name," aktivitesini baÅarıyla tamamladınız!"]}),e.jsxs("div",{className:"flex items-center justify-center space-x-4 mt-4",children:[e.jsxs(x,{className:"bg-green-600/20 text-green-400",children:[e.jsx(I,{className:"w-3 h-3 mr-1"}),E(p)]}),e.jsxs(x,{className:"bg-yellow-600/20 text-yellow-400",children:[e.jsx(Q,{className:"w-3 h-3 mr-1"}),"+15 puan"]})]})]}),e.jsxs(S,{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-900 dark:text-white font-medium mb-2",children:"Notlarınız (isteÄe baÄlı)"}),e.jsx(ke,{value:B,onChange:t=>Z(t.target.value),placeholder:"Bu aktivite hakkında düÅüncelerinizi paylaÅın...",className:"bg-white dark:bg-slate-700/50 border-gray-300 dark:border-slate-600 text-gray-900 dark:text-white",rows:3})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-gray-900 dark:text-white font-medium mb-2",children:["Ruh haliniz (1-10): ",f[0]]}),e.jsx(F,{value:f,onValueChange:_,max:10,min:1,step:1,className:"w-full"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-gray-900 dark:text-white font-medium mb-2",children:["Enerji seviyen (1-10): ",k[0]]}),e.jsx(F,{value:k,onValueChange:ee,max:10,min:1,step:1,className:"w-full"})]})]}),e.jsxs("div",{className:"flex flex-col space-y-3",children:[e.jsx(n,{onClick:ce,disabled:N.isPending,className:"bg-green-400 hover:bg-green-500 w-full",children:N.isPending?e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"animate-spin w-4 h-4 border-2 border-white border-t-transparent rounded-full mr-2"}),"Kaydediliyor..."]}):e.jsxs(e.Fragment,{children:[e.jsx(ve,{className:"w-4 h-4 mr-2"}),"Aktiviteyi Kaydet ve Puan Kazan"]})}),e.jsx(w,{to:"/student-dashboard",className:"block",children:e.jsx(n,{variant:"outline",className:"w-full border-gray-300 dark:border-slate-600 text-gray-700 dark:text-slate-300",children:"Dashboard'a Dön"})})]})]})]})}):e.jsx("div",{className:"max-w-3xl mx-auto",children:e.jsxs(C,{className:"bg-white/90 dark:bg-slate-800/60 border-gray-200 dark:border-slate-700",children:[e.jsx(T,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(A,{className:"text-xl text-gray-900 dark:text-white",children:a.name}),e.jsxs(x,{className:"bg-blue-600/20 text-blue-400",children:["Adım ",i+1," / ",a.instructions.steps.length]})]})}),e.jsxs(S,{className:"space-y-6",children:[e.jsx("div",{className:"bg-gray-100 dark:bg-slate-700/50 rounded-lg p-6",children:e.jsxs("div",{className:"flex items-start space-x-4",children:[e.jsx("div",{className:"w-8 h-8 bg-blue-600 rounded-full flex items-center justify-center text-white font-medium flex-shrink-0",children:i+1}),e.jsx("div",{children:e.jsx("p",{className:"text-gray-900 dark:text-white text-lg leading-relaxed",children:a.instructions.steps[i]})})]})}),e.jsx("div",{className:"w-full bg-gray-200 dark:bg-slate-700 rounded-full h-2",children:e.jsx("div",{className:"bg-gradient-to-r from-blue-500 to-purple-500 h-2 rounded-full transition-all duration-300",style:{width:`${(i+1)/a.instructions.steps.length*100}%`}})}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(n,{variant:"outline",onClick:de,disabled:i===0,className:"border-slate-600 text-slate-300",children:"Ãnceki Adım"}),i<a.instructions.steps.length-1?e.jsx(n,{onClick:ne,className:"bg-blue-600 hover:bg-blue-700",children:"Sonraki Adım"}):e.jsxs(n,{onClick:()=>D(!0),className:"bg-green-400 hover:bg-green-500",children:[e.jsx(z,{className:"w-4 h-4 mr-2"}),"Tamamlandı"]})]})]})]})}):e.jsx("div",{className:"max-w-4xl mx-auto",children:e.jsxs(C,{className:"bg-white/90 dark:bg-slate-800/60 border-gray-200 dark:border-slate-700",children:[e.jsx(T,{children:e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx("div",{className:"w-16 h-16 rounded-xl flex items-center justify-center text-3xl",style:{backgroundColor:a.color},children:a.icon}),e.jsxs("div",{children:[e.jsx(A,{className:"text-2xl text-gray-900 dark:text-white",children:a.name}),e.jsx("p",{className:"text-gray-600 dark:text-slate-300 mt-2",children:a.description}),e.jsxs("div",{className:"flex items-center space-x-4 mt-3",children:[e.jsxs(x,{variant:"secondary",className:"bg-blue-600/20 text-blue-400",children:[e.jsx(G,{className:"w-3 h-3 mr-1"}),a.duration," dakika"]}),e.jsxs(x,{variant:"secondary",className:"bg-green-600/20 text-green-400",children:[e.jsx(Q,{className:"w-3 h-3 mr-1"}),"15 puan"]})]})]})]})}),e.jsxs(S,{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-3",children:"Faydaları"}
6),e.jsx("ul",{className:"space-y-2",children:a.benefits.map((t,s)=>e.jsxs("li",{className:"flex items-start space-x-2 text-gray-700 dark:text-slate-300",children:[e.jsx(je,{className:"w-4 h-4 text-yellow-400 mt-0.5 flex-shrink-0"}),e.jsx("span",{children:t})]},s))})]}),e.jsxs("div",{children:[e.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-3",children:["Adımlar (",a.instructions.steps.length,")"]}),e.jsxs("div",{className:"space-y-2",children:[a.instructions.steps.slice(0,3).map((t,s)=>e.jsxs("div",{className:"flex items-start space-x-3 text-gray-700 dark:text-slate-300",children:[e.jsx("div",{className:"w-6 h-6 bg-blue-600 rounded-full flex items-center justify-center text-sm font-medium text-white flex-shrink-0",children:s+1}),e.jsx("span",{children:t})]},s)),a.instructions.steps.length>3&&e.jsxs("p",{className:"text-gray-500 dark:text-slate-400 text-sm ml-9",children:["... ve ",a.instructions.steps.length-3," adım daha"]})]})]}),a.instructions.tips&&a.instructions.tips.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-3",children:"İpuçları"}),e.jsx("ul",{className:"space-y-2",children:a.instructions.tips.map((t,s)=>e.jsxs("li",{className:"flex items-start space-x-2 text-gray-700 dark:text-slate-300",children:[e.jsx(pe,{className:"w-4 h-4 text-purple-400 mt-0.5 flex-shrink-0"}),e.jsx("span",{children:t})]},s))})]}),O?e.jsx("div",{className:"flex justify-center pt-6",children:e.jsxs(n,{size:"lg",disabled:!0,children:[e.jsx(G,{className:"w-5 h-5 mr-2 animate-spin"}),"Kontrol ediliyor..."]})}):ae?e.jsxs("div",{className:"text-center pt-6 space-y-4",children:[e.jsxs("div",{className:"bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-lg p-6",children:[e.jsxs("div",{className:"flex items-center justify-center space-x-3 mb-3",children:[e.jsx(z,{className:"w-6 h-6 text-amber-600 dark:text-amber-400"}),e.jsx("h3",{className:"text-lg font-semibold text-amber-800 dark:text-amber-200",children:"Günlük Aktivite Tamamlandı"})]}),e.jsx("p",{className:"text-amber-700 dark:text-amber-300 mb-4",children:"Bu aktiviteyi bugün zaten tamamladınız. Her aktivite günde bir kez yapılabilir."}),se&&e.jsx("p",{className:"text-sm text-amber-600 dark:text-amber-400",children:"Yarın saat 00:00'da tekrar yapabilirsiniz"})]}),e.jsx(n,{onClick:()=>u("/student-dashboard"),variant:"outline",size:"lg","data-testid":"button-dashboard",children:"Profilimne Dön"})]}):e.jsx("div",{className:"flex justify-center pt-6",children:e.jsxs(n,{onClick:le,size:"lg",className:"bg-gradient-to-r from-blue-600 to-purple-600 hover:from-blue-700 hover:to-purple-700 px-8 py-3","data-testid":"button-start-activity",children:[e.jsx(fe,{className:"w-5 h-5 mr-2"}),"Aktiviteyi BaÅlat"]})})]})]})})]})}):e.jsx("div",{className:"min-h-screen bg-gradient-to-br dark:from-slate-900 dark:via-blue-900 dark:to-slate-900 from-blue-50 via-white to-blue-50 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-4",children:"Aktivite Bulunamadı"}),e.jsx(w,{to:"/student-dashboard",children:e.jsx(n,{variant:"outline",className:"border-gray-300 dark:border-slate-600 text-gray-700 dark:text-slate-300",children:"Dashboard'a Dön"})})]})})}export{Se 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.