first
Deploy Iddaai Frontend / build-and-deploy (push) Successful in 4m0s

This commit is contained in:
2026-04-16 13:36:34 +03:00
parent de5e145c4e
commit fc7a1ba567
218 changed files with 32370 additions and 0 deletions
+43
View File
@@ -0,0 +1,43 @@
import { create } from "zustand";
import type { SportType } from "@/lib/api/matches/types";
interface MatchState {
selectedMatchIds: Set<string>;
sport: SportType;
leagueFilter: string | null;
}
interface MatchActions {
toggleMatch: (matchId: string) => void;
clearSelection: () => void;
setSport: (sport: SportType) => void;
setLeague: (leagueId: string | null) => void;
isSelected: (matchId: string) => boolean;
}
type MatchStore = MatchState & MatchActions;
export const useMatchStore = create<MatchStore>()((set, get) => ({
selectedMatchIds: new Set<string>(),
sport: "football",
leagueFilter: null,
toggleMatch: (matchId) =>
set((state) => {
const next = new Set(state.selectedMatchIds);
if (next.has(matchId)) {
next.delete(matchId);
} else {
next.add(matchId);
}
return { selectedMatchIds: next };
}),
clearSelection: () => set({ selectedMatchIds: new Set<string>() }),
setSport: (sport) => set({ sport, leagueFilter: null }),
setLeague: (leagueId) => set({ leagueFilter: leagueId }),
isSelected: (matchId) => get().selectedMatchIds.has(matchId),
}));