PageSourceSearch

https://www.vettis.ai/assets/TwitterTab-DMyp7mDi.js

js vettis.ai collected 2026-10-05 14:15:44 UTC 13,408 bytes, 14 lines download raw bytes

1import{t as T,r,h as u,j as e,L as N,Z as L,x as P,i as R,a9 as S,y as E,n as M,aa as C,ab as _,ac as b,a4 as z,Q as F,p as A,M as B,K as U}from"./index-SzBOED3G.js";/**
2 * @license lucide-react v0.303.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 $=T("Bookmark",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]]);/**
7 * @license lucide-react v0.303.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const D=T("Repeat2",[["path",{d:"m2 9 3-3 3 3",key:"1ltn5i"}],["path",{d:"M13 18H7a2 2 0 0 1-2-2V6",key:"1r6tfw"}],["path",{d:"m22 15-3 3-3-3",key:"4rnwn2"}],["path",{d:"M11 6h6a2 2 0 0 1 2 2v10",key:"2f72bc"}]]);function g({title:t,value:s,icon:i,color:n="primary"}){const o={primary:"bg-primary/10 text-primary",success:"bg-emerald-500/10 text-emerald-400",warning:"bg-amber-500/10 text-amber-400",error:"bg-red-500/10 text-red-400",info:"bg-blue-500/10 text-blue-400"};return e.jsx("div",{className:"bg-surface border border-border rounded-xl p-4",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-text-muted",children:t}),e.jsx("p",{className:"text-2xl font-bold text-text-primary mt-1",children:s})]}),e.jsx("div",{className:b("p-2 rounded-lg",o[n]),children:i})]})})}function I({post:t,onDelete:s}){const[i,n]=r.useState(!1),o={posted:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20",draft:"bg-amber-500/10 text-amber-400 border-amber-500/20",failed:"bg-red-500/10 text-red-400 border-red-500/20",deleted:"bg-zinc-500/10 text-zinc-400 border-zinc-500/20"},d={financial:"Financial",strategic:"Strategic",dual:"Dual",manual:"Manual"};return e.jsxs("div",{className:"bg-surface border border-border rounded-xl p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:b("text-[10px] font-semibold uppercase px-2 py-0.5 rounded-full border",o[t.status]||o.draft),children:t.status}),e.jsx("span",{className:"text-xs text-text-muted px-2 py-0.5 rounded bg-surface-light",children:d[t.pipeline_type]||t.pipeline_type}),t.ticker&&e.jsxs("span",{className:"text-xs font-mono text-primary",children:["$",t.ticker]}),t.stance&&e.jsxs("span",{className:b("text-[10px] font-semibold uppercase",t.stance.includes("BULL")?"text-emerald-400":"text-red-400"),children:[t.stance,t.confidence?` (${Math.round(t.confidence*100)}%)`:""]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"text-xs text-text-muted whitespace-nowrap",children:t.posted_at?new Date(t.posted_at).toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):new Date(t.created_at).toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}),t.status!=="deleted"&&e.jsx("button",{onClick:()=>s(t.id),className:"p-1 rounded hover:bg-red-500/10 text-text-muted hover:text-red-400 transition-colors",title:"Delete post",children:e.jsx(z,{className:"w-3.5 h-3.5"})})]})]}),e.jsxs("div",{className:"space-y-2",children:[(i?t.tweets:t.tweets.slice(0,1)).map((m,l)=>e.jsxs("p",{className:"text-sm text-text-secondary leading-relaxed",children:[t.tweets.length>1&&e.jsxs("span",{className:"text-text-muted mr-1",children:[l+1,"/",t.tweets.length]}),m]},l)),t.tweets.length>1&&e.jsxs("button",{onClick:()=>n(!i),className:"flex items-center gap-1 text-xs text-primary hover:text-primary/80 transition-colors",children:[i?e.jsx(F,{className:"w-3 h-3"}):e.jsx(A,{className:"w-3 h-3"}),i?"Collapse thread":`Show all ${t.tweets.length} tweets`]})]}),t.status==="posted"&&e.jsxs("div",{className:"flex items-center gap-4 pt-2 border-t border-border",children:[e.jsx(y,{icon:e.jsx(C,{className:"w-3 h-3"}),value:t.impressions}),e.jsx(y,{icon:e.jsx(_,{className:"w-3 h-3"}),value:t.likes}),e.jsx(y,{icon:e.jsx(D,{className:"w-3 h-3"}),value:t.retweets}),e.jsx(y,{icon:e.jsx(B,{className:"w-3 h-3"}),value:t.replies}),e.jsx(y,{icon:e.jsx($,{className:"w-3 h-3"}),value:t.bookmarks}),e.jsxs("span",{className:"text-xs text-text-muted ml-auto",children:[(t.engagement_rate*100).toFixed(2),"% ER"]})]})]})}function y({icon:t,value:s}){return e.jsxs("div",{className:"flex items-center gap-1 text-text-muted",children:[t,e.jsx("span",{className:"text-xs",children:s.toLocaleStr
11ing()})]})}function W({topic:t}){const s={financial:"text-emerald-400",strategic:"text-blue-400",dual:"text-primary"};return e.jsxs("div",{className:"flex items-center justify-between gap-4 py-3 border-b border-border last:border-b-0",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-sm text-text-primary truncate",children:t.title}),e.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[e.jsx("span",{className:b("text-[10px] font-semibold uppercase",s[t.pipeline_type]||"text-text-muted"),children:t.pipeline_type}),e.jsx("span",{className:"text-[10px] text-text-muted",children:t.source}),t.tickers.length>0&&e.jsx("span",{className:"text-[10px] font-mono text-primary",children:t.tickers.map(i=>`$${i}`).join(" ")})]})]}),e.jsxs("div",{className:"text-right shrink-0",children:[e.jsx("p",{className:"text-sm font-mono text-text-primary",children:t.final_score.toFixed(2)}),e.jsx("p",{className:"text-[10px] text-text-muted",children:t.status})]})]})}function H({onPost:t}){const[s,i]=r.useState(""),[n,o]=r.useState(!1),[d,m]=r.useState(!1),[l,v]=r.useState(""),[h,p]=r.useState(""),x=s.length,w=n?s.split(`
12
13`).filter(c=>c.trim()).length:1,k=async()=>{if(s.trim()){m(!0),v(""),p("");try{const c=await u.postTweetNow(s,n);p(`Posted! ID: ${c.post_id}`),i(""),t()}catch(c){v(c instanceof Error?c.message:"Failed to post")}finally{m(!1)}}};return e.jsxs("div",{className:"bg-surface border border-border rounded-xl p-4 space-y-3",children:[e.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"Manual Composer"}),e.jsx("textarea",{value:s,onChange:c=>i(c.target.value),placeholder:n?"Write thread tweets separated by blank lines...":"Compose a tweet...",className:"w-full bg-surface-light border border-border rounded-lg p-3 text-sm text-text-primary placeholder:text-text-muted resize-none focus:outline-none focus:border-primary/50 transition-colors",rows:4}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:n,onChange:c=>o(c.target.checked),className:"rounded border-border"}),e.jsx("span",{className:"text-xs text-text-muted",children:"Thread mode"})]}),e.jsxs("span",{className:b("text-xs",x>280&&!n?"text-red-400":"text-text-muted"),children:[x," chars",n&&` / ${w} tweets`]})]}),e.jsxs("button",{onClick:k,disabled:d||!s.trim(),className:b("flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm font-medium transition-colors",d||!s.trim()?"bg-surface-light text-text-muted cursor-not-allowed":"bg-primary text-background hover:bg-primary/90"),children:[d?e.jsx(N,{size:"sm"}):e.jsx(S,{className:"w-3.5 h-3.5"}),"Post Now"]})]}),l&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-red-400 bg-red-500/10 rounded-lg px-3 py-2",children:[e.jsx(U,{className:"w-3.5 h-3.5 shrink-0"}),l]}),h&&e.jsx("div",{className:"text-xs text-emerald-400 bg-emerald-500/10 rounded-lg px-3 py-2",children:h})]})}function V(){const[t,s]=r.useState("template_type"),[i,n]=r.useState([]),[o,d]=r.useState(!1),m=async()=>{d(!0);try{const l=await u.getTwitterABTests(t);n(l)}catch{n([])}finally{d(!1)}};return r.useEffect(()=>{m()},[t]),e.jsxs("div",{className:"bg-surface border border-border rounded-xl p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-sm font-semibold text-text-primary",children:"A/B Test Results"}),e.jsxs("select",{value:t,onChange:l=>s(l.target.value),className:"bg-surface-light border border-border rounded-lg px-2 py-1 text-xs text-text-secondary focus:outline-none",children:[e.jsx("option",{value:"template_type",children:"Template Type"}),e.jsx("option",{value:"tone",children:"Tone"}),e.jsx("option",{value:"cta_style",children:"CTA Style"})]})]}),o?e.jsx("div",{className:"flex justify-center py-4",children:e.jsx(N,{size:"sm"})}):i.length===0?e.jsx("p",{className:"text-xs text-text-muted py-2",children:"No A/B test data yet."}):e.jsx("div",{className:"space-y-2",children:i.map(l=>e.jsxs("div",{className:"flex items-center justify-between py-2 border-b border-border last:border-b-0",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-text-primary font-medium",children:l.variant}),e.jsxs("p",{className:"text-xs text-text-muted",children:[l.post_count," posts"]})]}),e.jsxs("div",{className:"text-right",children:[e.jsxs("p",{className:"text-sm font-mono text-text-primary",children:[(l.avg_engagement*100).toFixed(2),"% ER"]}),e.jsxs("p",{className:"text-xs text-text-muted",children:[l.avg_impressions.toLocaleStr
13ing()," avg imp"]})]})]},l.variant))})]})}function q({autoRefresh:t}){const[s,i]=r.useState(null),[n,o]=r.useState([]),[d,m]=r.useState([]),[l,v]=r.useState(!0),[h,p]=r.useState(null),x=r.useCallback(async()=>{try{const[a,j,f]=await Promise.all([u.getTwitterDashboard(),u.getTwitterPosts(50),u.getTwitterTopics(20)]);i(a),o(j),m(f)}catch(a){console.error("Failed to fetch Twitter data:",a)}finally{v(!1)}},[]);r.useEffect(()=>{x()},[x]),r.useEffect(()=>{if(t){const a=window.setInterval(x,15e3);return()=>clearInterval(a)}},[t,x]);const w=async()=>{p("discover");try{await u.triggerTwitterDiscovery(),setTimeout(x,2e3)}catch(a){console.error("Failed to trigger discovery:",a)}finally{p(null)}},k=async()=>{p("metrics");try{await u.triggerTwitterMetricsUpdate(),setTimeout(x,2e3)}catch(a){console.error("Failed to update metrics:",a)}finally{p(null)}},c=async a=>{if(window.confirm("Delete this post from Twitter and the database?"))try{await u.deleteTwitterPost(a),o(j=>j.map(f=>f.id===a?{...f,status:"deleted"}:f))}catch(j){console.error("Failed to delete post:",j)}};return l?e.jsx("div",{className:"flex items-center justify-center py-16",children:e.jsx(N,{size:"lg"})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:w,disabled:h==="discover",className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium border border-border bg-surface text-text-secondary hover:bg-surface-light transition-colors disabled:opacity-50",children:[h==="discover"?e.jsx(N,{size:"sm"}):e.jsx(L,{className:"w-3 h-3"}),"Run Pipeline"]}),e.jsxs("button",{onClick:k,disabled:h==="metrics",className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium border border-border bg-surface text-text-secondary hover:bg-surface-light transition-colors disabled:opacity-50",children:[h==="metrics"?e.jsx(N,{size:"sm"}):e.jsx(P,{className:"w-3 h-3"}),"Update Metrics"]}),e.jsxs("button",{onClick:x,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium border border-border bg-surface text-text-secondary hover:bg-surface-light transition-colors",children:[e.jsx(R,{className:"w-3 h-3"}),"Refresh"]})]}),s&&e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-3 xl:grid-cols-6 gap-3",children:[e.jsx(g,{title:"Posts Today",value:s.posts_today,icon:e.jsx(S,{className:"w-4 h-4"}),color:"primary"}),e.jsx(g,{title:"Posts This Week",value:s.posts_this_week,icon:e.jsx(E,{className:"w-4 h-4"}),color:"info"}),e.jsx(g,{title:"Avg Engagement",value:`${(s.avg_engagement_rate*100).toFixed(2)}%`,icon:e.jsx(M,{className:"w-4 h-4"}),color:"success"}),e.jsx(g,{title:"Impressions (Week)",value:s.total_impressions_week.toLocaleString(),icon:e.jsx(C,{className:"w-4 h-4"}),color:"info"}),e.jsx(g,{title:"Likes (Week)",value:s.total_likes_week.toLocaleString(),icon:e.jsx(_,{className:"w-4 h-4"}),color:"error"}),e.jsx(g,{title:"Retweets (Week)",value:s.total_retweets_week.toLocaleString(),icon:e.jsx(D,{className:"w-4 h-4"}),color:"warning"})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-4",children:[e.jsx("h2",{className:"text-lg font-semibold text-text-primary",children:"Recent Posts"}),n.length===0?e.jsx("div",{className:"bg-surface border border-border rounded-xl p-8 text-center",children:e.jsx("p",{className:"text-sm text-text-muted",children:"No posts yet. Run the pipeline or compose manually."})}):e.jsx("div",{className:"space-y-3",children:n.map(a=>e.jsx(I,{post:a,onDelete:c},a.id))})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(H,{onPost:x}),e.jsxs("div",{className:"bg-surface border border-border rounded-xl p-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-text-primary mb-3",children:"Discovered Topics"}),d.length===0?e.jsx("p",{className:"text-xs text-text-muted",children:"No topics discovered recently."}):e.jsx("div",{className:"max-h-80 overflow-y-auto",children:d.map(a=>e.jsx(W,{topic:a},a.id))})]}),e.jsx(V,{})]})]})]})}export{q as default};
14//# sourceMappingURL=TwitterTab-DMyp7mDi.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.