refactor(core): Restructure the projectfor feature-sliced architecture feature-sliced

- Move components, hooks, and types to their respective directories in /features.
  - Update all imports to reflect the new structure.
  - Fixes the path alias in tsconfig and removes legacy files.
This commit is contained in:
M-Gabrielly 2025-10-07 17:23:02 -03:00
parent 498d6c80c1
commit b0ab1e86ca
28 changed files with 21 additions and 152 deletions

View File

@ -54,7 +54,7 @@ import {
} from "@/components/ui/select";
import { mockAppointments, mockProfessionals } from "@/lib/mocks/appointment-mocks";
import { CalendarRegistrationForm } from "@/components/forms/calendar-registration-form";
import { CalendarRegistrationForm } from "@/features/agendamento/components/forms/calendar-registration-form";
const formatDate = (date: string | Date) => {

View File

@ -9,7 +9,7 @@ import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, Di
import { Label } from "@/components/ui/label";
import { MoreHorizontal, Plus, Search, Edit, Trash2, ArrowLeft, Eye } from "lucide-react";
import { Badge } from "@/components/ui/badge";
import { DoctorRegistrationForm } from "@/components/forms/doctor-registration-form";
import { DoctorRegistrationForm } from "@/features/profissionais/components/forms/doctor-registration-form";
import { listarMedicos, excluirMedico, buscarMedicos, buscarMedicoPorId, Medico } from "@/lib/api";

View File

@ -11,7 +11,7 @@ import { Label } from "@/components/ui/label";
import { MoreHorizontal, Plus, Search, Eye, Edit, Trash2, ArrowLeft } from "lucide-react";
import { Paciente, Endereco, listarPacientes, buscarPacientes, buscarPacientePorId, excluirPaciente } from "@/lib/api";
import { PatientRegistrationForm } from "@/components/forms/patient-registration-form";
import { PatientRegistrationForm } from "@/features/pacientes/components/forms/patient-registration-form";
function normalizePaciente(p: any): Paciente {

View File

@ -1,5 +1,5 @@
import { Header } from "@/components/layout/marketing/Header"
import { AboutSection } from "@/components/about-section"
import { AboutSection } from "@/features/marketing/components/about-section"
import { Footer } from "@/components/layout/marketing/Footer"
export default function AboutPage() {

View File

@ -1,7 +1,7 @@
"use client";
import { useRouter } from "next/navigation";
import { CalendarRegistrationForm } from "@/components/forms/calendar-registration-form";
import { CalendarRegistrationForm } from "@/features/agendamento/components/forms/calendar-registration-form";
import HeaderAgenda from "@/components/agenda/HeaderAgenda";
import FooterAgenda from "@/components/agenda/FooterAgenda";
import { useState } from "react";

View File

@ -1,6 +1,6 @@
import type React from "react"
import type { Metadata } from "next"
import { AuthProvider } from "@/hooks/useAuth"
import { AuthProvider } from "@/features/autenticacao/hooks/useAuth"
import { ThemeProvider } from "@/components/layout/ThemeProvider"
import "./globals.css"

View File

@ -3,13 +3,13 @@
import { useEffect, useMemo, useState, type ChangeEvent, type FormEvent } from 'react'
import Link from 'next/link'
import { useRouter, useSearchParams } from 'next/navigation'
import { useAuth } from '@/hooks/useAuth'
import { useAuth } from '@/features/autenticacao/hooks/useAuth'
import { Button } from '@/components/ui/button'
import { Input } from '@/components/ui/input'
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
import { Alert, AlertDescription } from '@/components/ui/alert'
import { AuthenticationError } from '@/lib/auth'
import { AUTH_STORAGE_KEYS } from '@/types/auth'
import { AUTH_STORAGE_KEYS } from '@/features/autenticacao/types'
type UserRole = 'profissional' | 'paciente' | 'administrador'

View File

@ -1,5 +1,5 @@
import { Header } from "@/components/layout/marketing/Header"
import { HeroSection } from "@/components/hero-section"
import { HeroSection } from "@/features/marketing/components/hero-section"
import { Footer } from "@/components/layout/marketing/Footer"
export default function HomePage() {

View File

@ -2,8 +2,8 @@
import { useEffect, useRef } from 'react'
import { useRouter } from 'next/navigation'
import { useAuth } from '@/hooks/useAuth'
import type { UserType } from '@/types/auth'
import { USER_TYPE_ROUTES, LOGIN_ROUTES, AUTH_STORAGE_KEYS } from '@/types/auth'
import type { UserType } from '@/features/autenticacao/types'
import { USER_TYPE_ROUTES, LOGIN_ROUTES, AUTH_STORAGE_KEYS } from '@/features/autenticacao/types'
interface ProtectedRouteProps {
children: React.ReactNode

View File

@ -1,6 +1,7 @@
import httpClient from "@/lib/http";
import { API_KEY } from "@/lib/config"; // Necessário para algumas chamadas de auth
import { AUTH_ENDPOINTS } from "@/lib/env-config"; // Endpoints de autenticação
import { ENV_CONFIG } from "@/lib/env-config"; // Configuração de ambiente completa
import { API_KEY } from "@/lib/config"; // Necessário para algumas chamadas de auth
// ===== TIPOS DE AUTENTICAÇÃO E PERFIL =====
export type Profile = {
@ -11,9 +12,10 @@ export type Profile = {
};
export type CreateUserWithPasswordResponse = {
user_id: string;
success: boolean;
user: any; // Objeto do usuário retornado pelo Supabase
email: string;
password?: string; // A senha só é retornada na criação
password?: string;
};
export type UserData = {

View File

@ -9,8 +9,8 @@ import type {
UserData,
AuthStatus,
UserType
} from '@/types/auth'
import { AUTH_STORAGE_KEYS, LOGIN_ROUTES } from '@/types/auth'
} from '@/features/autenticacao/types'
import { AUTH_STORAGE_KEYS, LOGIN_ROUTES } from '@/features/autenticacao/types'
const AuthContext = createContext<AuthContextType | undefined>(undefined)

View File

@ -4,7 +4,7 @@ import type {
RefreshTokenResponse,
AuthError,
UserData
} from '@/types/auth';
} from '@/features/autenticacao/types';
import { API_CONFIG, AUTH_ENDPOINTS, DEFAULT_HEADERS, API_KEY, buildApiUrl } from '@/lib/config';
import { debugRequest } from '@/lib/debug-utils';

View File

@ -3,7 +3,7 @@
* Implementa lock para evitar múltiplas chamadas de refresh simultaneamente
*/
import { AUTH_STORAGE_KEYS, LOGIN_ROUTES, type UserType } from '@/types/auth'
import { AUTH_STORAGE_KEYS, LOGIN_ROUTES, type UserType } from '@/features/autenticacao/types'
import { isExpired } from '@/lib/jwt'
import { API_KEY } from '@/lib/config'

View File

@ -1,133 +0,0 @@
@import 'tailwindcss';
@import 'tw-animate-css';
:root {
--background: var(--primary)
--background: oklch(1 0 0);
--foreground: oklch(0.145 0 0);
--card: oklch(1 0 0);
--card-foreground: oklch(0.145 0 0);
--popover: oklch(1 0 0);
--popover-foreground: oklch(0.145 0 0);
--primary: oklch(0.205 0 0);
--primary-foreground: oklch(0.985 0 0);
--secondary: oklch(0.97 0 0);
--secondary-foreground: oklch(0.205 0 0);
--muted: oklch(0.97 0 0);
--muted-foreground: oklch(0.556 0 0);
--accent: oklch(0.97 0 0);
--accent-foreground: oklch(0.205 0 0);
--destructive: oklch(0.577 0.245 27.325);
--destructive-foreground: oklch(0.577 0.245 27.325);
--border: oklch(0.922 0 0);
--input: oklch(0.922 0 0);
--ring: oklch(0.708 0 0);
--chart-1: oklch(0.646 0.222 41.116);
--chart-2: oklch(0.6 0.118 184.704);
--chart-3: oklch(0.398 0.07 227.392);
--chart-4: oklch(0.828 0.189 84.429);
--chart-5: oklch(0.769 0.188 70.08);
--radius: 0.625rem;
--sidebar: oklch(0.985 0 0);
--sidebar-foreground: oklch(0.145 0 0);
--sidebar-primary: oklch(0.205 0 0);
--sidebar-primary-foreground: oklch(0.985 0 0);
--sidebar-accent: oklch(0.97 0 0);
--sidebar-accent-foreground: oklch(0.205 0 0);
--sidebar-border: oklch(0.922 0 0);
--sidebar-ring: oklch(0.708 0 0);
}
.dark {
--background: oklch(0.145 0 0);
--foreground: oklch(0.985 0 0);
--card: oklch(0.145 0 0);
--card-foreground: oklch(0.985 0 0);
--popover: oklch(0.145 0 0);
--popover-foreground: oklch(0.985 0 0);
--primary: oklch(0.985 0 0);
--primary-foreground: oklch(0.205 0 0);
--secondary: oklch(0.269 0 0);
--secondary-foreground: oklch(0.985 0 0);
--muted: oklch(0.269 0 0);
--muted-foreground: oklch(0.708 0 0);
--accent: oklch(0.269 0 0);
--accent-foreground: oklch(0.985 0 0);
--destructive: oklch(0.396 0.141 25.723);
--destructive-foreground: oklch(0.637 0.237 25.331);
--border: oklch(0.269 0 0);
--input: oklch(0.269 0 0);
--ring: oklch(0.439 0 0);
--chart-1: oklch(0.488 0.243 264.376);
--chart-2: oklch(0.696 0.17 162.48);
--chart-3: oklch(0.769 0.188 70.08);
--chart-4: oklch(0.627 0.265 303.9);
--chart-5: oklch(0.645 0.246 16.439);
--sidebar: oklch(0.205 0 0);
--sidebar-foreground: oklch(0.985 0 0);
--sidebar-primary: oklch(0.488 0.243 264.376);
--sidebar-primary-foreground: oklch(0.985 0 0);
--sidebar-accent: oklch(0.269 0 0);
--sidebar-accent-foreground: oklch(0.985 0 0);
--sidebar-border: oklch(0.269 0 0);
--sidebar-ring: oklch(0.439 0 0);
}
:root {
--font-sans: var(--font-geist-sans);
--font-mono: var(--font-geist-mono);
--color-background: var(--background);
--color-foreground: var(--foreground);
--color-card: var(--card);
--color-card-foreground: var(--card-foreground);
--color-popover: var(--popover);
--color-popover-foreground: var(--popover-foreground);
--color-primary: var(--primary);
--color-primary-foreground: var(--primary-foreground);
--color-secondary: var(--secondary);
--color-secondary-foreground: var(--secondary-foreground);
--color-muted: var(--muted);
--color-muted-foreground: var(--muted-foreground);
--color-accent: var(--accent);
--color-accent-foreground: var(--accent-foreground);
--color-destructive: var(--destructive);
--color-destructive-foreground: var(--destructive-foreground);
--color-border: var(--border);
--color-input: var(--input);
--color-ring: var(--ring);
--color-chart-1: var(--chart-1);
--color-chart-2: var(--chart-2);
--color-chart-3: var(--chart-3);
--color-chart-4: var(--chart-4);
--color-chart-5: var(--chart-5);
--radius-sm: calc(var(--radius) - 4px);
--radius-md: calc(var(--radius) - 2px);
--radius-lg: var(--radius);
--radius-xl: calc(var(--radius) + 4px);
--color-sidebar: var(--sidebar);
--color-sidebar-foreground: var(--sidebar-foreground);
--color-sidebar-primary: var(--sidebar-primary);
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
--color-sidebar-accent: var(--sidebar-accent);
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
--color-sidebar-border: var(--sidebar-border);
--color-sidebar-ring: var(--sidebar-ring);
}
@layer base {
* {
border-color: var(--border);
outline-color: var(--ring);
outline-width: 2px;
outline-style: solid;
outline-offset: 0.5px;
}
body {
background-color: var(--background);
color: var(--foreground);
}
}
.buttonText {
background-color: var(--primary);
}

View File

@ -20,7 +20,7 @@
}
],
"paths": {
"@/*": ["./*"]
"@/*": ["./src/*"]
}
},
"include": [