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:
parent
498d6c80c1
commit
b0ab1e86ca
@ -54,7 +54,7 @@ import {
|
|||||||
} from "@/components/ui/select";
|
} from "@/components/ui/select";
|
||||||
|
|
||||||
import { mockAppointments, mockProfessionals } from "@/lib/mocks/appointment-mocks";
|
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) => {
|
const formatDate = (date: string | Date) => {
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, Di
|
|||||||
import { Label } from "@/components/ui/label";
|
import { Label } from "@/components/ui/label";
|
||||||
import { MoreHorizontal, Plus, Search, Edit, Trash2, ArrowLeft, Eye } from "lucide-react";
|
import { MoreHorizontal, Plus, Search, Edit, Trash2, ArrowLeft, Eye } from "lucide-react";
|
||||||
import { Badge } from "@/components/ui/badge";
|
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";
|
import { listarMedicos, excluirMedico, buscarMedicos, buscarMedicoPorId, Medico } from "@/lib/api";
|
||||||
|
|||||||
@ -11,7 +11,7 @@ import { Label } from "@/components/ui/label";
|
|||||||
import { MoreHorizontal, Plus, Search, Eye, Edit, Trash2, ArrowLeft } from "lucide-react";
|
import { MoreHorizontal, Plus, Search, Eye, Edit, Trash2, ArrowLeft } from "lucide-react";
|
||||||
|
|
||||||
import { Paciente, Endereco, listarPacientes, buscarPacientes, buscarPacientePorId, excluirPaciente } from "@/lib/api";
|
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 {
|
function normalizePaciente(p: any): Paciente {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { Header } from "@/components/layout/marketing/Header"
|
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"
|
import { Footer } from "@/components/layout/marketing/Footer"
|
||||||
|
|
||||||
export default function AboutPage() {
|
export default function AboutPage() {
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useRouter } from "next/navigation";
|
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 HeaderAgenda from "@/components/agenda/HeaderAgenda";
|
||||||
import FooterAgenda from "@/components/agenda/FooterAgenda";
|
import FooterAgenda from "@/components/agenda/FooterAgenda";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import type React from "react"
|
import type React from "react"
|
||||||
import type { Metadata } from "next"
|
import type { Metadata } from "next"
|
||||||
import { AuthProvider } from "@/hooks/useAuth"
|
import { AuthProvider } from "@/features/autenticacao/hooks/useAuth"
|
||||||
import { ThemeProvider } from "@/components/layout/ThemeProvider"
|
import { ThemeProvider } from "@/components/layout/ThemeProvider"
|
||||||
import "./globals.css"
|
import "./globals.css"
|
||||||
|
|
||||||
|
|||||||
@ -3,13 +3,13 @@
|
|||||||
import { useEffect, useMemo, useState, type ChangeEvent, type FormEvent } from 'react'
|
import { useEffect, useMemo, useState, type ChangeEvent, type FormEvent } from 'react'
|
||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
import { useRouter, useSearchParams } from 'next/navigation'
|
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 { Button } from '@/components/ui/button'
|
||||||
import { Input } from '@/components/ui/input'
|
import { Input } from '@/components/ui/input'
|
||||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
|
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
|
||||||
import { Alert, AlertDescription } from '@/components/ui/alert'
|
import { Alert, AlertDescription } from '@/components/ui/alert'
|
||||||
import { AuthenticationError } from '@/lib/auth'
|
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'
|
type UserRole = 'profissional' | 'paciente' | 'administrador'
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { Header } from "@/components/layout/marketing/Header"
|
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"
|
import { Footer } from "@/components/layout/marketing/Footer"
|
||||||
|
|
||||||
export default function HomePage() {
|
export default function HomePage() {
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
import { useEffect, useRef } from 'react'
|
import { useEffect, useRef } from 'react'
|
||||||
import { useRouter } from 'next/navigation'
|
import { useRouter } from 'next/navigation'
|
||||||
import { useAuth } from '@/hooks/useAuth'
|
import { useAuth } from '@/hooks/useAuth'
|
||||||
import type { UserType } from '@/types/auth'
|
import type { UserType } from '@/features/autenticacao/types'
|
||||||
import { USER_TYPE_ROUTES, LOGIN_ROUTES, AUTH_STORAGE_KEYS } from '@/types/auth'
|
import { USER_TYPE_ROUTES, LOGIN_ROUTES, AUTH_STORAGE_KEYS } from '@/features/autenticacao/types'
|
||||||
|
|
||||||
interface ProtectedRouteProps {
|
interface ProtectedRouteProps {
|
||||||
children: React.ReactNode
|
children: React.ReactNode
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import httpClient from "@/lib/http";
|
import httpClient from "@/lib/http";
|
||||||
import { API_KEY } from "@/lib/config"; // Necessário para algumas chamadas de auth
|
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 =====
|
// ===== TIPOS DE AUTENTICAÇÃO E PERFIL =====
|
||||||
export type Profile = {
|
export type Profile = {
|
||||||
@ -11,9 +12,10 @@ export type Profile = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export type CreateUserWithPasswordResponse = {
|
export type CreateUserWithPasswordResponse = {
|
||||||
user_id: string;
|
success: boolean;
|
||||||
|
user: any; // Objeto do usuário retornado pelo Supabase
|
||||||
email: string;
|
email: string;
|
||||||
password?: string; // A senha só é retornada na criação
|
password?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type UserData = {
|
export type UserData = {
|
||||||
|
|||||||
@ -9,8 +9,8 @@ import type {
|
|||||||
UserData,
|
UserData,
|
||||||
AuthStatus,
|
AuthStatus,
|
||||||
UserType
|
UserType
|
||||||
} from '@/types/auth'
|
} from '@/features/autenticacao/types'
|
||||||
import { AUTH_STORAGE_KEYS, LOGIN_ROUTES } from '@/types/auth'
|
import { AUTH_STORAGE_KEYS, LOGIN_ROUTES } from '@/features/autenticacao/types'
|
||||||
|
|
||||||
const AuthContext = createContext<AuthContextType | undefined>(undefined)
|
const AuthContext = createContext<AuthContextType | undefined>(undefined)
|
||||||
|
|
||||||
@ -4,7 +4,7 @@ import type {
|
|||||||
RefreshTokenResponse,
|
RefreshTokenResponse,
|
||||||
AuthError,
|
AuthError,
|
||||||
UserData
|
UserData
|
||||||
} from '@/types/auth';
|
} from '@/features/autenticacao/types';
|
||||||
|
|
||||||
import { API_CONFIG, AUTH_ENDPOINTS, DEFAULT_HEADERS, API_KEY, buildApiUrl } from '@/lib/config';
|
import { API_CONFIG, AUTH_ENDPOINTS, DEFAULT_HEADERS, API_KEY, buildApiUrl } from '@/lib/config';
|
||||||
import { debugRequest } from '@/lib/debug-utils';
|
import { debugRequest } from '@/lib/debug-utils';
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
* Implementa lock para evitar múltiplas chamadas de refresh simultaneamente
|
* 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 { isExpired } from '@/lib/jwt'
|
||||||
import { API_KEY } from '@/lib/config'
|
import { API_KEY } from '@/lib/config'
|
||||||
|
|
||||||
|
|||||||
@ -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);
|
|
||||||
}
|
|
||||||
@ -20,7 +20,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/*": ["./*"]
|
"@/*": ["./src/*"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user