PageSourceSearch

https://veribite.ai/assets/DailyCheckin-Bq3Nsp4k.js

js veribite.ai collected 2026-10-05 13:14:42 UTC 10,362 bytes, 1 lines download raw bytes

1import{r,j as e}from"./vendor-motion-9qIbWfdh.js";import{h as Q,u as R,b4 as f,aB as N,a7 as a,a as v,ae as w,b5 as x,ad as u,a9 as $,k,F as M,T as P,ai as C,b6 as B,as as S,N as A,q as i,g as I}from"./index-RER_5nha.js";import{a as h,u as W}from"./vendor-query-CrasLRbE.js";import{F as p}from"./footprints-C7rfCd1i.js";import{C as G}from"./credit-card-cVznZL7v.js";import"./vendor-react-C0Dkio3Y.js";import"./vendor-charts-JEUKlbbs.js";const z={1:"Exhausted",2:"Low Energy",3:"Average",4:"Good",5:"Peak"},U={1:"bg-red-500",2:"bg-orange-400",3:"bg-yellow-400",4:"bg-green-400",5:"bg-green-600"};function se(){const[,q]=Q(),{toast:g}=R(),L=new Date().toISOString().split("T")[0],[n,H]=r.useState(3),[j,T]=r.useState(""),[d,O]=r.useState(""),[l,D]=r.useState(""),[b,K]=r.useState(""),{data:t,isLoading:E}=h({queryKey:["/api/checkins/today"]}),{data:c}=h({queryKey:["/api/my-habits"]}),{data:o}=h({queryKey:["/api/checkins"]}),m=W({mutationFn:async()=>{await I("POST","/api/checkins",{date:L,readinessScore:n,sleepHours:j||void 0,steps:d?Number(d):void 0,waterOz:l?Number(l):void 0,notes:b||void 0})},onSuccess:()=>{i.invalidateQueries({queryKey:["/api/checkins/today"]}),i.invalidateQueries({queryKey:["/api/checkins"]}),i.invalidateQueries({queryKey:["/api/biosync/readiness"]}),i.invalidateQueries({queryKey:["/api/bite-meter"]}),i.invalidateQueries({queryKey:["/api/daily-score"]}),g({title:"Check-in saved",description:"Your daily readiness has been recorded."})},onError:()=>{g({title:"Error",description:"Failed to save check-in. You may have already checked in today.",variant:"destructive"})}}),F=!!t;return e.jsxs("div",{className:"min-h-screen bg-background pb-32",children:[e.jsxs("div",{className:"bg-primary/10 px-6 pb-6",style:{paddingTop:"calc(env(safe-area-inset-top, 0px) + 8px)"},children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(f,{className:"w-6 h-6 text-primary"}),e.jsx("h1",{className:"text-2xl font-bold text-foreground","data-testid":"text-checkin-title",children:"Daily Check-in"})]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Log your readiness, sleep, and activity for your coach"})]}),e.jsx("div",{className:"px-4 max-w-lg lg:max-w-2xl mx-auto mt-3",children:e.jsx("div",{className:"cursor-pointer",onClick:()=>q("/self-checkin"),children:e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-md bg-muted/30 hover:bg-muted/50 transition-colors","data-testid":"link-weekly-checkin",children:[e.jsx(N,{className:"w-3.5 h-3.5 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"Looking for your weekly wellness check-in?"}),e.jsx("span",{className:"text-xs text-primary font-medium ml-auto",children:"Go →"})]})})}),e.jsxs("div",{className:"px-4 max-w-lg lg:max-w-2xl mx-auto space-y-6",children:[E?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx("div",{className:"w-10 h-10 border-4 border-primary border-t-transparent rounded-full animate-spin"})}):F?e.jsx(a,{className:"p-6","data-testid":"card-already-checked-in",children:e.jsxs("div",{className:"text-center space-y-3",children:[e.jsx(v,{className:"w-12 h-12 text-green-500 mx-auto"}),e.jsx("h2",{className:"text-lg font-bold text-foreground",children:"Checked In Today"}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Readiness:"}),e.jsxs(w,{variant:"secondary","data-testid":"text-today-readiness",children:[t.readinessScore,"/5 - ",z[t.readinessScore]]})]}),t.sleepHours&&e.jsxs("p",{className:"text-sm text-muted-foreground","data-testid":"text-today-sleep",children:[e.jsx(x,{className:"w-3 h-3 inline mr-1"}),t.sleepHours," hours sleep"]}),t.steps!=null&&e.jsxs("p",{className:"text-sm text-muted-foreground","data-testid":"text-today-steps",children:[e.jsx(p,{className:"w-3 h-3 inline mr-1"}),t.steps.toLocaleString()," steps"]}),t.waterOz!=null&&e.jsxs("p",{className:"text-sm text-muted-foreground","data-testid":"text-today-water",children:[e.jsx(u,{className:"w-3 h-3 inline mr-1"}),t.waterOz," oz water"]})]})]})}):e.jsxs(e.Fragment,{children:[e.jsxs(a,{className:"p-4","data-testid":"card-readiness-input",children:[e.jsxs("h2",{className:"font-bold text-sm flex items-center gap-2 mb-4",children:[e.jsx($,{className:"w-4 h-4 text-primary"}),"How do you feel today?"]}),e.jsx("div",{className:"flex gap-2 justify-center",children:[1,2,3,4,5].map(s=>e.jsx(k,{size:"icon",variant:n===s?"secondary":"outline",onClick:()=>H(s),className:`toggle-elevate ${n===s?"toggle-elevated":""}`,"data-testid":`button-readiness-${s}`,children:s},s))}),e.jsx("p",{className:"text-center text-sm text-muted-foreground mt-2","data-testid":"text-readiness-label",children:z[n]})]}
1),e.jsxs(a,{className:"p-4","data-testid":"card-metrics-input",children:[e.jsxs("h2",{className:"font-bold text-sm flex items-center gap-2 mb-4",children:[e.jsx(M,{className:"w-4 h-4 text-primary"}),"Daily Metrics"]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"text-xs text-muted-foreground flex items-center gap-1 mb-1",children:[e.jsx(x,{className:"w-3 h-3"}),"Sleep (hours)"]}),e.jsx("input",{type:"number",step:"0.5",min:"0",max:"24",value:j,onChange:s=>T(s.target.value),placeholder:"e.g. 7.5",className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground text-sm","data-testid":"input-sleep-hours"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"text-xs text-muted-foreground flex items-center gap-1 mb-1",children:[e.jsx(p,{className:"w-3 h-3"}),"Steps"]}),e.jsx("input",{type:"number",min:"0",value:d,onChange:s=>O(s.target.value),placeholder:"e.g. 8000",className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground text-sm","data-testid":"input-steps"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"text-xs text-muted-foreground flex items-center gap-1 mb-1",children:[e.jsx(u,{className:"w-3 h-3"}),"Water (oz)"]}),e.jsx("input",{type:"number",min:"0",value:l,onChange:s=>D(s.target.value),placeholder:"e.g. 80",className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground text-sm","data-testid":"input-water-oz"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground flex items-center gap-1 mb-1",children:"Notes (optional)"}),e.jsx(P,{value:b,onChange:s=>K(s.target.value),placeholder:"How are you feeling? Any soreness?",className:"text-sm resize-none",rows:2,"data-testid":"input-checkin-notes"})]})]})]}),c?.habits&&c.habits.length>0&&e.jsxs(a,{className:"p-4","data-testid":"card-assigned-habits",children:[e.jsxs("h2",{className:"font-bold text-sm flex items-center gap-2 mb-3",children:[e.jsx(v,{className:"w-4 h-4 text-primary"}),"Daily Habits"]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:c.habits.map((s,y)=>e.jsx(w,{variant:"outline","data-testid":`badge-habit-${y}`,children:s},y))}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Track these habits assigned by your coach"})]}),e.jsxs(k,{className:"w-full",onClick:()=>m.mutate(),disabled:m.isPending,"data-testid":"button-submit-checkin",children:[e.jsx(f,{className:"w-4 h-4 mr-2"}),m.isPending?"Saving...":"Submit Check-in"]})]}),o&&o.length>0&&e.jsxs(a,{className:"p-4","data-testid":"card-checkin-history",children:[e.jsxs("h2",{className:"font-bold text-sm flex items-center gap-2 mb-3",children:[e.jsx(N,{className:"w-4 h-4 text-primary"}),"Recent Check-ins"]}),e.jsx("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:o.slice(0,7).map(s=>e.jsxs("div",{className:"flex items-center justify-between py-2 px-3 rounded-md bg-muted/30","data-testid":`checkin-entry-${s.id}`,children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:new Date(s.date).toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"})}),e.jsxs("div",{className:"flex items-center gap-3 mt-1 text-xs text-muted-foreground",children:[s.sleepHours&&e.jsxs("span",{children:[e.jsx(x,{className:"w-3 h-3 inline mr-0.5"}),s.sleepHours,"h"]}),s.steps!=null&&e.jsxs("span",{children:[e.jsx(p,{className:"w-3 h-3 inline mr-0.5"}),s.steps.toLocaleString()]}),s.waterOz!=null&&e.jsxs("span",{children:[e.jsx(u,{className:"w-3 h-3 inline mr-0.5"}),s.waterOz,"oz"]})]})]}),e.jsx("div",{className:`w-8 h-8 rounded-md flex items-center justify-center text-white text-sm font-bold ${U[s.readinessScore]||"bg-muted"}`,"data-testid":`text-checkin-readiness-${s.id}`,children:s.readinessScore})]},s.id))})]}),e.jsxs(a,{className:"p-4","data-testid":"card-account-links",children:[e.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground mb-3",children:"Account & Preferences"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{href:"/settings",children:e.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/40 hover:bg-muted/60 active:scale-[0.98] transition-all cursor-pointer","data-testid":"link-settings",children:[e.jsx("div",{className:"w-9 h-9 rounded-lg bg-slate-500/15 flex items-center justify-center shrink-0",children:e.jsx(B,{className:"w-4 h-4 text-slate-400"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Settings"}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Notifications, units & account"})]}),e.jsx(S,{className:"w-4 h-4 text-muted-foreground shrink-0"})]})}),e.jsx(C,{href:"/pricing",children:e.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/40 hover:bg-muted/60 active:scale-[0.98] transition-all cursor-pointer","data-testid":"link-subscription",children:[e.jsx("div",{className:"w-9 h-9 rounded-lg bg-amber-500/15 flex items-center justify-center shrink-0",children:e.jsx(G,{className:"w-4 h-4 text-amber-400"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Subscription"}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Manage your plan & billing"})]}),e.jsx(S,{className:"w-4 h-4 text-muted-foreground shrink-0"})]})})]})]})]}),e.jsx(A,{})]})}
1export{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.