Compare commits
2
Commits
v1.4.0
..
8def97731c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8def97731c | ||
|
|
5ca081a6af |
No files matched your search
+2
-1
@@ -9,7 +9,8 @@ schema in [docs/DATABASE.md](docs/DATABASE.md), le procedure in
|
|||||||
|
|
||||||
## Stato generale
|
## Stato generale
|
||||||
|
|
||||||
- **Versione:** 1.4.0 (in produzione su `main` la 1.3.0, tag `v1.3.0`) — avviso «Presenza modificata» ad admin e
|
- **Versione:** 1.4.1 (in produzione su `main` la 1.3.0, tag `v1.3.0`) — gli eventi con convocati si vedono
|
||||||
|
solo ai convocati (admin e allenatori sempre) e «Rosa e presenze» elenca solo loro. La 1.4.0: avviso «Presenza modificata» ad admin e
|
||||||
allenatori (DD-050, `m32`-`m33`). La 1.3.1: il Calendario mostra solo i prossimi
|
allenatori (DD-050, `m32`-`m33`). La 1.3.1: il Calendario mostra solo i prossimi
|
||||||
compleanni del mese; tolta la serie «Conferme 24h» con i badge «Risposta lampo» e «Mai un forfait». La 1.3.0
|
compleanni del mese; tolta la serie «Conferme 24h» con i badge «Risposta lampo» e «Mai un forfait». La 1.3.0
|
||||||
portava la notifica di compleanno, gli obiettivi cliccabili, le presenze sui convocati, gli avvisi in Home
|
portava la notifica di compleanno, gli obiettivi cliccabili, le presenze sui convocati, gli avvisi in Home
|
||||||
|
|||||||
@@ -13,6 +13,24 @@ versioni `0.y.z` erano pre-release.
|
|||||||
|
|
||||||
## [Non rilasciato]
|
## [Non rilasciato]
|
||||||
|
|
||||||
|
## [1.4.1] - 2026-10-19
|
||||||
|
|
||||||
|
Gli eventi con dei convocati si vedono solo a loro, e «Rosa e presenze» elenca solo i convocati.
|
||||||
|
Nessuna migration.
|
||||||
|
|
||||||
|
### Modificato
|
||||||
|
|
||||||
|
- Un evento con dei convocati compare nel Calendario, in Home e nell'elenco eventi solo ai
|
||||||
|
convocati. Admin e allenatori lo vedono sempre; `convocati` vuoto = visibile a tutti. È un
|
||||||
|
filtro dell'interfaccia: i dati restano leggibili dal database (RLS di `eventi_app` invariata).
|
||||||
|
|
||||||
|
### Corretto
|
||||||
|
|
||||||
|
- «Rosa e presenze» di allenamenti, partite ed eventi mostra solo i convocati (prima elencava
|
||||||
|
sempre tutta la rosa, anche se ne era stato convocato uno solo). Il conteggio «Hanno risposto»,
|
||||||
|
il pulsante «Sollecita» e il riquadro «La tua risposta» seguono la stessa regola; `convocati`
|
||||||
|
vuoto resta «tutta la rosa».
|
||||||
|
|
||||||
## [1.4.0] - 2026-10-09
|
## [1.4.0] - 2026-10-09
|
||||||
|
|
||||||
Gli admin e gli allenatori vengono avvisati quando una presenza cambia a ridosso di una partita o di un allenamento.
|
Gli admin e gli allenatori vengono avvisati quando una presenza cambia a ridosso di una partita o di un allenamento.
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "crapp",
|
"name": "crapp",
|
||||||
"version": "1.4.0",
|
"version": "1.4.1",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "crapp",
|
"name": "crapp",
|
||||||
"version": "1.4.0",
|
"version": "1.4.1",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@supabase/supabase-js": "^2.111.0",
|
"@supabase/supabase-js": "^2.111.0",
|
||||||
"@tailwindcss/vite": "^4.2.1",
|
"@tailwindcss/vite": "^4.2.1",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "crapp",
|
"name": "crapp",
|
||||||
"version": "1.4.0",
|
"version": "1.4.1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"sideEffects": false,
|
"sideEffects": false,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
@@ -20,9 +20,12 @@ export function RosaPresenze({
|
|||||||
eventoId,
|
eventoId,
|
||||||
data,
|
data,
|
||||||
tipo = "allenamento",
|
tipo = "allenamento",
|
||||||
|
convocati = [],
|
||||||
}: {
|
}: {
|
||||||
eventoId: string;
|
eventoId: string;
|
||||||
data: string;
|
data: string;
|
||||||
|
/** Id dei convocati: vuoto = tutta la rosa (come `convocatiEvento()`). */
|
||||||
|
convocati?: string[];
|
||||||
/** Negli eventi extra-campo "infortunato" non è pertinente: niente badge né opzione. */
|
/** Negli eventi extra-campo "infortunato" non è pertinente: niente badge né opzione. */
|
||||||
tipo?: EventoTipo;
|
tipo?: EventoTipo;
|
||||||
}) {
|
}) {
|
||||||
@@ -34,7 +37,9 @@ export function RosaPresenze({
|
|||||||
// Il nome di chi sollecita: admin o allenatore, che non ha una risposta propria (DD-034).
|
// Il nome di chi sollecita: admin o allenatore, che non ha una risposta propria (DD-034).
|
||||||
const mittente = useGiocatoreBase();
|
const mittente = useGiocatoreBase();
|
||||||
const puoSollecitare = usePuoGestireEventi();
|
const puoSollecitare = usePuoGestireEventi();
|
||||||
const rosa = useAnagraficaRosa();
|
const anagrafica = useAnagraficaRosa();
|
||||||
|
const rosa =
|
||||||
|
convocati.length === 0 ? anagrafica : anagrafica.filter((g) => convocati.includes(g.id));
|
||||||
const [sollecito, setSollecito] = useState(false);
|
const [sollecito, setSollecito] = useState(false);
|
||||||
const passato = data < dataOggi();
|
const passato = data < dataOggi();
|
||||||
|
|
||||||
@@ -97,7 +102,7 @@ export function RosaPresenze({
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{io ? (
|
{io && rosa.some((g) => g.id === io.id) ? (
|
||||||
<div className="mt-4 border-t border-border pt-3">
|
<div className="mt-4 border-t border-border pt-3">
|
||||||
<p className="text-[13px] font-bold uppercase tracking-wide text-muted-foreground">
|
<p className="text-[13px] font-bold uppercase tracking-wide text-muted-foreground">
|
||||||
La tua risposta
|
La tua risposta
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
import { eventoVisibile, useEventi } from "./eventi";
|
||||||
|
import { usePuoGestireEventi } from "./ruoli";
|
||||||
|
import { useGiocatoreId } from "./user-store";
|
||||||
|
|
||||||
|
/** Gli eventi che l'utente corrente può vedere (calendario, home, elenco). */
|
||||||
|
export function useEventiVisibili() {
|
||||||
|
const { eventi, ...resto } = useEventi();
|
||||||
|
const giocatoreId = useGiocatoreId();
|
||||||
|
const vedeTutto = usePuoGestireEventi();
|
||||||
|
return {
|
||||||
|
...resto,
|
||||||
|
eventi: eventi.filter((e) => eventoVisibile(e, giocatoreId, vedeTutto)),
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -90,6 +90,19 @@ export function useEventi() {
|
|||||||
return { ...query, eventi: query.data ?? [] };
|
return { ...query, eventi: query.data ?? [] };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Chi vede un evento: i convocati; se `convocati` è vuoto, tutta la rosa. Chi gestisce gli
|
||||||
|
* eventi (admin e allenatori) li vede sempre, convocato o no.
|
||||||
|
*/
|
||||||
|
export function eventoVisibile(
|
||||||
|
evento: Pick<Evento, "convocati">,
|
||||||
|
giocatoreId: string | null,
|
||||||
|
vedeTutto: boolean,
|
||||||
|
): boolean {
|
||||||
|
if (vedeTutto || evento.convocati.length === 0) return true;
|
||||||
|
return giocatoreId !== null && evento.convocati.includes(giocatoreId);
|
||||||
|
}
|
||||||
|
|
||||||
export function useEvento(id: string) {
|
export function useEvento(id: string) {
|
||||||
const { eventi, ...resto } = useEventi();
|
const { eventi, ...resto } = useEventi();
|
||||||
return { ...resto, evento: eventi.find((e) => e.id === id) ?? null };
|
return { ...resto, evento: eventi.find((e) => e.id === id) ?? null };
|
||||||
|
|||||||
@@ -93,7 +93,12 @@ function AllenamentoDetail() {
|
|||||||
</Section>
|
</Section>
|
||||||
|
|
||||||
<Section titolo="Rosa e presenze">
|
<Section titolo="Rosa e presenze">
|
||||||
<RosaPresenze eventoId={evento.id} data={evento.data} tipo={evento.tipo} />
|
<RosaPresenze
|
||||||
|
eventoId={evento.id}
|
||||||
|
data={evento.data}
|
||||||
|
tipo={evento.tipo}
|
||||||
|
convocati={evento.convocati}
|
||||||
|
/>
|
||||||
</Section>
|
</Section>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ import { molla, proietta } from "@/lib/molla";
|
|||||||
import { useMotoRidotto } from "@/lib/motion";
|
import { useMotoRidotto } from "@/lib/motion";
|
||||||
import { EventoCard, linkPerEvento } from "@/components/crapp/EventoCard";
|
import { EventoCard, linkPerEvento } from "@/components/crapp/EventoCard";
|
||||||
import { Card, PageHeader, Section } from "@/components/crapp/ui-bits";
|
import { Card, PageHeader, Section } from "@/components/crapp/ui-bits";
|
||||||
import { compleanniEventi, useEventi, type Evento } from "@/lib/eventi";
|
import { compleanniEventi, type Evento } from "@/lib/eventi";
|
||||||
|
import { useEventiVisibili } from "@/lib/eventi-visibili";
|
||||||
import { useAnagraficaRosa } from "@/lib/rosa";
|
import { useAnagraficaRosa } from "@/lib/rosa";
|
||||||
import { usePuoGestireEventi } from "@/lib/ruoli";
|
import { usePuoGestireEventi } from "@/lib/ruoli";
|
||||||
import { giorniDelMese, giorniIT, mesiIT, pad2, useMeseNav } from "@/lib/calendario";
|
import { giorniDelMese, giorniIT, mesiIT, pad2, useMeseNav } from "@/lib/calendario";
|
||||||
@@ -56,7 +57,7 @@ function Calendario() {
|
|||||||
const [giornoSelezionato, setGiornoSelezionato] = useState<number | null>(null);
|
const [giornoSelezionato, setGiornoSelezionato] = useState<number | null>(null);
|
||||||
const [drawerAperto, setDrawerAperto] = useState(false);
|
const [drawerAperto, setDrawerAperto] = useState(false);
|
||||||
const puoGestire = usePuoGestireEventi();
|
const puoGestire = usePuoGestireEventi();
|
||||||
const { eventi } = useEventi();
|
const { eventi } = useEventiVisibili();
|
||||||
const rosa = useAnagraficaRosa({ conAllenatori: true });
|
const rosa = useAnagraficaRosa({ conAllenatori: true });
|
||||||
// `useMotoRidotto` copre anche i device deboli (RAM bassa), non solo
|
// `useMotoRidotto` copre anche i device deboli (RAM bassa), non solo
|
||||||
// `prefers-reduced-motion`: disattiva anche lo swipe orizzontale tra mesi.
|
// `prefers-reduced-motion`: disattiva anche lo swipe orizzontale tra mesi.
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { useEventiVisibili } from "@/lib/eventi-visibili";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { createFileRoute } from "@tanstack/react-router";
|
import { createFileRoute } from "@tanstack/react-router";
|
||||||
import { CalendarPlus, ChevronLeft, ChevronRight, Loader2, Pencil, Trash2, X } from "lucide-react";
|
import { CalendarPlus, ChevronLeft, ChevronRight, Loader2, Pencil, Trash2, X } from "lucide-react";
|
||||||
@@ -22,7 +23,6 @@ import {
|
|||||||
daCategoria,
|
daCategoria,
|
||||||
eventoVuoto,
|
eventoVuoto,
|
||||||
useEliminaEvento,
|
useEliminaEvento,
|
||||||
useEventi,
|
|
||||||
useSalvaEvento,
|
useSalvaEvento,
|
||||||
type CategoriaEvento,
|
type CategoriaEvento,
|
||||||
type Evento,
|
type Evento,
|
||||||
@@ -65,7 +65,7 @@ function GestioneEventi() {
|
|||||||
const io = useGiocatoreBase();
|
const io = useGiocatoreBase();
|
||||||
// Admin o allenatore (DD-034): la RLS di `eventi_app` (M21) dice lo stesso.
|
// Admin o allenatore (DD-034): la RLS di `eventi_app` (M21) dice lo stesso.
|
||||||
const puoGestire = usePuoGestireEventi();
|
const puoGestire = usePuoGestireEventi();
|
||||||
const { eventi, isPending, isError, error, refetch } = useEventi();
|
const { eventi, isPending, isError, error, refetch } = useEventiVisibili();
|
||||||
const { righe: squadra } = useGiocatoriSquadra();
|
const { righe: squadra } = useGiocatoriSquadra();
|
||||||
const salva = useSalvaEvento();
|
const salva = useSalvaEvento();
|
||||||
const elimina = useEliminaEvento();
|
const elimina = useEliminaEvento();
|
||||||
|
|||||||
@@ -88,7 +88,12 @@ function EventoDetail() {
|
|||||||
</Section>
|
</Section>
|
||||||
|
|
||||||
<Section titolo="Rosa e presenze">
|
<Section titolo="Rosa e presenze">
|
||||||
<RosaPresenze eventoId={evento.id} data={evento.data} tipo={evento.tipo} />
|
<RosaPresenze
|
||||||
|
eventoId={evento.id}
|
||||||
|
data={evento.data}
|
||||||
|
tipo={evento.tipo}
|
||||||
|
convocati={evento.convocati}
|
||||||
|
/>
|
||||||
</Section>
|
</Section>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ import { Barra } from "@/components/motion/Barra";
|
|||||||
import { Numero } from "@/components/motion/Numero";
|
import { Numero } from "@/components/motion/Numero";
|
||||||
import { ObiettivoDrawer } from "@/components/crapp/ObiettivoDrawer";
|
import { ObiettivoDrawer } from "@/components/crapp/ObiettivoDrawer";
|
||||||
import { microcopyObiettivo, progressoObiettivo } from "@/lib/obiettivi";
|
import { microcopyObiettivo, progressoObiettivo } from "@/lib/obiettivi";
|
||||||
import { useEventi, type Evento } from "@/lib/eventi";
|
import { type Evento } from "@/lib/eventi";
|
||||||
|
import { useEventiVisibili } from "@/lib/eventi-visibili";
|
||||||
import { useRispostePresenze } from "@/lib/presenze";
|
import { useRispostePresenze } from "@/lib/presenze";
|
||||||
import { useIo, useObiettivi } from "@/lib/rosa";
|
import { useIo, useObiettivi } from "@/lib/rosa";
|
||||||
import { isAllenatore, nomeCompleto } from "@/lib/giocatori-squadra";
|
import { isAllenatore, nomeCompleto } from "@/lib/giocatori-squadra";
|
||||||
@@ -47,7 +48,7 @@ function Index() {
|
|||||||
const base = useGiocatoreBase();
|
const base = useGiocatoreBase();
|
||||||
const giocatore = useIo();
|
const giocatore = useIo();
|
||||||
const allenatore = isAllenatore(base);
|
const allenatore = isAllenatore(base);
|
||||||
const { eventi } = useEventi();
|
const { eventi } = useEventiVisibili();
|
||||||
const { presenze } = useRispostePresenze();
|
const { presenze } = useRispostePresenze();
|
||||||
const oggi = new Date().toISOString().slice(0, 10);
|
const oggi = new Date().toISOString().slice(0, 10);
|
||||||
const prossimi: Evento[] = eventi.filter((e) => e.data >= oggi).slice(0, 3);
|
const prossimi: Evento[] = eventi.filter((e) => e.data >= oggi).slice(0, 3);
|
||||||
|
|||||||
@@ -297,7 +297,12 @@ function PartitaDetail() {
|
|||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
<Section titolo="Rosa e presenze">
|
<Section titolo="Rosa e presenze">
|
||||||
<RosaPresenze eventoId={evento.id} data={evento.data} tipo={evento.tipo} />
|
<RosaPresenze
|
||||||
|
eventoId={evento.id}
|
||||||
|
data={evento.data}
|
||||||
|
tipo={evento.tipo}
|
||||||
|
convocati={evento.convocati}
|
||||||
|
/>
|
||||||
</Section>
|
</Section>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import {
|
|||||||
convocatiEvento,
|
convocatiEvento,
|
||||||
daCategoria,
|
daCategoria,
|
||||||
daRiga,
|
daRiga,
|
||||||
|
eventoVisibile,
|
||||||
eventoVuoto,
|
eventoVuoto,
|
||||||
type RigaEvento,
|
type RigaEvento,
|
||||||
} from "@/lib/eventi";
|
} from "@/lib/eventi";
|
||||||
@@ -123,3 +124,10 @@ assert.match(bozza.id, /^e[a-z0-9]+$/, "id generato dal client");
|
|||||||
assert.notEqual(bozza.id, "", "ogni bozza ha un id");
|
assert.notEqual(bozza.id, "", "ogni bozza ha un id");
|
||||||
|
|
||||||
console.log("eventi: ok");
|
console.log("eventi: ok");
|
||||||
|
|
||||||
|
// --- eventoVisibile: i non convocati non vedono l'evento, chi gestisce sì -----
|
||||||
|
assert.equal(eventoVisibile({ convocati: ["g1"] }, "g1", false), true, "il convocato lo vede");
|
||||||
|
assert.equal(eventoVisibile({ convocati: ["g1"] }, "g2", false), false, "il non convocato no");
|
||||||
|
assert.equal(eventoVisibile({ convocati: ["g1"] }, null, false), false, "senza slot no");
|
||||||
|
assert.equal(eventoVisibile({ convocati: ["g1"] }, "g2", true), true, "admin/allenatore sempre");
|
||||||
|
assert.equal(eventoVisibile({ convocati: [] }, "g2", false), true, "vuoto = tutta la rosa");
|
||||||
Reference in new issue
Block a user