Skip to content

Commit 7eecaab

Browse files
committed
fix: fix merger layout error
1 parent 3caec5d commit 7eecaab

File tree

3 files changed

+25
-23
lines changed

3 files changed

+25
-23
lines changed

src/services/home/chat/index.tsx

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,17 @@ import { listChats } from "../../../api/chat";
1717
import TestSection from "./TestSection";
1818

1919
function HomePage() {
20+
const [viewportHeight, setViewportHeight] = useState(
21+
window.visualViewport?.height || window.innerHeight
22+
);
2023
useEffect(() => {
21-
const setViewportHeight = () => {
22-
const height = window.visualViewport?.height || window.innerHeight;
23-
const vh = height * 0.01;
24-
document.documentElement.style.setProperty("--vh", `${vh}px`);
25-
};
26-
27-
setViewportHeight();
28-
window.visualViewport?.addEventListener("resize", setViewportHeight);
29-
window.addEventListener("resize", setViewportHeight);
30-
31-
return () => {
32-
window.visualViewport?.removeEventListener("resize", setViewportHeight);
33-
window.removeEventListener("resize", setViewportHeight);
24+
const updateHeight = () => {
25+
setViewportHeight(window.visualViewport?.height || window.innerHeight);
3426
};
27+
updateHeight();
28+
window.visualViewport?.addEventListener("resize", updateHeight);
29+
return () =>
30+
window.visualViewport?.removeEventListener("resize", updateHeight);
3531
}, []);
3632

3733
const isKeyboardOpen = useKeyboardStore((state) => state.isKeyboardOpen);
@@ -179,14 +175,18 @@ function HomePage() {
179175
return (
180176
<main
181177
className="relative flex flex-col bg-white overflow-hidden"
182-
style={{ height: "calc(var(--vh, 1vh) * 100)" }}
178+
style={{ height: `${viewportHeight}px` }}
183179
>
184180
<div className="sticky top-0 w-full gap-4 px-4 py-4">
185181
<HeaderCard />
186182
</div>
187183
<div
188-
className="flex-1 w-full overflow-y-auto overflow-x-hidden flex flex-col gap-4 px-4 py-4 mb-12"
189-
style={{ WebkitOverflowScrolling: "touch", overscrollBehavior: "none" }}
184+
className="flex-1 w-full overflow-y-auto overflow-x-hidden flex flex-col gap-4 px-4 py-4"
185+
style={{
186+
WebkitOverflowScrolling: "touch",
187+
overscrollBehavior: "none",
188+
marginBottom: isKeyboardOpen ? 0 : "3rem",
189+
}}
190190
>
191191
<DateChip date={new Date()} />
192192
{isNewSession && (

src/services/home/test/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export default function DiagnosisTest({
9797
return (
9898
<main className="pt-16 mt-5">
9999
{step === "intro" && (
100-
<div className="z-10 pb-32 flex flex-col items-center">
100+
<div className="z-10 flex flex-col items-center">
101101
<StartCard type={type} />
102102
<CautionTypo />
103103
<div className="w-full px-4">
@@ -108,7 +108,7 @@ export default function DiagnosisTest({
108108
Start the Test
109109
</button>
110110
</div>
111-
<div className="absolute -z-10 bottom-0 w-full h-72 bg-gradient-to-b from-[#fffaf4]/20 to-[#f57c00]/20 pointer-events-none" />
111+
<div className="sticky bottom-0 -z-10 w-full h-72 bg-gradient-to-b from-[#fffaf4]/20 to-[#f57c00]/20 pointer-events-none" />
112112
</div>
113113
)}
114114

src/services/setting/index.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ import FAQSection from "./Question";
66

77
function SettingPage() {
88
return (
9-
<main className="flex flex-col gap-5 pb-52 pt-16 px-5 mt-5 bg-white">
10-
<GlobalNavigation />
11-
<LanguageSetting />
12-
<FAQSection />
13-
<PolicySection />
9+
<main className="pb-52 pt-16 mt-5 bg-white">
10+
<div className="flex flex-col items-center gap-5 w-full px-5">
11+
<GlobalNavigation />
12+
<LanguageSetting />
13+
<FAQSection />
14+
<PolicySection />
15+
</div>
1416
<BottomNavigation />
1517
</main>
1618
);

0 commit comments

Comments
 (0)