Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | 1x 1x 2x 4x | import { create } from "zustand";
/**
* Local pairing state (skeleton). In production this is derived from the
* `couples` document in Firestore — `members: [uidA, uidB]`, no gendered roles
* (decision record §4). Pairing is server-authoritative via a Cloud Function.
*/
type PairingState = {
isPaired: boolean;
partnerName: string | null;
togetherDays: number;
inviteCode: string;
pair: (partnerName: string) => void;
reset: () => void;
};
function makeInviteCode(): string {
// Deterministic-enough placeholder; the real code is minted server-side.
return "GLM-2026";
}
export const usePairing = create<PairingState>((set) => ({
isPaired: false,
partnerName: null,
togetherDays: 0,
inviteCode: makeInviteCode(),
pair: (partnerName) => set({ isPaired: true, partnerName, togetherDays: 1 }),
reset: () => set({ isPaired: false, partnerName: null, togetherDays: 0 }),
}));
|