feat(mui): consistent staggered page entrance across all 43 route pages

Adopt the PageEnter wrapper as every page's outermost render element and remove the ad-hoc per-page entrance motion.div wrappers. Every page now enters the same way — all top-level sections rise+fade in, staggered — so nothing appears instantly and the motion is identical app-wide. Presentation-only: no data/logic/hooks/invalidate/permissions touched. Embedded sub-tabs (CompanySettings, ReceivedInvoices), Login (auth shell) and the dev UiKit are intentionally excluded. Gates: tsc -b --noEmit=0, build=0, vitest 152/152.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
BOHA
2026-06-07 10:13:06 +02:00
parent b273614128
commit 39fe84ce99
43 changed files with 4956 additions and 5709 deletions

View File

@@ -3,7 +3,6 @@ import { useQuery, useQueryClient } from "@tanstack/react-query";
import { useAlert } from "../context/AlertContext";
import { useAuth } from "../context/AuthContext";
import { Link as RouterLink, useSearchParams } from "react-router-dom";
import { motion } from "framer-motion";
import Box from "@mui/material/Box";
import Typography from "@mui/material/Typography";
import IconButton from "@mui/material/IconButton";
@@ -35,6 +34,7 @@ import {
FilterBar,
Tabs,
PageHeader,
PageEnter,
type DataColumn,
type TabDef,
type StatCardColor,
@@ -644,43 +644,33 @@ export default function Invoices() {
];
return (
<Box>
<motion.div
initial={{ opacity: 0, y: 12 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.25 }}
>
<PageHeader
title="Faktury"
subtitle={subtitle}
actions={
hasPermission("invoices.create") ? (
activeTab === "received" ? (
<Button
startIcon={UploadIcon}
onClick={() => setReceivedUploadOpen(true)}
>
Nahrát faktury
</Button>
) : (
<Button
component={RouterLink}
to="/invoices/new"
startIcon={PlusIcon}
>
Nová faktura
</Button>
)
) : undefined
}
/>
</motion.div>
<PageEnter>
<PageHeader
title="Faktury"
subtitle={subtitle}
actions={
hasPermission("invoices.create") ? (
activeTab === "received" ? (
<Button
startIcon={UploadIcon}
onClick={() => setReceivedUploadOpen(true)}
>
Nahrát faktury
</Button>
) : (
<Button
component={RouterLink}
to="/invoices/new"
startIcon={PlusIcon}
>
Nová faktura
</Button>
)
) : undefined
}
/>
<motion.div
initial={{ opacity: 0, y: 12 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.25, delay: 0.06 }}
>
<Box>
<Box
sx={{
display: "flex",
@@ -722,49 +712,31 @@ export default function Invoices() {
]}
/>
</Box>
</motion.div>
</Box>
{activeTab === "received" ? (
<motion.div
initial={{ opacity: 0, y: 12 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.25, delay: 0.1 }}
>
<Suspense fallback={<LoadingState />}>
<ReceivedInvoices
statsMonth={statsMonth}
statsYear={statsYear}
uploadOpen={receivedUploadOpen}
setUploadOpen={setReceivedUploadOpen}
/>
</Suspense>
</motion.div>
<Suspense fallback={<LoadingState />}>
<ReceivedInvoices
statsMonth={statsMonth}
statsYear={statsYear}
uploadOpen={receivedUploadOpen}
setUploadOpen={setReceivedUploadOpen}
/>
</Suspense>
) : (
<>
<motion.div
initial={{ opacity: 0, y: 12 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.25, delay: 0.1 }}
>
{renderKpi()}
</motion.div>
{renderKpi()}
<motion.div
initial={{ opacity: 0, y: 12 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.25, delay: 0.12 }}
>
<Box sx={{ mb: 2.5 }}>
<Tabs
value={statusFilter}
onChange={(v) => {
setStatusFilter(v);
setPage(1);
}}
tabs={statusTabs}
/>
</Box>
</motion.div>
<Box sx={{ mb: 2.5 }}>
<Tabs
value={statusFilter}
onChange={(v) => {
setStatusFilter(v);
setPage(1);
}}
tabs={statusTabs}
/>
</Box>
<FilterBar>
<Box sx={{ flex: "1 1 320px" }}>
@@ -845,40 +817,32 @@ export default function Invoices() {
</Box>
)}
<motion.div
initial={{ opacity: 0, y: 12 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.25, delay: 0.15 }}
>
<Card
sx={{ opacity: loading ? 0.6 : 1, transition: "opacity .2s" }}
>
<DataTable<Invoice>
columns={columns}
rows={invoices}
rowKey={(inv) => inv.id}
rowSx={rowSx}
sortBy={sort}
sortDir={order}
onSort={handleSort}
empty={
<EmptyState
title="Zatím nejsou žádné faktury."
description={
hasPermission("invoices.create")
? "Vytvořte první fakturu tlačítkem výše."
: undefined
}
/>
}
/>
<Pagination
page={page}
pageCount={pagination?.total_pages ?? 1}
onChange={setPage}
/>
</Card>
</motion.div>
<Card sx={{ opacity: loading ? 0.6 : 1, transition: "opacity .2s" }}>
<DataTable<Invoice>
columns={columns}
rows={invoices}
rowKey={(inv) => inv.id}
rowSx={rowSx}
sortBy={sort}
sortDir={order}
onSort={handleSort}
empty={
<EmptyState
title="Zatím nejsou žádné faktury."
description={
hasPermission("invoices.create")
? "Vytvořte první fakturu tlačítkem výše."
: undefined
}
/>
}
/>
<Pagination
page={page}
pageCount={pagination?.total_pages ?? 1}
onChange={setPage}
/>
</Card>
<ConfirmDialog
isOpen={deleteConfirm.show}
@@ -893,6 +857,6 @@ export default function Invoices() {
/>
</>
)}
</Box>
</PageEnter>
);
}