1import{r as i,j as e,c as b,k as x}from"./index-BH3jeLZo.js";const j=()=>{var o;const[s,m]=i.useState(null),[c,n]=i.useState(0),[h,p]=i.useState(!0);i.useEffect(()=>{(async()=>{try{const{ok:t,data:l}=await b.get("/roads-state");if(!t){x.error("Ù Ø´Ú©ÙÛ Ø¯Ø± Ø¯Ø±ÛØ§Ùت Ø§Ø·ÙØ§Ø¹Ø§Øª راÙâÙØ§ رخ داد");return}m((l==null?void 0:l.data)||null),n(0)}catch{x.error("Ù Ø´Ú©ÙÛ Ø¯Ø± Ø¯Ø±ÛØ§Ùت Ø§Ø·ÙØ§Ø¹Ø§Øª راÙâÙØ§ رخ داد")}finally{p(!1)}})()},[]);const d=Array.isArray(s==null?void 0:s.tabs)?s.tabs:[],a=d[c];return e.jsxs("div",{className:"pb-20 lg:pb-8 font-vazir",children:[e.jsxs("div",{className:"bg-white rounded-lg shadow-sm p-4 mb-4",children:[e.jsx("h1",{className:"text-xl font-bold text-primary mb-2",children:"آخرÛÙ ÙØ¶Ø¹Ûت راÙâÙØ§"}),e.jsx("p",{className:"text-sm text-gray-600",children:"Ø§Ø·ÙØ§Ø¹Ø§Øª Ø±Ø³Ù Û Ø³Ø§Ù Ø§ÙÙ Û±Û´Û± â Ø¨Ø±ÙزرساÙÛ ÙØ± Û±Û° دÙÛÙÙ"}),e.jsx("div",{className:"text-xs text-gray-500 mt-2",children:s!=null&&s.updatedAt?`آخرÛÙ Ø¨Ø±ÙØ²Ø±Ø³Ø§ÙÛ: ${new Date(s.updatedAt).toLocaleString("fa-IR")}`:"آخرÛÙ Ø¨Ø±ÙØ²Ø±Ø³Ø§ÙÛ: ---"})]}),e.jsx("div",{className:"bg-white rounded-lg shadow-sm p-4",children:h?e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"h-8 shimmer rounded"}),e.jsx("div",{className:"h-40 shimmer rounded"})]}):d.length===0?e.jsx("div",{className:"text-center text-sm text-gray-500 py-10",children:s!=null&&s.lastError?`خطا در Ø¯Ø±ÛØ§Ùت Ø§Ø·ÙØ§Ø¹Ø§Øª: ${s.lastError}`:"Ø§Ø·ÙØ§Ø¹Ø§ØªÛ Ø¨Ø±Ø§Û ÙÙ Ø§ÛØ´ ÙØ¬Ùد ÙØ¯Ø§Ø±Ø¯."}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-wrap gap-2 mb-4",children:d.map((r,t)=>e.jsx("button",{type:"button",onClick:()=>n(t),className:`px-4 py-2 text-xs rounded-full border transition ${c===t?"bg-primary text-white border-primary":"bg-white text-gray-700 border-gray-200 hover:bg-primary/10"}`,children:r.title||`تب ${t+1}`},r.title||t))}),e.jsx("div",{className:"border border-gray-200 rounded-lg p-4",children:(a==null?void 0:a.type)==="table"?e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"min-w-full text-xs text-gray-700",children:[((o=a.headers)==null?void 0:o.length)>0&&e.jsx("thead",{children:e.jsx("tr",{className:"bg-gray-50",children:a.headers.map((r,t)=>e.jsx("th",{className:"px-3 py-2 text-right font-semibold border-b",children:r||"-"},`${r}-${t}`))})}),e.jsx("tbody",{children:(a.rows||[]).map((r,t)=>e.jsx("tr",{className:"border-b",children:r.map((l,g)=>e.jsx("td",{className:"px-3 py-2",children:l||"-"},g))},t))})]})}):e.jsx("div",{className:"text-sm text-gray-700 leading-relaxed whitespace-pre-line",children:(a==null?void 0:a.content)||"Ø§Ø·ÙØ§Ø¹Ø§ØªÛ Ø¨Ø±Ø§Û ÙÙ Ø§ÛØ´ ÙØ¬Ùد ÙØ¯Ø§Ø±Ø¯."})})]})})]})};export{j as default}; 2//# sourceMappingURL=RoadsStatePage-CJ7zc7Wd.js.map
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.