PageSourceSearch

https://smadar.ai/assets/SideEffectsReporter-De0WqqV7.js

js smadar.ai collected 2026-10-05 15:05:46 UTC 11,934 bytes, 6 lines download raw bytes

1import{c as Q,b as X,d as Y,u as Z,e as m,g as J,j as e,B as j,C as l,n as c,o as x,h as i,k as p,X as W,i as ee,S as se,s as L}from"./index-BoPK12rZ.js";import{S as te}from"./ShareAccessButton-Cpy7wsA0.js";import{B as y}from"./badge-Dzgcftu_.js";import{S as ae}from"./slider-Dy9QdG3l.js";import{S as re}from"./separator-CZZGhig_.js";import{I as B}from"./input-B7jnFymG.js";import{k as ne}from"./smadarAgents-DJoJ-q7J.js";import{A as D}from"./activity-CT9PJwf8.js";import{T as S}from"./triangle-alert-Dyay52l3.js";import{P as le}from"./plus-DvgK6Rve.js";import{S as ie}from"./send-BepDDYBj.js";import{T as F}from"./trending-up-CjqgoF2p.js";import{T as P}from"./trending-down-FmqmKezy.js";import{M as oe}from"./minus-CbxIcMUH.js";import{A as de}from"./arrow-right-Blw5VId1.js";import{A as me}from"./arrow-left-Bm3n84ZD.js";import"./dialog-By_dUouJ.js";import"./index-BAk_bO_9.js";import"./index-DR_KIw6N.js";import"./index-DuY6vpjC.js";import"./share-2-C8elsqEp.js";import"./users-DpKGh2ZL.js";/**
2 * @license lucide-react v0.462.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 ce=Q("ThermometerSun",[["path",{d:"M12 9a4 4 0 0 0-2 7.5",key:"1jvsq6"}],["path",{d:"M12 3v2",key:"1w22ol"}],["path",{d:"m6.6 18.4-1.4 1.4",key:"w2yidj"}],["path",{d:"M20 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"iof6y5"}],["path",{d:"M4 13H2",key:"118le4"}],["path",{d:"M6.34 7.34 4.93 5.93",key:"1brd51"}]]),xe=[{value:"good",emoji:"😊",he:"טוב",en:"Good",color:"border-green-400 bg-green-50 dark:bg-green-950/30"},{value:"fair",emoji:"😐",he:"סביר",en:"Fair",color:"border-amber-400 bg-amber-50 dark:bg-amber-950/30"},{value:"bad",emoji:"😣",he:"רע",en:"Bad",color:"border-orange-400 bg-orange-50 dark:bg-orange-950/30"},{value:"terrible",emoji:"😫",he:"נורא",en:"Terrible",color:"border-red-400 bg-red-50 dark:bg-red-950/30"}],q={he:["עייפות","בחילה","כאב ראש","הקאות","שלשול","חום","כאבי שרירים","נשירת שיער","פצעים בפה","חוסר תיאבון","נדודי שינה","עצירות","סחרחורת","פריחה בעור"],en:["Fatigue","Nausea","Headache","Vomiting","Diarrhea","Fever","Muscle Pain","Hair Loss","Mouth Sores","Loss of Appetite","Insomnia","Constipation","Dizziness","Skin Rash"]},Be=()=>{const{t,language:H}=X(),{toast:u}=Y(),O=Z(),h=H==="he",[g,k]=m.useState(null),[d,b]=m.useState([]),[f,_]=m.useState(""),[C,M]=m.useState(""),[N,A]=m.useState(!1),[a,v]=m.useState(null),{data:o}=J({queryKey:["patient-for-side-effects"],queryFn:async()=>{const{data:{session:s}}=await L.auth.getSession();if(!(s!=null&&s.user))return null;const{data:r}=await L.from("patients").select("id").eq("user_id",s.user.id).maybeSingle();return r}}),z=h?q.he:q.en,T=s=>{d.find(r=>r.symptom===s)||b(r=>[...r,{id:crypto.randomUUID(),symptom:s,intensity:5}])},R=s=>{b(r=>r.filter(n=>n.id!==s))},U=(s,r)=>{b(n=>n.map(w=>w.id===s?{...w,intensity:r}:w))},E=()=>{const s=f.trim();s&&(T(s),_(""))},G=async()=>{if(!(o!=null&&o.id)){u({title:t("שגיאה","Error"),description:t("לא נמצא תיק מטופל","Patient record not found"),variant:"destructive"});return}if(!g){u({title:t("שגיאה","Error"),description:t("בחרו איך מרגישים היום","Please select how you're feeling today"),variant:"destructive"});return}A(!0),v(null);try{const s=await ne(o.id,{report_type:"daily_checkin",overall_feeling:g,symptoms:d.map(r=>({symptom:r.symptom,intensity:r.intensity})),free_text:C||void 0});v(s),u({title:t("הדיווח נשלח בהצלחה","Report submitted successfully")})}catch(s){u({title:t("שגיאה","Error"),description:s.message,variant:"destructive"})}finally{A(!1)}},V=s=>s<=3?"text-green-600":s<=6?"text-amber-500":"text-red-500",$=s=>s<=3?t("קל","Mild"):s<=6?t("בינוני","Moderate"):t("חמור","Severe"),I={0:{bg:"",icon:null,label:""},1:{bg:"bg-blue-50 dark:bg-blue-950/30 border-blue-200",icon:D,label:t("רגיל — המשיכו לעקוב","Normal — keep monitoring")},2:{bg:"bg-amber-50 dark:bg-amber-950/30 border-amber-300",icon:S,label:t("דרוש תשומת לב — עדכנו את הצוות הרפואי","Attention needed — update your medical team")},3:{bg:"bg-red-50 dark:bg-red-950/30 border-red-300",icon:S,label:t("דחוף — פנו לצוות הרפואי עכשיו","Urgent — contact your medical team now")}},K=h?de:me;return e.jsx("div",{className:"min-h-screen bg-background p-4 sm:p-6",dir:h?"rtl":"ltr",children:e.jsxs("div",{className:"max-w-lg mx-auto 
6space-y-5",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(j,{variant:"ghost",size:"icon",onClick:()=>O(-1),className:"shrink-0","aria-label":t("חזרה","Go back"),children:e.jsx(K,{className:"h-5 w-5"})}),e.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[e.jsx(ce,{className:"h-5 w-5 text-primary"}),e.jsx("h1",{className:"text-xl font-bold",children:t("דיווח תופעות לוואי","Side Effects Report")})]}),e.jsx(te,{patientId:(o==null?void 0:o.id)||null,currentCategory:"symptoms"})]}),a?e.jsx(se,{className:"max-h-[calc(100vh-120px)]",children:e.jsxs("div",{className:"space-y-4 pb-6",children:[a.alert_level>0&&e.jsx(l,{className:p("border",I[a.alert_level].bg),children:e.jsxs(i,{className:"pt-4 flex gap-3 items-start",children:[a.alert_level>=2&&e.jsx(S,{className:p("h-5 w-5 shrink-0",a.alert_level===3?"text-red-500":"text-amber-500")}),a.alert_level===1&&e.jsx(D,{className:"h-5 w-5 shrink-0 text-blue-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold",children:I[a.alert_level].label}),a.alert_message&&e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:a.alert_message})]})]})}),e.jsxs(l,{children:[e.jsx(c,{className:"pb-2",children:e.jsx(x,{className:"text-base",children:t("ניתוח סמדר","SMADAR Analysis")})}),e.jsxs(i,{className:"space-y-3",children:[e.jsx("p",{className:"text-sm leading-relaxed",children:a.response_message}),a.follow_up_question&&e.jsx("div",{className:"p-3 rounded-lg bg-primary/5 border border-primary/10",children:e.jsx("p",{className:"text-sm text-primary font-medium",children:a.follow_up_question})})]})]}),a.symptoms_reported&&a.symptoms_reported.length>0&&e.jsxs(l,{children:[e.jsx(c,{className:"pb-2",children:e.jsx(x,{className:"text-sm",children:t("תופעות שדווחו","Reported Symptoms")})}),e.jsx(i,{className:"space-y-2",children:a.symptoms_reported.map((s,r)=>e.jsxs("div",{className:"flex items-center justify-between p-2.5 rounded-lg bg-muted/50",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:s.symptom}),s.protocol_related&&e.jsx(y,{variant:"outline",className:"text-[10px]",children:t("קשור לטיפול","Treatment-related")})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:p("text-sm font-bold tabular-nums",V(s.intensity)),children:[s.intensity,"/10"]}),s.trend==="worsening"&&e.jsx(F,{className:"h-3.5 w-3.5 text-red-500"}),s.trend==="improving"&&e.jsx(P,{className:"h-3.5 w-3.5 text-green-500"}),s.trend==="stable"&&e.jsx(oe,{className:"h-3.5 w-3.5 text-muted-foreground"})]})]},r))})]}),a.trend_data&&(a.trend_data.improving.length>0||a.trend_data.worsening.length>0)&&e.jsxs(l,{children:[e.jsx(c,{className:"pb-2",children:e.jsx(x,{className:"text-sm",children:t("מגמות","Trends")})}),e.jsxs(i,{className:"space-y-2",children:[a.trend_data.improving.length>0&&e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx(P,{className:"h-4 w-4 text-green-500"}),a.trend_data.improving.map(s=>e.jsx(y,{variant:"secondary",className:"text-xs bg-green-100 dark:bg-green-900/30",children:s},s))]}),a.trend_data.worsening.length>0&&e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx(F,{className:"h-4 w-4 text-red-500"}),a.trend_data.worsening.map(s=>e.jsx(y,{variant:"secondary",className:"text-xs bg-red-100 dark:bg-red-900/30",children:s},s))]})]})]}),a.disclaimer&&e.jsx("p",{className:"text-[11px] text-muted-foreground text-center px-4",children:a.disclaimer}),e.jsx(j,{variant:"outline",className:"w-full",onClick:()=>{v(null),k(null),b([]),M("")},children:t("דיווח חדש","New Report")})]})}):e.jsxs("div",{className:"space-y-5",children:[e.jsxs(l,{children:[e.jsx(c,{className:"pb-3",children:e.jsx(x,{className:"text-base",children:t("איך מרגישים היום?","How are you feeling today?")})}),e.jsx(i,{children:e.jsx("div",{className:"grid grid-cols-4 gap-2",children:xe.map(s=>e.jsxs("button",{onClick:()=>k(s.value),className:p("flex flex-col items-center gap-1.5 p-3 rounded-xl border-2 transition-all duration-200",g===s.value?`${s.color} scale-105 shadow-md`:"border-border hover:border-primary/30 hover:bg-muted/50"),children:[e.jsx("span",{className:"text-2xl",children:s.emoji}
6),e.jsx("span",{className:"text-xs font-medium",children:h?s.he:s.en})]},s.value))})})]}),e.jsxs(l,{children:[e.jsxs(c,{className:"pb-3",children:[e.jsx(x,{className:"text-base",children:t("תופעות לוואי","Side Effects")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("בחרו את התופעות שחוויתם היום","Select symptoms you experienced today")})]}),e.jsxs(i,{className:"space-y-4",children:[e.jsx("div",{className:"flex flex-wrap gap-2",children:z.map(s=>{const r=d.some(n=>n.symptom===s);return e.jsx("button",{onClick:()=>r?R(d.find(n=>n.symptom===s).id):T(s),className:p("px-3 py-1.5 rounded-full text-xs font-medium border transition-all",r?"bg-primary text-primary-foreground border-primary shadow-sm":"bg-muted/50 border-border hover:border-primary/40 hover:bg-muted"),children:s},s)})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(B,{placeholder:t("תופעה אחרת...","Other symptom..."),value:f,onChange:s=>_(s.target.value),onKeyDown:s=>s.key==="Enter"&&E(),className:"text-sm"}),e.jsx(j,{size:"icon",variant:"outline",onClick:E,disabled:!f.trim(),"aria-label":t("הוסף תופעה","Add symptom"),children:e.jsx(le,{className:"h-4 w-4"})})]})]})]}),d.length>0&&e.jsxs(l,{children:[e.jsx(c,{className:"pb-3",children:e.jsx(x,{className:"text-base",children:t("דרגו עוצמה","Rate Intensity")})}),e.jsx(i,{className:"space-y-4",children:d.map((s,r)=>e.jsxs("div",{children:[r>0&&e.jsx(re,{className:"mb-4"}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm font-medium",children:s.symptom}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(y,{variant:s.intensity>=7?"destructive":s.intensity>=4?"default":"secondary",className:"text-xs tabular-nums",children:[s.intensity,"/10 — ",$(s.intensity)]}),e.jsx("button",{onClick:()=>R(s.id),className:"p-1 rounded-full hover:bg-muted transition-colors","aria-label":t(`הסר ${s.symptom}`,`Remove ${s.symptom}`),children:e.jsx(W,{className:"h-3.5 w-3.5 text-muted-foreground"})})]})]}),e.jsx(ae,{value:[s.intensity],min:1,max:10,step:1,onValueChange:([n])=>U(s.id,n),className:"w-full"}),e.jsxs("div",{className:"flex justify-between text-[10px] text-muted-foreground px-1",children:[e.jsx("span",{children:t("קל","Mild")}),e.jsx("span",{children:t("בינוני","Moderate")}),e.jsx("span",{children:t("חמור","Severe")})]})]})]},s.id))})]}),e.jsx(l,{children:e.jsx(i,{className:"pt-4",children:e.jsx(B,{placeholder:t("משהו נוסף שתרצו לשתף?","Anything else you'd like to share?"),value:C,onChange:s=>M(s.target.value)})})}),e.jsxs(j,{className:"w-full h-12 text-base",onClick:G,disabled:N||!g,children:[N?e.jsx(ee,{className:"h-5 w-5 animate-spin me-2"}):e.jsx(ie,{className:"h-5 w-5 me-2"}),N?t("שולח דיווח...","Submitting report..."):t("שלחו דיווח יומי","Submit Daily Report")]})]})]})})};export{Be 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.