11import React , { useState , useEffect } from 'react' ;
2+ import { usePage } from "@inertiajs/react" ;
23import { Dropdown , DropdownDivider , DropdownItem } from "flowbite-react" ;
34import { Button , Modal , ModalBody , ModalFooter , ModalHeader } from "flowbite-react" ;
45import AgentModalWrapper from '@/components/agentsModalWrapper' ;
56import AgentModalContent from '@/components/agentsModalContent' ;
67import ContentTableAgents from '@/components/contentTableAgents' ;
8+ import { useLoadStatus } from './context/loadContext' ;
9+ import { themeByProject } from './utils/theme' ;
10+
711import axios from 'axios' ;
812
913const AgentPanel = ( ) => {
14+ const { props } = usePage ( ) ;
15+ const proyecto = props ?. auth ?. user ?. proyecto || 'AZZU' ;
16+ const theme = themeByProject [ proyecto ] ;
1017 const [ modalOpen , setModalOpen ] = useState ( false ) ;
1118 const [ activeExtension , setActiveExtension ] = useState ( null ) ;
1219 const [ search , setSearch ] = useState ( '' ) ;
@@ -94,7 +101,7 @@ const AgentPanel = () => {
94101 base : 'relative inline-block text-left' ,
95102 } ,
96103 floating : {
97- target : 'bg-blue-400 hover:bg-blue-500 /80 dark:bg-gray-800 dark:hover:bg-gray-700 dark:text-gray-400 dark:border-gray-600 font-medium rounded-lg text-sm px-5 py-2.5 text-center inline-flex items-center z-50' ,
104+ target : ` ${ theme . bgHard } ${ theme . bgHover } /80 focus:ring-none dark:bg-gray-800 dark:hover:bg-gray-700 dark:text-gray-400 dark:border-gray-600 font-medium rounded-lg text-sm px-5 py-2.5 text-center inline-flex items-center z-50` ,
98105 item : {
99106 base : 'block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-600 dark:text-gray-200 dark:hover:text-white w-full text-left z-50' ,
100107 } ,
@@ -114,21 +121,21 @@ const AgentPanel = () => {
114121 return (
115122 < div className = "rounded-lg mt-4 relative shadow-md sm:rounded-lg px-4 mb-16" >
116123
117- < div className = "flex flex-wrap items-center px-4 py-2 text-sm dark:bg-gray-800 break-words max-w-full" >
118- < a href = "/table/agents" className = " text-purple-light-20" > Tablas</ a >
124+ < div className = "flex flex-wrap items-center px-4 py-2 text-sm dark:bg-gray-900 break-words max-w-full" >
125+ < a href = "/table/agents" className = { ` ${ theme . text } ` } > Tablas</ a >
119126 < span className = "mx-2 text-gray-500" > /</ span >
120127 < span > Agentes</ span >
121128 < span className = "mx-2 text-gray-500" > { operation ? `/` : '' } </ span >
122129 < span > { operation ? ` ${ operation } ` : '' } </ span >
123130 </ div >
124131
125- < div className = " overflow-hidden shadow-sm pb-60" >
126- < div className = "flex flex-col lg:flex-row flex-wrap items-start lg:items-center justify-between gap-4 px-4 pb-4 pt-2 bg-white dark:bg-gray-900 " >
132+ < div className = "overflow-hidden shadow-sm pb-60" >
133+ < div className = "flex flex-col lg:flex-row flex-wrap items-start lg:items-center justify-between gap-4 px-4 pb-4 pt-2 " >
127134 < div className = "w-full lg:w-auto mb-2 relative [&_.dropdown-menu]:w-auto [&_.dropdown-menu]:max-w-xs [&_.dropdown-menu]:mx-auto [&_.dropdown-menu]:z-50" >
128135 < Dropdown
129136 label = "Selecciona la operación"
130137 theme = { customTheme }
131- className = " w-full"
138+ className = { ` w-full dark:bg-gray-900 ` }
132139 >
133140 { userOps . map ( ( op ) => (
134141 < DropdownItem
@@ -137,7 +144,7 @@ const AgentPanel = () => {
137144 startPolling ( op ) ;
138145 setOperation ( op ) ;
139146 } }
140- className = 'z-99'
147+ className = 'z-99 '
141148 >
142149 { op }
143150 </ DropdownItem >
@@ -149,7 +156,7 @@ const AgentPanel = () => {
149156 { Object . entries ( stats ) . map ( ( [ key , value ] ) => (
150157 < div
151158 key = { key }
152- className = "text-center bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700
159+ className = "text-center border border-gray-200 dark:border-gray-700
153160 rounded-xl px-4 py-2 shadow"
154161 >
155162 < p className = "text-xs text-gray-500 dark:text-gray-400" > { key } </ p >
@@ -169,7 +176,7 @@ const AgentPanel = () => {
169176 type = "text"
170177 value = { search }
171178 onChange = { ( e ) => setSearch ( e . target . value ) }
172- className = "w-full sm:w-64 block p-2 pl-10 text-sm text-gray-900 border border-gray-300 rounded-lg bg-gray-50 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white"
179+ className = "w-full sm:w-64 block p-2 pl-10 text-sm text-gray-900 border border-gray-200 rounded-xl bg-gray-50 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-900 dark:border-gray-700 dark:placeholder-gray-400 dark:text-white shadow "
173180 placeholder = "Buscar agente..."
174181 />
175182 </ div >
0 commit comments