diff --git a/src/partials/main/MainInfractions.tsx b/src/partials/main/MainInfractions.tsx index 4f18b11..c2f3675 100644 --- a/src/partials/main/MainInfractions.tsx +++ b/src/partials/main/MainInfractions.tsx @@ -1,17 +1,103 @@ import Typography from "../../components/Typography/Typography"; -import { Grid } from "../../components/Grid/Grid"; +import { motion, AnimatePresence } from "framer-motion"; +import { + ExclamationTriangleIcon, + DocumentTextIcon, + CheckCircleIcon, +} from "@heroicons/react/24/outline"; + +const containerVariants = { + hidden: { opacity: 0 }, + visible: { + opacity: 1, + transition: { staggerChildren: 0.08, delayChildren: 0.05 }, + }, + exit: { + opacity: 0, + transition: { staggerChildren: 0.05, staggerDirection: -1 }, + }, +}; + +const itemVariants = { + hidden: { opacity: 0, y: 12 }, + visible: { opacity: 1, y: 0 }, + exit: { opacity: 0, y: -8 }, +}; export const MainInfractions = ({ data, - handleUpdate, + handleUpdate: _handleUpdate, }: { data: any; handleUpdate: () => void; }) => { - console.log(data, handleUpdate); + const infractions = data?.infractions || []; + + if (infractions.length === 0) { + return ( + + + + تخلفی ثبت نشده است + + + ); + } + return ( - - این بخش در دست توسعه است - + + + {infractions.map( + ( + infraction: { _id: string; title: string; description?: string }, + index: number, + ) => ( + +
+ +
+
+ + {index + 1}. {infraction.title} + + {infraction.description && ( +
+ + + {infraction.description} + +
+ )} +
+
+ ), + )} +
+
); }; diff --git a/src/partials/main/MainPlaceInfo.tsx b/src/partials/main/MainPlaceInfo.tsx index 7c64715..32e3f02 100644 --- a/src/partials/main/MainPlaceInfo.tsx +++ b/src/partials/main/MainPlaceInfo.tsx @@ -119,7 +119,7 @@ const MainPlaceInfo: React.FC = ({ const [personRegistryData, setPersonRegistryData] = useState(null); const [unitRegistryData, setUnitRegistryData] = useState( - [] + [], ); const [isLoadingRegistry, setIsLoadingRegistry] = useState(false); const { openDrawer } = useDrawerStore(); @@ -201,7 +201,7 @@ const MainPlaceInfo: React.FC = ({ const unitsCandidate = unitResult?.data ?? (Array.isArray(unitResult) ? unitResult : []); setUnitRegistryData( - Array.isArray(unitsCandidate) ? unitsCandidate : [] + Array.isArray(unitsCandidate) ? unitsCandidate : [], ); } catch (error: any) { console.error("Unit registry error:", error); @@ -320,7 +320,6 @@ const MainPlaceInfo: React.FC = ({ )} - {/* Submit Inspection Button */}