feat(web): pulido mobile de ficha de grupo, alumno, nuevo grupo y ajustes

- Ficha de grupo: "Agregar miembro" a todo el ancho y debajo Estadísticas,
  Cobrar y Compartir con icono y texto (antes iconos sueltos en mobile).
  Los mensajes automáticos de WhatsApp quedan en una fila plegable que
  arranca cerrada si no hay ninguno activo.
- Historial del alumno: arranca en la primera clase registrada si es
  anterior al alta, como la lista y la regla de riesgo ("1 de 5" en ambos).
- Nuevo grupo: cupo 10 por defecto, precio vacío obligatorio y foco
  inicial en el nombre.
- Ajustes: chevron en Seguridad; el botón de tema del header queda solo
  en desktop (en mobile vive en Apariencia).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jose Selesan
2026-10-27 14:33:37 -03:00
parent e6d405a71e
commit 90f31290d4
7 changed files with 156 additions and 80 deletions

View File

@@ -39,8 +39,21 @@ export class GetAttendeeHistory {
return err(notFoundResourceProblem('Attendee', attendeeId));
}
// Same effective join date as the risk rule (`toMemberAttendance`): an
// attendee loaded after their first classes were already recorded starts
// at that first class, not at `createdAt`. Otherwise this screen said
// "1 de 3 clases" while the group list said "1 de 5" for the same person.
const firstAttendance = await db.attendance.findFirst({
where: { attendeeId },
orderBy: { classSession: { startsAt: 'asc' } },
select: { classSession: { select: { startsAt: true } } },
});
const firstClassAt = firstAttendance?.classSession.startsAt;
const since =
firstClassAt && firstClassAt < attendee.createdAt ? firstClassAt : attendee.createdAt;
const sessions = await db.classSession.findMany({
where: { groupId, startsAt: { gte: attendee.createdAt } },
where: { groupId, startsAt: { gte: since } },
orderBy: { startsAt: 'desc' },
take: HISTORY_SESSIONS_LIMIT,
select: { id: true, startsAt: true },

View File

@@ -16,6 +16,7 @@ const db = {
},
attendance: {
findMany: mock(),
findFirst: mock(),
},
slotRelease: {
count: mock(),
@@ -251,6 +252,29 @@ describe('analytics routes', () => {
});
});
it('arranca en la primera clase registrada si es anterior al alta', async () => {
// Loaded on 1/10 with classes already marked since 20/9: the history
// starts at the first one, as the risk rule and the group list count it.
prisma.group.findUnique.mockResolvedValue(makeGroup());
prisma.attendee.findFirst.mockResolvedValue({
id: 'a-1',
fullName: 'Ana Pérez',
createdAt: new Date('2026-10-01T00:00:00.000Z'),
});
prisma.attendance.findFirst.mockResolvedValueOnce({
classSession: { startsAt: new Date('2026-09-20T10:00:00.000Z') },
});
prisma.classSession.findMany.mockResolvedValue([]);
await makeApp({ id: userId }).request('/groups/group-1/attendees/a-1/history');
expect(prisma.classSession.findMany).toHaveBeenCalledWith(
expect.objectContaining({
where: { groupId: 'group-1', startsAt: { gte: new Date('2026-09-20T10:00:00.000Z') } },
}),
);
});
it('devuelve 404 si el alumno no pertenece al grupo', async () => {
prisma.group.findUnique.mockResolvedValue(makeGroup());
prisma.attendee.findFirst.mockResolvedValue(null);