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:
@@ -1,6 +1,5 @@
|
||||
import { useState, useEffect, useRef } from "react";
|
||||
import { Link as RouterLink, useNavigate } 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";
|
||||
@@ -34,6 +33,7 @@ import {
|
||||
FilterBar,
|
||||
Tabs,
|
||||
PageHeader,
|
||||
PageEnter,
|
||||
LoadingState,
|
||||
type DataColumn,
|
||||
type TabDef,
|
||||
@@ -686,58 +686,46 @@ export default function Offers() {
|
||||
};
|
||||
|
||||
return (
|
||||
<Box>
|
||||
<motion.div
|
||||
initial={{ opacity: 0, y: 12 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
transition={{ duration: 0.25 }}
|
||||
>
|
||||
<PageHeader
|
||||
title="Nabídky"
|
||||
subtitle={subtitle}
|
||||
actions={
|
||||
<>
|
||||
{hasPermission("settings.templates") && (
|
||||
<Button
|
||||
component={RouterLink}
|
||||
to="/offers/templates"
|
||||
variant="outlined"
|
||||
color="inherit"
|
||||
startIcon={TemplatesIcon}
|
||||
>
|
||||
Šablony
|
||||
</Button>
|
||||
)}
|
||||
{hasPermission("offers.create") && (
|
||||
<Button
|
||||
component={RouterLink}
|
||||
to="/offers/new"
|
||||
startIcon={PlusIcon}
|
||||
>
|
||||
Nová nabídka
|
||||
</Button>
|
||||
)}
|
||||
</>
|
||||
}
|
||||
/>
|
||||
</motion.div>
|
||||
<PageEnter>
|
||||
<PageHeader
|
||||
title="Nabídky"
|
||||
subtitle={subtitle}
|
||||
actions={
|
||||
<>
|
||||
{hasPermission("settings.templates") && (
|
||||
<Button
|
||||
component={RouterLink}
|
||||
to="/offers/templates"
|
||||
variant="outlined"
|
||||
color="inherit"
|
||||
startIcon={TemplatesIcon}
|
||||
>
|
||||
Šablony
|
||||
</Button>
|
||||
)}
|
||||
{hasPermission("offers.create") && (
|
||||
<Button
|
||||
component={RouterLink}
|
||||
to="/offers/new"
|
||||
startIcon={PlusIcon}
|
||||
>
|
||||
Nová nabídka
|
||||
</Button>
|
||||
)}
|
||||
</>
|
||||
}
|
||||
/>
|
||||
|
||||
<motion.div
|
||||
initial={{ opacity: 0, y: 12 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
transition={{ duration: 0.25, delay: 0.1 }}
|
||||
>
|
||||
<Box sx={{ mb: 2.5 }}>
|
||||
<Tabs
|
||||
value={statusFilter}
|
||||
onChange={(v) => {
|
||||
setStatusFilter(v);
|
||||
setPage(1);
|
||||
}}
|
||||
tabs={tabs}
|
||||
/>
|
||||
</Box>
|
||||
</motion.div>
|
||||
<Box sx={{ mb: 2.5 }}>
|
||||
<Tabs
|
||||
value={statusFilter}
|
||||
onChange={(v) => {
|
||||
setStatusFilter(v);
|
||||
setPage(1);
|
||||
}}
|
||||
tabs={tabs}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
<FilterBar>
|
||||
<Box sx={{ flex: "1 1 320px" }}>
|
||||
@@ -838,44 +826,38 @@ export default function Offers() {
|
||||
</Box>
|
||||
)}
|
||||
|
||||
<motion.div
|
||||
initial={{ opacity: 0, y: 12 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
transition={{ duration: 0.25, delay: 0.15 }}
|
||||
>
|
||||
<Card sx={{ opacity: isFetching ? 0.6 : 1, transition: "opacity .2s" }}>
|
||||
<DataTable<Quotation>
|
||||
columns={columns}
|
||||
rows={quotations}
|
||||
rowKey={(q) => q.id}
|
||||
rowSx={rowSx}
|
||||
sortBy={sort}
|
||||
sortDir={order}
|
||||
onSort={handleSort}
|
||||
empty={
|
||||
debouncedSearch ? (
|
||||
<EmptyState title="Žádné nabídky odpovídající hledání." />
|
||||
) : (
|
||||
<EmptyState
|
||||
title="Zatím nejsou žádné nabídky."
|
||||
action={
|
||||
hasPermission("offers.create") ? (
|
||||
<Button component={RouterLink} to="/offers/new">
|
||||
Vytvořit první nabídku
|
||||
</Button>
|
||||
) : undefined
|
||||
}
|
||||
/>
|
||||
)
|
||||
}
|
||||
/>
|
||||
<Pagination
|
||||
page={page}
|
||||
pageCount={pagination?.total_pages ?? 1}
|
||||
onChange={setPage}
|
||||
/>
|
||||
</Card>
|
||||
</motion.div>
|
||||
<Card sx={{ opacity: isFetching ? 0.6 : 1, transition: "opacity .2s" }}>
|
||||
<DataTable<Quotation>
|
||||
columns={columns}
|
||||
rows={quotations}
|
||||
rowKey={(q) => q.id}
|
||||
rowSx={rowSx}
|
||||
sortBy={sort}
|
||||
sortDir={order}
|
||||
onSort={handleSort}
|
||||
empty={
|
||||
debouncedSearch ? (
|
||||
<EmptyState title="Žádné nabídky odpovídající hledání." />
|
||||
) : (
|
||||
<EmptyState
|
||||
title="Zatím nejsou žádné nabídky."
|
||||
action={
|
||||
hasPermission("offers.create") ? (
|
||||
<Button component={RouterLink} to="/offers/new">
|
||||
Vytvořit první nabídku
|
||||
</Button>
|
||||
) : undefined
|
||||
}
|
||||
/>
|
||||
)
|
||||
}
|
||||
/>
|
||||
<Pagination
|
||||
page={page}
|
||||
pageCount={pagination?.total_pages ?? 1}
|
||||
onChange={setPage}
|
||||
/>
|
||||
</Card>
|
||||
|
||||
<ConfirmDialog
|
||||
isOpen={deleteConfirm.show}
|
||||
@@ -935,6 +917,6 @@ export default function Offers() {
|
||||
</Typography>
|
||||
</Field>
|
||||
</Modal>
|
||||
</Box>
|
||||
</PageEnter>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user