PageSourceSearch

https://trybrain.io/assets/_authenticated.organic-patterns-BoyWruL_.js

js trybrain.io collected 2026-09-24 15:05:07 UTC 2,762 bytes, 1 lines download raw bytes

1import{z as m,D as u,E as x,au as w,e as i,P as N,f as d,K as v,t as l,j as e,B as _,q as F,S as P,k as S}from"./index-DHwBXtP2.js";import{T as k}from"./trending-up-BjyiYEVM.js";const q=m({method:"POST"}).middleware([u]).handler(x("src_lib_organic-remix_functions_ts--listWinningPatterns_createServerFn_handler")),O=m({method:"POST"}).middleware([u]).handler(x("src_lib_organic-remix_functions_ts--triggerOrganicRemix_createServerFn_handler"));function K(){const g=w(),p=i(N),{data:h}=d({queryKey:["workspaces"],queryFn:()=>p({})}),t=h?.[0]?.id,j=i(q),f=i(O),{data:y,isLoading:c}=d({queryKey:["organic-patterns",t],queryFn:()=>j({data:{workspaceId:t}}),enabled:!!t}),o=y?.patterns??[],n=v({mutationFn:()=>f({data:{workspaceId:t}}),onSuccess:s=>{l.success(`Generated ${s.scripts} new scripts across ${s.cells} winning cells`),g.invalidateQueries({queryKey:["organic-patterns",t]})},onError:s=>l.error(s?.message??"Remix failed")}),b=o.reduce((s,a)=>((s[a.pattern_type]||=[]).push(a),s),{});return e.jsxs("div",{className:"mx-auto max-w-5xl space-y-6 p-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-semibold",children:"Winning Patterns"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Hooks, formats and hashtags from posts that outperformed your 14-day baseline."})]}),e.jsxs(_,{onClick:()=>n.mutate(),disabled:!t||n.isPending,children:[n.isPending?e.jsx(F,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(P,{className:"mr-2 h-4 w-4"}),"Remix top winners"]})]}),c&&e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading…"}),!c&&o.length===0&&e.jsx("div",{className:"rounded-lg border border-dashed p-8 text-center text-sm text-muted-foreground",children:"No winning patterns yet. Publish more posts — the nightly job flags winners at ≥ 1.5× median views and extracts their patterns automatically."}),Object.entries(b).map(([s,a])=>e.jsxs("section",{className:"space-y-3",children:[e.jsxs("h2",{className:"text-sm font-semibold uppercase text-muted-foreground",children:[s," (",a.length,")"]}),e.jsx("div",{className:"space-y-2",children:a.map(r=>e.jsxs("div",{className:"flex items-start justify-between gap-4 rounded-lg border bg-card p-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"truncate text-sm",children:r.pattern_text}),e.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["seen ",r.support_count,"× · avg ",Number(r.avg_performance_ratio??0).toFixed(2),"× baseline"]})]}),e.jsxs(S,{variant:"secondary",className:"shrink-0",children:[e.jsx(k,{className:"mr-1 h-3 w-3"}),"weight ",Number(r.weight??1).toFixed(1)]})]},r.id))})]},s))]})}export{K 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.