diff --git a/src/app/favicon.ico b/src/app/favicon.ico index 718d6fea..381da129 100644 Binary files a/src/app/favicon.ico and b/src/app/favicon.ico differ diff --git a/src/app/solicitar-ayuda/_components/Form/FormContainer.tsx b/src/app/solicitar-ayuda/_components/Form/FormContainer.tsx index f99792f3..200aeb22 100644 --- a/src/app/solicitar-ayuda/_components/Form/FormContainer.tsx +++ b/src/app/solicitar-ayuda/_components/Form/FormContainer.tsx @@ -33,7 +33,7 @@ export function FormContainer() { const session = useSession(); const [formData, setFormData] = useState({ - nombre: session?.user?.user_metadata?.full_name || '', + nombre: session?.user?.user_metadata?.full_name || session?.user?.user_metadata?.nombre || ''.split(' ')[0], ubicacion: '', coordinates: null, tiposDeAyuda: new Map(TIPOS_DE_AYUDA.map(({ id }) => [id, false])), @@ -91,7 +91,7 @@ export function FormContainer() { try { const helpRequestData: Database['public']['Tables']['help_requests']['Insert'] = { type: 'necesita', - name: formData.nombre, + name: formData.nombre.split(' ')[0], location: formData.ubicacion, latitude: formData.coordinates ? parseFloat(formData.coordinates.lat) : null, longitude: formData.coordinates ? parseFloat(formData.coordinates.lng) : null, diff --git a/src/app/solicitar-ayuda/_components/Form/FormRenderer.tsx b/src/app/solicitar-ayuda/_components/Form/FormRenderer.tsx index 36edb6c1..11d730ca 100644 --- a/src/app/solicitar-ayuda/_components/Form/FormRenderer.tsx +++ b/src/app/solicitar-ayuda/_components/Form/FormRenderer.tsx @@ -62,7 +62,7 @@ export function FormRenderer({
- +
-
{caso.name || 'Necesita Ayuda'}
+
{caso?.name?.split(" ")[0] || 'Necesita Ayuda'}
{new Date(caso.created_at!).toLocaleDateString() + ' ' + diff --git a/src/lib/supabase/middleware.ts b/src/lib/supabase/middleware.ts index e59b4cc5..9814ec19 100644 --- a/src/lib/supabase/middleware.ts +++ b/src/lib/supabase/middleware.ts @@ -32,11 +32,20 @@ export async function updateSession(request: NextRequest) { const { data: { user }, } = await supabase.auth.getUser(); + const url = request.nextUrl.clone(); - if (!user && !request.nextUrl.pathname.startsWith('/login') && !request.nextUrl.pathname.startsWith('/auth')) { - // no user, potentially respond by redirecting the user to the login page - const url = request.nextUrl.clone(); - url.pathname = '/login'; + if ( + !user && + (request.nextUrl.pathname.startsWith('/ofertas') || request.nextUrl.pathname.startsWith('/solicitudes')) + ) { + // no user, no access to their offers or requests. Redirect to log in + + url.pathname = '/auth'; + return NextResponse.redirect(url); + } + + if (request.nextUrl.pathname === '/casos-activos') { + url.pathname = '/casos-activos/solicitudes'; return NextResponse.redirect(url); } diff --git a/middleware.ts b/src/middleware.ts similarity index 100% rename from middleware.ts rename to src/middleware.ts diff --git a/tailwind.config.js b/tailwind.config.js index 8f0f8688..2c3f3597 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -13,4 +13,10 @@ module.exports = { }, }, plugins: [], + safelist: [ + { + pattern: + /(bg|border|text)-(red|green|blue|yellow|indigo|purple|pink|gray|black|white|orange|teal|cyan|amber|lime|emerald|fuchsia|rose)-(50|100|200|300|400|500|600|700|800|900)/, + }, + ], };