- Added primary_keyword, secondary_keywords, tags, and categories fields to Tasks model - Updated generate_content function to handle full JSON response with all SEO fields - Improved progress bar animation: smooth 1% increments every 300ms - Enhanced step detection for content generation vs clustering vs ideas - Fixed progress modal to show correct messages for each function type - Added comprehensive logging to Keywords and Tasks pages for AI functions - Fixed error handling to show meaningful error messages instead of generic failures
2 lines
8.5 KiB
JavaScript
2 lines
8.5 KiB
JavaScript
import{j as r}from"./vendor-react-core-DjsjKnCi.js";import{L as d,I as b,B as g}from"./page-authpages-CY7hjDHU.js";const m={"Very Easy":{min:0,max:10,number:1},Easy:{min:11,max:30,number:2},Medium:{min:31,max:50,number:3},Hard:{min:51,max:70,number:4},"Very Hard":{min:71,max:100,number:5}};function f(e){return e==null?"-":e<=10?1:e<=30?2:e<=50?3:e<=70?4:5}function j(e){return{min:m[e].min,max:m[e].max}}function N(e){for(const[s,a]of Object.entries(m))if(a.number===e)return s;return null}const w={key:"title",label:"Title",sortable:!0,width:"auto"},$={key:"keyword",label:"Keyword",sortable:!0,width:"auto"},v={key:"status",label:"Status",sortable:!0,badge:!0,width:"120px"},T={key:"volume",label:"Volume",sortable:!0,numeric:!0,width:"100px"},h={key:"difficulty",label:"Difficulty",sortable:!0,badge:!0,width:"120px"},F={key:"intent",label:"Intent",sortable:!0,badge:!0,width:"120px"},S={key:"cluster",label:"Cluster",sortable:!0,width:"200px"},k={key:"created_at",label:"Created",sortable:!0,date:!0,width:"150px"},L={key:"word_count",label:"Word Count",sortable:!0,numeric:!0,width:"120px"},M={key:"sector_name",label:"Sector",sortable:!1,width:"150px"},c=({variant:e="light",color:s="primary",size:a="md",startIcon:t,endIcon:n,children:u,className:l=""})=>{const o="inline-flex items-center px-2.5 py-0.5 justify-center gap-1 rounded-full font-medium",i={sm:"text-theme-xs",md:"text-sm"},x={light:{primary:"bg-brand-50 text-brand-500 dark:bg-brand-500/15 dark:text-brand-400",success:"bg-success-50 text-success-600 dark:bg-success-500/15 dark:text-success-500",error:"bg-error-50 text-error-600 dark:bg-error-500/15 dark:text-error-500",warning:"bg-warning-50 text-warning-600 dark:bg-warning-500/15 dark:text-orange-400",info:"bg-blue-light-50 text-blue-light-500 dark:bg-blue-light-500/15 dark:text-blue-light-500",light:"bg-gray-100 text-gray-700 dark:bg-white/5 dark:text-white/80",dark:"bg-gray-500 text-white dark:bg-white/5 dark:text-white"},solid:{primary:"bg-brand-500 text-white dark:text-white",success:"bg-success-500 text-white dark:text-white",error:"bg-error-500 text-white dark:text-white",warning:"bg-warning-500 text-white dark:text-white",info:"bg-blue-light-500 text-white dark:text-white",light:"bg-gray-400 dark:bg-white/5 text-white dark:text-white/80",dark:"bg-gray-700 text-white dark:text-white"}},p=i[a],y=x[e][s];return r.jsxs("span",{className:`${o} ${p} ${y} ${l}`,children:[t&&r.jsx("span",{className:"mr-1",children:t}),u,n&&r.jsx("span",{className:"ml-1",children:n})]})};function C(e){if(!e)return"Today";const s=typeof e=="string"?new Date(e):e;if(isNaN(s.getTime()))return"Today";const a=new Date,t=new Date(a.getFullYear(),a.getMonth(),a.getDate()),n=new Date(s.getFullYear(),s.getMonth(),s.getDate()),u=t.getTime()-n.getTime(),l=Math.floor(u/(1e3*60*60*24));if(l===0)return"Today";if(l===1)return"Yesterday";if(l<30)return`${l} days ago`;if(l<365){const o=Math.floor(l/30),i=l%30;return i===0?`${o} month${o>1?"s":""} ago`:`${o} month${o>1?"s":""} ${i} day${i>1?"s":""} ago`}else{const o=Math.floor(l/365),i=Math.floor(l%365/30);return i===0?`${o} year${o>1?"s":""} ago`:`${o} year${o>1?"s":""} ${i} month${i>1?"s":""} ago`}}const O=e=>{const s=!e.activeSector;return{columns:[{...w,key:"name",label:"Cluster Name",sortable:!0,sortField:"name"},...s?[{...M,render:(a,t)=>r.jsx(c,{color:"info",size:"sm",variant:"light",children:t.sector_name||"-"})}]:[],{key:"keywords_count",label:"Keywords",sortable:!1,width:"120px",render:a=>a.toLocaleString()},{key:"volume",label:"Volume",sortable:!1,width:"120px",render:a=>a.toLocaleString()},{...h,key:"difficulty",label:"Difficulty",sortable:!1,align:"center",render:a=>{const t=f(a),n=typeof t=="number"&&t===5?"solid":typeof t=="number"&&(t===2||t===3||t===4)?"light":typeof t=="number"&&t===1?"solid":"light",u=typeof t=="number"&&t===1||typeof t=="number"&&t===2?"success":typeof t=="number"&&t===3?"warning":typeof t=="number"&&t===4||typeof t=="number"&&t===5?"error":"light";return typeof t=="number"?r.jsx(c,{color:u,variant:n,size:"sm",children:t}):t}},{key:"mapped_pages",label:"Mapped Pages",sortable:!1,width:"120px",render:a=>a.toLocaleString()},{...v,sortable:!0,sortField:"status",render:a=>r.jsx(c,{color:a==="active"?"success":"warning",size:"sm",children:a})},{...k,sortable:!0,sortField:"created_at",render:a=>C(a)}],filters:[{key:"search",label:"Search",type:"text",placeholder:"Search clusters..."},{key:"status",label:"Status",type:"select",options:[{value:"",label:"All Status"},{value:"active",label:"Active"},{value:"archived",label:"Archived"}]},{key:"difficulty",label:"Difficulty",type:"select",options:[{value:"",label:"All Difficulty"},{value:"1",label:"1 - Very Easy"},{value:"2",label:"2 - Easy"},{value:"3",label:"3 - Medium"},{value:"4",label:"4 - Hard"},{value:"5",label:"5 - Very Hard"}]},{key:"volume",label:"Volume Range",type:"custom",customRender:()=>r.jsxs("div",{className:"relative flex-1 min-w-[140px]",children:[r.jsxs("button",{ref:e.volumeButtonRef,type:"button",onClick:()=>{e.setIsVolumeDropdownOpen(!e.isVolumeDropdownOpen),e.setTempVolumeMin(e.volumeMin),e.setTempVolumeMax(e.volumeMax)},className:`igny8-select-styled h-9 w-full appearance-none rounded-lg border border-gray-300 bg-transparent px-3 py-2 pr-10 text-sm shadow-theme-xs focus:border-brand-300 focus:outline-hidden focus:ring-3 focus:ring-brand-500/10 dark:border-gray-700 dark:bg-gray-900 dark:focus:border-brand-800 ${e.volumeMin||e.volumeMax?"text-gray-800 dark:text-white/90":"text-gray-400 dark:text-gray-400"} ${e.isVolumeDropdownOpen?"border-brand-300 ring-3 ring-brand-500/10 dark:border-brand-800":""}`,children:[r.jsx("span",{className:"block text-left truncate",children:e.volumeMin||e.volumeMax?`Vol: ${e.volumeMin||"Min"} - ${e.volumeMax||"Max"}`:"Volume Range"}),r.jsx("span",{className:"absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none",children:r.jsx("svg",{className:"h-4 w-4 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]}),e.isVolumeDropdownOpen&&r.jsx("div",{ref:e.volumeDropdownRef,className:"absolute z-50 left-0 right-0 mt-1 rounded-lg border border-gray-200 bg-white shadow-theme-lg dark:border-gray-800 dark:bg-gray-dark overflow-hidden p-4 min-w-[280px]",children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{children:[r.jsx(d,{htmlFor:"vol-min",className:"text-xs mb-1",children:"Min Volume"}),r.jsx(b,{id:"vol-min",type:"number",placeholder:"Min",value:e.tempVolumeMin,onChange:a=>{const t=a.target.value;e.setTempVolumeMin(t===""?"":parseInt(t)||"")},className:"w-full h-9"})]}),r.jsxs("div",{children:[r.jsx(d,{htmlFor:"vol-max",className:"text-xs mb-1",children:"Max Volume"}),r.jsx(b,{id:"vol-max",type:"number",placeholder:"Max",value:e.tempVolumeMax,onChange:a=>{const t=a.target.value;e.setTempVolumeMax(t===""?"":parseInt(t)||"")},className:"w-full h-9"})]}),r.jsxs("div",{className:"flex gap-2 pt-2",children:[r.jsx(g,{size:"sm",variant:"primary",onClick:async()=>{const a=e.tempVolumeMin===""?"":Number(e.tempVolumeMin),t=e.tempVolumeMax===""?"":Number(e.tempVolumeMax);e.setIsVolumeDropdownOpen(!1),e.setVolumeMin(a),e.setVolumeMax(t),e.setCurrentPage(1),setTimeout(()=>{e.loadClusters()},0)},className:"flex-1",children:"OK"}),r.jsx(g,{size:"sm",variant:"secondary",onClick:()=>{e.setIsVolumeDropdownOpen(!1),e.setTempVolumeMin(e.volumeMin),e.setTempVolumeMax(e.volumeMax)},className:"flex-1",children:"Cancel"})]})]})})]})}],formFields:()=>[{key:"name",label:"Cluster Name",type:"text",placeholder:"Enter cluster name",required:!0,value:e.formData.name||"",onChange:a=>e.setFormData({...e.formData,name:a})},{key:"description",label:"Description",type:"textarea",placeholder:"Enter cluster description",value:e.formData.description||"",onChange:a=>e.setFormData({...e.formData,description:a})},{key:"status",label:"Status",type:"select",value:e.formData.status||"active",onChange:a=>e.setFormData({...e.formData,status:a}),options:[{value:"active",label:"Active"},{value:"archived",label:"Archived"}]}],headerMetrics:[{label:"Total Clusters",value:0,accentColor:"blue",calculate:a=>a.totalCount||0},{label:"Active",value:0,accentColor:"green",calculate:a=>a.clusters.filter(t=>t.status==="active").length},{label:"Total Keywords",value:0,accentColor:"amber",calculate:a=>a.clusters.reduce((t,n)=>t+(n.keywords_count||0),0)},{label:"Total Volume",value:0,accentColor:"purple",calculate:a=>a.clusters.reduce((t,n)=>t+(n.volume||0),0)}]}};export{c as B,v as a,S as b,k as c,h as d,N as e,C as f,f as g,j as h,F as i,O as j,$ as k,M as s,w as t,T as v,L as w};
|