GamerC0der commited on
Commit
2f73768
·
1 Parent(s): f21f023
app/components/sidebar/Menu.client.tsx CHANGED
@@ -2,8 +2,6 @@ import { motion, type Variants } from 'framer-motion';
2
  import { useCallback, useEffect, useRef, useState } from 'react';
3
  import { toast } from 'react-toastify';
4
  import { Dialog, DialogButton, DialogDescription, DialogRoot, DialogTitle } from '~/components/ui/Dialog';
5
- import { ControlPanel } from '~/components/@settings/core/ControlPanel';
6
- import { SettingsButton } from '~/components/ui/SettingsButton';
7
  import { Button } from '~/components/ui/Button';
8
  import { db, deleteById, getAll, chatId, type ChatHistoryItem, useChatHistory } from '~/lib/persistence';
9
  import { cubicEasingFn } from '~/utils/easings';
@@ -68,7 +66,6 @@ export const Menu = () => {
68
  const [list, setList] = useState<ChatHistoryItem[]>([]);
69
  const [open, setOpen] = useState(false);
70
  const [dialogContent, setDialogContent] = useState<DialogContent>(null);
71
- const [isSettingsOpen, setIsSettingsOpen] = useState(false);
72
  const profile = useStore(profileStore);
73
  const [selectionMode, setSelectionMode] = useState(false);
74
  const [selectedItems, setSelectedItems] = useState<string[]>([]);
@@ -282,10 +279,6 @@ export const Menu = () => {
282
  const exitThreshold = 40;
283
 
284
  function onMouseMove(event: MouseEvent) {
285
- if (isSettingsOpen) {
286
- return;
287
- }
288
-
289
  if (event.pageX < enterThreshold) {
290
  setOpen(true);
291
  }
@@ -300,21 +293,13 @@ export const Menu = () => {
300
  return () => {
301
  window.removeEventListener('mousemove', onMouseMove);
302
  };
303
- }, [isSettingsOpen]);
304
 
305
  const handleDuplicate = async (id: string) => {
306
  await duplicateCurrentChat(id);
307
  loadEntries(); // Reload the list after duplication
308
  };
309
 
310
- const handleSettingsClick = () => {
311
- setIsSettingsOpen(true);
312
- setOpen(false);
313
- };
314
-
315
- const handleSettingsClose = () => {
316
- setIsSettingsOpen(false);
317
- };
318
 
319
  const setDialogContentWithLogging = useCallback((content: DialogContent) => {
320
  console.log('Setting dialog content:', content);
@@ -332,8 +317,7 @@ export const Menu = () => {
332
  className={classNames(
333
  'flex selection-accent flex-col side-menu fixed top-0 h-full',
334
  'bg-white dark:bg-gray-950 border-r border-gray-100 dark:border-gray-800/50',
335
- 'shadow-sm text-sm',
336
- isSettingsOpen ? 'z-40' : 'z-sidebar',
337
  )}
338
  >
339
  <div className="h-12 flex items-center justify-between px-4 border-b border-gray-100 dark:border-gray-800/50 bg-gray-50/50 dark:bg-gray-900/50">
@@ -524,12 +508,15 @@ export const Menu = () => {
524
  </DialogRoot>
525
  </div>
526
  <div className="flex items-center justify-center border-t border-gray-200 dark:border-gray-800 px-4 py-3">
527
- <SettingsButton onClick={handleSettingsClick} />
 
 
 
 
 
528
  </div>
529
  </div>
530
  </motion.div>
531
-
532
- <ControlPanel open={isSettingsOpen} onClose={handleSettingsClose} />
533
  </>
534
  );
535
  };
 
2
  import { useCallback, useEffect, useRef, useState } from 'react';
3
  import { toast } from 'react-toastify';
4
  import { Dialog, DialogButton, DialogDescription, DialogRoot, DialogTitle } from '~/components/ui/Dialog';
 
 
5
  import { Button } from '~/components/ui/Button';
6
  import { db, deleteById, getAll, chatId, type ChatHistoryItem, useChatHistory } from '~/lib/persistence';
7
  import { cubicEasingFn } from '~/utils/easings';
 
66
  const [list, setList] = useState<ChatHistoryItem[]>([]);
67
  const [open, setOpen] = useState(false);
68
  const [dialogContent, setDialogContent] = useState<DialogContent>(null);
 
69
  const profile = useStore(profileStore);
70
  const [selectionMode, setSelectionMode] = useState(false);
71
  const [selectedItems, setSelectedItems] = useState<string[]>([]);
 
279
  const exitThreshold = 40;
280
 
281
  function onMouseMove(event: MouseEvent) {
 
 
 
 
282
  if (event.pageX < enterThreshold) {
283
  setOpen(true);
284
  }
 
293
  return () => {
294
  window.removeEventListener('mousemove', onMouseMove);
295
  };
296
+ }, []);
297
 
298
  const handleDuplicate = async (id: string) => {
299
  await duplicateCurrentChat(id);
300
  loadEntries(); // Reload the list after duplication
301
  };
302
 
 
 
 
 
 
 
 
 
303
 
304
  const setDialogContentWithLogging = useCallback((content: DialogContent) => {
305
  console.log('Setting dialog content:', content);
 
317
  className={classNames(
318
  'flex selection-accent flex-col side-menu fixed top-0 h-full',
319
  'bg-white dark:bg-gray-950 border-r border-gray-100 dark:border-gray-800/50',
320
+ 'shadow-sm text-sm z-sidebar',
 
321
  )}
322
  >
323
  <div className="h-12 flex items-center justify-between px-4 border-b border-gray-100 dark:border-gray-800/50 bg-gray-50/50 dark:bg-gray-900/50">
 
508
  </DialogRoot>
509
  </div>
510
  <div className="flex items-center justify-center border-t border-gray-200 dark:border-gray-800 px-4 py-3">
511
+ <a
512
+ href="/api"
513
+ className="flex items-center justify-center w-8 h-8 rounded-lg bg-purple-50 dark:bg-purple-500/10 text-purple-600 dark:text-purple-400 hover:bg-purple-100 dark:hover:bg-purple-500/20 transition-colors"
514
+ >
515
+ <span className="i-ph:brain h-5 w-5" />
516
+ </a>
517
  </div>
518
  </div>
519
  </motion.div>
 
 
520
  </>
521
  );
522
  };
app/routes/api.tsx ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { json } from '@remix-run/node';
2
+ import { useLoaderData } from '@remix-run/react';
3
+
4
+ export const loader = async () => {
5
+ return json({ message: 'API Coming Soon' });
6
+ };
7
+
8
+ export default function ApiPage() {
9
+ const data = useLoaderData<typeof loader>();
10
+
11
+ return (
12
+ <div className="min-h-screen bg-gray-50 dark:bg-gray-900 flex items-center justify-center">
13
+ <div className="max-w-md w-full bg-white dark:bg-gray-800 rounded-lg shadow-lg p-8 text-center">
14
+ <div className="mb-6">
15
+ <div className="mx-auto w-16 h-16 bg-purple-100 dark:bg-purple-900/30 rounded-full flex items-center justify-center mb-4">
16
+ <svg
17
+ className="w-8 h-8 text-purple-600 dark:text-purple-400"
18
+ fill="none"
19
+ stroke="currentColor"
20
+ viewBox="0 0 24 24"
21
+ >
22
+ <path
23
+ strokeLinecap="round"
24
+ strokeLinejoin="round"
25
+ strokeWidth={2}
26
+ d="M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"
27
+ />
28
+ </svg>
29
+ </div>
30
+ <h1 className="text-2xl font-bold text-gray-900 dark:text-white mb-2">
31
+ {data.message}
32
+ </h1>
33
+ <p className="text-gray-600 dark:text-gray-400">
34
+ Check back later for the AstraCoder API!
35
+ </p>
36
+ </div>
37
+ <div className="space-y-3">
38
+ <a
39
+ href="/"
40
+ className="inline-block w-full bg-purple-600 hover:bg-purple-700 text-white font-medium py-2 px-4 rounded-lg transition-colors"
41
+ >
42
+ Go Back Home
43
+ </a>
44
+ </div>
45
+ </div>
46
+ </div>
47
+ );
48
+ }