chore: update comments and documentation for clarity and consistency across various files
- Translated comments from Spanish to English in vite.config.ts, docker-compose.yml, attendance-risk.ts, analytics.ts, attendance.ts, attendees.ts, enums.ts, groups.ts, and onboarding.ts. - Improved descriptions for better understanding of code functionality and purpose. - Ensured uniformity in terminology and phrasing throughout the codebase.
This commit is contained in:
@@ -30,7 +30,7 @@ export type ListSection = 'members' | 'pending'
|
||||
type GroupDetailContextValue = {
|
||||
groupId: string
|
||||
group: GroupDto | undefined
|
||||
/** Nombre para el título grande: dato real, caché o "Grupo" mientras carga. */
|
||||
/** Name for the large title: real data, cache or "Grupo" while loading. */
|
||||
groupTitle: string
|
||||
groupQueryPending: boolean
|
||||
riskLevel: GroupRiskLevel
|
||||
@@ -50,7 +50,7 @@ type GroupDetailContextValue = {
|
||||
whatsappMessage: string
|
||||
searchFilter: string
|
||||
setSearchFilter: (value: string) => void
|
||||
/** La lista de miembros se reduce a quienes tienen el cobro vencido. */
|
||||
/** The member list narrows down to those whose charge is overdue. */
|
||||
overdueOnly: boolean
|
||||
setOverdueOnly: (value: boolean) => void
|
||||
listSection: ListSection
|
||||
@@ -96,8 +96,8 @@ export function GroupDetailProvider({ groupId, children }: { groupId: string; ch
|
||||
const [searchFilter, setSearchFilter] = useState('')
|
||||
const [overdueOnly, setOverdueOnly] = useState(false)
|
||||
|
||||
// Los controles de la lista pertenecen a la vista que los abrió: al cambiar de
|
||||
// pestaña se limpian para no heredar un filtro sin coincidencias.
|
||||
// The list's controls belong to the view that opened them: on a tab change
|
||||
// they are cleared so as not to inherit a filter with no matches.
|
||||
const setListSection = (value: ListSection) => {
|
||||
setListSectionState(value)
|
||||
setSearchFilter('')
|
||||
@@ -286,14 +286,15 @@ export function GroupDetailProvider({ groupId, children }: { groupId: string; ch
|
||||
toast.success('¡Abriendo WhatsApp! Mensaje copiado al portapapeles.')
|
||||
}
|
||||
} catch {
|
||||
// Si el portapapeles falla, igual abrimos WhatsApp con el mensaje.
|
||||
// If the clipboard fails, we still open WhatsApp with the message.
|
||||
}
|
||||
window.open(whatsappShareUrl, '_blank', 'noopener,noreferrer')
|
||||
}
|
||||
|
||||
// El título grande va siempre, incluso cargando: es lo que da altura a la
|
||||
// barra immersive y evita que el layout salte. Al llegar desde la ficha del
|
||||
// grupo el nombre ya está en caché; en la primera carga cae a "Grupo".
|
||||
// The large title always renders, even while loading: it is what gives the
|
||||
// immersive bar its height and stops the layout from jumping. Arriving from
|
||||
// the group detail page the name is already cached; on the first load it falls
|
||||
// back to "Grupo".
|
||||
const cachedGroupName = queryClient.getQueryData<GroupDto>(['group', groupId])?.name
|
||||
const groupTitle = group?.name ?? cachedGroupName ?? 'Grupo'
|
||||
|
||||
|
||||
@@ -25,8 +25,9 @@ export function GroupDetailView() {
|
||||
|
||||
return (
|
||||
<section className="animate-fade-in space-y-5 sm:space-y-6">
|
||||
{/* El título grande va siempre, incluso cargando: es lo que da altura a
|
||||
la barra immersive y evita que el layout salte cuando llegan los datos. */}
|
||||
{/* The large title always renders, even while loading: it is what gives
|
||||
the immersive bar its height and stops the layout from jumping when
|
||||
the data arrives. */}
|
||||
<GroupHeader />
|
||||
|
||||
{groupQueryPending ? (
|
||||
|
||||
@@ -23,15 +23,16 @@ export function GroupHeader() {
|
||||
const navigate = useNavigate()
|
||||
const hasRisk = riskLevel === 'HIGH' || riskLevel === 'MEDIUM'
|
||||
|
||||
// Grupo recién creado (sin miembros ni pendientes): los empty states de cada
|
||||
// pestaña ya ofrecen "Compartir" y "Agregar" con su primario explicado, así
|
||||
// que el header no repite las mismas acciones una segunda vez.
|
||||
// Brand new group (no members, nothing pending): each tab's empty state
|
||||
// already offers "Compartir" and "Agregar" with its primary explained, so the
|
||||
// header does not repeat the same actions a second time.
|
||||
const listLoading = attendeesPending || preRegistrationsPending || waitlistPending
|
||||
const isEmptyGroup =
|
||||
!listLoading && attendeesTotal === 0 && preRegistrationsTotal === 0 && waitlistTotal === 0
|
||||
|
||||
// Sin grupo todavía solo se pinta el título: los badges, la descripción y las
|
||||
// acciones necesitan datos, y mostrarlos a medias daría un header parpadeante.
|
||||
// With no group yet only the title is painted: the badges, the description and
|
||||
// the actions need data, and showing them halfway would give a flickering
|
||||
// header.
|
||||
const hasGroup = Boolean(group)
|
||||
|
||||
return (
|
||||
@@ -48,8 +49,8 @@ export function GroupHeader() {
|
||||
</Link>
|
||||
}
|
||||
>
|
||||
{/* Los estados cuelgan del título y no de la barra: en la barra
|
||||
colapsada solo va el nombre, que es lo que se usa para orientarse. */}
|
||||
{/* The states hang off the title and not off the bar: in the collapsed
|
||||
bar only the name goes, which is what you use to orient yourself. */}
|
||||
{hasGroup ? (
|
||||
<div className="mt-3 flex flex-wrap items-center gap-2">
|
||||
<Badge variant="success" className="gap-1.5 text-[11px]">
|
||||
@@ -57,8 +58,9 @@ export function GroupHeader() {
|
||||
Activo
|
||||
</Badge>
|
||||
{hasRisk ? (
|
||||
// El badge no puede llevar texto largo sin ensuciar el header: la
|
||||
// explicación (riesgo de abandono, no de cobranza) vive en el tooltip.
|
||||
// The badge cannot carry long text without cluttering the header:
|
||||
// the explanation (dropout risk, not collections risk) lives in the
|
||||
// tooltip.
|
||||
<Tooltip content={RISK_HINT}>
|
||||
<Badge
|
||||
variant={riskLevel === 'HIGH' ? 'danger' : 'warning'}
|
||||
@@ -86,13 +88,14 @@ export function GroupHeader() {
|
||||
</LargeTitle>
|
||||
|
||||
{hasGroup ? (
|
||||
// Una sola fila en mobile: el primario toma el ancho que sobra y las dos
|
||||
// acciones de apoyo se pliegan a iconos de 44px. En sm+ recuperan el
|
||||
// texto porque hay ancho de sobra y el rótulo hace más claro el destino.
|
||||
// A single row on mobile: the primary takes the leftover width and the two
|
||||
// supporting actions collapse into 44px icons. At sm+ they get their text
|
||||
// back because there is plenty of width and the label makes the
|
||||
// destination clearer.
|
||||
<div className="mt-4 flex items-center gap-2.5 sm:mt-5 sm:justify-end">
|
||||
{!isEmptyGroup ? (
|
||||
// Un solo primario por pantalla: "Agregar" encabeza la jerarquía y
|
||||
// las acciones de apoyo quedan al lado, en outline.
|
||||
// One primary per screen: "Agregar" heads the hierarchy and the
|
||||
// supporting actions sit beside it, in outline.
|
||||
<Button
|
||||
variant="primary"
|
||||
onClick={() =>
|
||||
@@ -110,7 +113,8 @@ export function GroupHeader() {
|
||||
aria-label="Estadísticas"
|
||||
className={cn(
|
||||
'h-11 shrink-0 justify-center border-border',
|
||||
// En grupo vacío es la única acción del header: ocupa la fila entera.
|
||||
// On an empty group it is the header's only action: it takes the
|
||||
// whole row.
|
||||
isEmptyGroup && 'w-full sm:w-auto',
|
||||
!isEmptyGroup && 'w-11 sm:w-auto sm:px-4',
|
||||
)}
|
||||
|
||||
@@ -7,10 +7,10 @@ import {
|
||||
import { cn } from '../../../lib/utils'
|
||||
import { useGroupDetail } from './GroupDetailProvider'
|
||||
|
||||
/* Escala de la tarjeta: label 11 (etiqueta) · valor 16 (dato) · hero 24
|
||||
(cupo). El cupo es lo único que se escanea de un vistazo, por eso es el
|
||||
único que sube de nivel; el resto se lee en línea. El ritmo vertical está
|
||||
apretado a propósito (~24px menos que antes) sin bajar la legibilidad. */
|
||||
/* The card's scale: label 11 (label) · value 16 (data) · hero 24 (capacity). The
|
||||
capacity is the only thing you scan at a glance, which is why it is the only
|
||||
one that goes up a level; the rest is read inline. The vertical rhythm is
|
||||
deliberately tight (~24px less than before) without hurting legibility. */
|
||||
const LABEL_CLASS = 'text-[11px] font-semibold uppercase tracking-wide text-foreground/70'
|
||||
const CELL_CLASS = 'flex items-start gap-3 py-2.5 first:pt-0 last:pb-0 md:py-0'
|
||||
|
||||
|
||||
@@ -11,9 +11,9 @@ import {
|
||||
summarizeAttendance,
|
||||
} from './member-row'
|
||||
|
||||
/* Solo lo excepcional se pinta. "Al día" queda en el tono base y con un check
|
||||
para que el estado se lea sin depender del color; vencido es el único que
|
||||
sube de peso. */
|
||||
/* Only the exceptional is painted. "Ok" stays in the base tone and with a check
|
||||
so the state reads without depending on color; overdue is the only one that
|
||||
gains weight. */
|
||||
const PAYMENT_TONE: Record<PaymentState['kind'], string> = {
|
||||
settled: 'text-foreground',
|
||||
dueSoon: 'font-medium text-warning',
|
||||
@@ -40,8 +40,8 @@ function AttendanceStrip({ recent }: { recent: AttendanceStatus[] }) {
|
||||
|
||||
return (
|
||||
<div className="mt-0.5 flex items-center gap-2">
|
||||
{/* Cada punto lleva su propio nombre accesible: el color solo es el
|
||||
refuerzo visual, no la única forma de saber qué pasó. */}
|
||||
{/* Every dot carries its own accessible name: color is only the visual
|
||||
reinforcement, not the only way to know what happened. */}
|
||||
<span className="flex items-center gap-1">
|
||||
{summary.dots.map((status, index) => (
|
||||
<span
|
||||
@@ -70,9 +70,10 @@ function MemberRow({
|
||||
<Link
|
||||
to="/groups/$groupId/attendees/$attendeeId"
|
||||
params={{ groupId, attendeeId: attendee.id }}
|
||||
// `min-h-14` (56px) es el piso táctil cómodo. La fila entera es el link, así
|
||||
// que no hace falta chevron ni fila con tabIndex: hereda el rol y el
|
||||
// teclado del <a>, y además sirve el href real al abrir en otra pestaña.
|
||||
// `min-h-14` (56px) is the comfortable touch floor. The whole row is the
|
||||
// link, so there is no need for a chevron or a row with tabIndex: it
|
||||
// inherits the role and keyboard of the <a>, and it also serves the real
|
||||
// href when opened in another tab.
|
||||
className={cn(
|
||||
'flex min-h-14 items-center border-b border-foreground/10 px-3 py-2.5',
|
||||
'transition-colors duration-150 hover:bg-surface/60 active:bg-surface',
|
||||
@@ -93,8 +94,8 @@ function MemberRow({
|
||||
}
|
||||
|
||||
export function MembersList({ attendees }: { attendees: AttendeeListItem[] }) {
|
||||
// El groupId se lee una vez y se pasa: suscribir cada fila al contexto entero
|
||||
// hace que un cambio de estado del provider re-renderice N filas sin motivo.
|
||||
// groupId is read once and passed down: subscribing every row to the whole
|
||||
// context makes a provider state change re-render N rows for no reason.
|
||||
const { groupId } = useGroupDetail()
|
||||
|
||||
return (
|
||||
|
||||
@@ -16,7 +16,7 @@ function OverdueFilter({ count }: { count: number }) {
|
||||
aria-pressed={overdueOnly}
|
||||
onClick={() => setOverdueOnly(!overdueOnly)}
|
||||
className={cn(
|
||||
// min-h-11 (44px): objetivo táctil mínimo, igual que los chips de sección.
|
||||
// min-h-11 (44px): minimum touch target, same as the section chips.
|
||||
'inline-flex min-h-11 items-center gap-1.5 rounded-full border px-3.5 text-xs font-semibold',
|
||||
'transition-[background-color,color,border-color,box-shadow] duration-150',
|
||||
'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-primary-soft',
|
||||
@@ -25,8 +25,8 @@ function OverdueFilter({ count }: { count: number }) {
|
||||
: 'border-border bg-surface text-foreground hover:border-danger/40 hover:text-danger',
|
||||
)}
|
||||
>
|
||||
{/* La ✕ solo aparece con el filtro puesto: es la señal de que tocarlo
|
||||
lo saca, sin tener que decirlo. */}
|
||||
{/* The ✕ only shows with the filter on: it is the signal that tapping it
|
||||
takes the filter off, without having to say so. */}
|
||||
{overdueOnly ? <X className="size-3.5 shrink-0" aria-hidden="true" /> : null}
|
||||
<span className="whitespace-nowrap">{count} con pago vencido</span>
|
||||
</button>
|
||||
@@ -46,8 +46,8 @@ export function MembersView() {
|
||||
const navigate = useNavigate()
|
||||
|
||||
const query = searchFilter.trim().toLowerCase()
|
||||
// El teléfono no se muestra en la fila, pero sigue siendo una vía de búsqueda:
|
||||
// es como la mayoría conoce a los alumnos del grupo.
|
||||
// The phone is not shown on the row but is still a search path: it is how most
|
||||
// people know the group's attendees.
|
||||
const matchesQuery = (attendee: (typeof attendees)[number]) =>
|
||||
!query ||
|
||||
attendee.fullName.toLowerCase().includes(query) ||
|
||||
@@ -61,9 +61,9 @@ export function MembersView() {
|
||||
const visible = attendees
|
||||
.filter((attendee) => !overdueOnly || isOverdue(resolvePaymentState(attendee.payment)))
|
||||
.filter(matchesQuery)
|
||||
// Orden alfabético fijo: si se ordenara por cobro o asistencia las filas
|
||||
// saltarían de lugar cada vez que alguien paga o falta, y el nombre es la
|
||||
// única columna estable de la lista.
|
||||
// Fixed alphabetical order: if it were sorted by charge or attendance the
|
||||
// rows would jump around every time someone pays or misses, and the name is
|
||||
// the only stable column in the list.
|
||||
.sort(byFullName)
|
||||
|
||||
if (attendeesPending) {
|
||||
@@ -108,8 +108,8 @@ export function MembersView() {
|
||||
const filterBar = overdueCount > 0 ? <OverdueFilter count={overdueCount} /> : null
|
||||
|
||||
if (visible.length === 0) {
|
||||
// El filtro de vencidos nunca queda vacío por sí solo (el chip no se muestra
|
||||
// si no hay vencidos), así que un vacío acá es siempre la búsqueda.
|
||||
// The overdue filter never ends up empty on its own (the chip is not shown
|
||||
// if there are none overdue), so an empty list here is always the search.
|
||||
return (
|
||||
<>
|
||||
{filterBar}
|
||||
|
||||
@@ -9,19 +9,19 @@ import { SectionChips } from './SectionChips'
|
||||
export function MembersWaitlistSection() {
|
||||
const { listSection, searchFilter, setSearchFilter, attendeesTotal } = useGroupDetail()
|
||||
|
||||
// Con pocos miembros el buscador es ruido: se alcanza con recorrer la lista.
|
||||
// Se quita del árbol en vez de esconderse, para no dejar un hueco en la fila.
|
||||
// En Pendientes no cambia nada: ahí el volumen es el que es.
|
||||
// With few attendees the search is noise: scrolling the list is enough. It is
|
||||
// removed from the tree instead of hidden, so as not to leave a gap in the
|
||||
// row. In Pendientes nothing changes: there the volume is what it is.
|
||||
const showSearch = listSection === 'pending' || attendeesTotal > MEMBER_SEARCH_MIN
|
||||
|
||||
return (
|
||||
// Una sola superficie: la lista va directo sobre el lavado, como la info
|
||||
// card de arriba, en vez de anidarse en una caja más clara. La separación
|
||||
// entre controles y datos la dan los propios divisores de fila, el tono
|
||||
// propio del input y el borde de los chips; una caja intermedia solo
|
||||
// sumaba un nivel de contención y padding horizontal.
|
||||
// `overflow-hidden` recorta el hover de las filas y el borde inferior
|
||||
// contra el radio del panel: las filas son full-bleed.
|
||||
// A single surface: the list sits directly on the wash, like the info card
|
||||
// above, instead of nesting inside a lighter box. The separation between
|
||||
// controls and data comes from the row dividers themselves, the input's own
|
||||
// tone and the chips' border; an intermediate box only added a level of
|
||||
// containment and horizontal padding.
|
||||
// `overflow-hidden` clips the rows' hover and the bottom border against the
|
||||
// panel's radius: the rows are full-bleed.
|
||||
<div className="overflow-hidden rounded-2xl bg-primary-soft">
|
||||
<div className="space-y-2 p-3">
|
||||
<div className="flex flex-col gap-2.5 lg:flex-row lg:items-center lg:justify-between">
|
||||
@@ -41,9 +41,9 @@ export function MembersWaitlistSection() {
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
{/* Solo Pendientes lleva copia de apoyo: explica la diferencia entre
|
||||
pre-inscripción y lista de espera, que no se deduce de los nombres.
|
||||
En Miembros los rótulos de columna ya dicen todo. */}
|
||||
{/* Only Pendientes has supporting copy: it explains the difference
|
||||
between pre-registration and waitlist, which cannot be deduced from
|
||||
the names. In Miembros the column labels already say everything. */}
|
||||
{listSection === 'pending' ? (
|
||||
<p className="max-w-2xl text-xs leading-snug text-foreground/80">
|
||||
Pre-inscripciones que esperan tu aprobación y personas en lista de espera por un cupo
|
||||
|
||||
@@ -37,9 +37,9 @@ export function PendingView() {
|
||||
|
||||
if (!hasAnyEntry && !query) {
|
||||
return (
|
||||
// Full-bleed y sin radio propio: el `overflow-hidden` del panel lo recorta
|
||||
// contra la silueta redondeada. `surface` sobre `primary-soft` hunde el
|
||||
// bloque; con el lavado anterior se camuflaba.
|
||||
// Full-bleed and with no radius of its own: the panel's `overflow-hidden`
|
||||
// clips it against the rounded silhouette. `surface` over `primary-soft`
|
||||
// sinks the block; with the previous wash it camouflaged.
|
||||
<div className="bg-surface px-4 py-10 text-center">
|
||||
<Inbox className="mx-auto mb-2 size-10 text-foreground/40" />
|
||||
<p className="text-sm font-semibold text-primary">No hay pendientes</p>
|
||||
@@ -92,7 +92,7 @@ export function PendingView() {
|
||||
const Icon = section.icon
|
||||
const hasRows = section.count > 0
|
||||
const titleId = `pending-${section.title.replace(/\s+/g, '-').toLowerCase()}`
|
||||
// Con búsqueda activa, las secciones sin coincidencias se ocultan.
|
||||
// With the search on, sections with no matches are hidden.
|
||||
if (!hasRows && query) return null
|
||||
|
||||
return (
|
||||
|
||||
@@ -9,12 +9,13 @@ export function PreRegistrationsTable({ entries }: { entries: GroupPreRegistrati
|
||||
return (
|
||||
<table className="w-full table-fixed text-left text-sm">
|
||||
<thead>
|
||||
{/* `border-foreground/10` y no `border`: en dark `--border` es igual a
|
||||
`primary-soft`, el fondo de la fila, y el separador desaparecería. */}
|
||||
{/* `border-foreground/10` and not `border`: in dark `--border` is the same
|
||||
as `primary-soft`, the row's background, and the separator would
|
||||
disappear. */}
|
||||
<tr className="border-b border-foreground/10 text-xs font-semibold text-foreground/80">
|
||||
<th scope="col" className="w-[47%] px-3 pb-1.5">Nombre</th>
|
||||
<th scope="col" className="px-3 pb-1.5">Teléfono</th>
|
||||
{/* En móvil el teléfono manda: la fecha vive en el detalle. */}
|
||||
{/* On mobile the phone leads: the date lives in the detail. */}
|
||||
<th scope="col" className="hidden px-3 pb-1.5 sm:table-cell">Solicitado</th>
|
||||
<th scope="col" className="w-8 px-1 pb-1.5">
|
||||
<span className="sr-only">Detalle</span>
|
||||
@@ -26,7 +27,8 @@ export function PreRegistrationsTable({ entries }: { entries: GroupPreRegistrati
|
||||
<tr
|
||||
key={entry.id}
|
||||
tabIndex={0}
|
||||
// El hover va a `surface` porque la fila ya vive sobre `primary-soft`.
|
||||
// The hover goes to `surface` because the row already lives on
|
||||
// `primary-soft`.
|
||||
className="group cursor-pointer border-b border-foreground/10 transition-colors last:border-b-0 hover:bg-surface/60 focus-visible:bg-surface focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent"
|
||||
onClick={() => setSelectedPreRegistration(entry)}
|
||||
onKeyDown={(e) => {
|
||||
@@ -36,8 +38,8 @@ export function PreRegistrationsTable({ entries }: { entries: GroupPreRegistrati
|
||||
}
|
||||
}}
|
||||
>
|
||||
{/* `px-3` alinea el texto con el chips y el search de arriba: es el
|
||||
mismo eje izquierdo de 12px en toda la sección. */}
|
||||
{/* `px-3` aligns the text with the chips and the search above: it is
|
||||
the same 12px left axis across the whole section. */}
|
||||
<td className="px-3 py-2">
|
||||
<div className="flex min-w-0 items-center gap-2">
|
||||
<div className="flex size-8 shrink-0 items-center justify-center rounded-full bg-accent/10 text-xs font-semibold text-accent">
|
||||
|
||||
@@ -34,7 +34,8 @@ export function SectionChips() {
|
||||
{SECTIONS.map((section) => {
|
||||
const isActive = listSection === section.id
|
||||
const count = counts[section.id]
|
||||
// Ámbar solo cuando hay algo que decidir: pre-inscripciones por revisar.
|
||||
// Amber only when there is something to decide: pre-registrations to
|
||||
// review.
|
||||
const isAttention = section.id === 'pending' && preRegistrationsTotal > 0
|
||||
const Icon = section.icon
|
||||
|
||||
@@ -45,7 +46,7 @@ export function SectionChips() {
|
||||
aria-pressed={isActive}
|
||||
onClick={() => setListSection(section.id)}
|
||||
className={cn(
|
||||
// min-h-11 (44px): objetivo táctil mínimo de iOS/Android.
|
||||
// min-h-11 (44px): minimum iOS/Android touch target.
|
||||
'inline-flex min-h-11 items-center gap-1.5 rounded-full border px-3.5 text-xs font-semibold',
|
||||
'transition-[background-color,color,border-color,box-shadow] duration-150',
|
||||
'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-primary-soft',
|
||||
|
||||
@@ -9,8 +9,9 @@ export function WaitlistTable({ entries }: { entries: GroupWaitlistEntryDto[] })
|
||||
return (
|
||||
<table className="w-full table-fixed text-left text-sm">
|
||||
<thead>
|
||||
{/* `border-foreground/10` y no `border`: en dark `--border` es igual a
|
||||
`primary-soft`, el fondo de la fila, y el separador desaparecería. */}
|
||||
{/* `border-foreground/10` and not `border`: in dark `--border` is the same
|
||||
as `primary-soft`, the row's background, and the separator would
|
||||
disappear. */}
|
||||
<tr className="border-b border-foreground/10 text-xs font-semibold text-foreground/80">
|
||||
<th scope="col" className="w-[47%] px-3 pb-1.5">Nombre</th>
|
||||
<th scope="col" className="px-3 pb-1.5">Teléfono</th>
|
||||
@@ -24,7 +25,8 @@ export function WaitlistTable({ entries }: { entries: GroupWaitlistEntryDto[] })
|
||||
<tr
|
||||
key={entry.id}
|
||||
tabIndex={0}
|
||||
// El hover va a `surface` porque la fila ya vive sobre `primary-soft`.
|
||||
// The hover goes to `surface` because the row already lives on
|
||||
// `primary-soft`.
|
||||
className="group cursor-pointer border-b border-foreground/10 transition-colors last:border-b-0 hover:bg-surface/60 focus-visible:bg-surface focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent"
|
||||
onClick={() => setSelectedWaitlistEntry(entry)}
|
||||
onKeyDown={(e) => {
|
||||
@@ -34,8 +36,8 @@ export function WaitlistTable({ entries }: { entries: GroupWaitlistEntryDto[] })
|
||||
}
|
||||
}}
|
||||
>
|
||||
{/* `px-3` alinea el texto con el chips y el search de arriba: es el
|
||||
mismo eje izquierdo de 12px en toda la sección. */}
|
||||
{/* `px-3` aligns the text with the chips and the search above: it is
|
||||
the same 12px left axis across the whole section. */}
|
||||
<td className="px-3 py-2">
|
||||
<div className="flex min-w-0 items-center gap-2">
|
||||
<div className="flex size-8 shrink-0 items-center justify-center rounded-full bg-accent/10 text-xs font-semibold text-accent">
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
/* Ajustes de la lista de miembros de la ficha de grupo. Viven acá y no
|
||||
incrustados en el componente porque son decisiones de producto, no de estilo:
|
||||
cambiarlas no debería obligar a tocar la fila. */
|
||||
/* Tuning of the group detail's member list. It lives here and not embedded in
|
||||
the component because these are product decisions, not style: changing them
|
||||
should not force a touch on the row. */
|
||||
|
||||
/* A partir de cuántos días para el vencimiento el cobro pasa a kuning y la fila
|
||||
avisa. Más atrás ya no es "pronto": o se pagó o quedó en el pasado. */
|
||||
/* From how many days to the due date does the charge turn yellow and the row
|
||||
warn. Further back it is no longer "due soon": either it was paid or it is in
|
||||
the past. */
|
||||
export const PAYMENT_DUE_SOON_DAYS = 3
|
||||
|
||||
/* El buscador se muestra a partir de cierta cantidad de miembros. Con pocos, es
|
||||
más ruido que ayuda: alcanza con mirar la lista. */
|
||||
/* The search shows from a certain number of attendees. With few of them it is
|
||||
more noise than help: looking at the list is enough. */
|
||||
export const MEMBER_SEARCH_MIN = 8
|
||||
|
||||
@@ -2,12 +2,13 @@ import type { AttendeeListItem, AttendanceStatus } from '@gruperly/shared'
|
||||
import { RECENT_ATTENDANCE_LIMIT } from '@gruperly/shared'
|
||||
import { PAYMENT_DUE_SOON_DAYS } from './constants'
|
||||
|
||||
/* La fila del listado no pide al backend juicios de presentación: pide los
|
||||
datos crudos (últimas clases, cobro vigente) y de acá sale el texto. Los
|
||||
días que faltan cambian según cuándo se mira, así que no pueden venir
|
||||
guardados desde el servidor. */
|
||||
/* The listing's row does not ask the backend for presentation verdicts: it asks
|
||||
for the raw data (recent classes, current charge) and the text comes from
|
||||
here. The days remaining change depending on when you look, so they cannot
|
||||
come stored from the server. */
|
||||
|
||||
/** Días calendario entre dos fechas, sin horas: "vence el día 10" no tiene hora. */
|
||||
/** Calendar days between two dates, without times: "due on the 10th" has no
|
||||
* time of day. */
|
||||
function calendarDaysBetween(from: Date, to: Date): number {
|
||||
const startOf = (date: Date) =>
|
||||
new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime()
|
||||
@@ -20,15 +21,15 @@ export type PaymentState =
|
||||
| { kind: 'overdue'; days: number }
|
||||
|
||||
/**
|
||||
* Qué hay que marcarle al cobro en la fila.
|
||||
* What to mark on the charge in the row.
|
||||
*
|
||||
* Devuelve `null` cuando no hay nada que avisar: o el miembro no tiene ningún
|
||||
* cobro registrado, o el que tiene vence más adelante que la ventana de aviso y
|
||||
* todavía no venció. No es lo mismo que "al día", que es un pago cerrado.
|
||||
* Returns `null` when there is nothing to warn about: either the attendee has no
|
||||
* recorded charge, or the one they have is due later than the warning window and
|
||||
* has not expired yet. That is not the same as "ok", which is a closed payment.
|
||||
*
|
||||
* Un `PENDING` con vencimiento ya pasado cuenta como vencido, igual que un
|
||||
* `OVERDUE`: el estado guardado suele quedarse en PENDING hasta que alguien lo
|
||||
* actualiza a mano y la fila no puede depender de esa disciplina.
|
||||
* A `PENDING` whose due date has already passed counts as overdue, same as an
|
||||
* `OVERDUE`: the stored state often stays at PENDING until someone updates it by
|
||||
* hand, and the row cannot depend on that discipline.
|
||||
*/
|
||||
export function resolvePaymentState(
|
||||
payment: AttendeeListItem['payment'],
|
||||
@@ -57,7 +58,7 @@ export function paymentStateLabel(state: PaymentState): string {
|
||||
case 'settled':
|
||||
return 'Al día'
|
||||
case 'dueSoon':
|
||||
// "Vence en 0 d" no es español de persona: hoy y mañana tienen palabras.
|
||||
// "Vence en 0 d" is not natural Spanish: today and tomorrow have words.
|
||||
if (state.days === 0) return 'Vence hoy'
|
||||
if (state.days === 1) return 'Vence mañana'
|
||||
return `Vence en ${state.days} d`
|
||||
@@ -67,20 +68,20 @@ export function paymentStateLabel(state: PaymentState): string {
|
||||
}
|
||||
|
||||
export type AttendanceSummary = {
|
||||
/** Estados a dibujar, del más antiguo al más reciente. */
|
||||
/** States to draw, from the oldest to the most recent. */
|
||||
dots: AttendanceStatus[]
|
||||
attended: number
|
||||
recorded: number
|
||||
/** "Sin clases aún" cuando no hay nada registrado. */
|
||||
/** "Sin clases aún" when nothing is recorded. */
|
||||
label: string
|
||||
}
|
||||
|
||||
/** Los últimos puntos de clase registrados, contados sobre esa misma ventana. */
|
||||
/** The last recorded class points, counted over that same window. */
|
||||
export function summarizeAttendance(
|
||||
recentAttendance: AttendanceStatus[],
|
||||
): AttendanceSummary {
|
||||
// La ventana la fija el backend; el corte final evita que una fila se alargue
|
||||
// si el contrato llegara con más clases de las previstas.
|
||||
// The window is set by the backend; the final cut prevents a row from getting
|
||||
// longer if the contract ever delivers more classes than expected.
|
||||
const dots = recentAttendance.slice(-RECENT_ATTENDANCE_LIMIT)
|
||||
const recorded = dots.length
|
||||
|
||||
@@ -97,7 +98,7 @@ export function summarizeAttendance(
|
||||
}
|
||||
}
|
||||
|
||||
/** Orden alfabético fijo del listado. */
|
||||
/** The listing's fixed alphabetical order. */
|
||||
export function byFullName(a: AttendeeListItem, b: AttendeeListItem): number {
|
||||
return a.fullName.localeCompare(b.fullName, 'es', { sensitivity: 'base' })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user