mirror of
https://github.com/jjbrunton/Sauci.git
synced 2026-11-01 18:19:43 +00:00
Unpaired users could only reach a waiting-room dead end and could not answer questions until a partner joined. Responses.couple_id is now nullable so a solo user answers immediately and banks "sealed answers" (couple_id IS NULL). Pairing claims both members' sealed answers and computes matches for every question both have now answered. Invite copy and the unpaired push nudge escalate with the sealed answer count. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
58 lines
2.3 KiB
TypeScript
58 lines
2.3 KiB
TypeScript
import { Share } from "react-native";
|
|
import { colors } from "../../../theme";
|
|
import { useAuthStore } from "../../../store";
|
|
import { Events } from "../../../lib/analytics";
|
|
import { buildInviteShareMessage } from "../../../lib/inviteShareCopy";
|
|
import { SwipeInfoStateLayout } from "./SwipeInfoStateLayout";
|
|
|
|
interface SwipeNoPartnerStateProps {
|
|
hasCouple: boolean;
|
|
onPairPress: () => void;
|
|
}
|
|
|
|
export const SwipeNoPartnerState = ({ hasCouple, onPairPress }: SwipeNoPartnerStateProps) => {
|
|
const accent = colors.premium.rose;
|
|
const { couple, sealedCount } = useAuthStore();
|
|
|
|
const handleShareCode = async () => {
|
|
if (!couple?.invite_code) return;
|
|
try {
|
|
await Share.share({
|
|
message: buildInviteShareMessage(couple.invite_code, sealedCount),
|
|
});
|
|
Events.codeShared();
|
|
} catch (error) {
|
|
console.error(error);
|
|
}
|
|
};
|
|
|
|
return (
|
|
<SwipeInfoStateLayout
|
|
accentColor={accent}
|
|
icon="heart"
|
|
label={hasCouple ? "ALMOST THERE" : "CONNECT"}
|
|
title={hasCouple ? "Waiting" : "Pair Up"}
|
|
badgeText={hasCouple ? "INVITE SENT" : "MADE FOR TWO"}
|
|
description={hasCouple
|
|
? "Share your invite code so they can join you. Once paired, you'll both answer questions and discover what you agree on!"
|
|
: "Sauci is made for two! Connect with your partner to start answering questions together and discover what you have in common."
|
|
}
|
|
features={[
|
|
{ icon: "lock-closed-outline", text: "Private and secure", color: accent },
|
|
{ icon: "sparkles", text: "Discover new things together", color: accent },
|
|
{ icon: "chatbubble-ellipses-outline", text: "Chat about your matches", color: accent },
|
|
]}
|
|
teaser={hasCouple ? "Your partner is just a code away" : "Begin your journey together"}
|
|
action={{
|
|
label: hasCouple ? "View Invite Code" : "Pair Now",
|
|
onPress: onPairPress,
|
|
}}
|
|
secondaryAction={hasCouple && couple?.invite_code ? {
|
|
label: "Share Code",
|
|
onPress: handleShareCode,
|
|
icon: "share-outline",
|
|
} : undefined}
|
|
/>
|
|
);
|
|
};
|