Skip to content

Commit

Permalink
Merge pull request #133 from Paola3stefania/feature/JustFirstNamePlease
Browse files Browse the repository at this point in the history
Trimear nombre antes de guardarlo
  • Loading branch information
patrickwebsdev authored Nov 7, 2024
2 parents 2df42e7 + aeb8c91 commit 6d3b5ba
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
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.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 @@ -61,7 +61,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

0 comments on commit 6d3b5ba

Please sign in to comment.