cleanup - froentend pages removed

This commit is contained in:
IGNY8 VPS (Salman)
2025-12-20 09:55:16 +00:00
parent ab0d6469d4
commit eb6cba7920
55 changed files with 4419 additions and 9232 deletions

View File

@@ -1,25 +0,0 @@
import { ReactNode } from "react";
import { Navigate } from "react-router-dom";
import { useAuthStore } from "../../store/authStore";
interface AdminGuardProps {
children: ReactNode;
}
/**
* AdminGuard - restricts access to system account (aws-admin/default) or developer
*/
export default function AdminGuard({ children }: AdminGuardProps) {
const { user } = useAuthStore();
const role = user?.role;
const accountSlug = user?.account?.slug;
const isSystemAccount = accountSlug === 'aws-admin' || accountSlug === 'default-account' || accountSlug === 'default';
const allowed = role === 'developer' || isSystemAccount;
if (!allowed) {
return <Navigate to="/" replace />;
}
return <>{children}</>;
}

View File

@@ -0,0 +1,31 @@
import { Navigate } from 'react-router-dom';
import { useAuthStore } from '../../store/authStore';
interface AwsAdminGuardProps {
children: React.ReactNode;
}
/**
* Route guard that only allows access to users of the aws-admin account
* Used for the single remaining admin dashboard page
*/
export const AwsAdminGuard: React.FC<AwsAdminGuardProps> = ({ children }) => {
const { user, loading } = useAuthStore();
if (loading) {
return (
<div className="flex items-center justify-center h-screen">
<div className="animate-spin rounded-full h-12 w-12 border-b-2 border-primary-600"></div>
</div>
);
}
// Check if user belongs to aws-admin account
const isAwsAdmin = user?.account?.slug === 'aws-admin';
if (!isAwsAdmin) {
return <Navigate to="/dashboard" replace />;
}
return <>{children}</>;
};

View File

@@ -124,15 +124,12 @@ export default function ProtectedRoute({ children }: ProtectedRouteProps) {
const accountStatus = user?.account?.status;
const accountInactive = accountStatus && ['suspended', 'cancelled'].includes(accountStatus);
const pendingPayment = accountStatus === 'pending_payment';
const isPrivileged = user?.role === 'developer' || user?.is_superuser;
if (!isPrivileged) {
if (pendingPayment && !isPlanAllowedPath) {
return <Navigate to="/account/plans" state={{ from: location }} replace />;
}
if (accountInactive && !isPlanAllowedPath) {
return <Navigate to="/account/plans" state={{ from: location }} replace />;
}
if (pendingPayment && !isPlanAllowedPath) {
return <Navigate to="/account/plans" state={{ from: location }} replace />;
}
if (accountInactive && !isPlanAllowedPath) {
return <Navigate to="/account/plans" state={{ from: location }} replace />;
}
return <>{children}</>;