Browse Source

chore(staging): auto-merge origin/master into staging

staging
Ali Alavi 2 weeks ago
parent
commit
29acb5e50f
  1. 2
      src/app/finding-match/finding-match-client.tsx
  2. 10
      src/app/globals.css
  3. 2
      src/app/intro/intro-client.tsx
  4. 2
      src/app/questions-list/[slug]/loading.tsx
  5. 12
      src/app/questions-list/[slug]/question-detail-client.tsx
  6. 123
      src/app/questions-list/[slug]/question-dimensions.test.tsx
  7. 2
      src/app/questions-list/[slug]/test-intro-client.tsx
  8. 4
      src/components/Componentes/page-header.tsx
  9. 4
      src/components/Componentes/page-loading-skeleton.tsx
  10. 2
      src/components/Componentes/test-loading-screen.tsx
  11. 2
      src/components/Componentes/test-questions-flow.tsx

2
src/app/finding-match/finding-match-client.tsx

@ -157,7 +157,7 @@ export default function FindingMatchClient() {
<main
style={{
minHeight: "calc(100dvh - 56px - max(12px, calc(var(--safe-top) + 6px)))",
minHeight: "calc(100dvh - 56px - max(12px, calc(var(--safe-top) + 4px)))",
paddingBottom: "calc(90px + var(--safe-bottom))",
}}
className="flex min-h-0 flex-1 flex-col justify-between text-center page-slide-enter"

10
src/app/globals.css

@ -469,7 +469,8 @@ body.section-overlay-open .app-shell {
overscroll-behavior: none;
touch-action: pan-y;
-webkit-overflow-scrolling: touch;
padding-inline: 17px;
--app-shell-px: 17px;
padding-inline: var(--app-shell-px);
box-sizing: border-box;
background-color: var(--background);
background-image: var(--default-page-background-image);
@ -487,7 +488,8 @@ body.section-overlay-open .app-shell {
@media (min-width: 600px) {
.section-overlay {
padding-inline: clamp(24px, 5vw, 48px);
--app-shell-px: clamp(24px, 5vw, 48px);
padding-inline: var(--app-shell-px);
}
}
@ -526,6 +528,10 @@ body.section-overlay-open .app-shell {
margin 300ms ease-in-out;
}
.question-detail-main {
margin-inline: calc(-1 * var(--app-shell-px, 17px));
}
.question-progress,
.question-snap-content {
transition:

2
src/app/intro/intro-client.tsx

@ -136,7 +136,7 @@ export default function IntroClient() {
style={{
minHeight: SHOW_INTRO_VIDEOS
? undefined
: "calc(100dvh - 56px - max(12px, calc(var(--safe-top) + 6px)))",
: "calc(100dvh - 56px - max(12px, calc(var(--safe-top) + 4px)))",
}}
className={[
"flex min-h-0 flex-1 flex-col text-center pb-[calc(90px+var(--safe-bottom))]",

2
src/app/questions-list/[slug]/loading.tsx

@ -1,6 +1,6 @@
export default function Loading() {
return (
<main className="-mx-[17px] flex h-svh flex-col overflow-hidden bg-[#F7F1F0]">
<main className="question-detail-main flex h-svh flex-col overflow-hidden bg-[#F7F1F0]">
{/* Header placeholder */}
<div
style={{ paddingTop: "max(12px, calc(var(--safe-top) + 4px))" }}

12
src/app/questions-list/[slug]/question-detail-client.tsx

@ -521,7 +521,7 @@ export default function QuestionDetailClient({
return (
<>
<PageBackground disabled />
<main className="-mx-[17px] flex h-svh flex-col overflow-hidden bg-[#F7F1F0]">
<main className="question-detail-main flex h-svh flex-col overflow-hidden bg-[#F7F1F0]">
<StickyHeader
sticky={false}
className="question-detail-header shrink-0"
@ -566,7 +566,7 @@ export default function QuestionDetailClient({
return (
<>
<PageBackground disabled />
<main className="-mx-[17px] flex h-svh flex-col overflow-hidden bg-[#F7F1F0]">
<main className="question-detail-main flex h-svh flex-col overflow-hidden bg-[#F7F1F0]">
<StickyHeader
sticky={false}
className="question-detail-header shrink-0"
@ -602,7 +602,7 @@ export default function QuestionDetailClient({
return (
<>
<PageBackground disabled />
<main className="-mx-[17px] flex h-svh flex-col overflow-hidden bg-[#F7F1F0]">
<main className="question-detail-main flex h-svh flex-col overflow-hidden bg-[#F7F1F0]">
<StickyHeader
sticky={false}
className="question-detail-header shrink-0"
@ -669,7 +669,7 @@ export default function QuestionDetailClient({
return (
<>
<PageBackground disabled />
<main className="-mx-[17px] flex h-svh flex-col items-center justify-center gap-4 bg-[#F7F1F0] px-6 text-center">
<main className="question-detail-main flex h-svh flex-col items-center justify-center gap-4 bg-[#F7F1F0] px-6 text-center">
<p className="font-semibold text-[#1B1B1B]">
{isError
? locale === "fa"
@ -781,7 +781,7 @@ export default function QuestionDetailClient({
return (
<>
<PageBackground disabled />
<main className="-mx-[17px] flex h-svh flex-col overflow-hidden bg-[#F7F1F0]">
<main className="question-detail-main flex h-svh flex-col overflow-hidden bg-[#F7F1F0]">
<StickyHeader
sticky={false}
className="question-detail-header shrink-0"
@ -962,7 +962,7 @@ export default function QuestionDetailClient({
questions={item.questions}
locale={locale}
>
<main className="-mx-[17px] flex h-svh flex-col overflow-hidden bg-[#F7F1F0]">
<main className="question-detail-main flex h-svh flex-col overflow-hidden bg-[#F7F1F0]">
<StickyHeader
sticky={false}
className="question-detail-header shrink-0"

123
src/app/questions-list/[slug]/question-dimensions.test.tsx

@ -0,0 +1,123 @@
import { describe, it, expect, vi, afterEach } from "vitest";
import { cleanup, render } from "@testing-library/react";
import fs from "fs";
import path from "path";
import { FixToTheEnd } from "@/components/Componentes/fix-to-the-end";
import { PageHeader } from "@/components/Componentes/page-header";
import StickyHeader from "@/components/Componentes/sticky-header";
import { I18nProvider } from "@/translations/provider";
afterEach(() => {
cleanup();
});
vi.mock("next/navigation", () => ({
useRouter: () => ({
push: vi.fn(),
replace: vi.fn(),
back: vi.fn(),
}),
}));
vi.mock("@/hooks/marriage/use-profile-main", () => ({
useMarriageProfileQuery: () => ({
data: undefined,
isLoading: false,
isFetched: true,
}),
}));
describe("Dimensions & Padding Integrity Verification", () => {
it("globals.css preserves --app-shell-px and padding-inline on section-overlay", () => {
const cssPath = path.resolve(process.cwd(), "src/app/globals.css");
const cssContent = fs.readFileSync(cssPath, "utf-8");
// Verify .section-overlay defines --app-shell-px: 17px and padding-inline: var(--app-shell-px)
expect(cssContent).toMatch(
/\.section-overlay\s*\{[\s\S]*?--app-shell-px:\s*17px;/,
);
expect(cssContent).toMatch(
/\.section-overlay\s*\{[\s\S]*?padding-inline:\s*var\(--app-shell-px\);/,
);
// Verify tablet responsive padding for .section-overlay
expect(cssContent).toMatch(
/@media\s*\(min-width:\s*600px\)\s*\{[\s\S]*?\.section-overlay\s*\{[\s\S]*?--app-shell-px:\s*clamp\(24px,\s*5vw,\s*48px\);/,
);
// Verify .section-overlay does NOT have zeroed out padding or 0px app-shell-px
expect(cssContent).not.toMatch(
/\.section-overlay\s*\{[\s\S]*?--app-shell-px:\s*0px;/,
);
// Verify .question-detail-main rule exists with breakout margin
expect(cssContent).toMatch(
/\.question-detail-main\s*\{[\s\S]*?margin-inline:\s*calc\(-1\s*\*\s*var\(--app-shell-px,\s*17px\)\);/,
);
});
it("FixToTheEnd retains var(--app-shell-px, 17px) padding for bottom buttons", () => {
const { container } = render(
<FixToTheEnd>
<button type="button">Submit</button>
</FixToTheEnd>,
);
const fixToEndEl = container.querySelector(
".question-fix-to-end",
) as HTMLElement;
expect(fixToEndEl).toBeInTheDocument();
expect(fixToEndEl.style.paddingInline).toBe("var(--app-shell-px, 17px)");
expect(fixToEndEl.style.paddingBottom).toBe(
"calc(16px + var(--safe-bottom))",
);
});
it("PageHeader applies full breakout marginInline and content paddingInline", () => {
const { container } = render(
<I18nProvider locale="fa" dictionary={{ Marriage: "مریج" }}>
<PageHeader sticky title="Test Title" />
</I18nProvider>,
);
const headerEl = container.querySelector("header") as HTMLElement;
expect(headerEl).toBeInTheDocument();
expect(headerEl.style.marginInline).toBe(
"calc(-1 * var(--app-shell-px, 17px))",
);
expect(headerEl.style.paddingInline).toBe("var(--app-shell-px, 17px)");
});
it("StickyHeader renders correctly with safe-area + 4px and rounded bottom", () => {
const { container } = render(
<StickyHeader>
<h1>Question Title</h1>
</StickyHeader>,
);
const headerEl = container.querySelector("header") as HTMLElement;
expect(headerEl).toBeInTheDocument();
expect(headerEl.className).toContain("rounded-b-[15px]");
expect(headerEl.className).toContain(
"bg-[linear-gradient(135deg,#E03950_0%,#FE6F82_100%)]",
);
});
it("all question detail main elements use question-detail-main class instead of hardcoded -mx-[17px]", () => {
const detailClientPath = path.resolve(
process.cwd(),
"src/app/questions-list/[slug]/question-detail-client.tsx",
);
const content = fs.readFileSync(detailClientPath, "utf-8");
// No hardcoded -mx-[17px] on <main>
expect(content).not.toMatch(/<main[^>]*className="[^"]*-mx-\[17px\]/);
// Matches question-detail-main on <main>
const mainMatches = content.match(
/<main[^>]*className="[^"]*question-detail-main/g,
);
expect(mainMatches).not.toBeNull();
expect(mainMatches!.length).toBeGreaterThanOrEqual(4);
});
});

2
src/app/questions-list/[slug]/test-intro-client.tsx

@ -32,7 +32,7 @@ export default function TestIntroClient({
return (
<>
<PageBackground disabled />
<main className="-mx-[17px] flex h-svh flex-col overflow-hidden bg-[#F7F1F0]">
<main className="question-detail-main flex h-svh flex-col overflow-hidden bg-[#F7F1F0]">
<StickyHeader sticky={false} className="shrink-0">
<div className="flex items-center gap-4">
<NavigationButton

4
src/components/Componentes/page-header.tsx

@ -69,8 +69,8 @@ export function PageHeader({
} : undefined}
className={[
sticky
? "sticky top-0 z-30 pt-[max(12px,calc(var(--safe-top)+6px))] bg-[#F5F5F5] dark:bg-[#1A1A1A] bg-[url('/assets/images/home-Checkups-List.svg')] bg-top bg-no-repeat bg-cover"
: "pb-3 pt-[max(8px,calc(var(--safe-top)+4px))]",
? "sticky top-0 z-30 pt-[max(12px,calc(var(--safe-top)+4px))] bg-[#F5F5F5] dark:bg-[#1A1A1A] bg-[url('/assets/images/home-Checkups-List.svg')] bg-top bg-no-repeat bg-cover"
: "pb-3 pt-[max(12px,calc(var(--safe-top)+4px))]",
className,
]
.filter(Boolean)

4
src/components/Componentes/page-loading-skeleton.tsx

@ -17,7 +17,7 @@ export function PageLoadingSkeleton({
<PageBackground disabled />
<main
aria-busy="true"
className="-mx-[17px] flex min-h-svh flex-col px-[17px] pt-[max(12px,calc(var(--safe-top)+4px))] pb-[calc(24px+var(--safe-bottom))] bg-[#F7F1F0]"
className="question-detail-main flex min-h-svh flex-col px-[17px] pt-[max(12px,calc(var(--safe-top)+4px))] pb-[calc(24px+var(--safe-bottom))] bg-[#F7F1F0]"
>
{/* Header */}
<header className="flex h-11 items-center justify-between shrink-0 mb-4">
@ -68,7 +68,7 @@ export function PageLoadingSkeleton({
<PageBackground disabled />
<main
aria-busy="true"
className="-mx-[17px] flex min-h-svh flex-col px-[23px] pt-[max(12px,calc(var(--safe-top)+4px))] pb-[calc(24px+var(--safe-bottom))]"
className="question-detail-main flex min-h-svh flex-col px-[23px] pt-[max(12px,calc(var(--safe-top)+4px))] pb-[calc(24px+var(--safe-bottom))]"
>
<header className="flex h-11 items-center justify-between">
<LoadingSkeleton className="size-10 rounded-full" />

2
src/components/Componentes/test-loading-screen.tsx

@ -15,7 +15,7 @@ export default function TestLoadingScreen(_props: TestLoadingScreenProps) {
<PageBackground disabled />
<main
aria-busy="true"
className="-mx-[17px] flex h-svh flex-col items-center justify-center bg-[#F7F1F0] px-6 text-center select-none"
className="question-detail-main flex h-svh flex-col items-center justify-center bg-[#F7F1F0] px-6 text-center select-none"
>
<div className="flex w-full max-w-xs flex-col items-center">
<LoadingSkeleton className="size-44 rounded-[32px]" />

2
src/components/Componentes/test-questions-flow.tsx

@ -238,7 +238,7 @@ export default function TestQuestionsFlow({
return (
<>
<PageBackground disabled />
<main className="-mx-[17px] flex h-svh flex-col overflow-hidden bg-[#F7F1F0]">
<main className="question-detail-main flex h-svh flex-col overflow-hidden bg-[#F7F1F0]">
{/* Header */}
<StickyHeader sticky={false} className="shrink-0">
<div className="flex items-center gap-4">

Loading…
Cancel
Save