+
@@ -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": {