diff --git a/src/renderer/src/components/ui/button.tsx b/src/renderer/src/components/ui/button.tsx
index b64ea9c..6e48ec8 100644
--- a/src/renderer/src/components/ui/button.tsx
+++ b/src/renderer/src/components/ui/button.tsx
@@ -17,7 +17,8 @@ const buttonVariants = cva(
ghost: 'text-muted-foreground hover:bg-accent hover:text-foreground',
link: 'text-primary underline-offset-4 hover:underline',
titlebar: 'non-draggable hover:bg-accent hover:text-accent-foreground',
- sidebar: 'non-draggable hover:bg-accent hover:text-accent-foreground'
+ sidebar: 'non-draggable hover:bg-accent hover:text-accent-foreground',
+ 'small-screen-titlebar': 'non-draggable hover:bg-accent hover:text-accent-foreground'
},
size: {
default: 'h-8 rounded-lg px-3',
@@ -25,7 +26,8 @@ const buttonVariants = cva(
lg: 'h-10 px-4 py-2',
icon: 'h-8 w-8 rounded-full',
titlebar: 'h-7 w-7 rounded-full',
- sidebar: 'w-full flex py-2 px-4 rounded-full justify-start gap-4 text-lg font-semibold'
+ sidebar: 'w-full flex py-2 px-4 rounded-full justify-start gap-4 text-lg font-semibold',
+ 'small-screen-titlebar': 'h-8 w-8 rounded-full'
}
},
defaultVariants: {
diff --git a/src/renderer/src/components/ui/command.tsx b/src/renderer/src/components/ui/command.tsx
index a338194..077eb7c 100644
--- a/src/renderer/src/components/ui/command.tsx
+++ b/src/renderer/src/components/ui/command.tsx
@@ -41,7 +41,7 @@ const CommandDialog = ({
diff --git a/src/renderer/src/components/ui/dialog.tsx b/src/renderer/src/components/ui/dialog.tsx
index 4e1b4f4..22442f2 100644
--- a/src/renderer/src/components/ui/dialog.tsx
+++ b/src/renderer/src/components/ui/dialog.tsx
@@ -37,7 +37,7 @@ const DialogContent = React.forwardRef<
e.stopPropagation()}
diff --git a/src/renderer/src/components/ui/dropdown-menu.tsx b/src/renderer/src/components/ui/dropdown-menu.tsx
index 08226ce..c23fb01 100644
--- a/src/renderer/src/components/ui/dropdown-menu.tsx
+++ b/src/renderer/src/components/ui/dropdown-menu.tsx
@@ -64,6 +64,7 @@ const DropdownMenuContent = React.forwardRef<
'z-50 min-w-[8rem] overflow-hidden rounded-lg border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
className
)}
+ collisionPadding={10}
{...props}
/>
diff --git a/src/renderer/src/layouts/PrimaryPageLayout/index.tsx b/src/renderer/src/layouts/PrimaryPageLayout/index.tsx
index 932d13d..a081b7e 100644
--- a/src/renderer/src/layouts/PrimaryPageLayout/index.tsx
+++ b/src/renderer/src/layouts/PrimaryPageLayout/index.tsx
@@ -4,15 +4,18 @@ import RefreshButton from '@renderer/components/RefreshButton'
import RelaySettingsButton from '@renderer/components/RelaySettingsButton'
import ScrollToTopButton from '@renderer/components/ScrollToTopButton'
import SearchButton from '@renderer/components/SearchButton'
+import ThemeToggle from '@renderer/components/ThemeToggle'
import { Titlebar } from '@renderer/components/Titlebar'
import { ScrollArea } from '@renderer/components/ui/scroll-area'
import { isMacOS } from '@renderer/lib/env'
import { cn } from '@renderer/lib/utils'
import { useScreenSize } from '@renderer/providers/ScreenSizeProvider'
-import { forwardRef, useImperativeHandle, useRef } from 'react'
+import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react'
const PrimaryPageLayout = forwardRef(({ children }: { children?: React.ReactNode }, ref) => {
const scrollAreaRef = useRef(null)
+ const [visible, setVisible] = useState(true)
+ const [lastScrollTop, setLastScrollTop] = useState(0)
useImperativeHandle(
ref,
@@ -24,17 +27,36 @@ const PrimaryPageLayout = forwardRef(({ children }: { children?: React.ReactNode
[]
)
+ useEffect(() => {
+ const handleScroll = () => {
+ const scrollTop = scrollAreaRef.current?.scrollTop || 0
+ if (scrollTop > lastScrollTop) {
+ setVisible(false)
+ } else {
+ setVisible(true)
+ }
+ setLastScrollTop(scrollTop)
+ }
+
+ const scrollArea = scrollAreaRef.current
+ scrollArea?.addEventListener('scroll', handleScroll)
+
+ return () => {
+ scrollArea?.removeEventListener('scroll', handleScroll)
+ }
+ }, [lastScrollTop])
+
return (
-
-
+
+
{children}
-
+
)
})
@@ -45,18 +67,24 @@ export type TPrimaryPageLayoutRef = {
scrollToTop: () => void
}
-function PrimaryPageTitlebar() {
+function PrimaryPageTitlebar({ visible = true }: { visible?: boolean }) {
const { isSmallScreen } = useScreenSize()
if (isSmallScreen) {
return (
-
- Jumble
-
-
-
-
-
+
+
+
)
diff --git a/src/renderer/src/layouts/SecondaryPageLayout/index.tsx b/src/renderer/src/layouts/SecondaryPageLayout/index.tsx
index 3880583..889a00e 100644
--- a/src/renderer/src/layouts/SecondaryPageLayout/index.tsx
+++ b/src/renderer/src/layouts/SecondaryPageLayout/index.tsx
@@ -6,7 +6,7 @@ import { ScrollArea } from '@renderer/components/ui/scroll-area'
import { isMacOS } from '@renderer/lib/env'
import { cn } from '@renderer/lib/utils'
import { useScreenSize } from '@renderer/providers/ScreenSizeProvider'
-import { useRef } from 'react'
+import { useEffect, useRef, useState } from 'react'
export default function SecondaryPageLayout({
children,
@@ -18,30 +18,58 @@ export default function SecondaryPageLayout({
hideBackButton?: boolean
}): JSX.Element {
const scrollAreaRef = useRef
(null)
+ const [visible, setVisible] = useState(true)
+ const [lastScrollTop, setLastScrollTop] = useState(0)
+
+ useEffect(() => {
+ const handleScroll = () => {
+ const scrollTop = scrollAreaRef.current?.scrollTop || 0
+ if (scrollTop > lastScrollTop) {
+ setVisible(false)
+ } else {
+ setVisible(true)
+ }
+ setLastScrollTop(scrollTop)
+ }
+
+ const scrollArea = scrollAreaRef.current
+ scrollArea?.addEventListener('scroll', handleScroll)
+
+ return () => {
+ scrollArea?.removeEventListener('scroll', handleScroll)
+ }
+ }, [lastScrollTop])
+
return (
-
+
{children}
-
+
)
}
export function SecondaryPageTitlebar({
content,
- hideBackButton = false
+ hideBackButton = false,
+ visible = true
}: {
content?: React.ReactNode
hideBackButton?: boolean
+ visible?: boolean
}): JSX.Element {
const { isSmallScreen } = useScreenSize()
if (isSmallScreen) {
return (
-
-
+
+
{content}
)
diff --git a/src/renderer/src/pages/secondary/NotePage/index.tsx b/src/renderer/src/pages/secondary/NotePage/index.tsx
index 8d89e46..8fbc233 100644
--- a/src/renderer/src/pages/secondary/NotePage/index.tsx
+++ b/src/renderer/src/pages/secondary/NotePage/index.tsx
@@ -38,7 +38,7 @@ export default function NotePage({ id }: { id?: string }) {
-
+
)