feat(api): add timezone support for group fetching and increase page size

feat(attendance): refactor attendance summary logic and update tests

feat(analytics): extend GroupRiskSummary schema with absence and attendance counts

feat(groups): enhance group schema with attendee and waitlist counts

chore(skills): add frontend design skill with guidelines and license

feat(attendee-detail): implement AttendeePhoneLine component for phone display

feat(groups): create AttendanceBadge and CapacityIndicator components for group cards

feat(groups): add card utility functions for attendance alerts and capacity summaries

test(groups): implement tests for attendance alert and capacity summary logic
This commit is contained in:
Jose Selesan
2026-09-30 17:39:13 -03:00
parent 4e86096653
commit 454f20ed25
31 changed files with 1323 additions and 250 deletions

View File

@@ -46,6 +46,8 @@ import type {
UpdateStudentStatusResult,
} from '@gruperly/shared'
import { browserTimezone } from './region'
const API_URL = import.meta.env.VITE_API_URL ?? 'http://localhost:4000'
export class ApiError extends Error {
@@ -106,15 +108,23 @@ export const createGroup = (payload: CreateFirstGroup) =>
body: JSON.stringify(payload),
})
export const getGroups = () => apiFetch<GroupList>('/api/v1/groups')
/* La pantalla de grupos no tiene paginación: se pide el máximo permitido para
que ningún grupo quede fuera de la lista, y la zona horaria del browser para
que el backend ordene por la próxima clase en la hora local de la persona. */
const GROUPS_PAGE_SIZE = 100
export const getGroups = () => {
const params = new URLSearchParams({ pageSize: String(GROUPS_PAGE_SIZE) })
const timeZone = browserTimezone()
if (timeZone) {
params.set('timeZone', timeZone)
}
return apiFetch<GroupList>(`/api/v1/groups?${params.toString()}`)
}
function timeZoneParam(): string {
try {
const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone
return timeZone ? `?timeZone=${encodeURIComponent(timeZone)}` : ''
} catch {
return ''
}
const timeZone = browserTimezone()
return timeZone ? `?timeZone=${encodeURIComponent(timeZone)}` : ''
}
export const getHomeSummary = () =>