feat: custom in-app titlebar with overlay window chrome
- macOS: titleBarStyle Overlay + hiddenTitle, traffic lights aligned with the header - header itself is the titlebar: draggable regions, no native glass strip - solid (not blurred) header surfaces once content scrolls - keep traffic lights clear of controls on library/login/settings pages
This commit is contained in:
1 parent
61ebc66127
commit
1c499f42ec
9 files changed
+52
-50
No files matched your search
@@ -1,50 +1,33 @@
|
||||
|
||||
.appBar {
|
||||
// Limit transitions to cheaper properties; avoid animating box-shadow directly
|
||||
// Custom titlebar: the app header itself sits at the very top of the window,
|
||||
// under the native overlay titlebar (no native glass strip, no blur panels).
|
||||
transition: background-color $transition-time-fast;
|
||||
padding: 0.8em ($page-margin - 1.7em);
|
||||
z-index: 999 !important;
|
||||
top: 0 !important;
|
||||
|
||||
// Keep the left controls clear of the macOS traffic lights.
|
||||
html.is-macos & {
|
||||
padding-left: calc(#{$page-margin} - 1.7em + 72px);
|
||||
}
|
||||
|
||||
.flex {
|
||||
// Avoid animating padding; it causes layout reflow on each frame.
|
||||
transition: background-color $transition-time-fast;
|
||||
// Avoid using will-change: scroll-position; it can degrade performance when misused
|
||||
// will-change: opacity, transform;
|
||||
border-radius: 1000px;
|
||||
position: relative;
|
||||
|
||||
// Pseudo-element handles elevation shadow; we animate its opacity
|
||||
&::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset: -0.35em;
|
||||
pointer-events: none;
|
||||
border-radius: inherit;
|
||||
|
||||
@include glass-effect;
|
||||
|
||||
opacity: 0;
|
||||
z-index: -1;
|
||||
transition: all $transition-time-fast;
|
||||
}
|
||||
}
|
||||
|
||||
// Inner content wrapper that we can scale without causing layout reflow
|
||||
.flex-inner {
|
||||
transform-origin: top center;
|
||||
transition: transform $transition-time-fast;
|
||||
// Solid, part-of-the-screen titlebar background once the page scrolls.
|
||||
&.elevated {
|
||||
background-color: $clr-background-default !important;
|
||||
border-bottom: 1px solid rgb(255 255 255 / 0.06);
|
||||
box-shadow: none !important;
|
||||
background-image: none !important;
|
||||
backdrop-filter: none !important;
|
||||
}
|
||||
&.elevated{
|
||||
.flex {
|
||||
&::after {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Apply a subtle scale to simulate shrink without layout changes
|
||||
.flex-inner {
|
||||
transform: scaleY(0.95);
|
||||
}
|
||||
}
|
||||
&-avatar {
|
||||
background: rgb(255 255 255 / 0.1) !important;
|
||||
&-icon {
|
||||
|
||||
@@ -2,7 +2,7 @@ import MuiAppBar from "@mui/material/AppBar";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import useScrollTrigger from "@mui/material/useScrollTrigger";
|
||||
import { useLocation, useNavigate } from "@tanstack/react-router";
|
||||
import React, { useCallback, useMemo, useState } from "react";
|
||||
import React, { useCallback, useState } from "react";
|
||||
|
||||
import "./appBar.scss";
|
||||
|
||||
@@ -51,13 +51,6 @@ export const AppBar = () => {
|
||||
|
||||
const [showDrawer, setShowDrawer] = useState(false);
|
||||
|
||||
const appBarStyling = useMemo(() => {
|
||||
return {
|
||||
backgroundColor: "transparent",
|
||||
paddingRight: "0 !important",
|
||||
};
|
||||
}, []);
|
||||
|
||||
const _handleNavigateToSearch = useCallback(
|
||||
() => navigate({ to: "/search", search: { query: "" } }),
|
||||
[navigate],
|
||||
@@ -85,7 +78,7 @@ export const AppBar = () => {
|
||||
return (
|
||||
<>
|
||||
<MuiAppBar
|
||||
style={appBarStyling}
|
||||
data-tauri-drag-region
|
||||
className={
|
||||
trigger
|
||||
? "appBar flex flex-row flex-justify-spaced-between elevated"
|
||||
@@ -94,7 +87,7 @@ export const AppBar = () => {
|
||||
elevation={0}
|
||||
color="transparent"
|
||||
>
|
||||
<div className="flex flex-row" style={{ gap: "0.6em" }}>
|
||||
<div className="flex flex-row" data-tauri-drag-region style={{ gap: "0.6em" }}>
|
||||
<IconButton onClick={handleDrawerOpen}>
|
||||
<span className="material-symbols-rounded">menu</span>
|
||||
</IconButton>
|
||||
@@ -112,7 +105,7 @@ export const AppBar = () => {
|
||||
</IconButton>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-row" style={{ gap: "0.6em" }}>
|
||||
<div className="flex flex-row" data-tauri-drag-region style={{ gap: "0.6em" }}>
|
||||
<IconButton onClick={toggleSearchDialog}>
|
||||
<span className="material-symbols-rounded">search</span>
|
||||
</IconButton>
|
||||
|
||||
@@ -258,6 +258,7 @@ export const LibraryHeader = () => {
|
||||
return (
|
||||
<>
|
||||
<AppBar
|
||||
data-tauri-drag-region
|
||||
className={
|
||||
scrollTrigger
|
||||
? "library-header scrolling flex flex-row"
|
||||
@@ -267,7 +268,7 @@ export const LibraryHeader = () => {
|
||||
elevation={0}
|
||||
color="transparent"
|
||||
>
|
||||
<div className="flex flex-row" style={{ gap: "0.6em" }}>
|
||||
<div className="flex flex-row" data-tauri-drag-region style={{ gap: "0.6em" }}>
|
||||
<IconButton onClick={handleDrawerOpen}>
|
||||
<div className="material-symbols-rounded">menu</div>
|
||||
</IconButton>
|
||||
|
||||
@@ -11,6 +11,15 @@
|
||||
z-index: 10;
|
||||
padding: 0.25em !important;
|
||||
transition: all 0.2s ease-in-out;
|
||||
|
||||
html.is-macos & {
|
||||
// The window has an overlay titlebar: keep controls clear of the traffic lights
|
||||
// without pushing the right-hand actions out of the viewport.
|
||||
padding-left: 72px !important;
|
||||
width: calc(100vw - 4em - 72px) !important;
|
||||
left: calc(2em + 72px) !important;
|
||||
right: 2em !important;
|
||||
}
|
||||
|
||||
&::after {
|
||||
content: "";
|
||||
@@ -18,10 +27,13 @@
|
||||
inset: -0.35em;
|
||||
pointer-events: none;
|
||||
border-radius: inherit;
|
||||
@include glass-effect;
|
||||
// Solid titlebar surface: no glass/blur.
|
||||
background-color: $clr-background-default;
|
||||
border: 1px solid rgb(255 255 255 / 0.08);
|
||||
box-shadow: 0 4px 20px rgb(0 0 0 / 0.4);
|
||||
opacity: 0;
|
||||
z-index: -1;
|
||||
transition: all 150ms;
|
||||
transition: opacity 150ms;
|
||||
}
|
||||
&.scrolling {
|
||||
&::after {
|
||||
|
||||
@@ -51,7 +51,7 @@ const LoginShell = ({
|
||||
const serverHost = api?.basePath.replace(/^https?:\/\//, "");
|
||||
|
||||
return (
|
||||
<div className="login-shell scrollY">
|
||||
<div className="login-shell scrollY" data-tauri-drag-region>
|
||||
<div className={`login-shell-content login-shell-${width}`}>
|
||||
{serverHost && (
|
||||
<div className="login-shell-server">
|
||||
|
||||
@@ -95,6 +95,11 @@ function ProviderWrapper() {
|
||||
}
|
||||
|
||||
const init = async () => {
|
||||
// The window is frameless-ish on macOS (overlay titlebar): the app header is the titlebar.
|
||||
if (navigator.userAgent.includes("Macintosh")) {
|
||||
document.documentElement.classList.add("is-macos");
|
||||
}
|
||||
|
||||
const initialApi = await initializeApi();
|
||||
|
||||
ReactDOM.createRoot(document.getElementById("root")!).render(
|
||||
|
||||
@@ -62,6 +62,11 @@
|
||||
padding: 1.5em 1em; // Reduced padding
|
||||
gap: 1em; // Reduced gap
|
||||
|
||||
html.is-macos & {
|
||||
// Overlay titlebar: leave room for the traffic lights.
|
||||
padding-top: 2.9em;
|
||||
}
|
||||
|
||||
&-controls {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
@@ -26,7 +26,7 @@ function SettingsRoute() {
|
||||
navigate({ to: "/home" });
|
||||
}, []);
|
||||
return (
|
||||
<div className="settings-page-container">
|
||||
<div className="settings-page-container" data-tauri-drag-region>
|
||||
<div className="settings-sidebar">
|
||||
<div className="settings-sidebar-controls">
|
||||
<BackButton />
|
||||
|
||||
Reference in new issue
Block a user