Skip to content

Commit

Permalink
Merge branch 'main' into pablogracia/filtro-peticiones-sin-voluntarios
Browse files Browse the repository at this point in the history
  • Loading branch information
PabloGracia committed Nov 7, 2024
2 parents ee6efb6 + c6b4df8 commit c0790d5
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 8 deletions.
Binary file modified src/app/favicon.ico
Binary file not shown.
4 changes: 2 additions & 2 deletions src/app/solicitar-ayuda/_components/Form/FormContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function FormContainer() {
const session = useSession();

const [formData, setFormData] = useState<FormData>({
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])),
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/app/solicitar-ayuda/_components/Form/FormRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export function FormRenderer({
<form onSubmit={handleSubmit} className="space-y-6">
<div className="grid md:grid-cols-2 gap-4">
<div>
<label className="block text-sm font-medium text-gray-700 mb-1">Nombre completo</label>
<label className="block text-sm font-medium text-gray-700 mb-1">Nombre</label>
<input
type="text"
name="nombre"
Expand Down
2 changes: 1 addition & 1 deletion src/components/SolicitudCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export default function SolicitudCard({
</svg>
</div>
<div className="flex-auto">
<div className="text-lg font-medium">{caso.name || 'Necesita Ayuda'}</div>
<div className="text-lg font-medium">{caso?.name?.split(" ")[0] || 'Necesita Ayuda'}</div>
<span className="text-gray-500">
{new Date(caso.created_at!).toLocaleDateString() +
' ' +
Expand Down
17 changes: 13 additions & 4 deletions src/lib/supabase/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
File renamed without changes.
6 changes: 6 additions & 0 deletions tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)/,
},
],
};

0 comments on commit c0790d5

Please sign in to comment.