20 ? 64 : 80,
- letterSpacing: '-0.04em',
- }}
- >
+
+ {/* Repite el mismo patrón para los otros bordes */}
+
+
+
20 ? 64 : 80,
+ lineHeight: '1.1'
+ }}>
{title}
-
+
{`${description?.slice(0, 100)}`}
@@ -57,6 +76,6 @@ export async function GET(req: NextRequest) {
style: 'normal',
},
],
- },
+ }
);
}
diff --git a/apps/web/app/opengraph-image.tsx b/apps/web/app/opengraph-image.tsx
index c809e2b..9b28978 100644
--- a/apps/web/app/opengraph-image.tsx
+++ b/apps/web/app/opengraph-image.tsx
@@ -1,8 +1,9 @@
+/* eslint-disable @next/next/no-img-element */
+
import { ImageResponse } from 'next/og';
export const runtime = 'edge';
-// Image metadata
export const alt = `Opengraph Image`;
export const size = {
width: 800,
diff --git a/apps/web/components/layout/ThemeToggle/theme-toggle.tsx b/apps/web/components/layout/ThemeToggle/theme-toggle.tsx
index 1024860..30da6f6 100644
--- a/apps/web/components/layout/ThemeToggle/theme-toggle.tsx
+++ b/apps/web/components/layout/ThemeToggle/theme-toggle.tsx
@@ -9,8 +9,8 @@ import {
DropdownMenuItem,
DropdownMenuTrigger,
} from '@repo/shadcn/dropdown-menu';
-type CompProps = {};
-export default function ThemeToggle({}: CompProps) {
+
+export default function ThemeToggle() {
const { setTheme } = useTheme();
return (
diff --git a/apps/web/components/layout/app-sidebar.tsx b/apps/web/components/layout/app-sidebar.tsx
index cdeffca..35e9608 100644
--- a/apps/web/components/layout/app-sidebar.tsx
+++ b/apps/web/components/layout/app-sidebar.tsx
@@ -1,6 +1,6 @@
'use client';
-import { NavMain as ConfigMain, NavMain as GeneralMain, NavMain as AdministrationMain, NavMain as StatisticsMain, } from '@/components/nav-main';
+import { NavMain as GeneralMain, NavMain as AdministrationMain, NavMain as StatisticsMain, } from '@/components/nav-main';
import { GeneralItems, AdministrationItems, StatisticsItems } from '@/constants/data';
import {
Sidebar,
diff --git a/apps/web/components/layout/providers.tsx b/apps/web/components/layout/providers.tsx
index b4b5a57..283f5f5 100644
--- a/apps/web/components/layout/providers.tsx
+++ b/apps/web/components/layout/providers.tsx
@@ -5,9 +5,6 @@ import { SessionProvider, SessionProviderProps } from 'next-auth/react';
import { NuqsAdapter } from 'nuqs/adapters/next/app';
import { ReactNode } from 'react';
-type ProvidersProps = {
- children: ReactNode;
-};
const queryClient = new QueryClient({
defaultOptions: {
diff --git a/apps/web/components/nav-projects.tsx b/apps/web/components/nav-projects.tsx
index 327469f..8b62d86 100644
--- a/apps/web/components/nav-projects.tsx
+++ b/apps/web/components/nav-projects.tsx
@@ -3,9 +3,7 @@
import {
Folder,
Forward,
- Frame,
PanelLeft,
- PieChart,
Trash2,
type LucideIcon,
} from 'lucide-react';
@@ -27,25 +25,6 @@ import {
useSidebar,
} from '@repo/shadcn/sidebar';
-const data = {
- projects: [
- {
- name: 'Design Engineering',
- url: '#',
- icon: Frame,
- },
- {
- name: 'Sales & Marketing',
- url: '#',
- icon: PieChart,
- },
- {
- name: 'Travel',
- url: '#',
- icon: Map,
- },
- ],
-};
export function NavProjects({
projects,
diff --git a/apps/web/components/team-switcher.tsx b/apps/web/components/team-switcher.tsx
index d68e480..f6815cb 100644
--- a/apps/web/components/team-switcher.tsx
+++ b/apps/web/components/team-switcher.tsx
@@ -1,10 +1,7 @@
'use client';
import {
- AudioWaveform,
ChevronsUpDownIcon,
- Command,
- GalleryVerticalEnd,
PlusIcon,
} from 'lucide-react';
@@ -25,25 +22,6 @@ import {
} from '@repo/shadcn/sidebar';
import * as React from 'react';
-const data = {
- teams: [
- {
- name: 'Acme Inc',
- logo: GalleryVerticalEnd,
- plan: 'Enterprise',
- },
- {
- name: 'Acme Corp.',
- logo: AudioWaveform,
- plan: 'Startup',
- },
- {
- name: 'Evil Corp.',
- logo: Command,
- plan: 'Free',
- },
- ],
-};
export function TeamSwitcher({
teams,
diff --git a/apps/web/feactures/auth/actions/login-action.ts b/apps/web/feactures/auth/actions/login-action.ts
index 23caf96..9799b80 100644
--- a/apps/web/feactures/auth/actions/login-action.ts
+++ b/apps/web/feactures/auth/actions/login-action.ts
@@ -2,7 +2,36 @@
import { safeFetchApi } from '@/lib';
import { loginResponseSchema, UserFormValue } from '../schemas/login';
-export const SignInAction = async (payload: UserFormValue) => {
+
+
+
+type LoginActionSuccess = {
+ message: string;
+ user: {
+ email: string;
+ username: string;
+ id: number;
+ rol: Array<{ id: number; rol: string }>;
+ fullname: string;
+ };
+ tokens: {
+ access_token: string;
+ access_expire_in: number;
+ refresh_token: string;
+ refresh_expire_in: number;
+ };
+}
+
+type LoginActionError = {
+ type: 'API_ERROR' | 'VALIDATION_ERROR' | 'UNKNOWN_ERROR'; // **Asegúrate de que el tipo de `type` sea este aquí**
+ message: string;
+ details?: any;
+};
+
+// Si SignInAction también puede devolver null, asegúralo en su tipo de retorno
+type LoginActionResult = LoginActionSuccess | LoginActionError | null;
+
+export const SignInAction = async (payload: UserFormValue): Promise => {
const [error, data] = await safeFetchApi(
loginResponseSchema,
'/auth/sign-in',
@@ -10,7 +39,11 @@ export const SignInAction = async (payload: UserFormValue) => {
payload,
);
if (error) {
- return error;
+ return {
+ type: error.type as 'API_ERROR' | 'VALIDATION_ERROR' | 'UNKNOWN_ERROR',
+ message: error.message,
+ details: error.details
+ };
} else {
return data;
}
diff --git a/apps/web/feactures/auth/components/user-register-form.tsx b/apps/web/feactures/auth/components/user-register-form.tsx
index 98e485e..ad59c68 100644
--- a/apps/web/feactures/auth/components/user-register-form.tsx
+++ b/apps/web/feactures/auth/components/user-register-form.tsx
@@ -10,7 +10,6 @@ import {
FormMessage,
} from '@repo/shadcn/form';
import { Input } from '@repo/shadcn/input';
-import { signIn } from 'next-auth/react';
import { useRouter, useSearchParams } from 'next/navigation';
import { useState, useTransition } from 'react';
import { useForm } from 'react-hook-form';
@@ -27,13 +26,10 @@ export default function UserAuthForm() {
const router = useRouter();
const searchParams = useSearchParams();
const callbackUrl = searchParams.get('callbackUrl');
- const [loading, startTransition] = useTransition();
const [error, SetError] = useState(null);
const [state, setState] = React.useState(0);
const [municipality, setMunicipality] = React.useState(0);
- const [parish, setParish] = React.useState(0);
-
const [disabledMunicipality, setDisabledMunicipality] = React.useState(true);
const [disabledParish, setDisabledParish] = React.useState(true);
diff --git a/apps/web/feactures/statistics/components/survey-details.tsx b/apps/web/feactures/statistics/components/survey-details.tsx
index ac65d34..9201f6a 100644
--- a/apps/web/feactures/statistics/components/survey-details.tsx
+++ b/apps/web/feactures/statistics/components/survey-details.tsx
@@ -3,7 +3,7 @@
import { useState } from 'react';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@repo/shadcn/card';
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@repo/shadcn/select';
-import { PieChart, Pie, Cell, ResponsiveContainer, Tooltip, Legend } from 'recharts';
+import { PieChart, Pie, Cell, ResponsiveContainer, Tooltip } from 'recharts';
import { SurveyStatisticsData } from '../schemas/statistics';
interface SurveyDetailsProps {
diff --git a/apps/web/feactures/statistics/components/survey-overview.tsx b/apps/web/feactures/statistics/components/survey-overview.tsx
index 6233f80..b64959b 100644
--- a/apps/web/feactures/statistics/components/survey-overview.tsx
+++ b/apps/web/feactures/statistics/components/survey-overview.tsx
@@ -1,7 +1,7 @@
'use client';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@repo/shadcn/card';
-import { BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer, PieChart, Pie, Cell } from 'recharts';
+import { BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer } from 'recharts';
import { SurveyStatisticsData } from '../schemas/statistics';
interface SurveyOverviewProps {
diff --git a/apps/web/feactures/statistics/components/survey-statistics.tsx b/apps/web/feactures/statistics/components/survey-statistics.tsx
index 71f759f..71e0378 100644
--- a/apps/web/feactures/statistics/components/survey-statistics.tsx
+++ b/apps/web/feactures/statistics/components/survey-statistics.tsx
@@ -1,6 +1,5 @@
'use client';
-import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@repo/shadcn/card';
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@repo/shadcn/tabs';
import { useSurveysStatsQuery } from '../hooks/use-query-statistics';
import { SurveyOverview } from './survey-overview';
diff --git a/apps/web/feactures/surveys/components/survey-list.tsx b/apps/web/feactures/surveys/components/survey-list.tsx
index 46e3cbd..3cc2a50 100644
--- a/apps/web/feactures/surveys/components/survey-list.tsx
+++ b/apps/web/feactures/surveys/components/survey-list.tsx
@@ -19,7 +19,7 @@ import {
} from '@repo/shadcn/card';
import { useRouter } from 'next/navigation';
import { useSurveysForUserQuery } from '@/feactures/surveys/hooks/use-query-surveys';
-import { Survey, SurveyAnswerForUser } from '../schemas/survey';
+import { SurveyAnswerForUser } from '../schemas/survey';
import { Badge } from '@repo/shadcn/badge';
import { BadgeCheck } from 'lucide-react';
diff --git a/apps/web/feactures/users/components/admin/surveys-tables/cell-action.tsx b/apps/web/feactures/users/components/admin/surveys-tables/cell-action.tsx
index 2fc8ce9..a2f2d0a 100644
--- a/apps/web/feactures/users/components/admin/surveys-tables/cell-action.tsx
+++ b/apps/web/feactures/users/components/admin/surveys-tables/cell-action.tsx
@@ -9,7 +9,7 @@ import {
TooltipProvider,
TooltipTrigger,
} from '@repo/shadcn/tooltip';
-import { Edit, Trash, User } from 'lucide-react';
+import { Edit, Trash } from 'lucide-react';
import { SurveyTable } from '@/feactures/users/schemas/users';
import { useDeleteUser } from '@/feactures/users/hooks/use-mutation-users';
import { AccountPlanModal } from '../user-modal';
@@ -23,7 +23,6 @@ export const CellAction: React.FC = ({ data }) => {
const [open, setOpen] = useState(false);
const [edit, setEdit] = useState(false);
const { mutate: deleteUser } = useDeleteUser();
- const router = useRouter();
const onConfirm = async () => {
try {
diff --git a/apps/web/feactures/users/components/admin/surveys-tables/users-table-action.tsx b/apps/web/feactures/users/components/admin/surveys-tables/users-table-action.tsx
index bc714d0..c482d56 100644
--- a/apps/web/feactures/users/components/admin/surveys-tables/users-table-action.tsx
+++ b/apps/web/feactures/users/components/admin/surveys-tables/users-table-action.tsx
@@ -12,7 +12,6 @@ export default function UserTableAction() {
typeFilter,
searchQuery,
setPage,
- setTypeFilter,
setSearchQuery,
} = useSurveyTableFilters();
diff --git a/apps/web/feactures/users/components/admin/users-header.tsx b/apps/web/feactures/users/components/admin/users-header.tsx
index bf4da6c..3ab7266 100644
--- a/apps/web/feactures/users/components/admin/users-header.tsx
+++ b/apps/web/feactures/users/components/admin/users-header.tsx
@@ -1,5 +1,4 @@
'use client';
-import { useRouter } from 'next/navigation';
import { Button } from '@repo/shadcn/button';
import { Heading } from '@repo/shadcn/heading';
import { Plus } from 'lucide-react';
diff --git a/apps/web/feactures/users/components/selectList.tsx b/apps/web/feactures/users/components/selectList.tsx
index 4150cd5..eec6688 100644
--- a/apps/web/feactures/users/components/selectList.tsx
+++ b/apps/web/feactures/users/components/selectList.tsx
@@ -14,9 +14,7 @@ import {
FormLabel,
FormMessage,
} from '@repo/shadcn/form';
-import { UpdateUser, updateUser } from '@/feactures/users/schemas/users';
-import { useForm } from 'react-hook-form';
-import { zodResolver } from '@hookform/resolvers/zod';
+
interface SelectListProps {
label: string
diff --git a/apps/web/feactures/users/components/update-user-form.tsx b/apps/web/feactures/users/components/update-user-form.tsx
index 6398864..077ab4f 100644
--- a/apps/web/feactures/users/components/update-user-form.tsx
+++ b/apps/web/feactures/users/components/update-user-form.tsx
@@ -46,8 +46,6 @@ export function ModalForm({
const [state, setState] = React.useState(0);
const [municipality, setMunicipality] = React.useState(0);
- const [parish, setParish] = React.useState(0);
-
const [disabledMunicipality, setDisabledMunicipality] = React.useState(true);
const [disabledParish, setDisabledParish] = React.useState(true);
diff --git a/apps/web/feactures/users/components/user-profile.tsx b/apps/web/feactures/users/components/user-profile.tsx
index 72c621c..caf6919 100644
--- a/apps/web/feactures/users/components/user-profile.tsx
+++ b/apps/web/feactures/users/components/user-profile.tsx
@@ -1,7 +1,7 @@
'use client';
import { useUserByProfile } from '@/feactures/users/hooks/use-query-users';
import { Button } from '@repo/shadcn/button';
-import { Edit, Edit2 } from 'lucide-react';
+import { Edit2 } from 'lucide-react';
import { useState } from 'react';
import { AccountPlanModal } from './modal-profile';
diff --git a/apps/web/lib/auth.config.ts b/apps/web/lib/auth.config.ts
index a4f0d54..321687c 100644
--- a/apps/web/lib/auth.config.ts
+++ b/apps/web/lib/auth.config.ts
@@ -4,6 +4,35 @@ import { CredentialsSignin, NextAuthConfig, Session, User } from 'next-auth';
import { DefaultJWT } from 'next-auth/jwt';
import CredentialProvider from 'next-auth/providers/credentials';
+
+// Define los tipos para tus respuestas de SignInAction
+interface SignInSuccessResponse {
+ message: string;
+ user: {
+ email: string;
+ username: string;
+ id: number;
+ rol: Array<{ id: number; rol: string }>;
+ fullname: string;
+ };
+ tokens: {
+ access_token: string;
+ access_expire_in: number;
+ refresh_token: string;
+ refresh_expire_in: number;
+ };
+}
+
+// **CAMBIO AQUÍ**: `type: string;` en lugar de una unión de literales
+interface SignInErrorResponse {
+ type: string; // Si SignInAction puede devolver cualquier string aquí
+ message: string;
+ details?: any;
+}
+
+// Unión de tipos para el resultado de SignInAction, AHORA INCLUYE `null`
+type SignInActionResult = SignInSuccessResponse | SignInErrorResponse | null;
+
const authConfig: NextAuthConfig = {
providers: [
CredentialProvider({
@@ -17,24 +46,39 @@ const authConfig: NextAuthConfig = {
},
async authorize(
credentials: Partial>,
- request: Request,
): Promise {
const credential = {
username: credentials?.username as string,
password: credentials?.password as string,
};
- const response = await SignInAction(credential);
-
+ // Asigna el tipo `SignInActionResult` que ahora incluye `null`
+ const response: SignInActionResult = await SignInAction(credential);
+
+ // **NUEVO: Manejar el caso `null` primero**
+ if (response === null) {
+ console.error("SignInAction returned null, indicating a potential issue before API call or generic error.");
+ throw new CredentialsSignin("Error de inicio de sesión inesperado.");
+ }
+
+ // Tipo Guarda: Verificar la respuesta de error
if (
- response &&
'type' in response &&
(response.type === 'API_ERROR' ||
- response.type === 'VALIDATION_ERROR')
+ response.type === 'VALIDATION_ERROR' ||
+ response.type === 'UNKNOWN_ERROR') // Incluye todos los tipos de error posibles
) {
+ // Si es un error, lánzalo. Este camino termina aquí.
throw new CredentialsSignin(response.message);
}
+ if (!('user' in response)) {
+ // Esto solo ocurriría si SignInAction devolvió un objeto que no es null,
+ // no es un error conocido por 'type', PERO tampoco tiene la propiedad 'user'.
+ // Es un caso de respuesta inesperada del API.
+ console.error("Respuesta de SignInAction con formato inesperado: falta la propiedad 'user'.");
+ throw new CredentialsSignin("Error en el formato de la respuesta del servidor.");
+ }
return {
id: response?.user.id?.toString() ?? '0',
@@ -58,12 +102,10 @@ const authConfig: NextAuthConfig = {
callbacks: {
async jwt({
token,
- user,
- account,
+ user
}: {
token: any;
user: User;
- account: any;
}) {
// Si es un nuevo login, asignamos los datos
if (user) {
@@ -94,6 +136,7 @@ const authConfig: NextAuthConfig = {
token.refresh_token = res.tokens.refresh_token;
token.refresh_expire_in = res.tokens.refresh_expire_in;
} catch (error) {
+ console.log(error);
return null;
}
}
diff --git a/apps/web/server/home.server.ts b/apps/web/server/home.server.ts
deleted file mode 100644
index 56c1b2c..0000000
--- a/apps/web/server/home.server.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-'use server';
-
-import { safeFetch } from '@/lib/safeFetch';
-import { GetAllUsers, GetAllUsersSchema } from '@/types/user.type';
-
-export const getAllUsers = async (): Promise => {
- const [isError, data] = await safeFetch(GetAllUsersSchema, '/users', {
- cache: 'no-store',
- });
- if (isError)
- return {
- data: [],
- };
- return data;
-};
diff --git a/apps/web/tsconfig.json b/apps/web/tsconfig.json
index 95ed664..c08e741 100644
--- a/apps/web/tsconfig.json
+++ b/apps/web/tsconfig.json
@@ -7,7 +7,8 @@
}
],
"paths": {
- "@/*": ["./*"]
+ "@/*": ["./*"],
+ "@repo/shadcn/*": ["../../packages/shadcn/src/*"]
}
},
"include": [
diff --git a/packages/eslint-config/next.js b/packages/eslint-config/next.js
index 0f93103..d77a9db 100644
--- a/packages/eslint-config/next.js
+++ b/packages/eslint-config/next.js
@@ -46,4 +46,11 @@ export const nextJsConfig = [
'react/react-in-jsx-scope': 'off',
},
},
+ // Aquí agregamos el override para TS
+ {
+ files: ['*.ts', '*.tsx'],
+ rules: {
+ 'react/prop-types': 'off',
+ },
+ },
];
diff --git a/packages/shadcn/src/components/ui/calendar.tsx b/packages/shadcn/src/components/ui/calendar.tsx
index ce40e81..d70bd60 100644
--- a/packages/shadcn/src/components/ui/calendar.tsx
+++ b/packages/shadcn/src/components/ui/calendar.tsx
@@ -5,7 +5,7 @@ import { DayPicker } from "react-day-picker"
import { cn } from "@repo/shadcn/lib/utils"
import { buttonVariants } from "@repo/shadcn/components/ui/button"
-import { ChevronLeftIcon, ChevronRightIcon } from "@radix-ui/react-icons"
+import { ChevronLeftIcon, ChevronRightIcon } from "@radix-ui/react-icons" // Asegúrate de que esto está bien importado
function Calendar({
className,
@@ -60,11 +60,17 @@ function Calendar({
...classNames,
}}
components={{
- IconLeft: ({ className, ...props }) => (
-
+ IconLeft: ({ className, children, style, ...propsFromDayPicker }) => ( // <--- CAMBIO AQUÍ
+
),
- IconRight: ({ className, ...props }) => (
-
+ IconRight: ({ className, children, style, ...propsFromDayPicker }) => ( // <--- CAMBIO AQUÍ
+
),
}}
{...props}
@@ -72,4 +78,4 @@ function Calendar({
)
}
-export { Calendar }
+export { Calendar }
\ No newline at end of file