Files
igny8/frontend/dist/assets/js/page-reference-aC0iABvU.js
Gitea Deploy 961362e088 Add SEO fields to Tasks model, improve content generation response handling, and enhance progress bar animation
- 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
2025-11-09 21:22:34 +00:00

2 lines
9.0 KiB
JavaScript

import{r as s,j as e,a as N}from"./vendor-react-core-DjsjKnCi.js";import{P as y}from"./page-analytics.tsx-1KCk8AGD.js";import{f,a as k}from"./page-dashboard-DxYTR5eF.js";import{C as p}from"./page-components.tsx-DYfg5dka.js";import{B as j}from"./page-clusters.config.tsx-9GAd-_h-.js";function S({id:l,variant:c,title:n,message:a,onClose:o}){s.useEffect(()=>{const x=setTimeout(()=>{o(l)},5e3);return()=>clearTimeout(x)},[l,o]);const r={success:{container:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-800 dark:text-white shadow-lg",icon:e.jsx("div",{className:"flex-shrink-0",children:e.jsx("svg",{className:"w-5 h-5 text-success-500",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})})},error:{container:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-800 dark:text-white shadow-lg",icon:e.jsx("div",{className:"flex-shrink-0",children:e.jsx("svg",{className:"w-5 h-5 text-error-500",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})})},warning:{container:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-800 dark:text-white shadow-lg",icon:e.jsx("div",{className:"flex-shrink-0",children:e.jsx("svg",{className:"w-5 h-5 text-warning-500",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})})})},info:{container:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-800 dark:text-white shadow-lg",icon:e.jsx("div",{className:"flex-shrink-0",children:e.jsx("svg",{className:"w-5 h-5 text-blue-light-500",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})})})}}[c];return e.jsxs("div",{className:`flex items-start gap-3 p-4 rounded-lg shadow-sm min-w-[320px] max-w-[420px] animate-slide-in-right ${r.container}`,children:[r.icon,e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h4",{className:"text-sm font-semibold mb-0.5",children:n}),a&&e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:a})]}),e.jsx("button",{onClick:()=>o(l),className:"flex-shrink-0 ml-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors","aria-label":"Close",children:e.jsx("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]})}const v=s.createContext(void 0);let C=0;function P({children:l}){const[c,n]=s.useState([]),a=s.useCallback((d,i,h)=>{const u=`toast-${++C}`,t={id:u,variant:d,title:i,message:h};return n(w=>[...w,t]),u},[]),o=s.useCallback(d=>{n(i=>i.filter(h=>h.id!==d))},[]),m=s.useCallback((d,i)=>a("success",d,i),[a]),r=s.useCallback((d,i)=>a("error",d,i),[a]),x=s.useCallback((d,i)=>a("warning",d,i),[a]),g=s.useCallback((d,i)=>a("info",d,i),[a]);return e.jsxs(v.Provider,{value:{success:m,error:r,warning:x,info:g},children:[l,e.jsx(I,{toasts:c,onClose:o})]})}function b(){const l=s.useContext(v);if(l===void 0)throw new Error("useToast must be used within a ToastProvider");return l}function I({toasts:l,onClose:c}){return l.length===0?null:N.createPortal(e.jsx("div",{className:"fixed top-6 right-4 z-[999999] flex flex-col gap-3 pointer-events-none",children:l.map((n,a)=>e.jsx("div",{className:"pointer-events-auto",style:{animationDelay:`${a*50}ms`},children:e.jsx(S,{...n,onClose:c})},n.id))}),document.body)}function T(){const l=b(),[c,n]=s.useState([]),[a,o]=s.useState([]),[m,r]=s.useState(!0),[x,g]=s.useState(null),[d,i]=s.useState("");s.useEffect(()=>{h(),u()},[x,d]);const h=async()=>{try{const t=await f();o(t.industries||[])}catch(t){l.error(`Failed to load industries: ${t.message}`)}},u=async()=>{try{r(!0);const t=await k({industry:x||void 0,search:d||void 0});n(t.results||[])}catch(t){l.error(`Failed to load seed keywords: ${t.message}`)}finally{r(!1)}};return e.jsxs("div",{className:"p-6",children:[e.jsx(y,{title:"Seed Keywords"}),e.jsxs("div",{className:"mb-6",children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:"Seed Keywords"}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:"Global keyword library for reference"})]}),e.jsxs("div",{className:"mb-6 flex gap-4",children:[e.jsxs("select",{className:"px-4 py-2 border border-gray-300 dark:border-gray-700 rounded-lg bg-white dark:bg-gray-800",value:x||"",onChange:t=>g(t.target.value?parseInt(t.target.value):null),children:[e.jsx("option",{value:"",children:"All Industries"}),a.map(t=>e.jsx("option",{value:t.id,children:t.name},t.id))]}),e.jsx("input",{type:"text",placeholder:"Search keywords...",className:"flex-1 px-4 py-2 border border-gray-300 dark:border-gray-700 rounded-lg bg-white dark:bg-gray-800",value:d,onChange:t=>i(t.target.value)})]}),m?e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("div",{className:"text-gray-500",children:"Loading..."})}):e.jsx(p,{className:"p-6",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-gray-200 dark:border-gray-700",children:[e.jsx("th",{className:"text-left py-3 px-4 text-sm font-medium text-gray-700 dark:text-gray-300",children:"Keyword"}),e.jsx("th",{className:"text-left py-3 px-4 text-sm font-medium text-gray-700 dark:text-gray-300",children:"Industry"}),e.jsx("th",{className:"text-left py-3 px-4 text-sm font-medium text-gray-700 dark:text-gray-300",children:"Sector"}),e.jsx("th",{className:"text-left py-3 px-4 text-sm font-medium text-gray-700 dark:text-gray-300",children:"Volume"}),e.jsx("th",{className:"text-left py-3 px-4 text-sm font-medium text-gray-700 dark:text-gray-300",children:"Difficulty"}),e.jsx("th",{className:"text-left py-3 px-4 text-sm font-medium text-gray-700 dark:text-gray-300",children:"Intent"})]})}),e.jsx("tbody",{children:c.map(t=>e.jsxs("tr",{className:"border-b border-gray-100 dark:border-gray-800",children:[e.jsx("td",{className:"py-3 px-4 text-sm font-medium text-gray-900 dark:text-white",children:t.keyword}),e.jsx("td",{className:"py-3 px-4 text-sm text-gray-600 dark:text-gray-400",children:t.industry_name}),e.jsx("td",{className:"py-3 px-4 text-sm text-gray-600 dark:text-gray-400",children:t.sector_name}),e.jsx("td",{className:"py-3 px-4 text-sm text-gray-900 dark:text-white",children:t.volume.toLocaleString()}),e.jsx("td",{className:"py-3 px-4 text-sm text-gray-900 dark:text-white",children:t.difficulty}),e.jsx("td",{className:"py-3 px-4",children:e.jsx(j,{variant:"light",color:"primary",children:t.intent_display})})]},t.id))})]})})})]})}const $=Object.freeze(Object.defineProperty({__proto__:null,default:T},Symbol.toStringTag,{value:"Module"}));function z(){const l=b(),[c,n]=s.useState([]),[a,o]=s.useState(!0);s.useEffect(()=>{m()},[]);const m=async()=>{try{o(!0);const r=await f();n(r.industries||[])}catch(r){l.error(`Failed to load industries: ${r.message}`)}finally{o(!1)}};return e.jsxs("div",{className:"p-6",children:[e.jsx(y,{title:"Industries"}),e.jsxs("div",{className:"mb-6",children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:"Industries"}),e.jsx("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:"Global industry reference data"})]}),a?e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("div",{className:"text-gray-500",children:"Loading..."})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:c.map(r=>e.jsxs(p,{className:"p-6",children:[e.jsxs("div",{className:"flex justify-between items-start mb-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:r.name}),e.jsx(j,{variant:"light",color:r.is_active?"success":"dark",children:r.is_active?"Active":"Inactive"})]}),r.description&&e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-2",children:r.description}),e.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Sectors: ",r.sectors_count||0]})]},r.id))})]})}const B=Object.freeze(Object.defineProperty({__proto__:null,default:z},Symbol.toStringTag,{value:"Module"}));export{B as I,$ as S,P as T,b as u};