MIF7T-1/MIF7T-7 收口真机反馈并统一移动体验
这个提交包含在:
@@ -1,4 +1,6 @@
|
||||
import type { ReactNode } from "react";
|
||||
import { useEffect } from "react";
|
||||
import { ArrowLeft } from "lucide-react";
|
||||
import { useLocation, useNavigate } from "react-router-dom";
|
||||
|
||||
import { Button } from "../ui/button";
|
||||
@@ -26,14 +28,26 @@ export function MobileDetailHeader({ title, subtitle, status, fallbackTo, testId
|
||||
const currentPath = `${location.pathname}${location.search}`;
|
||||
const from = isSafeMobileSource(state?.from, currentPath) ? state?.from : null;
|
||||
|
||||
useEffect(() => {
|
||||
const scrollToTop = () => {
|
||||
window.scrollTo({ top: 0, behavior: "auto" });
|
||||
document.querySelector<HTMLElement>(".hyb-mobile-shell .overflow-y-auto")?.scrollTo({ top: 0, behavior: "auto" });
|
||||
};
|
||||
|
||||
scrollToTop();
|
||||
const frameId = window.requestAnimationFrame(scrollToTop);
|
||||
return () => window.cancelAnimationFrame(frameId);
|
||||
}, [currentPath]);
|
||||
|
||||
const handleBack = () => {
|
||||
navigate(from ?? fallbackTo, { replace: true });
|
||||
};
|
||||
|
||||
return (
|
||||
<header className="mobile-detail-header flex min-h-12 items-center gap-3" data-testid={testId}>
|
||||
<Button className="shrink-0 px-3" size="sm" type="button" variant="secondary" onClick={handleBack}>
|
||||
返回
|
||||
<Button className="min-h-11 shrink-0 gap-1 px-3" size="sm" type="button" variant="secondary" onClick={handleBack}>
|
||||
<ArrowLeft aria-hidden="true" className="size-4" />
|
||||
<span>返回</span>
|
||||
</Button>
|
||||
<div className="min-w-0 flex-1">
|
||||
<div className="truncate text-base font-semibold text-zinc-900">{title}</div>
|
||||
|
||||
在新工单中引用
屏蔽一个用户