Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions apps/desktop/src/components/main/body/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ import { Button } from "@hypr/ui/components/ui/button";
import { cn } from "@hypr/utils";

import { useShell } from "../../../contexts/shell";
import { useIsLinux } from "../../../hooks/usePlatform";
import {
type Tab,
uniqueIdfromTab,
useTabs,
} from "../../../store/zustand/tabs";
import { ChatFloatingButton } from "../../chat";
import { TrafficLights } from "../../window/traffic-lights";
import { useNewNote } from "../shared";
import { TabContentContact, TabItemContact } from "./contacts";
import { TabContentEmpty, TabItemEmpty } from "./empty";
Expand Down Expand Up @@ -58,6 +60,7 @@ export function Body() {

function Header({ tabs }: { tabs: Tab[] }) {
const { leftsidebar } = useShell();
const isLinux = useIsLinux();
const {
select,
close,
Expand Down Expand Up @@ -93,8 +96,10 @@ function Header({ tabs }: { tabs: Tab[] }) {
className={cn([
"w-full h-9 flex items-center",
!leftsidebar.expanded && "pl-[72px]",
isLinux && "pl-3",
])}
>
{isLinux && <TrafficLights className="mr-2" />}
{!leftsidebar.expanded && (
<Button
size="icon"
Expand Down
34 changes: 34 additions & 0 deletions apps/desktop/src/components/window/traffic-lights.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { getCurrentWebviewWindow } from "@tauri-apps/api/webviewWindow";

import { cn } from "@hypr/utils";

export function TrafficLights({ className }: { className?: string }) {
const win = getCurrentWebviewWindow();

const onClose = () => win.close();
const onMinimize = () => win.minimize();
const onMaximize = () => win.toggleMaximize();

return (
<div className={cn(["flex gap-2 items-center", className])}>
<button
type="button"
data-tauri-drag-region="false"
onClick={onClose}
className="h-3 w-3 rounded-full bg-[#ff5f57] border border-black/10 hover:brightness-90 transition-all"
/>
<button
type="button"
data-tauri-drag-region="false"
onClick={onMinimize}
className="h-3 w-3 rounded-full bg-[#ffbd2e] border border-black/10 hover:brightness-90 transition-all"
/>
<button
type="button"
data-tauri-drag-region="false"
onClick={onMaximize}
className="h-3 w-3 rounded-full bg-[#28c840] border border-black/10 hover:brightness-90 transition-all"
/>
</div>
);
}
19 changes: 19 additions & 0 deletions apps/desktop/src/hooks/usePlatform.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { platform, type Platform } from "@tauri-apps/plugin-os";

export type { Platform };

export function usePlatform(): Platform {
return platform();
}

export function useIsLinux(): boolean {
return usePlatform() === "linux";
}

export function useIsMacos(): boolean {
return usePlatform() === "macos";
}

export function useIsWindows(): boolean {
return usePlatform() === "windows";
}
9 changes: 8 additions & 1 deletion apps/desktop/src/routes/app/settings/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import { Button } from "@hypr/ui/components/ui/button";
import { cn } from "@hypr/utils";

import { useTemplateNavigation } from "../../../components/settings/template/utils";
import { TrafficLights } from "../../../components/window/traffic-lights";
import { useIsLinux } from "../../../hooks/usePlatform";
import * as main from "../../../store/tinybase/main";

const TAB_KEYS = [
Expand Down Expand Up @@ -166,6 +168,7 @@ function Group({
includeTrafficLight?: boolean;
}) {
const navigate = Route.useNavigate();
const isLinux = useIsLinux();

const handleTabClick = async (tab: TabKey) => {
if (tab === "feedback") {
Expand All @@ -184,7 +187,11 @@ function Group({
expandHeight && "flex-1",
])}
>
{includeTrafficLight && <div data-tauri-drag-region className="h-9" />}
{includeTrafficLight && (
<div data-tauri-drag-region className="h-9 flex items-center px-3">
{isLinux && <TrafficLights />}
</div>
)}
{tabs.map((tab) => {
const tabInfo = info(tab);
const Icon = tabInfo.icon;
Expand Down
2 changes: 2 additions & 0 deletions plugins/windows/src/window/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ impl WindowImpl for AppWindow {
let window = self
.window_builder(app, "/app/settings")
.resizable(true)
.minimizable(true)
.maximizable(true)
.min_inner_size(800.0, 600.0)
.build()?;

Expand Down
Loading