design: remove login transition overlay as requested
This commit is contained in:
@@ -13,7 +13,6 @@ import { DialogProvider } from './context/DialogContext';
|
||||
import { motion, AnimatePresence } from 'framer-motion';
|
||||
import { StatusTimeline, type Event } from './components/dashboard/EventStatusTimeline';
|
||||
import { useEffect } from 'react';
|
||||
import ritLogo from './assets/images/college-logo.png';
|
||||
|
||||
import { InstitutionalCalendar } from './components/dashboard/InstitutionalCalendar';
|
||||
import { VenueTimeline } from './components/dashboard/VenueTimeline';
|
||||
@@ -28,56 +27,6 @@ import { ManageNoticesView } from './components/dashboard/ManageNoticesView';
|
||||
import { ManageStudentsView } from './components/dashboard/ManageStudentsView';
|
||||
import { VenueManagement } from './components/dashboard/VenueManagement';
|
||||
|
||||
const LoginTransitionScreen: React.FC<{ user: any }> = ({ user }) => {
|
||||
return (
|
||||
<motion.div
|
||||
initial={{ opacity: 0 }}
|
||||
animate={{ opacity: 1 }}
|
||||
exit={{ opacity: 0 }}
|
||||
transition={{ duration: 0.6, ease: "easeInOut" }}
|
||||
className="fixed inset-0 z-[300] bg-gradient-to-br from-[#003B5C] via-[#004a99] to-[#001D3D] flex flex-col items-center justify-center text-white"
|
||||
>
|
||||
<div className="flex flex-col items-center gap-6 max-w-sm text-center px-6">
|
||||
<motion.div
|
||||
initial={{ scale: 0.8, opacity: 0 }}
|
||||
animate={{ scale: 1, opacity: 1 }}
|
||||
transition={{ delay: 0.2, duration: 0.6, type: "spring" }}
|
||||
className="bg-white/95 p-4 rounded-3xl shadow-2xl shadow-blue-900/30"
|
||||
>
|
||||
<img src={ritLogo} alt="RIT Logo" className="h-16 w-auto object-contain" />
|
||||
</motion.div>
|
||||
|
||||
<div className="space-y-2 mt-4 animate-pulse">
|
||||
<motion.h2
|
||||
initial={{ y: 15, opacity: 0 }}
|
||||
animate={{ y: 0, opacity: 1 }}
|
||||
transition={{ delay: 0.4, duration: 0.5 }}
|
||||
className="text-2xl font-black uppercase tracking-tight"
|
||||
>
|
||||
Welcome Back
|
||||
</motion.h2>
|
||||
<motion.p
|
||||
initial={{ y: 10, opacity: 0 }}
|
||||
animate={{ y: 0, opacity: 1 }}
|
||||
transition={{ delay: 0.6, duration: 0.5 }}
|
||||
className="text-sm font-bold text-slate-300 uppercase tracking-widest"
|
||||
>
|
||||
{user?.fullName || "User"}
|
||||
</motion.p>
|
||||
</div>
|
||||
|
||||
<motion.div
|
||||
initial={{ opacity: 0 }}
|
||||
animate={{ opacity: [0, 1, 0] }}
|
||||
transition={{ delay: 0.8, duration: 1.5, repeat: Infinity }}
|
||||
className="text-[9px] font-black uppercase tracking-widest text-[#f97316] mt-8"
|
||||
>
|
||||
Connecting to Event Hub...
|
||||
</motion.div>
|
||||
</div>
|
||||
</motion.div>
|
||||
);
|
||||
};
|
||||
|
||||
const AppContent: React.FC = () => {
|
||||
const { isAuthenticated, user } = useAuth();
|
||||
@@ -85,22 +34,6 @@ const AppContent: React.FC = () => {
|
||||
const [activeItem, setActiveItem] = useState('dashboard');
|
||||
const [userEvents, setUserEvents] = useState<Event[]>([]);
|
||||
const [preFillData, setPreFillData] = useState<any>(null);
|
||||
const [showTransition, setShowTransition] = useState(false);
|
||||
const [cachedUser, setCachedUser] = useState<any>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (isAuthenticated && user) {
|
||||
setCachedUser(user);
|
||||
setShowTransition(true);
|
||||
const timer = setTimeout(() => {
|
||||
setShowTransition(false);
|
||||
}, 2000);
|
||||
return () => clearTimeout(timer);
|
||||
} else {
|
||||
setShowTransition(false);
|
||||
setCachedUser(null);
|
||||
}
|
||||
}, [isAuthenticated, user]);
|
||||
|
||||
const handleIncompleteClick = (data: any) => {
|
||||
setPreFillData(data);
|
||||
@@ -168,6 +101,38 @@ const AppContent: React.FC = () => {
|
||||
}
|
||||
}, [isAuthenticated, activeItem, user?.email, user?.role, user?.department]);
|
||||
|
||||
if (!isAuthenticated) {
|
||||
return (
|
||||
<AnimatePresence mode="wait">
|
||||
<motion.div
|
||||
key="login"
|
||||
initial={{ opacity: 0 }}
|
||||
animate={{ opacity: 1 }}
|
||||
exit={{ opacity: 0 }}
|
||||
transition={{ duration: 0.5 }}
|
||||
>
|
||||
<LoginPage />
|
||||
</motion.div>
|
||||
</AnimatePresence>
|
||||
);
|
||||
}
|
||||
|
||||
if (user?.role === 'STUDENT') {
|
||||
return (
|
||||
<AnimatePresence mode="wait">
|
||||
<motion.div
|
||||
key="student-dashboard"
|
||||
initial={{ opacity: 0 }}
|
||||
animate={{ opacity: 1 }}
|
||||
exit={{ opacity: 0 }}
|
||||
transition={{ duration: 0.5 }}
|
||||
>
|
||||
<StudentDashboard />
|
||||
</motion.div>
|
||||
</AnimatePresence>
|
||||
);
|
||||
}
|
||||
|
||||
const renderContent = () => {
|
||||
const isDashboard = (
|
||||
<Overview
|
||||
@@ -217,16 +182,6 @@ const AppContent: React.FC = () => {
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<AnimatePresence>
|
||||
{showTransition && <LoginTransitionScreen user={cachedUser} />}
|
||||
</AnimatePresence>
|
||||
|
||||
{!isAuthenticated ? (
|
||||
<LoginPage />
|
||||
) : user?.role === 'STUDENT' ? (
|
||||
<StudentDashboard />
|
||||
) : (
|
||||
<DashboardLayout
|
||||
activeItem={activeItem}
|
||||
onItemClick={handleSidebarClick}
|
||||
@@ -243,8 +198,6 @@ const AppContent: React.FC = () => {
|
||||
</motion.div>
|
||||
</AnimatePresence>
|
||||
</DashboardLayout>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user