fix:contract page

This commit is contained in:
Nathnael
2026-08-13 19:13:18 +00:00
parent 147887b7c5
commit 6cee9a2676
2 changed files with 42 additions and 27 deletions

View File

@@ -33,8 +33,6 @@ import { contractsService } from "@/services/contracts.service";
import { api } from "@/services/api"; import { api } from "@/services/api";
import { extractApiError } from "@/utils/result"; import { extractApiError } from "@/utils/result";
import "./contract-sign-bar.css";
const CONSENT_TEXT = "I have read the entire contract and agree to its terms."; const CONSENT_TEXT = "I have read the entire contract and agree to its terms.";
/** /**
@@ -227,9 +225,29 @@ export default function ContractViewPage() {
return ( return (
<Box <Box
p={{ base: "md", md: "xl" }} p={{ base: "md", md: "xl" }}
pb={data.canSignCustomer ? { base: 220, sm: 160, md: 120 } : undefined} style={{
// Lock the page to the viewport so the contract iframe is the ONLY
// scroll container — page scroll + iframe scroll together made the
// sign flow slippery. The negative margin cancels AppShell.Main's
// global 112px bottom clearance (see AppLayout) for this page only;
// the sign bar below already keeps content clear of the chat FAB.
height: "calc(100dvh - var(--app-shell-header-offset, 72px))",
marginBottom: -112,
display: "flex",
flexDirection: "column",
}}
> >
<Box maw={920} mx="auto"> <Box
maw={920}
mx="auto"
w="100%"
style={{
flex: 1,
minHeight: 0,
display: "flex",
flexDirection: "column",
}}
>
<Group justify="space-between" wrap="wrap" gap="sm" mb="md"> <Group justify="space-between" wrap="wrap" gap="sm" mb="md">
<Button <Button
variant="subtle" variant="subtle"
@@ -272,15 +290,24 @@ export default function ContractViewPage() {
</Alert> </Alert>
)} )}
<Paper withBorder radius="lg" p={0} style={{ overflow: "hidden" }}> <Paper
withBorder
radius="lg"
p={0}
// minHeight keeps the document usable on short/landscape viewports;
// the page then overflows and window-scrolls a little, which beats
// an unreadably squashed iframe.
style={{ overflow: "hidden", flex: 1, minHeight: 220 }}
>
<iframe <iframe
ref={iframeRef} ref={iframeRef}
srcDoc={data.html} srcDoc={data.html}
title="Contract document" title="Contract document"
onLoad={handleIframeLoad} onLoad={handleIframeLoad}
style={{ style={{
display: "block",
width: "100%", width: "100%",
minHeight: "80vh", height: "100%",
border: "none", border: "none",
background: "white", background: "white",
}} }}
@@ -293,19 +320,18 @@ export default function ContractViewPage() {
withBorder withBorder
radius="lg" radius="lg"
p="md" p="md"
mt="md"
w="100%"
maw={920}
mx="auto"
style={{ style={{
position: "fixed", // Above SupportWidget's Affix (zIndex 300) — the fixed chat FAB
bottom: 0, // shares this bottom-right corner and would otherwise render on
left: "var(--sign-bar-left, 0px)", // top of the required agree-and-sign bar.
right: 0, position: "relative",
zIndex: 100, zIndex: 301,
borderTop: "1px solid var(--mantine-color-gray-3)",
background: "var(--mantine-color-body)", background: "var(--mantine-color-body)",
paddingBottom: "max(env(safe-area-inset-bottom, 0px), 16px)",
maxHeight: "80vh",
overflowY: "auto",
}} }}
className="contract-sign-bar"
> >
<Box maw={920} mx="auto"> <Box maw={920} mx="auto">
<Group justify="flex-start" align="flex-start" wrap="wrap" gap="sm"> <Group justify="flex-start" align="flex-start" wrap="wrap" gap="sm">

View File

@@ -1,11 +0,0 @@
/* Keeps the fixed sign bar confined to the content area (right of the
navbar) instead of spanning the full viewport and drifting off-center. */
.contract-sign-bar {
--sign-bar-left: 0px;
}
@media (min-width: 48em) {
.contract-sign-bar {
--sign-bar-left: 260px;
}
}