PageSourceSearch

https://dmvmusicalliance.org/assets/ResearchSurveys-DsO1OrIC.js

js dmvmusicalliance.org collected 2026-10-04 08:50:59 UTC 4,229 bytes, 2 lines download raw bytes

1import{r,s as g,j as e,I as N}from"./index-BfjHogyd.js";import{R as S}from"./ResearchDashboardLayout-B9-yhvpG.js";import"./PageLayout-C4FFeSGk.js";import"./SiteFooter-BpkKuvEO.js";import"./ChatWidget-B0pHQBe1.js";import"./blue-control-room-wide-CIQ9u9e1.js";import"./concert-crowd-acdc-B2NaYUQ0.js";import"./violin-underwater-DPdNnEP6.js";import"./heroTitle-Clu977N3.js";const D=()=>{const[a,p]=r.useState([]),[d,u]=r.useState(!0),[c,h]=r.useState(""),[n,m]=r.useState("all"),[y,f]=r.useState(null);r.useEffect(()=>{(async()=>{const{data:s}=await g.from("survey_responses").select("id, survey_key, user_id, created_at, answers").order("created_at",{ascending:!1}).limit(1e3);p(s??[]),u(!1)})()},[]);const j=r.useMemo(()=>Array.from(new Set(a.map(s=>s.survey_key))).sort(),[a]),o=r.useMemo(()=>{const s=c.trim().toLowerCase();return a.filter(t=>n!=="all"&&t.survey_key!==n?!1:s?t.survey_key.toLowerCase().includes(s)||JSON.stringify(t.answers??{}).toLowerCase().includes(s):!0)},[a,c,n]),w=()=>{const t=[["id","survey_key","user_id","created_at","answers"].join(",")];for(const l of o){const b=v=>`"${String(v??"").replace(/"/g,'""').replace(/\n/g," ")}"`;t.push([l.id,l.survey_key,l.user_id??"",l.created_at,JSON.stringify(l.answers??{})].map(b).join(","))}const _=new Blob([t.join(`
2`)],{type:"text/csv"}),x=URL.createObjectURL(_),i=document.createElement("a");i.href=x,i.download=`survey-responses-${new Date().toISOString().slice(0,10)}.csv`,i.click(),URL.revokeObjectURL(x)};return e.jsxs(S,{pageTitle:"Survey Responses",children:[e.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-3 mb-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"font-heading text-3xl uppercase tracking-wider text-black",children:"Survey Responses"}),e.jsx("p",{className:"text-sm text-[hsl(225_50%_30%)] mt-1",children:d?"Loading…":`${o.length} of ${a.length} responses`})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs("select",{value:n,onChange:s=>m(s.target.value),className:"h-9 px-3 rounded-md border border-[hsl(208_60%_78%)] bg-white text-sm text-black",children:[e.jsx("option",{value:"all",children:"All surveys"}),j.map(s=>e.jsx("option",{value:s,children:s},s))]}),e.jsx(N,{value:c,onChange:s=>h(s.target.value),placeholder:"Search answers…",className:"h-9 w-56 bg-white text-black"}),e.jsx("button",{type:"button",onClick:w,className:"h-9 px-3 rounded-md text-sm font-medium bg-[#0000ff] text-white hover:opacity-90",children:"Export CSV"})]})]}),e.jsx("div",{className:"rounded-lg border border-[hsl(208_60%_78%)] overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-[aliceblue] text-xs uppercase tracking-widest text-[hsl(225_50%_30%)] font-heading",children:e.jsxs("tr",{children:[e.jsx("th",{className:"text-left px-4 py-3",children:"Survey"}),e.jsx("th",{className:"text-left px-4 py-3",children:"Submitted"}),e.jsx("th",{className:"text-left px-4 py-3",children:"User"}),e.jsx("th",{className:"text-left px-4 py-3",children:"Answers"})]})}),e.jsxs("tbody",{children:[o.map(s=>{const t=y===s.id;return e.jsxs("tr",{className:"border-t border-[hsl(208_60%_78%)] align-top hover:bg-[hsl(208_80%_92%)]",children:[e.jsx("td",{className:"px-4 py-3 font-medium text-black whitespace-nowrap",children:s.survey_key}),e.jsx("td",{className:"px-4 py-3 text-[hsl(225_50%_30%)] whitespace-nowrap",children:new Date(s.created_at).toLocaleString()}),e.jsx("td",{className:"px-4 py-3 text-[hsl(225_50%_30%)] text-xs font-mono",children:s.user_id?s.user_id.slice(0,8)+"…":"anon"}),e.jsxs("td",{className:"px-4 py-3",children:[e.jsx("button",{type:"button",onClick:()=>f(t?null:s.id),className:"text-xs text-[#0000ff] hover:underline",children:t?"Hide":"View"}),t&&e.jsx("pre",{className:"mt-2 max-h-72 overflow-auto p-3 bg-[aliceblue] border border-[hsl(208_60%_78%)] rounded text-xs text-black whitespace-pre-wrap",children:JSON.stringify(s.answers??{},null,2)})]})]},s.id)}),!d&&o.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:4,className:"px-4 py-10 text-center text-[hsl(225_40%_40%)]",children:"No survey responses match your filters."})})]})]})})})]})};export{D 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.