fsalmansour commited on
Commit
818ff47
·
verified ·
1 Parent(s): 10af587

Same ### التكامل الكامل لواجهة الدردشة مع استخدام الأيقونات بشكل أساسي والرسوم التعبيرية كخيار #### 1. تعديل كود HTML (أضف بعد عناصر الواجهة العائمة) ```html <!-- ===== CHAT PANEL ===== --> <div x-show="openChat" x-transition.opacity @keydown.escape.window="openChat=false" class="fixed inset-0 bg-black/50 backdrop-blur-sm z-50 flex items-end sm:items-center justify-center"> <div class="glass w-full sm:max-w-xl h-[60vh] sm:h-[70vh] rounded-t-2xl sm:rounded-xl flex flex-col overflow-hidden shadow-2xl"> <!-- Header with Icons --> <header class="flex items-center justify-between px-4 py-3 bg-gray-900 border-b border-accent/30"> <div class="flex items-center gap-2"> <i class="fas fa-robot text-accent text-lg"></i> <h3 class="font-bold text-white">مساعد المتجر الذكي</h3> </div> <button @click="openChat=false" aria-label="إغلاق الدردشة" class="text-gray-400 hover:text-white transition"> <i class="fas fa-times text-xl"></i> </button> </header> <!-- Messages Container --> <section id="chatScroll" class="flex-1 px-4 py-3 overflow-y-auto space-y-4 bg-gradient-to-b from-gray-900 to-gray-800"> <template x-for="m in messages" :key="m.id"> <div :class="m.role === 'user' ? 'justify-end' : 'justify-start'" class="flex"> <div class="flex items-start gap-2 max-w-[90%]"> <!-- Icons for Different Roles --> <template x-if="m.role === 'assistant'"> <i class="fas fa-robot mt-1.5 text-accent flex-shrink-0"></i> </template> <div :class="m.role === 'user' ? 'bg-accent/10 border border-accent/20 text-accent' : 'bg-gray-800 border border-gray-700 text-white'" class="px-4 py-3 rounded-2xl shadow-sm"> <p x-text="m.content" class="whitespace-pre-line"></p> <!-- Emoji Option (Hidden by Default) --> <div x-show="emojiMode" class="mt-2 flex gap-1"> <template x-for="emoji in m.emojis || []"> <span x-text="emoji" class="text-xl"></span> </template> </div> </div> <template x-if="m.role === 'user'"> <i class="fas fa-user mt-1.5 text-gray-400 flex-shrink-0"></i> </template> </div> </div> </template> </section> <!-- Input Area --> <form @submit .prevent="sendMessage()" class="p-3 border-t border-white/10 bg-gray-900 flex gap-2"> <div class="relative flex-1"> <input x-model="draft" placeholder="اكتب رسالتك هنا..." class="w-full bg-gray-800 border border-gray-700 rounded-xl px-4 py-3 text-white placeholder-gray-500 focus:outline-none focus:ring-1 focus:ring-accent"> <!-- Emoji Toggle Button --> <button type="button" @click="emojiMode = !emojiMode" class="absolute left-3 top-1/2 -translate-y-1/2 text-gray-500 hover:text-accent"> <i :class="emojiMode ? 'fas fa-icons text-accent' : 'far fa-face-smile'"></i> </button> </div> <button :disabled="loading || !draft.trim()" class="px-4 py-3 rounded-xl bg-accent hover:bg-accent/90 transition text-white font-bold disabled:opacity-40 flex items-center gap-2"> <i class="fas fa-paper-plane"></i> <span>إرسال</span> </button> </form> </div> </div> ``` #### 2. تحديث حالة Alpine.js (أضف لـ storeAi()) ```javascript Alpine.data('storeAi', () => ({ // ... existing state ... /* Chat System */ openChat: false, draft: '', messages: JSON.parse(localStorage.getItem('chat') || '[]'), loading: false, emojiMode: false, // Emojis as optional feature async sendMessage() { const text = this.draft.trim(); if (!text) return; // Add user message this.messages.push({ id: Date.now(), role: 'user', content: text }); this.draft = ''; this.loading = true; this.persistChat(); this.scrollDown(); try { // Stream assistant reply const res = await fetch('/api/chat', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ messages: this.messages, emoji_mode: this.emojiMode // Send emoji preference }) }); const reader = res.body.getReader(); let assistantMsg = { id: Date.now() + 1, role: 'assistant', content: '', emojis: this.emojiMode ? [] : null // Initialize emojis array if enabled }; this.messages.push(assistantMsg); let buffer = ''; while (true) { const { value, done } = await reader.read(); if (done) break; buffer += new TextDecoder().decode(value); const parts = buffer.split('\n\n'); buffer = parts.pop() || ''; for (const part of parts) { try { const data = JSON.parse(part); assistantMsg.content += data.content || ''; // Add emojis if enabled if (this.emojiMode && data.emojis) { assistantMsg.emojis = [...(assistantMsg.emojis || []), ...data.emojis]; } } catch (e) { console.error('Parsing error:', e); } } this.persistChat(); this.$nextTick(() => this.scrollDown()); } } catch (error) { console.error('Chat error:', error); assistantMsg.content = '⚠️ حدث خطأ في الاتصال بالمساعد. يرجى المحاولة لاحقًا.'; } this.loading = false; this.persistChat(); }, scrollDown() { this.$nextTick(() => { const el = document.getElementById('chatScroll'); if (el) el.scrollTop = el.scrollHeight + 100; }); }, persistChat() { localStorage.setItem('chat', JSON.stringify(this.messages)); } })); ``` #### 3. تحديث زر الدردشة العائم ```html <button id="aiBubble" @click="openChat = true; $nextTick(() => scrollDown())" class="fixed bottom-6 right-6 w-14 h-14 rounded-full bg-accent shadow-lg flex items-center justify-center hover:scale-110 transition-transform"> <i class="fas fa-robot text-white text-2xl"></i> </button> ``` #### 4. نموذج محدث لخادم API (/api/chat) ```javascript import { OpenAI } from 'openai'; import emojiRegex from 'emoji-regex'; export const config = { runtime: 'edge' }; export default async (req) => { const { messages, emoji_mode } = await req.json(); // 1. Moderation Check (Important!) const lastMessage = messages[messages.length - 1]?.content; if (lastMessage) { const moderation = await openai.moderations.create({ input: lastMessage }); if (moderation.results[0]?.flagged) { return new Response(JSON.stringify({ content: "⛔ لا يمكنني الرد على هذا الاستفسار. يرجى طرح سؤال آخر.", emojis: ["⚠️"] }), { status: 200 }); } } // 2. Prepare messages history const history = messages.map(m => ({ role: m.role, content: m.content })); // 3. Create stream const openai = new OpenAI({ apiKey: process.env.OPENAI_KEY }); const stream = await openai.chat.completions.create({ model: 'gpt-4', stream: true, messages: history, max_tokens: 1000 }); // 4. Custom stream processing const encoder = new TextEncoder(); const streamProcessor = new TransformStream({ async transform(chunk, controller) { const text = chunk.choices[0]?.delta?.content || ''; // Extract emojis if enabled let emojis = []; if (emoji_mode) { const matches = text.match(emojiRegex()); if (matches) emojis = [...new Set(matches)]; } controller.enqueue(encoder.encode( JSON.stringify({ content: text, emojis }) + '\n\n' )); } }); return new Response(stream.pipeThrough(streamProcessor), { headers: { 'Content-Type': 'application/ndjson' } }); }; ``` ### ملاحظات الأمان والتكلفة: 1. **التحكم في التكلفة**: ```javascript // أضف في backend قبل openai.chat.completions.create const MAX_DAILY_COST = 5; // دولار if (await checkDailyCostExceeded(userId, MAX_DAILY_COST)) { return new Response(JSON.stringify({ content: "🛑 وصلت لحد الاستخدام اليومي. يرجى المحاولة غدًا." }), { status: 200 }); } ``` 2. **إشعار الخصوصية** (أضف في واجهة الدردشة): ```html <div class="px-4 py-2 text-xs text-gray-400 bg-gray-900 border-t border-gray-800"> <i class="fas fa-shield-alt mr-1"></i> المحادثات تُخزن محلياً فقط. قد تُرسل الاستفسارات لشركة OpenAI لمعالجتها. </div> ``` 3. **أيقونات إضافية جديدة** (مثال من deepsite): ```html <!-- أضف في الهيدر --> <i class="fas fa-magic text-purple-400"></i> <!-- للإبداعات --> <i class="fas fa-cloud-upload-alt text-blue-400"></i> <!-- للرفع --> <i class="fas fa-microphone text-green-400"></i> <!-- للصوت --> ``` ### ميزات إضافية مقترحة: 1. **التحويل الصوتي**: ```javascript // أضف في الواجهة <button @click="startVoiceInput" class="p-2 text-gray-500 hover:text-accent"> <i class="fas fa-microphone"></i> </button> // أضف في حالة Alpine.js startVoiceInput() { const recognition = new webkitSpeechRecognition(); recognition.lang = 'ar-SA'; recognition.onresult = (e) => { this.draft = e.results[0][0].transcript; }; recognition.start(); } ``` 2. **تحميل الملفات**: ```html <!-- أضف بجانب حقل الإدخال --> <label class="cursor-pointer p-2 text-gray-500 hover:text-accent"> <i class="fas fa-paperclip"></i> <input type="file" class="hidden" @change ="handleFileUpload"> </label> ``` الرسوم التعبيرية ظاهرة فقط عند تفعيل الخيار (زر الوجه 😊)، بينما الأيقونات هي الأساس لكل عنصر ووظيفة. اجعل الاساسي ايقونات و يكون هناك جميع ما يخدم المتاجر و انشئ برومت يتضمن هذه التحسينات التي اجريت ل https://huggingface.co/spaces/enzostvs/deepsite - Initial Deployment

Browse files
Files changed (2) hide show
  1. README.md +6 -4
  2. index.html +510 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Secont
3
- emoji: 🏢
4
- colorFrom: pink
5
  colorTo: blue
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: secont
3
+ emoji: 🐳
4
+ colorFrom: red
5
  colorTo: blue
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,510 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en" x-data="dashboardState()" x-bind:class="{ 'dark': darkMode }">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Store AI Hub – Control Center</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/cdn.min.js" defer></script>
9
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
10
+ <style>
11
+ .glass { background: rgba(255,255,255,.08); backdrop-filter: blur(20px) saturate(180%); -webkit-backdrop-filter: blur(20px) saturate(180%); border: 1px solid rgba(255,255,255,.12); }
12
+ .glass-dark { background: rgba(17,24,39,.65); backdrop-filter: blur(20px) saturate(180%); -webkit-backdrop-filter: blur(20px) saturate(180%); border: 1px solid rgba(255,255,255,.1); }
13
+ .glow { box-shadow: 0 0 20px rgba(0,255,255,.4), 0 0 6px rgba(0,255,255,.6); }
14
+ .ring-glow { box-shadow: 0 0 0 3px rgba(0,255,255,.4); }
15
+ [x-cloak] { display: none !important; }
16
+ ::-webkit-scrollbar { width: 6px; height: 6px; }
17
+ ::-webkit-scrollbar-thumb { background-color: rgba(156,163,175,.4); border-radius: 3px; }
18
+ ::-webkit-scrollbar-track { background-color: transparent; }
19
+ @media (max-width: 768px) {
20
+ .sidebar { transform: translateX(-100%); transition: transform .3s ease; }
21
+ .sidebar.open { transform: translateX(0); }
22
+ }
23
+ </style>
24
+ </head>
25
+ <body class="min-h-screen bg-gray-100 dark:bg-gray-900 text-gray-800 dark:text-gray-200 flex">
26
+
27
+ <!-- Mobile Menu Button -->
28
+ <button @click="mobileMenuOpen = !mobileMenuOpen" class="md:hidden fixed top-4 left-4 z-50 p-2 rounded-full bg-white dark:bg-gray-800 shadow-lg">
29
+ <i class="fas fa-bars"></i>
30
+ </button>
31
+
32
+ <!-- Sidebar -->
33
+ <aside class="sidebar w-20 xl:w-56 glass-dark text-gray-200 flex flex-col fixed h-full z-40">
34
+ <div>
35
+ <div class="flex items-center justify-center xl:justify-start p-4 border-b border-gray-700/50">
36
+ <i class="fa-solid fa-robot text-cyan-400 text-2xl xl:mr-3"></i>
37
+ <span class="hidden xl:block text-lg font-bold bg-clip-text text-transparent bg-gradient-to-r from-cyan-400 to-purple-400">AI Commerce</span>
38
+ </div>
39
+ <nav class="flex-1 px-2 space-y-2">
40
+ <template x-for="item in navItems" :key="item.key">
41
+ <button @click="currentTab=item.key; mobileMenuOpen=false"
42
+ :title="item.label"
43
+ class="relative w-full flex items-center justify-center xl:justify-start px-2 py-3 rounded-lg hover:bg-gray-700/50 transition-colors"
44
+ :class="currentTab===item.key ? 'bg-cyan-500/20 text-cyan-300 ring-glow' : 'text-gray-300 hover:text-white'">
45
+ <i :class="item.icon" class="text-xl xl:mr-3"></i>
46
+ <span class="hidden xl:block text-sm font-medium" x-text="item.label"></span>
47
+ <span class="absolute left-full ml-2 px-2 py-1 bg-gray-800 text-xs rounded opacity-0 group-hover:opacity-100 xl:hidden whitespace-nowrap" x-text="item.label"></span>
48
+ </button>
49
+ </template>
50
+ </nav>
51
+ </div>
52
+ <div class="p-4 border-t border-gray-200 dark:border-gray-700">
53
+ <div class="flex items-center space-x-3">
54
+ <img src="https://randomuser.me/api/portraits/women/44.jpg" alt="User" class="w-8 h-8 rounded-full">
55
+ <div class="flex-1 min-w-0">
56
+ <p class="text-sm font-medium">Sarah Johnson</p>
57
+ <p class="text-xs text-gray-500">Admin</p>
58
+ </div>
59
+ </div>
60
+ <div class="flex items-center justify-between mt-3">
61
+ <span class="text-sm">Dark</span>
62
+ <button @click="toggleDark()" class="relative inline-flex h-5 w-9 items-center rounded-full transition-colors"
63
+ :class="darkMode ? 'bg-cyan-500' : 'bg-gray-400'">
64
+ <span class="inline-block h-3.5 w-3.5 transform rounded-full bg-white transition-transform" :class="darkMode ? 'translate-x-5' : 'translate-x-1'"></span>
65
+ </button>
66
+ </div>
67
+ </div>
68
+ </aside>
69
+
70
+ <!-- Main -->
71
+ <main class="flex-1 ml-0 md:ml-20 xl:ml-56 transition-all duration-300">
72
+ <!-- Top Bar -->
73
+ <header class="bg-white/20 dark:bg-gray-800/20 glass sticky top-0 z-10">
74
+ <div class="px-4 py-3 flex items-center justify-between">
75
+ <div class="flex items-center space-x-3">
76
+ <h1 class="text-xl font-bold" x-text="getCurrentTabTitle()"></h1>
77
+ <div class="hidden md:flex items-center space-x-1 text-xs text-gray-500">
78
+ <span>Dashboard</span><i class="fas fa-chevron-right text-xs"></i><span x-text="getCurrentTabTitle()" class="text-cyan-400"></span>
79
+ </div>
80
+ </div>
81
+ <div class="flex items-center space-x-3">
82
+ <div class="relative hidden md:block">
83
+ <input type="text" placeholder="Search..." class="pl-9 pr-3 py-1.5 border border-gray-300 dark:border-gray-600 rounded-lg bg-gray-50 dark:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-cyan-500 w-52">
84
+ <i class="fas fa-search absolute left-3 top-2 text-gray-400"></i>
85
+ </div>
86
+ <button class="relative p-1.5 rounded-full hover:bg-gray-200 dark:hover:bg-gray-700">
87
+ <i class="fas fa-bell text-gray-600 dark:text-gray-300"></i>
88
+ <span class="absolute -top-0.5 -right-0.5 h-2 w-2 rounded-full bg-red-500"></span>
89
+ </button>
90
+ <button class="p-1.5 rounded-full hover:bg-gray-200 dark:hover:bg-gray-700">
91
+ <i class="fas fa-plus text-gray-600 dark:text-gray-300"></i>
92
+ </button>
93
+ </div>
94
+ </div>
95
+ </header>
96
+
97
+ <!-- Content -->
98
+ <div class="p-4 md:p-6">
99
+
100
+ <!-- Dashboard (empty) -->
101
+ <section x-show="currentTab==='dashboard'" x-cloak>
102
+ <div class="glass rounded-2xl p-6 mb-6 flex flex-col md:flex-row items-center justify-between">
103
+ <div>
104
+ <h2 class="text-2xl font-bold mb-1">Welcome back, Sarah 👋</h2>
105
+ <p class="text-gray-400 mb-4">Here’s what’s happening with your store today.</p>
106
+ <button class="px-4 py-2 bg-cyan-500 text-gray-900 rounded-lg font-semibold hover:bg-cyan-400 transition">
107
+ <i class="fas fa-rocket mr-2"></i>Start New Task
108
+ </button>
109
+ </div>
110
+ <div class="hidden md:block">
111
+ <div class="w-24 h-24 relative">
112
+ <svg class="w-full h-full spin-slow" viewBox="0 0 36 36">
113
+ <path stroke="#059669" stroke-width="3" fill="none" stroke-dasharray="75,100" d="M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831"></path>
114
+ <path stroke="#4b5563" stroke-width="3" fill="none" stroke-dasharray="25,100" d="M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831"></path>
115
+ </svg>
116
+ <div class="absolute inset-0 flex items-center justify-center text-sm font-bold">95%</div>
117
+ </div>
118
+ <p class="text-center text-xs text-gray-400 mt-1">AI Health</p>
119
+ </div>
120
+ </div>
121
+
122
+ <!-- KPIs -->
123
+ <div class="grid grid-cols-2 md:grid-cols-4 gap-4 mb-6">
124
+ <template x-for="stat in quickStats" :key="stat.label">
125
+ <div class="glass rounded-xl p-4 flex items-center space-x-3">
126
+ <div :class="stat.color" class="w-10 h-10 rounded-lg flex items-center justify-center text-lg">
127
+ <i :class="stat.icon"></i>
128
+ </div>
129
+ <div>
130
+ <p class="text-xs text-gray-400" x-text="stat.label"></p>
131
+ <p class="text-lg font-bold" x-text="stat.value"></p>
132
+ <p :class="stat.trend > 0 ? 'text-green-400' : 'text-red-400'" class="text-xs flex items-center">
133
+ <i :class="stat.trend > 0 ? 'fas fa-arrow-up' : 'fas fa-arrow-down'" class="mr-1"></i>
134
+ <span x-text="Math.abs(stat.trend)+'%'"></span>
135
+ </p>
136
+ </div>
137
+ </div>
138
+ </template>
139
+ </div>
140
+
141
+ <!-- Widgets Row -->
142
+ <div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
143
+ <div class="glass rounded-xl p-4 lg:col-span-2">
144
+ <h3 class="font-semibold mb-3">Revenue</h3>
145
+ <div class="bg-gray-700/30 rounded-lg h-48 flex items-center justify-center">
146
+ <i class="fas fa-chart-line text-4xl text-cyan-400"></i>
147
+ </div>
148
+ </div>
149
+ <div class="glass rounded-xl p-4">
150
+ <h3 class="font-semibold mb-3">Top Products</h3>
151
+ <ul class="space-y-3">
152
+ <li class="flex items-center">
153
+ <div class="w-8 h-8 bg-gray-700 rounded mr-2"></div>
154
+ <div>
155
+ <p class="text-sm">Wireless Headphones</p>
156
+ <p class="text-xs text-gray-400">$1,245 / 45 sold</p>
157
+ </div>
158
+ </li>
159
+ <li class="flex items-center">
160
+ <div class="w-8 h-8 bg-gray-700 rounded mr-2"></div>
161
+ <div>
162
+ <p class="text-sm">Smart Watch</p>
163
+ <p class="text-xs text-gray-400">$980 / 32 sold</p>
164
+ </div>
165
+ </li>
166
+ </ul>
167
+ </div>
168
+ </div>
169
+
170
+ <!-- Empty helper -->
171
+ <div x-show="showEmptyHelper" x-transition class="fixed bottom-6 right-6 glass-dark rounded-xl p-4 max-w-xs">
172
+ <p class="text-sm">New here? <button class="text-cyan-400 underline">Upload your first file</button> to get AI insights in seconds.</p>
173
+ </div>
174
+ </section>
175
+
176
+ <!-- Orders -->
177
+ <section x-show="currentTab==='orders'" x-cloak>
178
+ <div class="glass rounded-xl overflow-hidden">
179
+ <div class="p-4 border-b border-gray-700/50 flex items-center justify-between">
180
+ <h3 class="font-semibold">Orders</h3>
181
+ <button class="px-3 py-1 bg-cyan-500 text-gray-900 rounded text-sm font-semibold"><i class="fas fa-plus mr-1"></i>New</button>
182
+ </div>
183
+ <div class="overflow-x-auto">
184
+ <table class="w-full text-sm">
185
+ <thead class="bg-gray-800/50">
186
+ <tr>
187
+ <th class="px-4 py-2 text-left">ID</th>
188
+ <th class="px-4 py-2 text-left">Customer</th>
189
+ <th class="px-4 py-2 text-left">Date</th>
190
+ <th class="px-4 py-2 text-left">Amount</th>
191
+ <th class="px-4 py-2 text-left">Status</th>
192
+ <th class="px-4 py-2 text-left"></th>
193
+ </tr>
194
+ </thead>
195
+ <tbody>
196
+ <tr class="border-t border-gray-700/50">
197
+ <td class="px-4 py-2">#1001</td>
198
+ <td class="px-4 py-2">John Smith</td>
199
+ <td class="px-4 py-2">05 Jun 2024</td>
200
+ <td class="px-4 py-2">$245.00</td>
201
+ <td class="px-4 py-2"><span class="px-2 py-0.5 rounded-full text-xs bg-green-500/20 text-green-300">Completed</span></td>
202
+ <td class="px-4 py-2"><button class="text-cyan-400 text-xs">View</button></td>
203
+ </tr>
204
+ <tr class="border-t border-gray-700/50">
205
+ <td class="px-4 py-2">#1002</td>
206
+ <td class="px-4 py-2">Sarah Johnson</td>
207
+ <td class="px-4 py-2">05 Jun 2024</td>
208
+ <td class="px-4 py-2">$189.50</td>
209
+ <td class="px-4 py-2"><span class="px-2 py-0.5 rounded-full text-xs bg-yellow-500/20 text-yellow-300">Processing</span></td>
210
+ <td class="px-4 py-2"><button class="text-cyan-400 text-xs">View</button></td>
211
+ </tr>
212
+ </tbody>
213
+ </table>
214
+ </div>
215
+ </div>
216
+ </section>
217
+
218
+ <!-- Products -->
219
+ <section x-show="currentTab==='products'" x-cloak>
220
+ <div class="glass rounded-xl overflow-hidden">
221
+ <div class="p-4 border-b border-gray-700/50 flex items-center justify-between">
222
+ <h3 class="font-semibold">Products</h3>
223
+ <button class="px-3 py-1 bg-cyan-500 text-gray-900 rounded text-sm font-semibold"><i class="fas fa-plus mr-1"></i>Add</button>
224
+ </div>
225
+ <div class="overflow-x-auto">
226
+ <table class="w-full text-sm">
227
+ <thead class="bg-gray-800/50">
228
+ <tr>
229
+ <th class="px-4 py-2 text-left">Product</th>
230
+ <th class="px-4 py-2 text-left">SKU</th>
231
+ <th class="px-4 py-2 text-left">Stock</th>
232
+ <th class="px-4 py-2 text-left">Price</th>
233
+ <th class="px-4 py-2 text-left">Status</th>
234
+ <th class="px-4 py-2 text-left"></th>
235
+ </tr>
236
+ </thead>
237
+ <tbody>
238
+ <tr class="border-t border-gray-700/50">
239
+ <td class="px-4 py-2 flex items-center"><img src="https://via.placeholder.com/32" class="rounded mr-2"><span>Wireless Headphones</span></td>
240
+ <td class="px-4 py-2">SKU-001</td>
241
+ <td class="px-4 py-2">45</td>
242
+ <td class="px-4 py-2">$89.99</td>
243
+ <td class="px-4 py-2"><span class="px-2 py-0.5 rounded-full text-xs bg-green-500/20 text-green-300">Active</span></td>
244
+ <td class="px-4 py-2"><button class="text-cyan-400 text-xs">Edit</button></td>
245
+ </tr>
246
+ <tr class="border-t border-gray-700/50">
247
+ <td class="px-4 py-2 flex items-center"><img src="https://via.placeholder.com/32" class="rounded mr-2"><span>Smart Watch</span></td>
248
+ <td class="px-4 py-2">SKU-002</td>
249
+ <td class="px-4 py-2">12</td>
250
+ <td class="px-4 py-2">$199.99</td>
251
+ <td class="px-4 py-2"><span class="px-2 py-0.5 rounded-full text-xs bg-green-500/20 text-green-300">Active</span></td>
252
+ <td class="px-4 py-2"><button class="text-cyan-400 text-xs">Edit</button></td>
253
+ </tr>
254
+ </tbody>
255
+ </table>
256
+ </div>
257
+ </div>
258
+ </section>
259
+
260
+ <!-- Customers -->
261
+ <section x-show="currentTab==='customers'" x-cloak>
262
+ <div class="glass rounded-xl overflow-hidden">
263
+ <div class="p-4 border-b border-gray-700/50 flex items-center justify-between">
264
+ <h3 class="font-semibold">Customers</h3>
265
+ <button class="px-3 py-1 bg-cyan-500 text-gray-900 rounded text-sm font-semibold"><i class="fas fa-plus mr-1"></i>Add</button>
266
+ </div>
267
+ <div class="overflow-x-auto">
268
+ <table class="w-full text-sm">
269
+ <thead class="bg-gray-800/50">
270
+ <tr>
271
+ <th class="px-4 py-2 text-left">Customer</th>
272
+ <th class="px-4 py-2 text-left">Email</th>
273
+ <th class="px-4 py-2 text-left">Orders</th>
274
+ <th class="px-4 py-2 text-left">Spent</th>
275
+ <th class="px-4 py-2 text-left"></th>
276
+ </tr>
277
+ </thead>
278
+ <tbody>
279
+ <tr class="border-t border-gray-700/50">
280
+ <td class="px-4 py-2 flex items-center"><img src="https://randomuser.me/api/portraits/men/32.jpg" class="w-8 h-8 rounded-full mr-2"><span>John Smith</span></td>
281
+ <td class="px-4 py-2">[email protected]</td>
282
+ <td class="px-4 py-2">5</td>
283
+ <td class="px-4 py-2">$1,245</td>
284
+ <td class="px-4 py-2"><button class="text-cyan-400 text-xs">View</button></td>
285
+ </tr>
286
+ <tr class="border-t border-gray-700/50">
287
+ <td class="px-4 py-2 flex items-center"><img src="https://randomuser.me/api/portraits/women/44.jpg" class="w-8 h-8 rounded-full mr-2"><span>Sarah Johnson</span></td>
288
+ <td class="px-4 py-2">[email protected]</td>
289
+ <td class="px-4 py-2">3</td>
290
+ <td class="px-4 py-2">$756</td>
291
+ <td class="px-4 py-2"><button class="text-cyan-400 text-xs">View</button></td>
292
+ </tr>
293
+ </tbody>
294
+ </table>
295
+ </div>
296
+ </div>
297
+ </section>
298
+
299
+ <!-- Shipping -->
300
+ <section x-show="currentTab==='shipping'" x-cloak>
301
+ <div class="glass rounded-xl p-6 text-center">
302
+ <i class="fas fa-truck text-4xl text-cyan-400 mb-3"></i>
303
+ <h3 class="text-lg font-semibold mb-2">Shipping</h3>
304
+ <p class="text-gray-400 mb-4">Connect carriers, print labels & track packages in one click.</p>
305
+ <button class="px-4 py-2 bg-cyan-500 text-gray-900 rounded-lg font-semibold">Get Started</button>
306
+ </div>
307
+ </section>
308
+
309
+ <!-- AI Center -->
310
+ <section x-show="currentTab==='ai'" x-cloak>
311
+ <div class="glass rounded-xl p-6 text-center">
312
+ <i class="fas fa-robot text-4xl text-cyan-400 mb-3"></i>
313
+ <h3 class="text-lg font-semibold mb-2">AI Center</h3>
314
+ <p class="text-gray-400 mb-4">Chat with AI, auto-generate descriptions, and get smart recommendations.</p>
315
+ <button class="px-4 py-2 bg-cyan-500 text-gray-900 rounded-lg font-semibold">Open Chat</button>
316
+ </div>
317
+ </section>
318
+
319
+ <!-- Analytics -->
320
+ <section x-show="currentTab==='analytics'" x-cloak>
321
+ <div class="glass rounded-xl p-6 text-center">
322
+ <i class="fas fa-chart-line text-4xl text-cyan-400 mb-3"></i>
323
+ <h3 class="text-lg font-semibold mb-2">Analytics</h3>
324
+ <p class="text-gray-400 mb-4">Deep insights on sales, products, and customer behavior.</p>
325
+ <button class="px-4 py-2 bg-cyan-500 text-gray-900 rounded-lg font-semibold">View Reports</button>
326
+ </div>
327
+ </section>
328
+
329
+ <!-- Social -->
330
+ <section x-show="currentTab==='social'" x-cloak>
331
+ <div class="glass rounded-xl p-6 text-center">
332
+ <i class="fas fa-share-alt text-4xl text-cyan-400 mb-3"></i>
333
+ <h3 class="text-lg font-semibold mb-2">Social</h3>
334
+ <p class="text-gray-400 mb-4">Schedule posts, manage ads, and track performance across platforms.</p>
335
+ <button class="px-4 py-2 bg-cyan-500 text-gray-900 rounded-lg font-semibold">Connect Account</button>
336
+ </div>
337
+ </section>
338
+
339
+ </div>
340
+ </main>
341
+
342
+ <!-- Floating Action Button -->
343
+ <button class="fixed bottom-6 right-20 md:right-6 w-14 h-14 bg-cyan-500 rounded-full shadow-lg flex items-center justify-center text-gray-900 text-2xl font-bold hover:bg-cyan-400 transition z-50">
344
+ +
345
+ </button>
346
+
347
+ <!-- Upgrade CTA Popup -->
348
+ <div x-show="showUpgrade" x-transition class="fixed inset-0 bg-black/50 flex items-center justify-center z-50">
349
+ <div class="glass-dark rounded-2xl p-6 max-w-sm text-center">
350
+ <i class="fas fa-rocket text-3xl text-cyan-400 mb-3"></i>
351
+ <h3 class="font-bold text-lg mb-2">Level-up your store</h3>
352
+ <p class="text-sm text-gray-300 mb-4">Unlock AI insights, automation rules & 24/7 live support.</p>
353
+ <button class="w-full px-4 py-2 bg-cyan-500 text-gray-900 rounded-lg font-semibold hover:bg-cyan-400">Upgrade Now</button>
354
+ <button @click="showUpgrade=false" class="mt-2 text-xs text-gray-400 hover:text-white">Maybe later</button>
355
+ </div>
356
+ </div>
357
+
358
+ <!-- AI Assistant Bubble -->
359
+ <button id="aiBubble"
360
+ @click="openChat = true; $nextTick(() => scrollDown())"
361
+ class="fixed bottom-6 right-6 w-14 h-14 rounded-full bg-accent shadow-lg
362
+ flex items-center justify-center hover:scale-110 transition-transform">
363
+ <i class="fas fa-robot text-white text-2xl"></i>
364
+ </button>
365
+
366
+ <!-- Chat Widget -->
367
+ <div x-show="showChat" x-transition class="fixed bottom-20 right-6 w-80 glass-dark rounded-xl shadow-2xl z-50">
368
+ <div class="flex items-center justify-between p-3 border-b border-gray-700/50">
369
+ <span class="font-semibold">Live Support</span>
370
+ <button @click="showChat=false"><i class="fas fa-times text-sm"></i></button>
371
+ </div>
372
+ <div class="p-3 space-y-2 text-sm">
373
+ <div class="bg-gray-700/50 rounded-lg p-2">Hi! Need help? Ask me anything.</div>
374
+ <div class="bg-cyan-500/20 rounded-lg p-2 ml-8">Thanks, I’m good for now.</div>
375
+ </div>
376
+ <div class="p-3 border-t border-gray-700/50">
377
+ <input type="text" placeholder="Type a message..." class="w-full bg-gray-800/50 rounded px-2 py-1 text-sm">
378
+ </div>
379
+ </div>
380
+
381
+ <script>
382
+ function dashboardState() {
383
+ return {
384
+ darkMode: false,
385
+ currentTab: 'dashboard',
386
+ mobileMenuOpen: false,
387
+ showEmptyHelper: true,
388
+ showUpgrade: false,
389
+ showChat: false,
390
+ quickStats: [
391
+ { label: 'Sales', value: '$0', trend: 0, icon: 'fas fa-dollar-sign', color: 'bg-green-500/20 text-green-400' },
392
+ { label: 'Orders', value: '0', trend: 0, icon: 'fas fa-shopping-cart', color: 'bg-blue-500/20 text-blue-400' },
393
+ { label: 'Conversion', value: '0%', trend: 0, icon: 'fas fa-percent', color: 'bg-yellow-500/20 text-yellow-400' },
394
+ { label: 'Health', value: '100', trend: 0, icon: 'fas fa-heartbeat', color: 'bg-red-500/20 text-red-400' }
395
+ ],
396
+ navItems: [
397
+ { key: 'dashboard', label: 'Home', icon: 'fas fa-home' },
398
+ { key: 'products', label: 'Products', icon: 'fas fa-boxes-stacked' },
399
+ { key: 'orders', label: 'Orders', icon: 'fas fa-shopping-cart' },
400
+ { key: 'integrations', label: 'Integrations', icon: 'fas fa-plug' },
401
+ { key: 'social', label: 'Social', icon: 'fas fa-share-alt' },
402
+ { key: 'assistant', label: 'AI Assistant', icon: 'fas fa-robot' },
403
+ { key: 'automations', label: 'Automations', icon: 'fas fa-cogs' },
404
+ { key: 'shipping', label: 'Shipping', icon: 'fas fa-truck' },
405
+ { key: 'payments', label: 'Payments', icon: 'fas fa-credit-card' },
406
+ { key: 'trends', label: 'Trends', icon: 'fas fa-chart-line' },
407
+ { key: 'settings', label: 'Settings', icon: 'fas fa-cog' },
408
+ { key: 'feedback', label: 'Feedback', icon: 'fas fa-comment-dots' }
409
+ ],
410
+ getCurrentTabTitle() {
411
+ const found = this.navItems.find(i => i.key === this.currentTab);
412
+ return found ? found.label : 'Dashboard';
413
+ },
414
+ toggleDark() {
415
+ this.darkMode = !this.darkMode;
416
+ },
417
+ /* Chat System */
418
+ openChat: false,
419
+ draft: '',
420
+ messages: JSON.parse(localStorage.getItem('chat') || '[]'),
421
+ loading: false,
422
+ emojiMode: false,
423
+
424
+ async sendMessage() {
425
+ const text = this.draft.trim();
426
+ if (!text) return;
427
+
428
+ // Add user message
429
+ this.messages.push({
430
+ id: Date.now(),
431
+ role: 'user',
432
+ content: text
433
+ });
434
+
435
+ this.draft = '';
436
+ this.loading = true;
437
+ this.persistChat();
438
+ this.scrollDown();
439
+
440
+ try {
441
+ const res = await fetch('/api/chat', {
442
+ method: 'POST',
443
+ headers: { 'Content-Type': 'application/json' },
444
+ body: JSON.stringify({
445
+ messages: this.messages,
446
+ emoji_mode: this.emojiMode
447
+ })
448
+ });
449
+
450
+ const reader = res.body.getReader();
451
+ let assistantMsg = {
452
+ id: Date.now() + 1,
453
+ role: 'assistant',
454
+ content: '',
455
+ emojis: this.emojiMode ? [] : null
456
+ };
457
+
458
+ this.messages.push(assistantMsg);
459
+ let buffer = '';
460
+
461
+ while (true) {
462
+ const { value, done } = await reader.read();
463
+ if (done) break;
464
+
465
+ buffer += new TextDecoder().decode(value);
466
+ const parts = buffer.split('\n\n');
467
+ buffer = parts.pop() || '';
468
+
469
+ for (const part of parts) {
470
+ try {
471
+ const data = JSON.parse(part);
472
+ assistantMsg.content += data.content || '';
473
+
474
+ if (this.emojiMode && data.emojis) {
475
+ assistantMsg.emojis = [...(assistantMsg.emojis || []), ...data.emojis];
476
+ }
477
+ } catch (e) { /* ignore parse errors */ }
478
+ }
479
+
480
+ this.persistChat();
481
+ this.$nextTick(() => this.scrollDown());
482
+ }
483
+ } catch (error) {
484
+ console.error('Chat error:', error);
485
+ assistantMsg.content = '⚠️ حدث خطأ في الاتصال بالمساعد. يرجى المحاولة لاحقًا.';
486
+ }
487
+
488
+ this.loading = false;
489
+ this.persistChat();
490
+ },
491
+
492
+ scrollDown() {
493
+ this.$nextTick(() => {
494
+ const el = document.getElementById('chatScroll');
495
+ if (el) el.scrollTop = el.scrollHeight + 100;
496
+ });
497
+ },
498
+
499
+ persistChat() {
500
+ localStorage.setItem('chat', JSON.stringify(this.messages));
501
+ },
502
+
503
+ init() {
504
+ setTimeout(() => this.showUpgrade = true, 30000);
505
+ }
506
+ };
507
+ }
508
+ </script>
509
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=fsalmansour/secont" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
510
+ </html>