style(web): 统一移动端视口与编辑器样式
- 将邮件、个人中心与规则弹窗从 `100dvh` 调整为 `h-svh`,减少移动端视口抖动。 - 优化邮件正文编辑器的基础布局与滚动样式,提升输入区可用性。 - 移除 `protected-layout` 中切换路由时自动关闭移动侧栏的逻辑。
This commit is contained in:
@@ -133,15 +133,6 @@ function ProtectedContent() {
|
|||||||
|
|
||||||
function AdminSectionItems({ activeSection }: { activeSection: string }) {
|
function AdminSectionItems({ activeSection }: { activeSection: string }) {
|
||||||
const { isMobile, setOpenMobile } = useSidebar()
|
const { isMobile, setOpenMobile } = useSidebar()
|
||||||
const location = useLocation()
|
|
||||||
const locationKey = `${location.pathname}${location.search}`
|
|
||||||
const previousLocationKey = React.useRef(locationKey)
|
|
||||||
|
|
||||||
React.useEffect(() => {
|
|
||||||
const previous = previousLocationKey.current
|
|
||||||
previousLocationKey.current = locationKey
|
|
||||||
if (isMobile && previous !== locationKey) setOpenMobile(false)
|
|
||||||
}, [isMobile, locationKey, setOpenMobile])
|
|
||||||
|
|
||||||
function closeMobile() {
|
function closeMobile() {
|
||||||
if (isMobile) setOpenMobile(false)
|
if (isMobile) setOpenMobile(false)
|
||||||
|
|||||||
@@ -748,7 +748,7 @@ export function MailPage() {
|
|||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="h-[100dvh] overflow-hidden bg-background">
|
<div className="h-svh overflow-hidden bg-background">
|
||||||
<SidebarProvider className="h-full min-h-0 w-full">
|
<SidebarProvider className="h-full min-h-0 w-full">
|
||||||
{isMobile ? (
|
{isMobile ? (
|
||||||
<div className="flex h-full min-h-0 flex-col">
|
<div className="flex h-full min-h-0 flex-col">
|
||||||
@@ -760,7 +760,7 @@ export function MailPage() {
|
|||||||
</SheetTrigger>
|
</SheetTrigger>
|
||||||
<SheetContent side="left" className="w-[86vw] max-w-80 p-0 [&>button]:hidden" aria-describedby={undefined}>
|
<SheetContent side="left" className="w-[86vw] max-w-80 p-0 [&>button]:hidden" aria-describedby={undefined}>
|
||||||
<SheetTitle className="sr-only">邮箱导航</SheetTitle>
|
<SheetTitle className="sr-only">邮箱导航</SheetTitle>
|
||||||
<div className="h-[100dvh]">{sidebarContent}</div>
|
<div className="h-svh">{sidebarContent}</div>
|
||||||
</SheetContent>
|
</SheetContent>
|
||||||
</Sheet>
|
</Sheet>
|
||||||
<Button size="icon" variant="ghost" onClick={refreshMail} disabled={refreshing || autoRefreshing} className={cn("transition-all", (refreshing || autoRefreshing) && "bg-primary/5 text-primary")} title={autoRefreshing ? "自动刷新中" : "刷新邮件"}>
|
<Button size="icon" variant="ghost" onClick={refreshMail} disabled={refreshing || autoRefreshing} className={cn("transition-all", (refreshing || autoRefreshing) && "bg-primary/5 text-primary")} title={autoRefreshing ? "自动刷新中" : "刷新邮件"}>
|
||||||
@@ -1767,7 +1767,7 @@ function ComposeDialog({ mailbox, open, draft, onOpenChange, onSent }: { mailbox
|
|||||||
return (
|
return (
|
||||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
<Dialog open={open} onOpenChange={onOpenChange}>
|
||||||
<DialogContent
|
<DialogContent
|
||||||
className="flex h-[100dvh] w-screen max-w-none overflow-hidden p-0 sm:h-auto sm:max-h-[92vh] sm:w-[min(96vw,82rem)]"
|
className="flex h-svh w-screen max-w-none overflow-hidden p-0 sm:h-auto sm:max-h-[92vh] sm:w-[min(96vw,82rem)]"
|
||||||
onInteractOutside={(event) => event.preventDefault()}
|
onInteractOutside={(event) => event.preventDefault()}
|
||||||
onPointerDownOutside={(event) => event.preventDefault()}
|
onPointerDownOutside={(event) => event.preventDefault()}
|
||||||
>
|
>
|
||||||
@@ -2090,7 +2090,7 @@ function MailBodyComposer({ defaultValue, defaultHtml, files, signatureText, onC
|
|||||||
content: composerInitialHtml(defaultValue, defaultHtml),
|
content: composerInitialHtml(defaultValue, defaultHtml),
|
||||||
editorProps: {
|
editorProps: {
|
||||||
attributes: {
|
attributes: {
|
||||||
class: "mail-html w-full outline-none",
|
class: "mail-html min-h-[240px] min-w-0 flex-1 overflow-y-auto px-4 py-4 text-base leading-7 outline-none sm:min-h-[280px] sm:px-6 sm:py-5",
|
||||||
"aria-label": "正文",
|
"aria-label": "正文",
|
||||||
},
|
},
|
||||||
handlePaste(view, event) {
|
handlePaste(view, event) {
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ export function ProfilePage() {
|
|||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="h-[100dvh] overflow-hidden bg-background">
|
<div className="h-svh overflow-hidden bg-background">
|
||||||
<SidebarProvider className="h-full min-h-0 w-full">
|
<SidebarProvider className="h-full min-h-0 w-full">
|
||||||
{isMobile ? (
|
{isMobile ? (
|
||||||
<div className="flex h-full min-h-0 flex-col">
|
<div className="flex h-full min-h-0 flex-col">
|
||||||
@@ -236,7 +236,7 @@ export function ProfilePage() {
|
|||||||
</SheetTrigger>
|
</SheetTrigger>
|
||||||
<SheetContent side="left" className="w-[86vw] max-w-80 p-0 [&>button]:hidden" aria-describedby={undefined}>
|
<SheetContent side="left" className="w-[86vw] max-w-80 p-0 [&>button]:hidden" aria-describedby={undefined}>
|
||||||
<SheetTitle className="sr-only">个人中心导航</SheetTitle>
|
<SheetTitle className="sr-only">个人中心导航</SheetTitle>
|
||||||
<div className="h-[100dvh]">{sidebarContent}</div>
|
<div className="h-svh">{sidebarContent}</div>
|
||||||
</SheetContent>
|
</SheetContent>
|
||||||
</Sheet>
|
</Sheet>
|
||||||
<div className="min-w-0 flex-1 text-sm font-semibold">{tabs[tab].label}</div>
|
<div className="min-w-0 flex-1 text-sm font-semibold">{tabs[tab].label}</div>
|
||||||
@@ -826,7 +826,7 @@ function RuleDialog({ open, onOpenChange, mailboxes, labels, pending, onCreate }
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
<Dialog open={open} onOpenChange={onOpenChange}>
|
||||||
<DialogContent className="flex h-[100dvh] w-screen max-w-none gap-0 overflow-hidden p-0 sm:h-auto sm:max-h-[92vh] sm:w-[min(94vw,84rem)]">
|
<DialogContent className="flex h-svh w-screen max-w-none gap-0 overflow-hidden p-0 sm:h-auto sm:max-h-[92vh] sm:w-[min(94vw,84rem)]">
|
||||||
<DialogHeader className="border-b px-4 py-4 text-left sm:px-8 sm:py-6">
|
<DialogHeader className="border-b px-4 py-4 text-left sm:px-8 sm:py-6">
|
||||||
<DialogTitle className="text-xl sm:text-2xl">新建规则</DialogTitle>
|
<DialogTitle className="text-xl sm:text-2xl">新建规则</DialogTitle>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
|
|||||||
Reference in New Issue
Block a user