PageSourceSearch

https://cradermind.com/assets/NewsAdmin-Bis5AyvJ.js

js cradermind.com collected 2026-10-02 01:26:49 UTC 23,779 bytes, 1 lines download raw bytes

1import{r as o,j as e,L as ae}from"./vendor-react-BPv6TnFg.js";import{X as L,s as g}from"./index-CjMpuxY_.js";import{A as re}from"./arrow-left-Dilz1jPN.js";import{P as C}from"./plus-BDZlOKxp.js";import{U}from"./upload-CkG57FOo.js";import{S as B}from"./save-DjynxUFd.js";import{C as te}from"./chevron-up-CRwD_9HT.js";import{C as se}from"./chevron-down-BflcE69q.js";import{T as le}from"./trash-pBF6ZdnJ.js";const S=10,be=()=>{const[G,n]=o.useState([]),[O,y]=o.useState(!0),[E,f]=o.useState(null),[x,b]=o.useState(!1),[I,D]=o.useState({}),[w,A]=o.useState(!1),[T,j]=o.useState(!1),[H,q]=o.useState(new Set),[N,W]=o.useState(""),[Y,v]=o.useState(1),[i,c]=o.useState({title_de:"",title_en:"",description_de:"",description_en:"",date:new Date().toISOString().split("T")[0],impact:"medium",probability:50,strength:5,direction:"neutral",affected_markets:[],image_url:"",images:[]}),k=async()=>{try{const{data:a,error:r}=await g.from("news_items").select("*").order("date",{ascending:!1}).order("created_at",{ascending:!1});if(r)throw r;n(a||[])}catch(a){console.error("Error fetching news:",a),f("Error fetching news items")}finally{y(!1)}};o.useEffect(()=>{k()},[]),o.useEffect(()=>{v(1)},[N]);const P=async a=>{try{A(!0);const r=a.name.split(".").pop(),d="news-".concat(Date.now(),".").concat(r),t="news-images/".concat(d),{error:l,data:s}=await g.storage.from("images").upload(t,a,{upsert:!0,contentType:a.type});if(l)return console.error("Upload error:",l),alert("Fehler beim Hochladen des Bildes: "+l.message),null;const{data:m}=g.storage.from("images").getPublicUrl(t);return m.publicUrl}catch(r){return console.error("Error uploading image:",r),alert("Fehler beim Hochladen des Bildes"),null}finally{A(!1)}},M=async a=>{const r=await P(a);r&&c(d=>{var t;return{...d,images:[...d.images||[],r],image_url:((t=d.images)==null?void 0:t.length)===0?r:d.image_url}})},Z=async a=>{for(let r=0;r<a.length;r++)await M(a[r])},J=a=>{c(r=>{const d=[...r.images||[]];return d.splice(a,1),{...r,images:d,image_url:d.length>0?d[0]:""}})},$=async(a,r)=>{var t;const d=await P(a);if(d){const l=[...r.images||[],d],s={...r,images:l,image_url:((t=r.images)==null?void 0:t.length)===0?d:r.image_url};await _(s)}},K=async(a,r)=>{const d=[...r.images||[]];d.splice(a,1);const t={...r,images:d,image_url:d.length>0?d[0]:""};await _(t)},R=async()=>{if(!i.title_de||!i.title_en||!i.description_de||!i.description_en){alert("Bitte füllen Sie alle Pflichtfelder aus");return}try{b(!0);const{data:a,error:r}=await g.from("news_items").insert([{...i,date:new Date(i.date).toISOString()}]).select().single();if(r)throw r;if(a){const{error:d}=await g.from("notifications").insert([{type:"news",message:"Neue News hinzugefügt: ".concat(i.title_de||i.title_en),link:"/dashboard?newsId=".concat(a.id),symbol:"NEWS"}]);d&&console.error("Error creating notification:",d);try{const{data:t}=await g.auth.getSession();if(t!=null&&t.session){const l="📰 Neue News: ".concat(i.title_de||i.title_en);await fetch("https://bsmvcmmwkmaqpgrmvjql.supabase.co/functions/v1/send-broadcast-notification",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(t.session.access_token)},body:JSON.stringify({message:l,link:"/dashboard?newsId=".concat(a.id)})})}}catch(t){console.error("Error sending push notification:",t)}}await k(),j(!1),c({title_de:"",title_en:"",description_de:"",description_en:"",date:new Date().toISOString().split("T")[0],impact:"medium",probability:50,strength:5,direction:"neutral",affected_markets:[],image_url:""})}catch(a){console.error("Error adding news:",a),alert("Fehler beim Hinzufügen der News")}finally{b(!1)}},_=async a=>{try{b(!0);const{error:r}=await g.from("news_items").upsert({...a,date:new Date(a.date).toISOString()});if(r)throw r;await k(),alert("News item saved successfully!")}catch(r){console.error("Error saving news:",r),f("Error saving news item"),alert("Failed to save news item. Please try again.")}finally{b(!1)}},X=async a=>{if(confirm("Are you sure you want to delete this news item?"))try{y(!0);const{error:r}=await g.from("news_items").delete().eq("id",a);if(r)throw r;n(d=>d.filter(t=>t.id!==a)),alert("News item deleted successfully!")}catch(r){console.error("Error deleting news:",r),f("Error deleting news item"),alert("Failed to delete news item. Please try again.")}finally{y(!1)}},Q=a=>{q(r=>{const d=new Set(r);return d.has(a)?d.delete(a):d.add(a),d})},p=G.filter(a=>{var d,t;const r=N.trim().toLowerCase();return r?((d=a.title_de)==null?void 0:d.toLowerCase().includes(r))||((t=a.title_en)==null?void 0:t.toLowerCase().includes(r)):!0}),h=Math.max(1,Math.ceil(p.length/S)),u=Math.min(Y,h),V=p.slice((u-1)*S,u*S),F=a=>{var d;const r=(d=I[a])==null?void 0:d.trim();r&&(n(t=>t.map(l=>{if(l.id===a){const s=l.affected_markets||[];if(!s.includes(r))return{...l,affected_markets:[...s,r]}}return l})),D(t=>({...t,[a]:""})))};return O?e.jsx("div",{className:"min-h-screen bg-gray-50 dark:bg-[#0A0A0A] p-6 pt-20",children:e.jsx("div",{className:"max-w-[1800px] lg:max-w-[1600px] xl:max-w-[1400px] 2xl:max-w-[1280px] mx-auto",children:e.jsx("div",{className:"flex items-center justify-center h-32",children:e.jsx("div",{className:"text-gray-600 dark:text-gray-400",children:"Loading..."})})})}):E?e.jsx("div",{className:"min-h-screen bg-gray-50 dark:bg-[#0A0A0A] p-6 pt-20",children:e.jsx("div",{className:"max-w-[1800px] lg:max-w-[1600px] xl:max-w-[1400px] 2xl:max-w-[1280px] mx-auto",children:e.jsx("div",{className:"bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-400 p-4 rounded-lg",children:E})})}):e.jsx("div",{className:"min-h-screen bg-gray-50 dark:bg-[#0A0A0A] py-20",children:e.jsxs("div",{className:"max-w-[1800px] lg:max-w-[1600px] xl:max-w-[1400px] 2xl:max-w-[1280px] mx-auto px-4 sm:px-6 lg:px-8",children:[e.jsx("div",{className:"flex items-center justify-between mb-6",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx(ae,{to:"/dashboard",className:"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white mr-4",children:e.jsx(re,{className:"h-6 w-6"})}),e.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:"Manage News"})]})}),e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-3 mb-4",children:[e.jsx("h2",{className:"text-xl font-bold text-gray-900 dark:text-white",children:"News"}),e.jsxs("button",{onClick:()=>j(!T),className:"flex items-center px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 transition-colors",children:[e.jsx(C,{className:"w-4 h-4 mr-2"}),"Add News"]})]}),e.jsx("div",{className:"mb-4",children:e.jsx("input",{type:"text",value:N,onChange:a=>W(a.target.value),placeholder:"Nach Titel suchen...",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})}),T&&e.jsxs("div",{className:"bg-white dark:bg-surface-elevated rounded-lg shadow p-6 mb-6",children:[e.jsx("h3",{className:"text-lg font-semibold mb-4 text-gray-900 dark:text-white",children:"Add New News Item"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Title (German)"}),e.jsx("input",{type:"text",value:i.title_de||"",onChange:a=>c(r=>({...r,title_de:a.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white",placeholder:"German title"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Title (English)"}),e.jsx("input",{type:"text",value:i.title_en||"",onChange:a=>c(r=>({...r,title_en:a.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white",placeholder:"English title"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Description (German)"}),e.jsx("textarea",{value:i.description_de||"",onChange:a=>c(r=>({...r,description_de:a.target.value})),rows:4,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white",placeholder:"German description"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Description (English)"}),e.jsx("textarea",{value:i.description_en||"",onChange:a=>c(r=>({...r,description_en:a.target.value})),rows:4,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white",placeholder:"English description"})]})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Image"}),e.jsxs("div",{className:"space-y-4",children:[i.images&&i.images.length>0&&e.jsx("div",{className:"grid grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-3",children:i.images.map((a,r)=>
1e.jsxs("div",{className:"relative",children:[e.jsx("img",{src:a,alt:"News image ".concat(r+1),className:"w-20 h-20 object-cover rounded-lg border"}),e.jsx("button",{onClick:()=>J(r),className:"absolute -top-2 -right-2 bg-red-500 text-white rounded-full p-1 hover:bg-red-600",children:e.jsx(L,{className:"w-3 h-3"})}),r===0&&e.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-surface-elevated text-white text-xs text-center py-0.5 rounded-b-lg",children:"Primary"})]},r))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"file",accept:"image/*",onChange:a=>{var d;const r=(d=a.target.files)==null?void 0:d[0];r&&M(r)},className:"hidden",id:"new-image-upload"}),e.jsx("label",{htmlFor:"new-image-upload",className:"flex items-center justify-center w-20 h-20 border-2 border-dashed border-gray-300 dark:border-gray-600 rounded-lg cursor-pointer hover:border-bronze-500 transition-colors",children:w?e.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-bronze-600"}):e.jsx(C,{className:"w-6 h-6 text-gray-400"})}),e.jsx("input",{type:"file",accept:"image/*",multiple:!0,onChange:a=>{const r=a.target.files;r&&Z(r)},className:"hidden",id:"new-multiple-image-upload"}),e.jsxs("label",{htmlFor:"new-multiple-image-upload",className:"flex items-center gap-2 px-3 py-2 bg-surface-elevated text-white rounded-lg cursor-pointer hover:bg-surface-elevated transition-colors",children:[e.jsx(U,{className:"w-4 h-4"}),e.jsx("span",{className:"text-sm",children:"Multiple"})]})]}),e.jsx("p",{className:"text-xs text-gray-500",children:"First image will be used as the primary image. You can upload multiple images at once."})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-5 gap-4 mb-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Date"}),e.jsx("input",{type:"date",value:i.date||"",onChange:a=>c(r=>({...r,date:a.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Impact"}),e.jsxs("select",{value:i.impact||"medium",onChange:a=>c(r=>({...r,impact:a.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[e.jsx("option",{value:"low",children:"Low"}),e.jsx("option",{value:"medium",children:"Medium"}),e.jsx("option",{value:"high",children:"High"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Direction"}),e.jsxs("select",{value:i.direction||"neutral",onChange:a=>c(r=>({...r,direction:a.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[e.jsx("option",{value:"neutral",children:"Neutral"}),e.jsx("option",{value:"bullish",children:"Bullish"}),e.jsx("option",{value:"bearish",children:"Bearish"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Probability (%)"}),e.jsx("input",{type:"number",min:"0",max:"100",value:i.probability||50,onChange:a=>c(r=>({...r,probability:parseInt(a.target.value)})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Strength (1-10)"}),e.jsx("input",{type:"number",min:"1",max:"10",value:i.strength||5,onChange:a=>c(r=>({...r,strength:parseInt(a.target.value)})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:R,disabled:x||w,className:"flex items-center px-4 py-2 bg-surface-elevated text-white rounded-lg hover:bg-surface-elevated transition-colors disabled:opacity-50",children:[e.jsx(B,{className:"w-4 h-4 mr-2"}),x?"Saving...":"Save News"]}),e.jsx("button",{onClick:()=>j(!1),className:"px-4 py-2 bg-gray-500 text-white rounded-lg hover:bg-gray-600 transition-colors",children:"Cancel"})]})]}),e.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400 mb-2",children:[p.length," News-Eintrag",p.length===1?"":"e"]}),e.jsx("div",{className:"space-y-4",children:V.map(a=>{var d;const r=H.has(a.id);return e.jsxs("div",{className:"bg-white dark:bg-surface-elevated rounded-lg shadow",children:[e.jsxs("button",{type:"button",onClick:()=>Q(a.id),className:"w-full flex items-center justify-between gap-4 p-4 text-left",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"font-semibold text-gray-900 dark:text-white truncate",children:a.title_de||a.title_en||"Ohne Titel"}),e.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:[new Date(a.date).toLocaleDateString("de-DE")," · ",a.impact," · ",a.direction]})]}),r?e.jsx(te,{className:"w-5 h-5 text-gray-400 flex-shrink-0"}):e.jsx(se,{className:"w-5 h-5 text-gray-400 flex-shrink-0"})]}),r&&e.jsxs("div",{className:"p-6 pt-0",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Title (German)"}),e.jsx("input",{type:"text",value:a.title_de||"",onChange:t=>n(l=>l.map(s=>s.id===a.id?{...s,title_de:t.target.value}:s)),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Title (English)"}),e.jsx("input",{type:"text",value:a.title_en||"",onChange:t=>n(l=>l.map(s=>s.id===a.id?{...s,title_en:t.target.value}:s)),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Description (German)"}),e.jsx("textarea",{value:a.description_de||"",onChange:t=>n(l=>l.map(s=>s.id===a.id?{...s,description_de:t.target.value}:s)),rows:4,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Description (English)"}),e.jsx("textarea",{value:a.description_en||"",onChange:t=>n(l=>l.map(s=>s.id===a.id?{...s,description_en:t.target.value}:s)),rows:4,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Image"}),e.jsxs("div",{className:"space-y-4",children:[a.images&&a.images.length>0&&e.jsx("div",{className:"grid grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-3",children:a.images.map((t,l)=>e.jsxs("div",{className:"relative",children:[e.jsx("img",{src:t,alt:"News image ".concat(l+1),className:"w-20 h-20 object-cover rounded-lg border",onError:s=>{console.error("Image failed to load:",t),s.target.style.border="2px s
1olid red"}}),e.jsx("button",{onClick:()=>K(l,a),className:"absolute -top-2 -right-2 bg-red-500 text-white rounded-full p-1 hover:bg-red-600",children:e.jsx(L,{className:"w-3 h-3"})}),l===0&&e.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-surface-elevated text-white text-xs text-center py-0.5 rounded-b-lg",children:"Primary"})]},l))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"file",accept:"image/*",onChange:t=>{var s;const l=(s=t.target.files)==null?void 0:s[0];l&&$(l,a)},className:"hidden",id:"image-upload-".concat(a.id)}),e.jsx("label",{htmlFor:"image-upload-".concat(a.id),className:"flex items-center justify-center w-20 h-20 border-2 border-dashed border-gray-300 dark:border-gray-600 rounded-lg cursor-pointer hover:border-bronze-500 transition-colors",children:w?e.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-bronze-600"}):e.jsx(C,{className:"w-6 h-6 text-gray-400"})}),e.jsx("input",{type:"file",accept:"image/*",multiple:!0,onChange:t=>{const l=t.target.files;if(l)for(let s=0;s<l.length;s++)$(l[s],a)},className:"hidden",id:"multiple-image-upload-".concat(a.id)}),e.jsxs("label",{htmlFor:"multiple-image-upload-".concat(a.id),className:"flex items-center gap-2 px-3 py-2 bg-surface-elevated text-white rounded-lg cursor-pointer hover:bg-surface-elevated transition-colors",children:[e.jsx(U,{className:"w-4 h-4"}),e.jsx("span",{className:"text-sm",children:"Multiple"})]})]}),e.jsx("p",{className:"text-xs text-gray-500",children:"First image will be used as the primary image. You can upload multiple images at once."})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-5 gap-4 mb-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Date"}),e.jsx("input",{type:"date",value:a.date,onChange:t=>n(l=>l.map(s=>s.id===a.id?{...s,date:t.target.value}:s)),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Impact"}),e.jsxs("select",{value:a.impact,onChange:t=>n(l=>l.map(s=>s.id===a.id?{...s,impact:t.target.value}:s)),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[e.jsx("option",{children:"Low"}),e.jsx("option",{children:"Medium"}),e.jsx("option",{children:"High"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Probability (%)"}),e.jsx("input",{type:"number",min:"0",max:"100",value:a.probability,onChange:t=>n(l=>l.map(s=>s.id===a.id?{...s,probability:parseInt(t.target.value)}:s)),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Strength of Impact (%)"}),e.jsx("input",{type:"number",min:"0",max:"100",value:a.strength,onChange:t=>n(l=>l.map(s=>s.id===a.id?{...s,strength:parseInt(t.target.value)}:s)),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Direction"}),e.jsxs("select",{value:a.direction,onChange:t=>n(l=>l.map(s=>s.id===a.id?{...s,direction:t.target.value}:s)),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white",children:[e.jsx("option",{children:"Bullish"}),e.jsx("option",{children:"Bearish"}),e.jsx("option",{children:"Neutral"})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Affected Markets"}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:I[a.id]||"",onChange:t=>D(l=>({...l,[a.id]:t.target.value})),onKeyDown:t=>{t.key==="Enter"&&(t.preventDefault(),F(a.id))},className:"flex-1 px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white",placeholder:"Type and press Enter to add market"}),e.jsx("button",{onClick:()=>F(a.id),className:"px-4 py-2 bg-surface-elevated text-white rounded-lg hover:bg-surface-elevated transition-colors",children:"Add"})]}),e.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:(d=a.affected_markets)==null?void 0:d.map((t,l)=>e.jsxs("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-sm font-medium bg-surface-elevated dark:bg-surface-elevated text-bronze-800 dark:text-bronze-200",children:[t,e.jsx("button",{type:"button",onClick:()=>{n(s=>s.map(m=>{var z;return m.id===a.id?{...m,affected_markets:(z=m.affected_markets)==null?void 0:z.filter((de,ee)=>ee!==l)}:m}))},className:"ml-1 inline-flex items-center justify-center w-4 h-4 text-bronze-400 hover:text-bronze-600 dar
1k:text-bronze-300 dark:hover:text-bronze-100",children:"×"})]},l))})]})]}),e.jsxs("div",{className:"flex justify-end space-x-4 mt-6",children:[e.jsxs("button",{onClick:()=>X(a.id),disabled:x,className:"flex items-center px-4 py-2 text-red-600 hover:text-red-700 transition-colors disabled:opacity-50",children:[e.jsx(le,{className:"h-5 w-5 mr-2"}),"Delete"]}),e.jsxs("button",{onClick:()=>_(a),disabled:x,className:"flex items-center px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 transition-colors disabled:opacity-50",children:[e.jsx(B,{className:"h-5 w-5 mr-2"}),x?"Saving...":"Save"]})]})]})]},a.id)})}),h>1&&e.jsxs("div",{className:"flex items-center justify-center gap-2 mt-6",children:[e.jsx("button",{onClick:()=>v(a=>Math.max(1,a-1)),disabled:u===1,className:"px-3 py-1.5 rounded-lg border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 disabled:opacity-40 disabled:cursor-not-allowed",children:"Zurück"}),e.jsxs("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:["Seite ",u," von ",h]}),e.jsx("button",{onClick:()=>v(a=>Math.min(h,a+1)),disabled:u===h,className:"px-3 py-1.5 rounded-lg border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 disabled:opacity-40 disabled:cursor-not-allowed",children:"Weiter"})]})]})})};export{be 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.