PageSourceSearch

https://cinematic-lead-page.lovable.app/assets/app.alertas-Djmm2Gpm.js

js cinematic-lead-page.lovable.app collected 2026-10-03 05:35:33 UTC 5,676 bytes, 1 lines download raw bytes

1import{g as q,r as s,j as e,s as c,t as o}from"./index-DibrhDCm.js";import{B as O}from"./button-BO0V4WFY.js";import{L as y}from"./label-CJkCMb2F.js";import{T as k}from"./textarea-Dp20pZ0_.js";import{T as L}from"./triangle-alert-Bqt_rV47.js";import{T as R}from"./trash-2-BKdql64U.js";import"./utils-BQHNewu7.js";import"./createLucideIcon-B3Ia1LUg.js";const S=["Febre acima de 38 °C","Dor lombar forte ou nas costas","Vômitos ou não consegue beber água","Confusão mental ou muita sonolência","Sangue na urina em grande quantidade","Calafrios intensos"],A=["Ardência que não melhora em 48h","Terceiro episódio em poucos meses","Sintomas voltaram logo após o antibiótico","Urina com odor muito forte"];function P(){const{user:n}=q.useRouteContext(),[l,m]=s.useState([]),[u,C]=s.useState(!0),[t,x]=s.useState([]),[g,p]=s.useState(""),[f,h]=s.useState(""),[b,j]=s.useState(!1),i=t.some(r=>S.includes(r))?"procurar atendimento agora":t.length>0?"falar com o médico nos próximos dias":"observar";async function v(){const{data:r}=await c.from("alert_checks").select("id, checked_on, signs, urgency, action_taken, notes").eq("user_id",n.id).order("checked_on",{ascending:!1});m(r??[]),C(!1)}s.useEffect(()=>{v()},[n.id]);function N(r){x(a=>a.includes(r)?a.filter(d=>d!==r):[...a,r])}async function w(){if(t.length===0){o.error("Marque ao menos um sinal para registrar.");return}j(!0);const{error:r}=await c.from("alert_checks").insert({user_id:n.id,signs:t,urgency:i,action_taken:g||null,notes:f||null});if(j(!1),r){o.error("Não foi possível salvar.");return}o.success("Verificação registrada."),x([]),p(""),h(""),v()}async function _(r){const{error:a}=await c.from("alert_checks").delete().eq("id",r);a?o.error("Não foi possível apagar."):m(d=>d.filter(T=>T.id!==r))}return e.jsxs("section",{className:"space-y-6",children:[e.jsxs("header",{children:[e.jsx("p",{className:"text-[11px] uppercase tracking-[0.18em] text-muted-foreground",children:"Bônus 3"}),e.jsx("h2",{className:"font-display text-2xl text-foreground",children:"Cartão de sinais de alerta"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Marque o que você está sentindo agora. O cartão indica se é hora de observar, de falar com o médico ou de procurar atendimento."})]}),e.jsxs("div",{className:"rounded-2xl border border-destructive/40 bg-destructive/5 p-5",children:[e.jsxs("p",{className:"flex items-center gap-2 text-sm font-semibold text-destructive",children:[e.jsx(L,{className:"h-4 w-4"})," Sinais de urgência"]}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:S.map(r=>e.jsx("button",{type:"button",onClick:()=>N(r),className:`rounded-full border px-3 py-1.5 text-xs transition-colors ${t.includes(r)?"border-destructive bg-destructive text-destructive-foreground":"border-destructive/40 bg-background text-foreground"}`,children:r},r))})]}),e.jsxs("div",{className:"rounded-2xl border border-border bg-card p-5",children:[e.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Sinais de atenção"}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:A.map(r=>e.jsx("button",{type:"button",onClick:()=>N(r),className:`rounded-full border px-3 py-1.5 text-xs transition-colors ${t.includes(r)?"border-primary bg-primary text-primary-foreground":"border-border bg-background text-muted-foreground"}`,children:r},r))})]}),e.jsxs("div",{className:"rounded-2xl border border-border bg-secondary p-5",children:[e.jsx("p",{className:"text-xs uppercase tracking-[0.16em] text-muted-foreground",children:"Orientação"}),e.jsx("p",{className:"mt-2 font-display text-xl text-foreground",children:i==="observar"?"Nada marcado — siga observando":i==="procurar atendimento agora"?"Procure atendimento agora":"Fale com seu médico nos próximos dias"}),e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:"Orientação educativa. Na dúvida, procure sempre um profissional de saúde."})]}),e.jsxs("div",{className:"space-y-4 rounded-2xl border border-border bg-card p-5",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(y,{htmlFor:"acao",children:"O que eu fiz"}),e.jsx(k,{id:"acao",rows:2,value:g,onChange:r=>p(r.target.value)})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(y,{htmlFor:"obs2",children:"Observações"}),e.jsx(k,{id:"obs2",rows:2,value:f,onChange:r=>h(r.target.value)})]}),e.jsx(O,{className:"w-full",onClick:w,disabled:b,children:b?"Salvando...":"Registrar verificação"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Verificações anteriores"}),u&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"Carregando..."}),!u&&l.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"Nenhuma verificação registrada ainda."}),l.map(r=>e.jsxs("article",{className:"rounded-2xl border border-border bg-card p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold text-foreground",children:new Date(`${r.checked_on}T12:00:00`).toLocaleDateString("pt-BR")}),e.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Orientação: ",r.urgency]})]}),e.jsx("button",{onClick:()=>_(r.id),"aria-label":"Apagar registro",className:"text-muted-foreground transition-colors hover:text-destructive",children:e.jsx(R,{className:"h-4 w-4"})})]}),e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:r.signs.join(" · ")}),r.action_taken&&e.jsx("p",{className:"mt-2 text-sm text-foreground",children:r.action_taken})]},r.id))]})]})}export{P as component};

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.