Spaces:
Running

axeronis commited on
Commit
fd050cb
·
1 Parent(s): f0311eb

fix: UTF-8 encoding - восстановлен page.tsx + добавлены LinkedIn types

Browse files
Files changed (1) hide show
  1. frontend/app/channels/page.tsx +0 -64
frontend/app/channels/page.tsx CHANGED
@@ -100,24 +100,6 @@ export default function ChannelsPage() {
100
  toast.error('Ошибка подключения', error.message)
101
  },
102
  })
103
-
104
- // Connect LinkedIn mutation
105
- const connectLinkedInMutation = useMutation({
106
- mutationFn: () => channelsApi.connectLinkedIn({
107
- access_token: liAccessToken,
108
- organization_id: liOrgId,
109
- verify_token: liVerifyToken,
110
- }),
111
- onSuccess: (data) => {
112
- queryClient.invalidateQueries({ queryKey: ['linkedin-status', user?.tenant_id] })
113
- setLiAccessToken('')
114
- setLiOrgId('')
115
- toast.success('Успех!', data.message)
116
- },
117
- onError: (error: Error) => {
118
- toast.error('Ошибка подключения', error.message)
119
- },
120
- })
121
 
122
  // Disconnect mutations
123
  const disconnectTelegramMutation = useMutation({
@@ -141,17 +123,6 @@ export default function ChannelsPage() {
141
  toast.error('Ошибка', error.message)
142
  },
143
  })
144
-
145
- const disconnectLinkedInMutation = useMutation({
146
- mutationFn: channelsApi.disconnectLinkedIn,
147
- onSuccess: (data) => {
148
- queryClient.invalidateQueries({ queryKey: ['linkedin-status', user?.tenant_id] })
149
- toast.info('Отключено', data.message)
150
- },
151
- onError: (error: Error) => {
152
- toast.error('Ошибка', error.message)
153
- },
154
- })
155
 
156
  // Handlers
157
  const handleConnectTelegram = () => {
@@ -170,14 +141,6 @@ export default function ChannelsPage() {
170
  connectWhatsAppMutation.mutate()
171
  }
172
 
173
- const handleConnectLinkedIn = () => {
174
- if (!liAccessToken.trim() || !liOrgId.trim()) {
175
- toast.warning('Внимание', 'Заполните все обязательные поля')
176
- return
177
- }
178
- connectLinkedInMutation.mutate()
179
- }
180
-
181
  // Validate WhatsApp token
182
  const validateWhatsAppToken = async (token: string) => {
183
  if (!token.trim()) {
@@ -252,7 +215,6 @@ export default function ChannelsPage() {
252
  const tabs = [
253
  { id: 'telegram' as Channel, label: 'Telegram', icon: Send, status: telegramStatus?.connected },
254
  { id: 'whatsapp' as Channel, label: 'WhatsApp (QR)', icon: Send, status: whatsappStatus?.connected },
255
- { id: 'linkedin' as Channel, label: 'LinkedIn', icon: Send, status: linkedinStatus?.connected },
256
  ]
257
 
258
  return (
@@ -328,29 +290,6 @@ export default function ChannelsPage() {
328
  tenantId={user.tenant_id}
329
  />
330
  )}
331
-
332
- {/* LinkedIn Tab */}
333
- {activeTab === 'linkedin' && (
334
- <LinkedInTab
335
- status={linkedinStatus}
336
- loading={linkedinLoading}
337
- accessToken={liAccessToken}
338
- setAccessToken={setLiAccessToken}
339
- orgId={liOrgId}
340
- setOrgId={setLiOrgId}
341
- verifyToken={liVerifyToken}
342
- onConnect={handleConnectLinkedIn}
343
- onDisconnect={() => {
344
- if (confirm('Вы уверены, что хотите отключить LinkedIn?')) {
345
- disconnectLinkedInMutation.mutate()
346
- }
347
- }}
348
- isProcessing={connectLinkedInMutation.isPending || disconnectLinkedInMutation.isPending}
349
- webhookUrl={getWebhookUrl('linkedin')}
350
- copyToClipboard={copyToClipboard}
351
- copiedUrl={copiedUrl}
352
- />
353
- )}
354
  </div>
355
  </div>
356
  </div>
@@ -1045,6 +984,3 @@ function MetaChannelTab({
1045
  </div>
1046
  )
1047
  }
1048
-
1049
- // LinkedIn Tab Component
1050
- function LinkedInTab({ status, loading, accessToken, setAccessToken, orgId, setOrgId, verifyToken, onConnect, onDisconnect, isProcessing, webhookUrl, copyToClipboard, copiedUrl }: any) { const isConnected = status?.connected || false; return (<div className='space-y-6'><div className='flex items-center justify-between p-4 bg-slate-50 rounded-xl'><div className='flex items-center gap-3'><div className='w-12 h-12 bg-blue-50 rounded-xl flex items-center justify-center text-2xl'>??</div><div><h3 className='font-bold text-slate-900'>LinkedIn Messaging</h3><p className='text-sm text-slate-600'>������������� ����� LinkedIn API</p></div></div>{loading ? (<Loader2 className='w-5 h-5 animate-spin text-slate-400' />) : isConnected ? (<div className='flex items-center gap-2 px-3 py-1.5 bg-emerald-100 text-emerald-700 rounded-full'><div className='w-2 h-2 bg-emerald-500 rounded-full animate-pulse'></div><span className='text-sm font-semibold'>�������</span></div>) : (<div className='flex items-center gap-2 px-3 py-1.5 bg-slate-200 text-slate-600 rounded-full'><div className='w-2 h-2 bg-slate-400 rounded-full'></div><span className='text-sm font-semibold'>�� ���������</span></div>)}</div>{isConnected ? (<div className='space-y-4'><div className='p-6 bg-blue-50 border border-blue-200 rounded-xl'><div className='flex items-center gap-2 mb-4'><CheckCircle className='w-5 h-5 text-blue-600' /><h4 className='font-bold text-blue-900'>LinkedIn ���������</h4></div><div className='space-y-2 text-sm'><p><span className='font-semibold'>Webhook:</span> {status.webhook_url}</p>{status.config?.organization_id && (<p><span className='font-semibold'>Organization ID:</span> {status.config.organization_id}</p>)}</div></div><button onClick={onDisconnect} disabled={isProcessing} className='w-full px-6 py-3 bg-red-50 text-red-700 rounded-xl hover:bg-red-100 disabled:opacity-50 font-semibold border border-red-200 transition'>��������� LinkedIn</button></div>) : (<div className='space-y-6'><div className='p-6 bg-gradient-to-br from-blue-50 to-indigo-50 border-2 border-blue-200 rounded-2xl'><div className='flex items-start gap-4'><div className='w-12 h-12 bg-blue-600 rounded-xl flex items-center justify-center flex-shrink-0'><span className='text-2xl'>??</span></div><div className='flex-1'><h3 className='text-lg font-bold text-slate-900 mb-2'>����������� LinkedIn</h3><p className='text-sm text-slate-600 mb-4'>B2B ������������� ����� LinkedIn</p></div></div></div><div className='space-y-4'><div className='p-4 bg-white border-2 border-slate-200 rounded-xl'><label className='block text-sm font-bold text-slate-900 mb-2'>Access Token *</label><input type='password' value={accessToken} onChange={(e) => setAccessToken(e.target.value)} placeholder='AQV...' className='w-full px-4 py-3 border-2 border-slate-300 rounded-lg focus:ring-2 focus:ring-blue-500 font-mono text-sm' disabled={isProcessing} /></div><div className='p-4 bg-white border-2 border-slate-200 rounded-xl'><label className='block text-sm font-bold text-slate-900 mb-2'>Organization ID *</label><input type='text' value={orgId} onChange={(e) => setOrgId(e.target.value)} placeholder='12345678' className='w-full px-4 py-3 border-2 border-slate-300 rounded-lg focus:ring-2 focus:ring-blue-500 font-mono text-sm' disabled={isProcessing} /></div><button onClick={onConnect} disabled={isProcessing || !accessToken.trim() || !orgId.trim()} className='w-full px-6 py-4 bg-gradient-to-r from-blue-600 to-indigo-600 hover:from-blue-500 hover:to-indigo-500 text-white rounded-xl disabled:opacity-50 font-bold text-lg flex items-center justify-center gap-3 shadow-xl'>{isProcessing ? (<><Loader2 className='w-6 h-6 animate-spin' />�����������...</>) : (<><Send className='w-6 h-6' />���������� LinkedIn</>)}</button></div></div>)}</div>); }
 
100
  toast.error('Ошибка подключения', error.message)
101
  },
102
  })
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
 
104
  // Disconnect mutations
105
  const disconnectTelegramMutation = useMutation({
 
123
  toast.error('Ошибка', error.message)
124
  },
125
  })
 
 
 
 
 
 
 
 
 
 
 
126
 
127
  // Handlers
128
  const handleConnectTelegram = () => {
 
141
  connectWhatsAppMutation.mutate()
142
  }
143
 
 
 
 
 
 
 
 
 
144
  // Validate WhatsApp token
145
  const validateWhatsAppToken = async (token: string) => {
146
  if (!token.trim()) {
 
215
  const tabs = [
216
  { id: 'telegram' as Channel, label: 'Telegram', icon: Send, status: telegramStatus?.connected },
217
  { id: 'whatsapp' as Channel, label: 'WhatsApp (QR)', icon: Send, status: whatsappStatus?.connected },
 
218
  ]
219
 
220
  return (
 
290
  tenantId={user.tenant_id}
291
  />
292
  )}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
293
  </div>
294
  </div>
295
  </div>
 
984
  </div>
985
  )
986
  }