PageSourceSearch

https://velozity.co/assets/_id_-CNdqAJ9E.js

js velozity.co collected 2026-10-04 23:40:58 UTC 3,970 bytes, 1 lines download raw bytes

1import{a8 as x,u as j,Z as R,a as v,r as c,b as w,a9 as l,j as e,S as T,aa as U,ab as N,L as d}from"./index-K-zNuvHd.js";import{U as k}from"./UsabilityTestResults-CYpK5-5T.js";import"./dialog-Cg6JG9Gx.js";import"./circle-x-tRETMKIX.js";function L(){const[,o]=x("/usability-test/:id"),t=o==null?void 0:o.id,[,f]=j(),{toast:u}=R(),r=v(),g=c.useRef(null),{data:a,isLoading:m}=w({queryKey:["/api/usability-tests",t],enabled:!!t,queryFn:async()=>{const i=await fetch(`/api/usability-tests/${t}`);if(!i.ok)throw new Error("Failed to fetch test data");const s=await i.json();if(console.log("Usability test data:",s),s.status==="running"||s.status==="in_progress")return console.log("Test is still running - showing loading state"),{...s,isRunning:!0,taskResults:[],guidanceResponses:[],insights:[],actionItems:[]};if(s.results&&Object.keys(s.results).length>0){console.log("Test has results:",s.results);let n=null;s.results.persona?(console.log("Found persona in results:",s.results.persona),n=s.results.persona):s.persona?(console.log("Found persona at top level:",s.persona),n=s.persona):console.log("No persona found in test data");const p={...s,id:s.id,title:s.title,figmaUrl:s.figmaUrl,persona:n,taskResults:Array.isArray(s.results.taskResults)?s.results.taskResults:[],guidanceResponses:Array.isArray(s.results.guidanceResponses)?s.results.guidanceResponses:[],insights:Array.isArray(s.results.insights)?s.results.insights:[],actionItems:Array.isArray(s.results.actionItems)?s.results.actionItems:[]};return console.log("Processed test data with persona:",p),p}else return console.log("Creating default structure for test with no results"),{...s,taskResults:[],guidanceResponses:[],insights:[],actionItems:[]}}});c.useEffect(()=>{if(!t)return;l.subscribeUsabilityTest(t);const i=n=>{n.usabilityTestId===t&&(console.log("Usability test completed, refreshing data"),r.invalidateQueries({queryKey:["/api/usability-tests",t]}),u({title:"Usability test completed",description:"The usability test results are now available."}))},s=n=>{n.usabilityTestId===t&&(console.log("Usability test failed, refreshing data"),r.invalidateQueries({queryKey:["/api/usability-tests",t]}),u({title:"Usability test failed",description:"There was an error processing the usability test.",variant:"destructive"}))};l.on("usabilityTestComplete",i),l.on("usabilityTestFailed",s);const y=setInterval(()=>{a!=null&&a.isRunning&&(console.log("Polling for usability test updates"),r.invalidateQueries({queryKey:["/api/usability-tests",t]}))},15e3);return()=>{l.unsubscribeUsabilityTest(t),l.off("usabilityTestComplete",i),l.off("usabilityTestFailed",s),clearInterval(y)}},[t,r,a==null?void 0:a.isRunning,u]);const h=()=>{f("/usability-tests")},b=i=>{g.current=i};return e.jsx(T,{children:e.jsxs("div",{className:"flex flex-col space-y-6",children:[e.jsx("div",{className:"mb-4 flex justify-between items-center",children:e.jsx(U,{variant:"ghost",icon:e.jsx(N,{className:"h-4 w-4"}),onClick:h,children:"Back to Usability Tests"})}),m?e.jsx("div",{className:"flex justify-center py-12",children:e.jsx(d,{className:"h-8 w-8 animate-spin text-primary"})}):a?a.isRunning?e.jsx("div",{className:"text-center py-12",children:e.jsxs("div",{className:"flex flex-col items-center gap-4",children:[e.jsx(d,{className:"h-12 w-12 animate-spin text-primary"}),e.jsx("h2",{className:"text-xl font-semibold",children:"Processing Usability Test"}),e.jsx("p",{className:"text-muted-foreground max-w-md",children:"Your usability test is being processed. This might take a few minutes. You'll receive a notification when it's ready."})]})}):e.jsx(c.Suspense,{fallback:e.jsx("div",{className:"flex justify-center py-12",children:e.jsx(d,{className:"h-8 w-8 animate-spin text-primary"})}),children:e.jsx(k,{testData:a,onExport:b})}):e.jsx("div",{className:"text-center py-12",children:e.jsx("p",{className:"text-gray-500",children:"Failed to load usability test data. Please try again later."})})]})})}export{L 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.