Skip to content
Open
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
14 changes: 12 additions & 2 deletions apps/web/src/components/title-bar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,23 @@ export function getWindowControls(
];
}
export const TITLE_BAR_HEIGHT = 37;
export function TitleBar({ isUnderlay = isMac() }: { isUnderlay?: boolean }) {
export function TitleBar({
isUnderlay = isMac(),
force = false
}: {
isUnderlay?: boolean;
force?: boolean;
}) {
const { isFullscreen, hasNativeWindowControls, isMaximized } =
useWindowControls();
const isTablet = useTablet();
const isMobile = useMobile();
if ((!isMac() && !isMobile && !isTablet) || (isFullscreen && isMac()))
if (
!force &&
((!isMac() && !isMobile && !isTablet) || (isFullscreen && isMac()))
) {
return null;
}

const tools = getWindowControls(
hasNativeWindowControls,
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { desktop } from "./common/desktop-bridge";
import { useKeyStore } from "./interfaces/key-store";
import Config from "./utils/config";
import { usePromise } from "@notesnook/common";
import { AuthProps } from "./views/auth";
import { AuthProps, isAuthRouteActive } from "./views/auth";
import { loadDatabase } from "./hooks/use-database";
import AppLock from "./views/app-lock";
import { Text } from "@theme-ui/components";
Expand Down Expand Up @@ -58,7 +58,7 @@ export async function startApp(children?: React.ReactNode) {

root.render(
<>
<TitleBar />
<TitleBar force={isAuthRouteActive()} />
<ErrorBoundary>
<GlobalErrorHandler>
<BaseThemeProvider
Expand Down
12 changes: 11 additions & 1 deletion apps/web/src/views/auth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ import {
Warn
} from "../components/icons";
import Field, { FieldProps } from "../components/field";
import { getQueryParams, hardNavigate, makeURL } from "../navigation";
import {
getCurrentPath,
getQueryParams,
hardNavigate,
makeURL
} from "../navigation";
import { store as userstore } from "../stores/user-store";
import { db } from "../common/db";
import Config from "../utils/config";
Expand Down Expand Up @@ -163,6 +168,11 @@ const routePaths: Record<AuthRoutes, string> = {
signup: "/signup"
};

export function isAuthRouteActive() {
const path = getCurrentPath();
return Object.values(routePaths).includes(path);
}

const authorizedRoutes: AuthRoutes[] = [
"login:email",
"login:password",
Expand Down
Loading