PageSourceSearch

https://fokus-cockpit.lovable.app/assets/TabRewards-CSiNdTTH.js

js fokus-cockpit.lovable.app collected 2026-10-03 03:32:07 UTC 7,671 bytes, 1 lines download raw bytes

1import{E,r as o,j as e,B as v,t as h}from"./index-C9ebdKB5.js";import{C as l}from"./card-DR5LKJwI.js";import{I as y}from"./label-mUns6IyZ.js";import{A as T,B as R,G as A,D as G}from"./Cockpit-COB0Md-T.js";import{T as L,a as M,b as C,c as B}from"./tabs-CntS2C33.js";import{a as z}from"./ResetButtons-DPcsf0jx.js";import{A as F}from"./archive-_7GY6ByE.js";import{L as b}from"./lock-CInwS2dp.js";import{S as I}from"./accordion-DEExls7I.js";import{C as _}from"./alert-dialog-DC8lUvR1.js";import"./FokusLogo-6nlbNsOi.js";import"./index-DfOTqTrH.js";import"./users-MNfdipfr.js";import"./download-D4Jj7-3E.js";import"./Footer-sQ8iIHWy.js";import"./arrow-left-D7dovSXJ.js";import"./focus-reschedule-nmBTkqgv.js";import"./confetti-bEOLSAJf.js";function r(a){return a.toLocaleString("de-DE")}function W(a){const n=String(a);return n.length<=3?"text-lg":n.length===4?"text-sm":n.length===5?"text-xs":"text-[10px]"}function N({r:a,available:n,archivedAlwaysClaimable:i,onClaim:c,onDelete:x}){const t=i?!0:n>=a.points,u=Math.min(100,Math.round(n/Math.max(1,a.points)*100)),d=Math.max(0,a.points-n);return e.jsxs(l,{className:h("p-4 flex flex-col gap-2 transition relative overflow-hidden",a.claimed&&"opacity-60",!a.claimed&&t&&"border-primary/40 shadow-[0_2px_18px_-8px_hsl(var(--primary)/0.5)]",!a.claimed&&!t&&"bg-muted/30 border-dashed"),children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"relative shrink-0",children:[e.jsx("div",{className:h("rounded-lg w-14 h-14 grid place-items-center font-display leading-none tabular-nums text-center px-1",t&&!a.claimed?"bg-gradient-gold text-white":"bg-muted text-muted-foreground"),"aria-label":`${a.points} Punkte`,children:e.jsx("span",{className:W(a.points),children:r(a.points)})}),!t&&!a.claimed&&e.jsx("div",{className:"absolute -bottom-1 -right-1 rounded-full bg-background border border-border w-5 h-5 grid place-items-center",children:e.jsx(b,{className:"h-3 w-3 text-muted-foreground"})})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:h("font-semibold text-sm break-words",a.claimed&&"line-through"),children:a.text}),e.jsx("div",{className:"text-xs mt-0.5 flex items-center gap-1",children:a.claimed?e.jsx("span",{className:"text-muted-foreground",children:"Eingelöst"}):t?e.jsxs("span",{className:"inline-flex items-center gap-1 text-primary font-medium",children:[e.jsx(I,{className:"h-3 w-3"})," Freigeschaltet"]}):e.jsxs("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[e.jsx(b,{className:"h-3 w-3"})," Noch ",r(d)," Pkt"]})}),!a.claimed&&!t&&e.jsxs("div",{className:"mt-1.5",children:[e.jsx(R,{value:u,className:"h-1.5"}),e.jsxs("div",{className:"text-[10px] text-muted-foreground mt-0.5 tabular-nums",children:[r(n)," / ",r(a.points)," Pkt"]})]})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(v,{size:"sm",variant:a.claimed?"secondary":t?"default":"secondary",className:h("flex-1",!a.claimed&&t&&"bg-gradient-brand"),disabled:!t&&!a.claimed,onClick:c,children:a.claimed?e.jsxs(e.Fragment,{children:[e.jsx(A,{className:"h-4 w-4 mr-1"})," Eingelöst"]}):t?e.jsxs(e.Fragment,{children:[e.jsx(_,{className:"h-4 w-4 mr-1"})," Einlösen"]}):e.jsxs(e.Fragment,{children:[e.jsx(b,{className:"h-4 w-4 mr-1"})," Gesperrt"]})}),e.jsx(v,{size:"sm",variant:"ghost",onClick:x,"aria-label":"Löschen",children:e.jsx(G,{className:"h-4 w-4 text-destructive"})})]})]})}function ie(){const{rewards:a,totalPoints:n,rewardsAvailable:i,rewardsBaseline:c,addReward:x,claimReward:t,deleteReward:u}=E(),[d,w]=o.useState(100),[g,k]=o.useState("");function P(s){s.preventDefault(),!(!g.trim()||d<=0)&&(x.mutate({points:d,text:g.trim()}),k(""),w(100))}const m=a.data??[],D=o.useMemo(()=>m.filter(s=>!s.archived),[m]),p=o.useMemo(()=>m.filter(s=>s.archived),[m]),S=p.length>0,f=s=>t.mutate(s),j=s=>{confirm("Belohnung löschen?")&&u.mutate(s)};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs(l,{className:"p-4 bg-gradient-to-br from-primary/5 to-accent/5 border-primary/20",children:[e.jsx("h3",{className:"font-display text-base flex items-center gap-2 mb-2",children:"🎁 Warum Du Dich selbst belohnen solltest"}),e.jsxs("p",{className:"text-sm leading-relaxed text-muted-foreground",children:['Dein Gehirn merkt sich, was sich gelohnt hat. Wenn Du Erfolge ohne Belohnung abhakst, lernt es: „war wohl egal". Wenn Du Dich aber bewusst belohnst, verbindet es Anstrengung mit gutem Gefühl – und macht es Dir beim nächsten Mal leichter. Ich bin kein Psychologe, aber das ist ziemlich gut erforscht: operante Konditionierung, Dopamin-Schleife, all sowas. Deshalb: ',e.jsx("strong",{children:"feiere Deine Erfolge wirklich."})]})]}),e.jsxs(l,{className:"p-4 flex flex-wrap items-center justify-between gap-3 border-primary/30",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:"Verfügbare Belohnungs-Punkte"}),e.jsx("div",{className:"font-display text-3xl tabular-nums text-primary",children:r(i)}),c>0&&e.jsxs("div",{className:"text-[11px] text-muted-foreground mt-0.5",children:["Gesamtpunkte: ",r(n)," · Startwert seit Reset: ",r(c)]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground max-w-[280px] leading-relaxed",children:["Belohnungen schalten sich anhand Deiner ",e.jsx("strong",{children:"verfügbaren"})," Punkte frei. Gesamtpunkte, Level & Stats bleiben davon unberührt."]})]}),e.jsx(l,{className:"p-3 bg-primary/5 border-primary/30",children:e.jsxs("p",{className:"text-xs text-foreground
1/80 leading-relaxed",children:["💡 ",e.jsx("strong",{children:"Die Belohnungen sind nur Inspiration."})," Du kannst jede umbenennen, neue Punkte vergeben oder eigene anlegen – und natürlich auch löschen. Belohne Dich für das, was Dir wirklich Freude macht."]})}),e.jsxs(l,{className:"p-4",children:[e.jsx("h3",{className:"font-display text-base mb-2",children:"Neue Belohnung"}),e.jsxs("form",{onSubmit:P,className:"flex flex-col sm:flex-row gap-2",children:[e.jsx(y,{type:"number",min:1,value:d,onChange:s=>w(parseInt(s.target.value||"0")),className:"sm:w-24"}),e.jsx(y,{value:g,onChange:s=>k(s.target.value),placeholder:"z. B. Lieblings-Eis",className:"flex-1"}),e.jsxs(v,{type:"submit",className:"bg-gradient-brand",children:[e.jsx(T,{className:"h-4 w-4 mr-1"})," Hinzufügen"]})]})]}),S?e.jsxs(L,{defaultValue:"current",className:"w-full",children:[e.jsxs(M,{children:[e.jsx(C,{value:"current",children:"Aktuell"}),e.jsxs(C,{value:"archived",className:"gap-1",children:[e.jsx(F,{className:"h-3 w-3"})," Früher freigeschaltet",e.jsxs("span",{className:"ml-1 text-[10px] text-muted-foreground",children:["(",p.length,")"]})]})]}),e.jsx(B,{value:"current",className:"mt-3",children:e.jsx("div",{className:"grid sm:grid-cols-2 gap-3",children:D.map(s=>e.jsx(N,{r:s,available:i,onClaim:()=>f(s),onDelete:()=>j(s.id)},s.id))})}),e.jsxs(B,{value:"archived",className:"mt-3 space-y-3",children:[e.jsx(l,{className:"p-3 bg-muted/40 border-dashed",children:e.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Diese Belohnungen hattest Du Dir vor dem Neustart bereits verdient — Du kannst sie weiterhin einlösen, unabhängig von Deinen aktuellen Belohnungs-Punkten."})}),e.jsx("div",{className:"grid sm:grid-cols-2 gap-3",children:p.map(s=>e.jsx(N,{r:s,available:i,archivedAlwaysClaimable:!0,onClaim:()=>f(s),onDelete:()=>j(s.id)},s.id))})]})]}):e.jsx("div",{className:"grid sm:grid-cols-2 gap-3",children:D.map(s=>e.jsx(N,{r:s,available:i,onClaim:()=>f(s),onDelete:()=>j(s.id)},s.id))}),e.jsx("div",{className:"flex justify-end",children:e.jsx(z,{variant:"ghost"})})]})}export{ie as TabRewards};

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.