Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

web: fix integrated titlebar on windows

Abdullah Atta53b89a59ed78
diff --git a/apps/web/src/components/editor/action-bar.tsx b/apps/web/src/components/editor/action-bar.tsx
index 5263da1e1..2a3302ca9 100644
--- a/apps/web/src/components/editor/action-bar.tsx
+++ b/apps/web/src/components/editor/action-bar.tsx
@@ -81,6 +81,7 @@ import useMobile from "../../hooks/use-mobile";
import { strings } from "@notesnook/intl";
import { TITLE_BAR_HEIGHT, getWindowControls } from "../title-bar";
import useTablet from "../../hooks/use-tablet";
+import { isMac } from "../../utils/platform";
export function EditorActionBar() {
const { isMaximized, isFullscreen, hasNativeWindowControls } =
@@ -230,35 +231,46 @@ export function EditorActionBar() {
) : (
<TabStrip />
)}
- {tools.map((tool) => (
- <Button
- data-test-id={tool.title}
- disabled={!tool.enabled}
- variant={tool.title === "Close" ? "error" : "secondary"}
- title={tool.title}
- key={tool.title}
- sx={{
- height: "100%",
- alignItems: "center",
- bg: "transparent",
- display: [
- "hideOnMobile" in tool && tool.hideOnMobile ? "none" : "flex",
- tool.hidden ? "none" : "flex"
- ],
- borderRadius: 0,
- flexShrink: 0,
- "&:hover svg path": {
- fill:
- tool.title === "Close"
- ? "var(--accentForeground-error) !important"
- : "var(--icon)"
- }
- }}
- onClick={tool.onClick}
- >
- <tool.icon size={18} />
- </Button>
- ))}
+ <Flex
+ sx={{
+ alignItems: "center",
+ justifyContent: "center",
+ mr:
+ hasNativeWindowControls && !isMac() && !isMobile && !isTablet
+ ? `calc(100vw - env(titlebar-area-width))`
+ : 0
+ }}
+ >
+ {tools.map((tool) => (
+ <Button
+ data-test-id={tool.title}
+ disabled={!tool.enabled}
+ variant={tool.title === "Close" ? "error" : "secondary"}
+ title={tool.title}
+ key={tool.title}
+ sx={{
+ height: "100%",
+ alignItems: "center",
+ bg: "transparent",
+ display: [
+ "hideOnMobile" in tool && tool.hideOnMobile ? "none" : "flex",
+ tool.hidden ? "none" : "flex"
+ ],
+ borderRadius: 0,
+ flexShrink: 0,
+ "&:hover svg path": {
+ fill:
+ tool.title === "Close"
+ ? "var(--accentForeground-error) !important"
+ : "var(--icon)"
+ }
+ }}
+ onClick={tool.onClick}
+ >
+ <tool.icon size={18} />
+ </Button>
+ ))}
+ </Flex>
</>
);
}
diff --git a/apps/web/src/components/title-bar/index.tsx b/apps/web/src/components/title-bar/index.tsx
index a1fa63bd1..be2631e56 100644
--- a/apps/web/src/components/title-bar/index.tsx
+++ b/apps/web/src/components/title-bar/index.tsx
@@ -73,12 +73,7 @@ export function TitleBar({ isUnderlay = isMac() }: { isUnderlay?: boolean }) {
useWindowControls();
const isTablet = useTablet();
const isMobile = useMobile();
- if (
- (!isMobile && !isTablet) ||
- hasNativeWindowControls ||
- (isFullscreen && isMac())
- )
- return null;
+ if ((!isMobile && !isTablet) || (isFullscreen && isMac())) return null;
const tools = getWindowControls(
hasNativeWindowControls,