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,7 +1,6 @@
|
||||
import { useState, useEffect, useRef } from "react";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { Link as RouterLink } from "react-router-dom";
|
||||
import { motion } from "framer-motion";
|
||||
import { parseISO, isValid } from "date-fns";
|
||||
import Box from "@mui/material/Box";
|
||||
import Typography from "@mui/material/Typography";
|
||||
@@ -30,6 +29,7 @@ import {
|
||||
StatusChip,
|
||||
TextField,
|
||||
ProgressBar,
|
||||
PageEnter,
|
||||
EmptyState,
|
||||
LoadingState,
|
||||
type DataColumn,
|
||||
@@ -614,24 +614,18 @@ export default function Attendance() {
|
||||
];
|
||||
|
||||
return (
|
||||
<Box>
|
||||
<motion.div
|
||||
initial={{ opacity: 0, y: 12 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
transition={{ duration: 0.25 }}
|
||||
>
|
||||
<Box sx={{ mb: 3 }}>
|
||||
<Typography variant="h4">Docházka</Typography>
|
||||
<Typography variant="body2" color="text.secondary" sx={{ mt: 0.5 }}>
|
||||
{new Date().toLocaleDateString("cs-CZ", {
|
||||
weekday: "long",
|
||||
day: "numeric",
|
||||
month: "long",
|
||||
year: "numeric",
|
||||
})}
|
||||
</Typography>
|
||||
</Box>
|
||||
</motion.div>
|
||||
<PageEnter>
|
||||
<Box sx={{ mb: 3 }}>
|
||||
<Typography variant="h4">Docházka</Typography>
|
||||
<Typography variant="body2" color="text.secondary" sx={{ mt: 0.5 }}>
|
||||
{new Date().toLocaleDateString("cs-CZ", {
|
||||
weekday: "long",
|
||||
day: "numeric",
|
||||
month: "long",
|
||||
year: "numeric",
|
||||
})}
|
||||
</Typography>
|
||||
</Box>
|
||||
|
||||
<Box
|
||||
sx={{
|
||||
@@ -642,11 +636,7 @@ export default function Attendance() {
|
||||
}}
|
||||
>
|
||||
{/* Left Column - Clock In/Out */}
|
||||
<motion.div
|
||||
initial={{ opacity: 0, y: 12 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
transition={{ duration: 0.25, delay: 0.06 }}
|
||||
>
|
||||
<>
|
||||
<Card>
|
||||
<Box
|
||||
sx={{
|
||||
@@ -986,35 +976,63 @@ export default function Attendance() {
|
||||
/>
|
||||
</Card>
|
||||
)}
|
||||
</motion.div>
|
||||
</>
|
||||
|
||||
{/* Right Column - Stats & Quick Links */}
|
||||
<motion.div
|
||||
initial={{ opacity: 0, y: 12 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
transition={{ duration: 0.25, delay: 0.06 }}
|
||||
>
|
||||
<Box sx={{ display: "flex", flexDirection: "column", gap: 3 }}>
|
||||
{/* Leave Balance Card */}
|
||||
<Box sx={{ display: "flex", flexDirection: "column", gap: 3 }}>
|
||||
{/* Leave Balance Card */}
|
||||
<StatCard
|
||||
icon={VacationIcon}
|
||||
color="success"
|
||||
label={`Dovolená ${new Date().getFullYear()}`}
|
||||
value={
|
||||
<>
|
||||
{vacationDaysRemaining}{" "}
|
||||
<Typography
|
||||
component="span"
|
||||
variant="body2"
|
||||
color="text.secondary"
|
||||
sx={{ fontFamily: "inherit" }}
|
||||
>
|
||||
{czechPlural(vacationDaysRemaining, "den", "dny", "dnů")}
|
||||
{vacationHoursRemaining > 0 && ` ${vacationHoursRemaining}h`}
|
||||
</Typography>
|
||||
</>
|
||||
}
|
||||
footer={
|
||||
<Box>
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
justifyContent: "space-between",
|
||||
mb: 0.75,
|
||||
}}
|
||||
>
|
||||
<span>Celkem: {leaveBalance.vacation_total}h</span>
|
||||
<span>Čerpáno: {leaveBalance.vacation_used}h</span>
|
||||
</Box>
|
||||
<ProgressBar
|
||||
value={
|
||||
leaveBalance.vacation_total > 0
|
||||
? (leaveBalance.vacation_remaining /
|
||||
leaveBalance.vacation_total) *
|
||||
100
|
||||
: 0
|
||||
}
|
||||
color="success"
|
||||
height={6}
|
||||
/>
|
||||
</Box>
|
||||
}
|
||||
/>
|
||||
|
||||
{/* Monthly Fund Card */}
|
||||
{data.monthly_fund && (
|
||||
<StatCard
|
||||
icon={VacationIcon}
|
||||
color="success"
|
||||
label={`Dovolená ${new Date().getFullYear()}`}
|
||||
value={
|
||||
<>
|
||||
{vacationDaysRemaining}{" "}
|
||||
<Typography
|
||||
component="span"
|
||||
variant="body2"
|
||||
color="text.secondary"
|
||||
sx={{ fontFamily: "inherit" }}
|
||||
>
|
||||
{czechPlural(vacationDaysRemaining, "den", "dny", "dnů")}
|
||||
{vacationHoursRemaining > 0 &&
|
||||
` ${vacationHoursRemaining}h`}
|
||||
</Typography>
|
||||
</>
|
||||
}
|
||||
icon={CalendarIcon}
|
||||
color="info"
|
||||
label={data.monthly_fund.month_name}
|
||||
value={`${data.monthly_fund.worked}h / ${data.monthly_fund.fund}h`}
|
||||
footer={
|
||||
<Box>
|
||||
<Box
|
||||
@@ -1024,137 +1042,102 @@ export default function Attendance() {
|
||||
mb: 0.75,
|
||||
}}
|
||||
>
|
||||
<span>Celkem: {leaveBalance.vacation_total}h</span>
|
||||
<span>Čerpáno: {leaveBalance.vacation_used}h</span>
|
||||
<span>Odpracováno: {data.monthly_fund.worked}h</span>
|
||||
{data.monthly_fund.overtime > 0 ? (
|
||||
<Box
|
||||
component="span"
|
||||
sx={{ color: "warning.main", fontWeight: 600 }}
|
||||
>
|
||||
Přesčas: +{data.monthly_fund.overtime}h
|
||||
</Box>
|
||||
) : (
|
||||
<span>Zbývá: {data.monthly_fund.remaining}h</span>
|
||||
)}
|
||||
</Box>
|
||||
<ProgressBar
|
||||
value={
|
||||
leaveBalance.vacation_total > 0
|
||||
? (leaveBalance.vacation_remaining /
|
||||
leaveBalance.vacation_total) *
|
||||
100
|
||||
data.monthly_fund.fund > 0
|
||||
? Math.min(
|
||||
100,
|
||||
(data.monthly_fund.covered /
|
||||
data.monthly_fund.fund) *
|
||||
100,
|
||||
)
|
||||
: 0
|
||||
}
|
||||
color="success"
|
||||
color={getFundBarColor(data.monthly_fund)}
|
||||
height={6}
|
||||
/>
|
||||
{data.monthly_fund.leave_hours > 0 && (
|
||||
<Box sx={{ mt: 0.5, color: "text.disabled" }}>
|
||||
{"Pokryto: "}
|
||||
{data.monthly_fund.covered}h (práce{" "}
|
||||
{data.monthly_fund.worked}h
|
||||
{data.monthly_fund.vacation_hours > 0 &&
|
||||
` + dovolená ${data.monthly_fund.vacation_hours}h`}
|
||||
{data.monthly_fund.sick_hours > 0 &&
|
||||
` + nemoc ${data.monthly_fund.sick_hours}h`}
|
||||
{data.monthly_fund.unpaid_hours > 0 &&
|
||||
` + neplacené ${data.monthly_fund.unpaid_hours}h`}
|
||||
)
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
}
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* Monthly Fund Card */}
|
||||
{data.monthly_fund && (
|
||||
<StatCard
|
||||
icon={CalendarIcon}
|
||||
color="info"
|
||||
label={data.monthly_fund.month_name}
|
||||
value={`${data.monthly_fund.worked}h / ${data.monthly_fund.fund}h`}
|
||||
footer={
|
||||
<Box>
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
justifyContent: "space-between",
|
||||
mb: 0.75,
|
||||
}}
|
||||
>
|
||||
<span>Odpracováno: {data.monthly_fund.worked}h</span>
|
||||
{data.monthly_fund.overtime > 0 ? (
|
||||
<Box
|
||||
component="span"
|
||||
sx={{ color: "warning.main", fontWeight: 600 }}
|
||||
>
|
||||
Přesčas: +{data.monthly_fund.overtime}h
|
||||
</Box>
|
||||
) : (
|
||||
<span>Zbývá: {data.monthly_fund.remaining}h</span>
|
||||
)}
|
||||
</Box>
|
||||
<ProgressBar
|
||||
value={
|
||||
data.monthly_fund.fund > 0
|
||||
? Math.min(
|
||||
100,
|
||||
(data.monthly_fund.covered /
|
||||
data.monthly_fund.fund) *
|
||||
100,
|
||||
)
|
||||
: 0
|
||||
}
|
||||
color={getFundBarColor(data.monthly_fund)}
|
||||
height={6}
|
||||
/>
|
||||
{data.monthly_fund.leave_hours > 0 && (
|
||||
<Box sx={{ mt: 0.5, color: "text.disabled" }}>
|
||||
{"Pokryto: "}
|
||||
{data.monthly_fund.covered}h (práce{" "}
|
||||
{data.monthly_fund.worked}h
|
||||
{data.monthly_fund.vacation_hours > 0 &&
|
||||
` + dovolená ${data.monthly_fund.vacation_hours}h`}
|
||||
{data.monthly_fund.sick_hours > 0 &&
|
||||
` + nemoc ${data.monthly_fund.sick_hours}h`}
|
||||
{data.monthly_fund.unpaid_hours > 0 &&
|
||||
` + neplacené ${data.monthly_fund.unpaid_hours}h`}
|
||||
)
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
}
|
||||
{/* Sick Leave Card */}
|
||||
<StatCard
|
||||
icon={SickIcon}
|
||||
color="error"
|
||||
label={`Nemoc ${new Date().getFullYear()}`}
|
||||
value={`${leaveBalance.sick_used}h čerpáno`}
|
||||
/>
|
||||
|
||||
{/* Quick Links */}
|
||||
<Card>
|
||||
<Typography
|
||||
variant="caption"
|
||||
color="text.secondary"
|
||||
sx={{
|
||||
display: "block",
|
||||
textTransform: "uppercase",
|
||||
letterSpacing: ".06em",
|
||||
fontWeight: 700,
|
||||
mb: 1,
|
||||
}}
|
||||
>
|
||||
Rychlé odkazy
|
||||
</Typography>
|
||||
<Box sx={{ display: "flex", flexDirection: "column", gap: 0.25 }}>
|
||||
<QuickLink
|
||||
to="/attendance/requests"
|
||||
icon={RequestsIcon}
|
||||
label="Moje žádosti"
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* Sick Leave Card */}
|
||||
<StatCard
|
||||
icon={SickIcon}
|
||||
color="error"
|
||||
label={`Nemoc ${new Date().getFullYear()}`}
|
||||
value={`${leaveBalance.sick_used}h čerpáno`}
|
||||
/>
|
||||
|
||||
{/* Quick Links */}
|
||||
<Card>
|
||||
<Typography
|
||||
variant="caption"
|
||||
color="text.secondary"
|
||||
sx={{
|
||||
display: "block",
|
||||
textTransform: "uppercase",
|
||||
letterSpacing: ".06em",
|
||||
fontWeight: 700,
|
||||
mb: 1,
|
||||
}}
|
||||
>
|
||||
Rychlé odkazy
|
||||
</Typography>
|
||||
<Box sx={{ display: "flex", flexDirection: "column", gap: 0.25 }}>
|
||||
<QuickLink
|
||||
to="/attendance/history"
|
||||
icon={HistoryIcon}
|
||||
label="Historie docházky"
|
||||
/>
|
||||
{hasPermission("attendance.manage") && (
|
||||
<QuickLink
|
||||
to="/attendance/requests"
|
||||
icon={RequestsIcon}
|
||||
label="Moje žádosti"
|
||||
to="/attendance/admin"
|
||||
icon={ManageIcon}
|
||||
label="Správa docházky"
|
||||
/>
|
||||
)}
|
||||
{hasPermission("attendance.balances") && (
|
||||
<QuickLink
|
||||
to="/attendance/history"
|
||||
icon={HistoryIcon}
|
||||
label="Historie docházky"
|
||||
to="/attendance/balances"
|
||||
icon={BalancesIcon}
|
||||
label="Správa bilancí"
|
||||
/>
|
||||
{hasPermission("attendance.manage") && (
|
||||
<QuickLink
|
||||
to="/attendance/admin"
|
||||
icon={ManageIcon}
|
||||
label="Správa docházky"
|
||||
/>
|
||||
)}
|
||||
{hasPermission("attendance.balances") && (
|
||||
<QuickLink
|
||||
to="/attendance/balances"
|
||||
icon={BalancesIcon}
|
||||
label="Správa bilancí"
|
||||
/>
|
||||
)}
|
||||
</Box>
|
||||
</Card>
|
||||
</Box>
|
||||
</motion.div>
|
||||
)}
|
||||
</Box>
|
||||
</Card>
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
{/* Leave Modal */}
|
||||
@@ -1273,6 +1256,6 @@ export default function Attendance() {
|
||||
cancelText="Zrušit"
|
||||
confirmVariant="primary"
|
||||
/>
|
||||
</Box>
|
||||
</PageEnter>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user