diff --git a/app/chat/page.tsx b/app/chat/page.tsx index 430cf3c..1970738 100644 --- a/app/chat/page.tsx +++ b/app/chat/page.tsx @@ -8,6 +8,7 @@ import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/comp import { ChatInput } from "@/components/chat/chat-input"; import { ChatMessage } from "@/components/chat/chat-message"; import { ReasoningChain } from "@/components/chat/reasoning-chain"; +import { TitleBar } from "@/components/titlebar"; import { SidebarList } from "@/components/chat/sidebar-list"; import { useChat } from "@/hooks/use-chat"; @@ -874,9 +875,13 @@ Ao responder sobre fatos atuais ou notícias, inicie mencionando explicitamente }; return ( -
- {/* Left Sidebar (Nav) */} - +
+ {/* Custom Title Bar */} + + + {/* Main Content Area */} +
+ +
{/* Mobile Sidebar Overlay */} {!isChatsSidebarCollapsed && ( diff --git a/app/settings/page.tsx b/app/settings/page.tsx index 97e8f3f..40472ea 100644 --- a/app/settings/page.tsx +++ b/app/settings/page.tsx @@ -28,6 +28,7 @@ import { CheckCircle2, XCircle, Loader2, Download, Trash2, Copy, ExternalLink, P import { useToast } from '@/hooks/use-toast'; import { useRouter } from 'next/navigation'; import { SourcesConfig, SourceCategory } from '@/lib/types'; +import { TitleBar } from '@/components/titlebar'; interface Model { name: string; @@ -217,7 +218,10 @@ export default function SettingsPage() { }; return ( -
+
+ +
+
@@ -1130,6 +1134,8 @@ export default function SettingsPage() { +
+
); } diff --git a/app/tasks/page.tsx b/app/tasks/page.tsx index 6e22122..73de553 100644 --- a/app/tasks/page.tsx +++ b/app/tasks/page.tsx @@ -8,6 +8,7 @@ import { Switch } from '@/components/ui/switch'; import { Label } from '@/components/ui/label'; import { Plus, Trash2, Clock, Play, Pause, CheckCircle2, XCircle, X, ArrowLeft } from 'lucide-react'; import { useRouter } from 'next/navigation'; +import { TitleBar } from '@/components/titlebar'; import { Badge } from '@/components/ui/badge'; import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger } from '@/components/ui/dialog'; import { Input } from '@/components/ui/input'; @@ -102,7 +103,10 @@ export default function TasksPage() { }; return ( -
+
+ +
+
@@ -254,6 +258,8 @@ export default function TasksPage() {
)} +
+
); } diff --git a/components/titlebar.tsx b/components/titlebar.tsx new file mode 100644 index 0000000..227766e --- /dev/null +++ b/components/titlebar.tsx @@ -0,0 +1,123 @@ +'use client'; + +import { useEffect, useState } from 'react'; +import { getCurrentWindow } from '@tauri-apps/api/window'; +import { Minus, Square, X } from 'lucide-react'; +import { cn } from '@/lib/utils'; + +export function TitleBar() { + const [isMaximized, setIsMaximized] = useState(false); + + useEffect(() => { + let isMounted = true; + + const checkMaximized = async () => { + try { + const appWindow = getCurrentWindow(); + const maximized = await appWindow.isMaximized(); + if (isMounted) { + setIsMaximized(maximized); + } + } catch (error) { + console.error('Failed to check window state:', error); + } + }; + + checkMaximized(); + + // Listener para mudanças de estado + const setupListener = async () => { + try { + const appWindow = getCurrentWindow(); + const unlisten = await appWindow.onResized(async () => { + if (isMounted) { + const maximized = await appWindow.isMaximized(); + setIsMaximized(maximized); + } + }); + + return unlisten; + } catch (error) { + console.error('Failed to setup resize listener:', error); + return null; + } + }; + + let unlistenFn: (() => void) | null = null; + setupListener().then(fn => { + unlistenFn = fn; + }); + + return () => { + isMounted = false; + if (unlistenFn) { + unlistenFn(); + } + }; + }, []); + + const handleMinimize = async () => { + const appWindow = getCurrentWindow(); + await appWindow.minimize(); + }; + + const handleMaximize = async () => { + const appWindow = getCurrentWindow(); + if (isMaximized) { + await appWindow.unmaximize(); + } else { + await appWindow.maximize(); + } + }; + + const handleClose = async () => { + const appWindow = getCurrentWindow(); + await appWindow.close(); + }; + + return ( +
+ {/* Área de arrasto com logo/título */} +
+ + OllaHub + +
+ + {/* Controles de janela */} +
+ + + +
+
+ ); +} + diff --git a/src-tauri/capabilities/default.json b/src-tauri/capabilities/default.json index c135d7f..1ba7fc8 100644 --- a/src-tauri/capabilities/default.json +++ b/src-tauri/capabilities/default.json @@ -6,6 +6,13 @@ "main" ], "permissions": [ - "core:default" + "core:default", + "core:window:allow-start-dragging", + "core:window:allow-start-resize-dragging", + "core:window:allow-minimize", + "core:window:allow-maximize", + "core:window:allow-unmaximize", + "core:window:allow-close", + "core:window:allow-is-maximized" ] } diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 15f5a64..2bc7910 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -13,10 +13,12 @@ "windows": [ { "title": "OllaHub", - "width": 800, - "height": 600, + "width": 1200, + "height": 800, "resizable": true, - "fullscreen": false + "fullscreen": false, + "decorations": false, + "transparent": false } ], "security": {