feat: add superadmin management
All checks were successful
CI / Validate frontend and API (push) Successful in 1m59s
CI / Build and publish Docker images (push) Successful in 22s

This commit is contained in:
Cauê Faleiros
2026-09-01 09:54:45 -03:00
parent 2dfca33758
commit a5055238b9
21 changed files with 366 additions and 74 deletions

View File

@@ -4,7 +4,6 @@ import { Section, Course } from '../types';
import { getCourses } from '../services/db';
import { useAuth } from '../context/AuthContext';
import { Loader2, ChevronLeft, ChevronRight } from 'lucide-react';
import { CATEGORIES } from '../constants';
interface CourseGridProps {
onCourseSelect?: (course: Course) => void;
@@ -100,6 +99,9 @@ export const CourseGrid: React.FC<CourseGridProps> = ({
}
};
const categories = Array.from(new Set<string>(courses.map((course) => course.category)))
.sort((left, right) => left.localeCompare(right, 'pt-BR'));
if (loading) {
return (
<div className="flex justify-center items-center h-64 w-full">
@@ -108,6 +110,17 @@ export const CourseGrid: React.FC<CourseGridProps> = ({
);
}
if (courses.length === 0) {
return (
<section className="min-h-[60vh] flex items-center justify-center px-6 pt-28 pb-20">
<div className="max-w-md text-center rounded-2xl border border-white/10 bg-zinc-950/80 p-8">
<h2 className="text-xl font-bold text-white">Cursos em breve</h2>
<p className="mt-3 text-sm leading-relaxed text-gray-400">Ainda não há cursos publicados. Cadastre o primeiro curso no Painel do Instrutor.</p>
</div>
</section>
);
}
// Filter courses if a specific category is active
const filteredCourses = activeCategory === 'all'
? courses
@@ -178,7 +191,7 @@ export const CourseGrid: React.FC<CourseGridProps> = ({
Todos os Cursos ({courses.length})
</button>
{CATEGORIES.map(cat => {
{categories.map(cat => {
const count = courses.filter(c => c.category === cat).length;
return (
<button