PageSourceSearch

https://fitdietaihkapp.manus.space/assets/SupplementManager-BJBL16-i.js

js fitdietaihkapp.manus.space collected 2026-10-03 05:01:49 UTC 29,671 bytes, 6 lines download raw bytes

1import{f as ie,l as pe,u as oe,r as c,t as f,b as n,j as e,A as de,C as d,e as m,B as r,n as M,c as R,d as U,S as W,X as E,v as me,T as ge,w as xe,P as J,x as ue}from"./index-bM8UT4Os.js";import{I as C}from"./input-BwpLlRYf.js";import{L as p}from"./label-2Seh_wFH.js";import{S as Q,a as X,b as K,c as Y,d as _}from"./select-CDP2pHh8.js";import{P}from"./plus-DSaqw8wa.js";import{T as he}from"./trash-2-4iirX7DH.js";import"./dialog-CxcTDVnZ.js";import"./useComposition-DO5dIJEj.js";import"./chevron-up-TG6jWiKP.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 Se=ie("ClipboardCheck",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]]),T={protein_powder:"蛋白粉",creatine:"肌酸",bcaa:"支鏈胺基酸",pre_workout:"前訓練補充",post_workout:"後訓練補充",collagen:"膠原蛋白",hyaluronic_acid:"透明質酸",vitamin_c:"維生素 C",retinol:"視黃醇",milk_thistle:"乳薊",schisandra:"五味子",n_acetyl_cysteine:"N-乙酰半胱氨酸",multivitamin:"綜合維他命",vitamin_d:"維生素 D",vitamin_b_complex:"維生素 B 複合體",iron:"鐵",magnesium:"鎂",zinc:"鋅",fish_oil:"魚油",omega_3:"Omega-3",flaxseed:"亞麻籽",female_cycle_support:"女性周期支持",calcium:"鈣",birth_control_reminder:"避孕藥提醒",testosterone_support:"睾酮支持",male_vitality:"男性活力",saw_palmetto:"鋸棕櫚"};function _e(){const[,Z]=pe();oe();const[g,x]=c.useState(!1),[u,h]=c.useState(!1),[t,b]=c.useState(null),[B,N]=c.useState(!1),[A,I]=c.useState(null),o=c.useRef(null),[l,i]=c.useState({name:"",category:"multivitamin",dosage:"",frequency:"daily",scheduledTime:"",notes:"",timingTag:"anytime"}),[ee,F]=c.useState(null),[L,q]=c.useState(null),[z,V]=c.useState(!1),y=c.useRef(null),{data:v,refetch:D}=f.supplements.getAll.useQuery(),S=f.supplements.add.useMutation({onSuccess:()=>{n.success("補充劑已記低!💊"),i({name:"",category:"multivitamin",dosage:"",frequency:"daily",scheduledTime:"",notes:"",timingTag:"anytime"}),F(null),q(null),x(!1),h(!1),b(null),I(null),D()},onError:()=>{n.error("記錄唔到,試多次")}}),ae=f.supplements.analyzePhoto.useMutation({onSuccess:a=>{b(a),N(!1),a.success&&a.identified?n.success("AI 識別成功!✨"):n.error("AI 暫時識別唔到,你可以自己入")},onError:()=>{N(!1),n.error("分析唔到,試多次")}}),O=f.supplements.delete.useMutation({onSuccess:()=>{n.success("補充劑已剷咗!"),D()},onError:()=>{n.error("剷唔到,試多次")}}),$=f.supplements.recordIntake.useMutation({onSuccess:()=>{n.success("已記錄服用 ✅")},onError:()=>{n.error("記錄唔到,試多次")}}),te=async a=>{const s=a.target.files?.[0];if(!s)return;if(s.size>10*1024*1024){n.error("圖片太大喇,最大 10MB");return}N(!0),h(!0),b(null);const j=new FileReader;j.onload=async w=>{const k=(w.target?.result).split(",")[1];I(w.target?.result),ae.mutate({imageBase64:k,mimeType:s.type||"image/jpeg"})},j.readAsDataURL(s),o.current&&(o.current.value="")},se=()=>{if(!t||!t.identified)return;const a=t.category in T?t.category:"multivitamin",s=["daily","weekly","as_needed"].includes(t.frequency)?t.frequency:"daily";S.mutate({name:t.brand?`${t.brand} ${t.name}`:t.name,category:a,dosage:t.dosage||void 0,frequency:s,scheduledTime:void 0,notes:t.tips||void 0,timingTag:"anytime"})},le=async a=>{const s=a.target.files?.[0];if(!s)return;if(s.size>10*1024*1024){n.error("圖片太大喇,最大 10MB");return}V(!0);const j=new FileReader;j.onload=async w=>{const k=w.target?.result;q(k);const re=k.split(",")[1];try{const H=await(await fetch("/api/upload-supplement-photo",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({imageBase64:re,mimeType:s.type||"image/jpeg"})})).json();H.url?(F(H.url),n.success("相片已上傳 ✅")):n.error("上傳失敗")}catch{n.error("上傳失敗")}V(!1)},j.readAsDataURL(s),y.current&&(y.current.value="")},ne=async a=>{if(a.preventDefault(),!l.name){n.error("入返補充劑名先");return}await S.mutateAsync({...l,photoUrl:ee||void 0})},G=a=>a>=8?"text-green-400":a>=5?"text-yellow-400":"text-red-400",ce=a=>a>=8?"非常適合":a>=6?"適合":a>=4?"一般":"唔太適合";return e.jsx(de,{"data-loc":"client/src/pages/SupplementManager.tsx:271",title:"補充劑管理",showBack:!0,children:e.jsx("div",{"data-loc":"client/src/pages/SupplementManager.tsx:272",className:"py-6 px-4",children:e.jsxs("div",{"data-loc":"client/src/pages/SupplementManager.tsx:273",className:"max-w-3xl mx-auto 
6space-y-5",children:[!g&&!u&&e.jsxs("div",{"data-loc":"client/src/pages/SupplementManager.tsx:276",className:"mb-2",children:[e.jsx("h1",{"data-loc":"client/src/pages/SupplementManager.tsx:277",className:"text-2xl md:text-3xl font-bold text-foreground",children:"💊 補充劑管理"}),e.jsx("p",{"data-loc":"client/src/pages/SupplementManager.tsx:278",className:"text-sm text-muted-foreground mt-1",children:"管理日常補充劑,建立適合你嘅打卡計劃"})]}),!g&&!u&&e.jsx(d,{"data-loc":"client/src/pages/SupplementManager.tsx:284",className:"card-premium cursor-pointer hover:shadow-md transition-all active:scale-[0.98]",onClick:()=>Z("/supplement-checklist"),children:e.jsxs(m,{"data-loc":"client/src/pages/SupplementManager.tsx:285",className:"p-4 flex items-center justify-between",children:[e.jsxs("div",{"data-loc":"client/src/pages/SupplementManager.tsx:286",className:"flex items-center gap-3",children:[e.jsx("div",{"data-loc":"client/src/pages/SupplementManager.tsx:287",className:"w-10 h-10 rounded-full bg-primary/20 flex items-center justify-center",children:e.jsx(Se,{"data-loc":"client/src/pages/SupplementManager.tsx:288",className:"w-5 h-5 text-primary"})}),e.jsxs("div",{"data-loc":"client/src/pages/SupplementManager.tsx:290",children:[e.jsx("p",{"data-loc":"client/src/pages/SupplementManager.tsx:291",className:"font-medium text-foreground",children:"每日打卡"}),e.jsx("p",{"data-loc":"client/src/pages/SupplementManager.tsx:292",className:"text-xs text-muted-foreground",children:"記住食補充劑,身體會多謝你嘅!"})]})]}),e.jsx("span",{"data-loc":"client/src/pages/SupplementManager.tsx:295",className:"text-muted-foreground",children:"→"})]})}),!g&&!u&&e.jsxs("div",{"data-loc":"client/src/pages/SupplementManager.tsx:302",className:"flex gap-3",children:[e.jsxs(r,{"data-loc":"client/src/pages/SupplementManager.tsx:303",onClick:()=>{h(!0),setTimeout(()=>o.current?.click(),100)},className:"flex-1 bg-gradient-to-r from-purple-600 to-pink-600 hover:from-purple-700 hover:to-pink-700 text-foreground",children:[e.jsx(M,{"data-loc":"client/src/pages/SupplementManager.tsx:310",className:"w-4 h-4 mr-2"}),"影相識別"]}),e.jsxs(r,{"data-loc":"client/src/pages/SupplementManager.tsx:313",onClick:()=>x(!0),className:"flex-1 bg-amber-600 hover:bg-amber-700",children:[e.jsx(P,{"data-loc":"client/src/pages/SupplementManager.tsx:317",className:"w-4 h-4 mr-2"}),"手動加入"]})]}),!g&&!u&&e.jsxs(d,{"data-loc":"client/src/pages/SupplementManager.tsx:325",className:"card-premium",children:[e.jsxs(R,{"data-loc":"client/src/pages/SupplementManager.tsx:326",className:"pb-2",children:[e.jsxs(U,{"data-loc":"client/src/pages/SupplementManager.tsx:327",className:"text-sm font-bold text-foreground flex items-center gap-2",children:[e.jsx(W,{"data-loc":"client/src/pages/SupplementManager.tsx:328",className:"w-4 h-4"}),"常見補充劑揀選"]}),e.jsx("p",{"data-loc":"client/src/pages/SupplementManager.tsx:331",className:"text-xs text-muted-foreground",children:"撳一下即刻加入,唔使慢慢打名"})]}),e.jsx(m,{"data-loc":"client/src/pages/SupplementManager.tsx:333",className:"pt-0",children:e.jsx("div",{"data-loc":"client/src/pages/SupplementManager.tsx:334",className:"grid grid-cols-3 gap-2",children:[{name:"Whey Protein",cat:"protein_powder",emoji:"🥛",dosage:"1 scoop/天",timing:"post_workout"},{name:"Creatine Mono",cat:"creatine",emoji:"💪",dosage:"5g/天",timing:"post_workout"},{name:"BCAA",cat:"bcaa",emoji:"⚡",dosage:"訓練前後 1 scoop",timing:"pre_workout"},{name:"Fish Oil",cat:"fish_oil",emoji:"🐟",dosage:"1-2 粒/天",timing:"with_meal"},{name:"Vitamin D3",cat:"vitamin_d",emoji:"☀️",dosage:"2000IU/天",timing:"after_breakfast"},{name:"Vitamin C",cat:"vitamin_c",emoji:"🍊",dosage:"500-1000mg/天",timing:"after_breakfast"},{name:"綜合維他命",cat:"multivitamin",emoji:"💊",dosage:"1 粒/天",timing:"after_breakfast"},{name:"鎂",cat:"magnesium",emoji:"🧪",dosage:"400mg/天",timing:"before_sleep"},{name:"鋅",cat:"zinc",emoji:"🛡️",dosage:"15-30mg/天",timing:"before_sleep"},{name:"Collagen",cat:"collagen",emoji:"✨",dosage:"5-10g/天",timing:"empty_stomach"},{name:"Pre-Workout",cat:"pre_workout",emoji:"🚀",dosage:"訓練前 30min",timing:"pre_workout"},{name:"鐵",cat:"iron",emoji:"❤️",dosage:"18mg/天",timing:"empty_stomach"}].map(a=>e.jsxs("button",{"data-loc":"client/src/pages/SupplementManager.tsx:349",onClick:()=>{i({name:a.name,category:a.cat,dosage:a.dosage,frequency:"daily",scheduledTime:"",notes:"",timingTag:a.timing}),x(!0),n.success(`已填入 ${a.name},可以再調整內容`)},className:"flex flex-col items-center gap-1 p-2.5 rounded-xl border border-border/50 hover:border-amber-500/50 hover:bg-amber-500/5 transition-all active:scale-95",children:[e.jsx("span",{"data-loc":"client/src/pages/SupplementManager.tsx:366",className:"text-lg",children:a.emoji}),e.jsx("span",{"data-loc":"client/src/pages/SupplementManager.tsx:367",className:"text-[10px] font-medium text-foreground
6/80 text-center leading-tight",children:a.name})]},a.name))})})]}),e.jsx("input",{"data-loc":"client/src/pages/SupplementManager.tsx:376",ref:o,type:"file",accept:"image/*",className:"hidden",onChange:te}),u&&e.jsxs(d,{"data-loc":"client/src/pages/SupplementManager.tsx:386",className:"mb-6 card-premium",children:[e.jsx(R,{"data-loc":"client/src/pages/SupplementManager.tsx:387",className:"pb-3",children:e.jsxs("div",{"data-loc":"client/src/pages/SupplementManager.tsx:388",className:"flex justify-between items-center",children:[e.jsxs(U,{"data-loc":"client/src/pages/SupplementManager.tsx:389",className:"text-foreground flex items-center gap-2",children:[e.jsx(W,{"data-loc":"client/src/pages/SupplementManager.tsx:390",className:"w-5 h-5"}),"AI 補充劑分析"]}),e.jsx(r,{"data-loc":"client/src/pages/SupplementManager.tsx:393",size:"sm",variant:"ghost",onClick:()=>{h(!1),b(null),I(null),N(!1)},children:e.jsx(E,{"data-loc":"client/src/pages/SupplementManager.tsx:403",className:"w-4 h-4"})})]})}),e.jsxs(m,{"data-loc":"client/src/pages/SupplementManager.tsx:407",className:"space-y-4",children:[A&&e.jsx("div",{"data-loc":"client/src/pages/SupplementManager.tsx:410",className:"relative rounded-lg overflow-hidden max-h-48 flex justify-center bg-black/20",children:e.jsx("img",{"data-loc":"client/src/pages/SupplementManager.tsx:411",src:A,alt:"補充劑圖片",className:"max-h-48 object-contain"})}),B&&e.jsxs("div",{"data-loc":"client/src/pages/SupplementManager.tsx:417",className:"text-center py-8",children:[e.jsx("div",{"data-loc":"client/src/pages/SupplementManager.tsx:418",className:"animate-spin w-10 h-10 border-4 border-purple-500 border-t-transparent rounded-full mx-auto mb-4"}),e.jsx("p",{"data-loc":"client/src/pages/SupplementManager.tsx:419",className:"text-purple-300",children:"AI 分析緊你嘅補充劑..."}),e.jsx("p",{"data-loc":"client/src/pages/SupplementManager.tsx:420",className:"text-sm text-muted-foreground mt-1",children:"識別成分 + 分析配合度"})]}),t&&t.success&&t.identified&&e.jsxs("div",{"data-loc":"client/src/pages/SupplementManager.tsx:426",className:"space-y-4",children:[e.jsxs("div",{"data-loc":"client/src/pages/SupplementManager.tsx:428",className:"bg-white/5 rounded-lg p-4",children:[e.jsxs("h3",{"data-loc":"client/src/pages/SupplementManager.tsx:429",className:"text-lg font-bold text-foreground mb-1",children:[t.brand&&e.jsxs("span",{"data-loc":"client/src/pages/SupplementManager.tsx:430",className:"text-purple-300",children:[t.brand," "]}),t.name]}),e.jsxs("p",{"data-loc":"client/src/pages/SupplementManager.tsx:433",className:"text-sm text-muted-foreground",children:["分類:",T[t.category]||t.category]})]}),e.jsxs("div",{"data-loc":"client/src/pages/SupplementManager.tsx:439",className:"bg-white/5 rounded-lg p-4",children:[e.jsxs("div",{"data-loc":"client/src/pages/SupplementManager.tsx:440",className:"flex items-center gap-3 mb-2",children:[e.jsx(me,{"data-loc":"client/src/pages/SupplementManager.tsx:441",className:`w-6 h-6 ${G(t.compatibility.score)}`}),e.jsxs("div",{"data-loc":"client/src/pages/SupplementManager.tsx:442",children:[e.jsxs("span",{"data-loc":"client/src/pages/SupplementManager.tsx:443",className:`text-2xl font-bold ${G(t.compatibility.score)}`,children:[t.compatibility.score,"/10"]}),e.jsx("span",{"data-loc":"client/src/pages/SupplementManager.tsx:446",className:"text-sm text-muted-foreground ml-2",children:ce(t.compatibility.score)})]})]}),e.jsx("p",{"data-loc":"client/src/pages/SupplementManager.tsx:451",className:"text-sm text-foreground/80",children:t.compatibility.reason}),t.compatibility.benefits?.length>0&&e.jsxs("div",{"data-loc":"client/src/pages/SupplementManager.tsx:455",className:"mt-3",children:[e.jsx("p",{"data-loc":"client/src/pages/SupplementManager.tsx:456",className:"text-xs text-green-400 font-medium mb-1",children:"✅ 好處"}),e.jsx("ul",{"data-loc":"client/src/pages/SupplementManager.tsx:457",className:"text-sm text-foreground/80 space-y-1",children:t.compatibility.benefits.map((a,s)=>e.jsxs("li",{"data-loc":"client/src/pages/SupplementManager.tsx:459",children:["• ",a]}
6,s))})]}),t.compatibility.concerns?.length>0&&e.jsxs("div",{"data-loc":"client/src/pages/SupplementManager.tsx:467",className:"mt-3",children:[e.jsxs("p",{"data-loc":"client/src/pages/SupplementManager.tsx:468",className:"text-xs text-yellow-400 font-medium mb-1 flex items-center gap-1",children:[e.jsx(ge,{"data-loc":"client/src/pages/SupplementManager.tsx:469",className:"w-3 h-3"})," 注意"]}),e.jsx("ul",{"data-loc":"client/src/pages/SupplementManager.tsx:471",className:"text-sm text-foreground/80 space-y-1",children:t.compatibility.concerns.map((a,s)=>e.jsxs("li",{"data-loc":"client/src/pages/SupplementManager.tsx:473",children:["• ",a]},s))})]})]}),t.ingredients?.length>0&&e.jsxs("div",{"data-loc":"client/src/pages/SupplementManager.tsx:482",className:"bg-white/5 rounded-lg p-4",children:[e.jsx("h4",{"data-loc":"client/src/pages/SupplementManager.tsx:483",className:"text-sm font-medium text-purple-300 mb-2",children:"主要成分"}),e.jsx("div",{"data-loc":"client/src/pages/SupplementManager.tsx:484",className:"space-y-1",children:t.ingredients.slice(0,8).map((a,s)=>e.jsxs("div",{"data-loc":"client/src/pages/SupplementManager.tsx:486",className:"flex justify-between text-sm",children:[e.jsx("span",{"data-loc":"client/src/pages/SupplementManager.tsx:487",className:"text-foreground/80",children:a.name}),e.jsxs("span",{"data-loc":"client/src/pages/SupplementManager.tsx:488",className:"text-muted-foreground",children:[a.amount," ",a.dailyValue&&`(${a.dailyValue})`]})]},s))})]}),e.jsxs("div",{"data-loc":"client/src/pages/SupplementManager.tsx:496",className:"bg-white/5 rounded-lg p-4",children:[e.jsxs("h4",{"data-loc":"client/src/pages/SupplementManager.tsx:497",className:"text-sm font-medium text-purple-300 mb-2 flex items-center gap-1",children:[e.jsx(xe,{"data-loc":"client/src/pages/SupplementManager.tsx:498",className:"w-4 h-4"})," 服用建議"]}),e.jsxs("div",{"data-loc":"client/src/pages/SupplementManager.tsx:500",className:"space-y-1 text-sm text-foreground/80",children:[t.dosage&&e.jsxs("p",{"data-loc":"client/src/pages/SupplementManager.tsx:501",children:["💊 劑量:",t.dosage]}),t.bestTime&&e.jsxs("p",{"data-loc":"client/src/pages/SupplementManager.tsx:502",children:["⏰ 最佳時間:",t.bestTime]}),t.tips&&e.jsxs("p",{"data-loc":"client/src/pages/SupplementManager.tsx:503",children:["💡 ",t.tips]})]})]}),e.jsxs(r,{"data-loc":"client/src/pages/SupplementManager.tsx:508",onClick:se,disabled:S.isPending,className:"w-full bg-gradient-to-r from-purple-600 to-pink-600 hover:from-purple-700 hover:to-pink-700",children:[e.jsx(P,{"data-loc":"client/src/pages/SupplementManager.tsx:513",className:"w-4 h-4 mr-2"}),S.isPending?"加入緊...":"確定加入我嘅補充劑"]})]}),t&&(!t.success||!t.identified)&&e.jsxs("div",{"data-loc":"client/src/pages/SupplementManager.tsx:521",className:"text-center py-4",children:[e.jsx("p",{"data-loc":"client/src/pages/SupplementManager.tsx:522",className:"text-muted-foreground mb-3",children:"AI 暫時識別唔到呢個補充劑 😅"}),e.jsxs("div",{"data-loc":"client/src/pages/SupplementManager.tsx:523",className:"flex gap-2",children:[e.jsxs(r,{"data-loc":"client/src/pages/SupplementManager.tsx:524",variant:"outline",onClick:()=>o.current?.click(),className:"flex-1",children:[e.jsx(M,{"data-loc":"client/src/pages/SupplementManager.tsx:529",className:"w-4 h-4 mr-2"}),"重新影過"]}),e.jsxs(r,{"data-loc":"client/src/pages/SupplementManager.tsx:532",onClick:()=>{h(!1),x(!0)},className:"flex-1 bg-amber-600 hover:bg-amber-700",children:[e.jsx(P,{"data-loc":"client/src/pages/SupplementManager.tsx:539",className:"w-4 h-4 mr-2"}),"自己入"]})]})]}),!A&&!B&&e.jsxs("div",{"data-loc":"client/src/pages/SupplementManager.tsx:548",className:"text-center py-6",children:[e.jsx(M,{"data-loc":"client/src/pages/SupplementManager.tsx:549",className:"w-12 h-12 text-purple-400 mx-auto mb-3 opacity-50"}),e.jsx("p",{"data-loc":"client/src/pages/SupplementManager.tsx:550",className:"text-muted-foreground mb-3",children:"影低你嘅補充劑包裝"}),e.jsx("p",{"data-loc":"client/src/pages/SupplementManager.tsx:551",className:"text-xs text-muted-foreground mb-4",children:"AI 會自動識別成分同分析配合度"}),e.jsxs(r,{"data-loc":"client/src/pages/SupplementManager.tsx:552",onClick:()=>o.current?.click(),className:"bg-purple-600 hover:bg-purple-700",children:[e.jsx(M,{"data-loc":"client/src/pages/SupplementManager.tsx:556",className:"w-4 h-4 mr-2"}),"影相 / 揀相"]})]})]})]}),g&&e.jsxs(d,{"data-loc":"client/src/pages/SupplementManager.tsx:567",className:"mb-6 card-premium",children:[e.jsx(R,{"data-loc":"client/src/pages/SupplementManager.tsx:568",children:e.jsxs("div",{"data-loc":"client/src/pages/SupplementManager.tsx:569",className:"flex justify-between items-center",children:[e.jsx(U,{"data-loc":"client/src/pages/SupplementManager.tsx:570",children:"手動加入補充劑"}),e.jsx(r,{"data-loc":"client/src/pages/SupplementManager.tsx:571",size:"sm",variant:"ghost",onClick:()=>x(!1),children:e.jsx(E,{"data-loc":"client/src/pages/SupplementManager.tsx:572",className:"w-4 h-4"})})]})}),e.jsx(m,{"data-loc":"client/src/pages/SupplementManager.tsx:576",children:e.jsxs("form",{"data-loc":"client/src/pages/SupplementManager.tsx:577",onSubmit:ne,className:"space-y-4",children:[e.jsxs("div",{"data-loc":"client/src/pages/SupplementManager.tsx:578",className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{"data-loc":"client/src/pages/SupplementManager.tsx:579",children:[e.jsx(p,{"data-loc":"client/src/pages/SupplementManager.tsx:580",htmlFor:"name",className:"text-sm font-medium",children:"補充劑名稱"}),e.jsx(C,{"data-loc":"client/src/pages/SupplementManager.tsx:583",id:"name",placeholder:"ä¾
6‹ï¼šOptimum Gold Standard",value:l.name,onChange:a=>i({...l,name:a.target.value}),className:"mt-2"})]}),e.jsxs("div",{"data-loc":"client/src/pages/SupplementManager.tsx:592",children:[e.jsx(p,{"data-loc":"client/src/pages/SupplementManager.tsx:593",htmlFor:"category",className:"text-sm font-medium",children:"分類"}),e.jsxs(Q,{"data-loc":"client/src/pages/SupplementManager.tsx:596",value:l.category,onValueChange:a=>i({...l,category:a}),children:[e.jsx(X,{"data-loc":"client/src/pages/SupplementManager.tsx:597",id:"category",className:"mt-2",children:e.jsx(K,{"data-loc":"client/src/pages/SupplementManager.tsx:598"})}),e.jsx(Y,{"data-loc":"client/src/pages/SupplementManager.tsx:600",children:Object.entries(T).map(([a,s])=>e.jsx(_,{"data-loc":"client/src/pages/SupplementManager.tsx:602",value:a,children:s},a))})]})]})]}),e.jsxs("div",{"data-loc":"client/src/pages/SupplementManager.tsx:611",className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{"data-loc":"client/src/pages/SupplementManager.tsx:612",children:[e.jsx(p,{"data-loc":"client/src/pages/SupplementManager.tsx:613",htmlFor:"dosage",className:"text-sm font-medium",children:"劑量"}),e.jsx(C,{"data-loc":"client/src/pages/SupplementManager.tsx:616",id:"dosage",placeholder:"例:1 粒/天",value:l.dosage,onChange:a=>i({...l,dosage:a.target.value}),className:"mt-2"})]}),e.jsxs("div",{"data-loc":"client/src/pages/SupplementManager.tsx:625",children:[e.jsx(p,{"data-loc":"client/src/pages/SupplementManager.tsx:626",htmlFor:"frequency",className:"text-sm font-medium",children:"頻率"}),e.jsxs(Q,{"data-loc":"client/src/pages/SupplementManager.tsx:629",value:l.frequency,onValueChange:a=>i({...l,frequency:a}),children:[e.jsx(X,{"data-loc":"client/src/pages/SupplementManager.tsx:630",id:"frequency",className:"mt-2",children:e.jsx(K,{"data-loc":"client/src/pages/SupplementManager.tsx:631"})}),e.jsxs(Y,{"data-loc":"client/src/pages/SupplementManager.tsx:633",children:[e.jsx(_,{"data-loc":"client/src/pages/SupplementManager.tsx:634",value:"daily",children:"每天"}),e.jsx(_,{"data-loc":"client/src/pages/SupplementManager.tsx:635",value:"weekly",children:"每週"}),e.jsx(_,{"data-loc":"client/src/pages/SupplementManager.tsx:636",value:"as_needed",children:"按需"})]})]})]}),e.jsxs("div",{"data-loc":"client/src/pages/SupplementManager.tsx:641",children:[e.jsx(p,{"data-loc":"client/src/pages/SupplementManager.tsx:642",htmlFor:"time",className:"text-sm font-medium",children:"服用時間"}),e.jsx(C,{"data-loc":"client/src/pages/SupplementManager.tsx:645",id:"time",type:"time",value:l.scheduledTime,onChange:a=>i({...l,scheduledTime:a.target.value}),className:"mt-2"})]})]}),e.jsxs("div",{"data-loc":"client/src/pages/SupplementManager.tsx:655",children:[e.jsx(p,{"data-loc":"client/src/pages/SupplementManager.tsx:656",className:"text-sm font-medium",children:"服用時機標籤"}),e.jsx("div",{"data-loc":"client/src/pages/SupplementManager.tsx:659",className:"mt-2 flex flex-wrap gap-2",children:[{value:"pre_workout",label:"🏋️ 操練前"},{value:"post_workout",label:"💪 操練後"},{value:"after_breakfast",label:"🍳 早餐後"},{value:"with_meal",label:"🍽️ 隨餐"},{value:"empty_stomach",label:"🌟 空腹"},{value:"before_sleep",label:"🌙 臨睦前"},{value:"anytime",label:"⏰ 隨時"}].map(a=>e.jsx("button",{"data-loc":"client/src/pages/SupplementManager.tsx:669",type:"button",onClick:()=>i({...l,timingTag:a.value}),className:`px-3 py-1.5 rounded-full text-xs font-medium border transition-all ${l.timingTag===a.value?"bg-purple-600 border-purple-500 text-white shadow-md":"border-border/50 text-muted-foreground hover:border-purple-500/50 hover:text-purple-300"}`,children:a.label},a.value))})]}),e.jsxs("div",{"data-loc":"client/src/pages/SupplementManager.tsx:685",children:[e.jsx(p,{"data-loc":"client/src/pages/SupplementManager.tsx:686",htmlFor:"notes",className:"text-sm font-medium",children:"備註"}),e.jsx(C,{"data-loc":"client/src/pages/SupplementManager.tsx:689",id:"notes",placeholder:"例:隨餐服用",value:l.notes,onChange:a=>i({...l,notes:a.target.value}),className:"mt-2"})]}),e.jsxs("div",{"data-loc":"client/src/pages/SupplementManager.tsx:699",children:[e.jsx(p,{"data-loc":"client/src/pages/SupplementManager.tsx:700",className:"text-sm font-medium",children:"補充劑相片(可選)"}),e.jsx("div",{"data-loc":"client/src/pages/SupplementManager.tsx:701",className:"mt-2",children:L?e.jsxs("div",{"data-loc":"client/src/pages/SupplementManager.tsx:703",className:"relative rounded-lg overflow-hidden max-h-32 flex justify-center bg-black/20",children:[e.jsx("img",{"data-loc":"client/src/pages/SupplementManager.tsx:704",src:L,alt:"補充劑相",className:"max-h-32 object-contain"}),e.jsx("button",{"data-loc":"client/src/pages/SupplementManager.tsx:705",type:"button",onClick:()=>{q(null),F(null)},className:"absolute top-1 right-1 w-6 h-6 bg-black/60 rounded-full flex items-center justify-center text-white hover:bg-black/80",children:e.jsx(E,{"data-loc":"client/src/pages/SupplementManager.tsx:710",className:"w-3 h-3"})})]}):e.jsxs("button",{"data-loc":"client/src/pages/SupplementManager.tsx:714",type:"button",onClick:()=>y.current?.click(),disabled:z,className:"w-full border-2 border-dashed border-purple-500/40 rounded-lg p-4 flex flex-col items-center gap-2 text-purple-400 hover:border-purple-500/70 hover:bg-purple-500/5 transition-all",children:[z?e.jsx("div",{"data-loc":"client/src/pages/SupplementManager.tsx:721",className:"w-6 h-6 border-2 border-purple-400 border-t-transparent roun
6ded-full animate-spin"}):e.jsx(M,{"data-loc":"client/src/pages/SupplementManager.tsx:723",className:"w-6 h-6"}),e.jsx("span",{"data-loc":"client/src/pages/SupplementManager.tsx:725",className:"text-sm",children:"影低補充劑包裝"})]})}),e.jsx("input",{"data-loc":"client/src/pages/SupplementManager.tsx:729",ref:y,type:"file",accept:"image/*",className:"hidden",onChange:le})]}),e.jsxs(r,{"data-loc":"client/src/pages/SupplementManager.tsx:738",type:"submit",disabled:S.isPending||z,className:"w-full bg-amber-600 hover:bg-amber-700",children:[e.jsx(P,{"data-loc":"client/src/pages/SupplementManager.tsx:743",className:"w-4 h-4 mr-2"}),"加入補充劑"]})]})})]}),e.jsxs("div",{"data-loc":"client/src/pages/SupplementManager.tsx:752",className:"space-y-3",children:[e.jsxs("h2",{"data-loc":"client/src/pages/SupplementManager.tsx:753",className:"text-xl font-semibold text-amber-400 mb-4",children:["我的補充劑 (",v?.length||0,")"]}),v&&v.length>0?v.map(a=>e.jsx(d,{"data-loc":"client/src/pages/SupplementManager.tsx:756",className:"card-glass-subtle hover:shadow-lg transition-shadow",children:e.jsx(m,{"data-loc":"client/src/pages/SupplementManager.tsx:757",className:"pt-4 pb-4",children:e.jsxs("div",{"data-loc":"client/src/pages/SupplementManager.tsx:758",className:"flex justify-between items-start gap-3",children:[a.photoUrl&&e.jsx("div",{"data-loc":"client/src/pages/SupplementManager.tsx:760",className:"w-10 h-10 rounded-lg overflow-hidden shrink-0 border border-border",children:e.jsx("img",{"data-loc":"client/src/pages/SupplementManager.tsx:761",src:a.photoUrl,alt:"",className:"w-full h-full object-cover"})}),e.jsxs("div",{"data-loc":"client/src/pages/SupplementManager.tsx:764",className:"flex-1 min-w-0",children:[e.jsxs("div",{"data-loc":"client/src/pages/SupplementManager.tsx:765",className:"flex items-center gap-2 mb-1",children:[e.jsx(J,{"data-loc":"client/src/pages/SupplementManager.tsx:766",className:"w-4 h-4 text-amber-500 shrink-0"}),e.jsx("h3",{"data-loc":"client/src/pages/SupplementManager.tsx:767",className:"font-semibold truncate",children:a.name})]}),e.jsxs("div",{"data-loc":"client/src/pages/SupplementManager.tsx:769",className:"flex flex-wrap gap-1.5 mb-1",children:[e.jsx("span",{"data-loc":"client/src/pages/SupplementManager.tsx:770",className:"px-2 py-0.5 bg-amber-500/20 text-amber-300 rounded text-xs",children:T[a.category]||a.category}),a.dosage&&e.jsx("span",{"data-loc":"client/src/pages/SupplementManager.tsx:774",className:"px-2 py-0.5 bg-gray-500/20 text-foreground/80 rounded text-xs",children:a.dosage}),a.frequency&&e.jsx("span",{"data-loc":"client/src/pages/SupplementManager.tsx:779",className:"px-2 py-0.5 bg-blue-500/20 text-blue-300 rounded text-xs",children:a.frequency==="daily"?"每天":a.frequency==="weekly"?"每週":"按需"})]}),a.notes&&e.jsx("p",{"data-loc":"client/src/pages/SupplementManager.tsx:789",className:"text-xs text-muted-foreground truncate",children:a.notes})]}),e.jsxs("div",{"data-loc":"client/src/pages/SupplementManager.tsx:792",className:"flex gap-1.5 shrink-0",children:[e.jsx(r,{"data-loc":"client/src/pages/SupplementManager.tsx:793",size:"sm",variant:"outline",onClick:()=>$.mutate({supplementId:a.id}),disabled:$.isPending,className:"h-8 w-8 p-0",children:e.jsx(ue,{"data-loc":"client/src/pages/SupplementManager.tsx:800",className:"w-4 h-4 text-green-400"})}),e.jsx(r,{"data-loc":"client/src/pages/SupplementManager.tsx:802",size:"sm",variant:"ghost",onClick:()=>O.mutate({id:a.id}),disabled:O.isPending,className:"h-8 w-8 p-0",children:e.jsx(he,{"data-loc":"client/src/pages/SupplementManager.tsx:809",className:"w-4 h-4 text-red-400"})})]})]})})},a.id)):e.jsx(d,{"data-loc":"client/src/pages/SupplementManager.tsx:817",className:"card-glass-subtle border-dashed",children:e.jsx(m,{"data-loc":"client/src/pages/SupplementManager.tsx:818",className:"py-8",children:e.jsxs("div",{"data-loc":"client/src/pages/SupplementManager.tsx:819",className:"text-center",children:[e.jsx(J,{"data-loc":"client/src/pages/SupplementManager.tsx:820",className:"w-10 h-10 text-muted-foreground mx-auto mb-3"}),e.jsx("p",{"data-loc":"client/src/pages/SupplementManager.tsx:821",className:"text-muted-foreground mb-1",children:"未有補充劑記錄"}),e.jsx("p",{"data-loc":"client/src/pages/SupplementManager.tsx:822",className:"text-xs text-muted-foreground",children:"影低你嘅補充劑包裝,AI 幫你分析成分同配合度"})]})})})]})]})})})}export{_e 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.