Skip to content

Commit 320d084

Browse files
committed
feat: add functional title bar
Signed-off-by: tylerslaton <[email protected]>
1 parent 1d1e853 commit 320d084

File tree

8 files changed

+30
-30
lines changed

8 files changed

+30
-30
lines changed

app/edit/layout.tsx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
1-
export default function RunLayout({
2-
children,
3-
}: {
4-
children: React.ReactNode;
5-
}) {
1+
export default function EditLayout({children}: {children: React.ReactNode}) {
62
return (
7-
<section className="absolute left-0 top-16">
8-
<div className="border-t-1 border-gray-300 dark:border-zinc-900"
9-
style={{width: `100vw`, height: `calc(100vh - 64px)`}}
10-
>
3+
<section className="absolute left-0 top-[90px]">
4+
<div className="border-t-1 border-gray-300 dark:border-zinc-900" style={{width: `100vw`, height: `calc(100vh - 90px)`}}>
115
{children}
126
</div>
137
</section>

app/explore/layout.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
export default function RunLayout({
2-
children,
3-
}: {
4-
children: React.ReactNode;
5-
}) {
1+
export default function ExploreLayout({children}: {children: React.ReactNode}) {
62
return (
7-
<section>
8-
{children}
3+
<section className="absolute left-0 top-[90px]">
4+
<div className="border-t-1 dark:border-zinc-800" style={{width: `100vw`, height: `calc(100vh - 90px)`}}>
5+
{children}
6+
</div>
97
</section>
108
);
119
}

app/explore/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export default function Explore() {
7676
useEffect(() => { refresh() }, [authenticated]);
7777

7878
return (
79-
<div className="w-full h-full">
79+
<div className="w-3/4 px-10 h-full overflow-y-scroll mx-auto pt-10">
8080
<div>
8181
<div className="flex space-x-4 mb-4">
8282
<Select radius="lg" label="Owners" color="primary" isDisabled={!owners.length} size="sm" aria-label="owners" selectionMode="multiple" className="w-1/6" variant="bordered" classNames={{label: 'text-gray-500 dark:text-gray-400', value:'text-black dark:text-white'}}

app/layout.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {fontSans} from "@/config/fonts";
55
import {Providers} from "./providers";
66
import {Navbar} from "@/components/navbar";
77
import clsx from "clsx";
8+
import TitleBar from "@/components/titlebar";
89

910
export const metadata: Metadata = {
1011
title: {
@@ -24,11 +25,7 @@ export const viewport: Viewport = {
2425
],
2526
}
2627

27-
export default function RootLayout({
28-
children,
29-
}: {
30-
children: React.ReactNode;
31-
}) {
28+
export default function RootLayout({children}: {children: React.ReactNode}) {
3229
return (
3330
<html lang="en" suppressHydrationWarning>
3431
<head/>
@@ -40,6 +37,7 @@ export default function RootLayout({
4037
>
4138
<Providers themeProps={{attribute: "class", defaultTheme: "dark"}}>
4239
<div className="relative flex flex-col h-screen overflow-auto order-transparent">
40+
<TitleBar/>
4341
<Navbar/>
4442
<main className="container mx-auto max-w-7xl pt-16 px-6 flex-grow">
4543
{children}

app/run/layout.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
export default function RunLayout({
2-
children,
3-
}: {
4-
children: React.ReactNode;
5-
}) {
1+
export default function RunLayout({children}: {children: React.ReactNode}) {
62
return (
7-
<section className="absolute left-0 top-16">
8-
<div className="border-t-1 dark:border-zinc-800" style={{width: `100vw`, height: `calc(100vh - 66px)`}}>
3+
<section className="absolute left-0 top-[90px]">
4+
<div className="border-t-1 dark:border-zinc-800" style={{width: `100vw`, height: `calc(100vh - 90px)`}}>
95
{children}
106
</div>
117
</section>

components/navbar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import {Logo} from "@/components/icons";
2424

2525
export const Navbar = () => {
2626
return (
27-
<NextUINavbar maxWidth="xl" position="sticky">
27+
<NextUINavbar maxWidth="xl" height="10px" position="sticky">
2828
<NavbarContent className="basis-1/5 sm:basis-full" justify="start">
2929
<NavbarBrand as="li" className="gap-3 max-w-fit">
3030
<NextLink className="flex justify-start items-center gap-1" href="/">

components/titlebar.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
"use client";
2+
import React, { useEffect } from 'react';
3+
4+
const TitleBar: React.FC = () => {
5+
useEffect(() => {
6+
document.getElementById("drag-bar")?.style.setProperty("-webkit-app-region", "drag");
7+
}, []);
8+
9+
return <div id="drag-bar" className="w-full h-10"/>
10+
};
11+
12+
export default TitleBar;

electron/main.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ function createWindow(url) {
6262
}
6363
});
6464

65+
win.setWindowButtonVisibility(true)
66+
6567
win.loadURL(url);
6668
win.webContents.on("did-fail-load", () => win.webContents.reloadIgnoringCache());
6769
}

0 commit comments

Comments
 (0)