Spaces:
Running
Running
Update src/App.tsx
Browse files- src/App.tsx +23 -18
src/App.tsx
CHANGED
@@ -143,31 +143,39 @@ const AppInternalLogic: React.FC<{
|
|
143 |
<div className="w-full flex flex-col items-center justify-center min-h-screen text-foreground antialiased">
|
144 |
<div className="max-w-3xl w-full flex flex-col items-center justify-center h-full relative">
|
145 |
<div className="header-controls">
|
146 |
-
<div id="notification-trigger-container">
|
147 |
<button
|
148 |
ref={notificationButtonRef}
|
149 |
id="notification-button"
|
150 |
aria-label="Notifications"
|
151 |
-
className="header-button"
|
152 |
onClick={(e) => {
|
153 |
e.stopPropagation();
|
154 |
setIsNotificationOpen(!isNotificationOpen);
|
155 |
}}
|
156 |
>
|
|
|
157 |
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="8" x2="12" y2="12"></line><line x1="12" y1="16" x2="12.01" y2="16"></line></svg>
|
158 |
</button>
|
159 |
</div>
|
160 |
-
<div className="back-button-container">
|
161 |
-
|
162 |
-
|
163 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
</div>
|
165 |
</div>
|
166 |
|
167 |
<div ref={notificationPopoverRef} id="notification-popover-wrapper" className="notification-popover-wrapper">
|
168 |
<div
|
169 |
id="notification-popover"
|
170 |
-
className={cn("popover-content", {
|
171 |
"open animate-popover-open-top-center": isNotificationOpen,
|
172 |
"animate-popover-close-top-center": !isNotificationOpen && document.getElementById('notification-popover')?.classList.contains('open'),
|
173 |
})}
|
@@ -177,7 +185,7 @@ const AppInternalLogic: React.FC<{
|
|
177 |
</div>
|
178 |
</div>
|
179 |
</div>
|
180 |
-
|
181 |
<div className="w-full flex flex-col items-center justify-center flex-grow relative">
|
182 |
<video
|
183 |
id="video-feed"
|
@@ -202,7 +210,7 @@ const AppInternalLogic: React.FC<{
|
|
202 |
{isMicActive && !isCamActive && createLogoFunction(false, true, 'human')}
|
203 |
</div>
|
204 |
</div>
|
205 |
-
|
206 |
<ControlTray
|
207 |
videoRef={videoRef}
|
208 |
supportsVideo={true}
|
@@ -218,7 +226,6 @@ const AppInternalLogic: React.FC<{
|
|
218 |
);
|
219 |
}
|
220 |
|
221 |
-
// *** NEW: Configuration for logo colors for Tailwind JIT compatibility ***
|
222 |
const logoColorConfig = {
|
223 |
blue: {
|
224 |
ping: "bg-blue-200 dark:bg-blue-700",
|
@@ -232,7 +239,7 @@ const logoColorConfig = {
|
|
232 |
mid: "bg-green-300 dark:bg-green-600",
|
233 |
inner: "bg-green-400 dark:bg-green-500",
|
234 |
},
|
235 |
-
gray: {
|
236 |
ping: "bg-gray-200 dark:bg-gray-700",
|
237 |
outer: "bg-gray-200 dark:bg-gray-700",
|
238 |
mid: "bg-gray-300 dark:bg-gray-600",
|
@@ -258,7 +265,7 @@ function App() {
|
|
258 |
}
|
259 |
const timer = setTimeout(() => {
|
260 |
setIsAllowedOrigin(true);
|
261 |
-
}, 100);
|
262 |
return () => clearTimeout(timer);
|
263 |
}, []);
|
264 |
|
@@ -283,16 +290,15 @@ function App() {
|
|
283 |
if (isAllowedOrigin === null) {
|
284 |
return <div style={{ padding: '20px', textAlign: 'center' }}>در حال بررسی دسترسی...</div>;
|
285 |
}
|
286 |
-
|
287 |
const createLogoFunction = (isMini: boolean, isActive: boolean, type: 'human' | 'ai' = 'human') => {
|
288 |
if (!isActive) return null;
|
289 |
const size = isMini ? 80 : 200;
|
290 |
-
const iconSize = isMini ? 35 : 70; //
|
291 |
-
const insetBase = isMini
|
292 |
? { ping: 10, outer: 0, mid: 5, inner: 12, icon: 22 }
|
293 |
: { ping: 40, outer: 0, mid: 20, inner: 50, icon: 65 };
|
294 |
-
|
295 |
-
// *** UPDATED: Use logoColorConfig for Tailwind JIT compatibility ***
|
296 |
const effectiveType = (type === 'human') ? 'blue' : (type === 'ai' ? 'green' : 'gray');
|
297 |
const currentColors = logoColorConfig[effectiveType as keyof typeof logoColorConfig] || logoColorConfig.gray;
|
298 |
|
@@ -304,7 +310,6 @@ function App() {
|
|
304 |
<div className={`absolute rounded-full opacity-50 ${currentColors.inner}`} style={{ inset: `${insetBase.inner}px` }}></div>
|
305 |
<div className="z-10 absolute" style={{ inset: `${insetBase.icon}px`, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
|
306 |
{type === 'human' && <SvgHumanIcon />}
|
307 |
-
{/* اگر آیکون AI دارید، اینجا اضافه کنید. مثال: type === 'ai' && <SvgAiIcon /> */}
|
308 |
</div>
|
309 |
</div>
|
310 |
);
|
|
|
143 |
<div className="w-full flex flex-col items-center justify-center min-h-screen text-foreground antialiased">
|
144 |
<div className="max-w-3xl w-full flex flex-col items-center justify-center h-full relative">
|
145 |
<div className="header-controls">
|
146 |
+
<div id="notification-trigger-container"> {/* Wrapper is good for potential future styling or positioning */}
|
147 |
<button
|
148 |
ref={notificationButtonRef}
|
149 |
id="notification-button"
|
150 |
aria-label="Notifications"
|
151 |
+
className="header-button" // Standard class for header buttons
|
152 |
onClick={(e) => {
|
153 |
e.stopPropagation();
|
154 |
setIsNotificationOpen(!isNotificationOpen);
|
155 |
}}
|
156 |
>
|
157 |
+
{/* Notification Icon SVG */}
|
158 |
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="8" x2="12" y2="12"></line><line x1="12" y1="16" x2="12.01" y2="16"></line></svg>
|
159 |
</button>
|
160 |
</div>
|
161 |
+
<div className="back-button-container"> {/* Wrapper for the back button */}
|
162 |
+
{/* *** MODIFIED: Ensure it uses the same `header-button` class *** */}
|
163 |
+
<button // Changed from div to button for better accessibility and event handling
|
164 |
+
id="back-button"
|
165 |
+
aria-label="Go back"
|
166 |
+
className="header-button" // Standard class for header buttons
|
167 |
+
onClick={() => alert('Back clicked (implement navigation)')}
|
168 |
+
>
|
169 |
+
{/* Back Icon SVG - Ensure its size is consistent with notification icon or adjust padding */}
|
170 |
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><path d="m15 18-6-6 6-6"></path></svg>
|
171 |
+
</button>
|
172 |
</div>
|
173 |
</div>
|
174 |
|
175 |
<div ref={notificationPopoverRef} id="notification-popover-wrapper" className="notification-popover-wrapper">
|
176 |
<div
|
177 |
id="notification-popover"
|
178 |
+
className={cn("popover-content", {
|
179 |
"open animate-popover-open-top-center": isNotificationOpen,
|
180 |
"animate-popover-close-top-center": !isNotificationOpen && document.getElementById('notification-popover')?.classList.contains('open'),
|
181 |
})}
|
|
|
185 |
</div>
|
186 |
</div>
|
187 |
</div>
|
188 |
+
|
189 |
<div className="w-full flex flex-col items-center justify-center flex-grow relative">
|
190 |
<video
|
191 |
id="video-feed"
|
|
|
210 |
{isMicActive && !isCamActive && createLogoFunction(false, true, 'human')}
|
211 |
</div>
|
212 |
</div>
|
213 |
+
|
214 |
<ControlTray
|
215 |
videoRef={videoRef}
|
216 |
supportsVideo={true}
|
|
|
226 |
);
|
227 |
}
|
228 |
|
|
|
229 |
const logoColorConfig = {
|
230 |
blue: {
|
231 |
ping: "bg-blue-200 dark:bg-blue-700",
|
|
|
239 |
mid: "bg-green-300 dark:bg-green-600",
|
240 |
inner: "bg-green-400 dark:bg-green-500",
|
241 |
},
|
242 |
+
gray: {
|
243 |
ping: "bg-gray-200 dark:bg-gray-700",
|
244 |
outer: "bg-gray-200 dark:bg-gray-700",
|
245 |
mid: "bg-gray-300 dark:bg-gray-600",
|
|
|
265 |
}
|
266 |
const timer = setTimeout(() => {
|
267 |
setIsAllowedOrigin(true);
|
268 |
+
}, 100);
|
269 |
return () => clearTimeout(timer);
|
270 |
}, []);
|
271 |
|
|
|
290 |
if (isAllowedOrigin === null) {
|
291 |
return <div style={{ padding: '20px', textAlign: 'center' }}>در حال بررسی دسترسی...</div>;
|
292 |
}
|
293 |
+
|
294 |
const createLogoFunction = (isMini: boolean, isActive: boolean, type: 'human' | 'ai' = 'human') => {
|
295 |
if (!isActive) return null;
|
296 |
const size = isMini ? 80 : 200;
|
297 |
+
// const iconSize = isMini ? 35 : 70; // Unused for SvgHumanIcon
|
298 |
+
const insetBase = isMini
|
299 |
? { ping: 10, outer: 0, mid: 5, inner: 12, icon: 22 }
|
300 |
: { ping: 40, outer: 0, mid: 20, inner: 50, icon: 65 };
|
301 |
+
|
|
|
302 |
const effectiveType = (type === 'human') ? 'blue' : (type === 'ai' ? 'green' : 'gray');
|
303 |
const currentColors = logoColorConfig[effectiveType as keyof typeof logoColorConfig] || logoColorConfig.gray;
|
304 |
|
|
|
310 |
<div className={`absolute rounded-full opacity-50 ${currentColors.inner}`} style={{ inset: `${insetBase.inner}px` }}></div>
|
311 |
<div className="z-10 absolute" style={{ inset: `${insetBase.icon}px`, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
|
312 |
{type === 'human' && <SvgHumanIcon />}
|
|
|
313 |
</div>
|
314 |
</div>
|
315 |
);
|