mirror of
https://github.com/jjbrunton/Sauci.git
synced 2026-10-31 18:19:43 +00:00
Add couple comfort zone gate toggle and bump version
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
494ed17fe2
commit
a0049b7f8a
6 files changed
+389
-5
No files matched your search
@@ -5,6 +5,7 @@ export interface AppConfig {
|
||||
id: string;
|
||||
answer_gap_threshold: number;
|
||||
daily_response_limit: number;
|
||||
couple_intensity_gate_enabled: boolean | null;
|
||||
updated_at: string | null;
|
||||
updated_by: string | null;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import { useAuth, PERMISSION_KEYS } from '@/contexts/AuthContext';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { Switch } from '@/components/ui/switch';
|
||||
import { Skeleton } from '@/components/ui/skeleton';
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert';
|
||||
@@ -29,6 +30,7 @@ export function AppSettingsPage() {
|
||||
setFormData({
|
||||
answer_gap_threshold: config.answer_gap_threshold ?? 10,
|
||||
daily_response_limit: config.daily_response_limit ?? 0,
|
||||
couple_intensity_gate_enabled: config.couple_intensity_gate_enabled ?? false,
|
||||
});
|
||||
setHasChanges(false);
|
||||
}
|
||||
@@ -61,6 +63,7 @@ export function AppSettingsPage() {
|
||||
setFormData({
|
||||
answer_gap_threshold: config.answer_gap_threshold ?? 10,
|
||||
daily_response_limit: config.daily_response_limit ?? 0,
|
||||
couple_intensity_gate_enabled: config.couple_intensity_gate_enabled ?? false,
|
||||
});
|
||||
setHasChanges(false);
|
||||
}
|
||||
@@ -157,6 +160,19 @@ export function AppSettingsPage() {
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-4">
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="space-y-0.5">
|
||||
<Label>Couple Comfort Zone Gate</Label>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
When enabled, both recommended questions and answer-gap blocking use the lower of the two partners' comfort zones.
|
||||
</p>
|
||||
</div>
|
||||
<Switch
|
||||
checked={Boolean(formData.couple_intensity_gate_enabled)}
|
||||
onCheckedChange={(checked) => handleChange('couple_intensity_gate_enabled', checked)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="threshold">Answer Gap Threshold</Label>
|
||||
<Input
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { useState, useEffect, useCallback } from 'react';
|
||||
import { useParams, Link } from 'react-router-dom';
|
||||
import { supabase, supabaseConfig } from '@/config';
|
||||
import { auditedSupabase } from '@/hooks/useAuditedSupabase';
|
||||
import { useRealtimeSubscription } from '@/hooks/useRealtimeSubscription';
|
||||
import { RealtimeStatusIndicator } from '@/components/RealtimeStatusIndicator';
|
||||
import { useAuth, PERMISSION_KEYS } from '@/contexts/AuthContext';
|
||||
@@ -339,7 +338,7 @@ export function UserDetailPage() {
|
||||
expires_at_param: expiresAt,
|
||||
});
|
||||
if (error) throw error;
|
||||
const { data: updatedProfile } = await supabase.rpc('get_profile_with_auth_info', { user_id: userId }).single();
|
||||
const { data: updatedProfile } = await supabase.rpc('get_profile_with_auth_info', { user_id: userId }).single<Profile>();
|
||||
if (updatedProfile) setProfile(updatedProfile);
|
||||
setUpgradeOpen(false);
|
||||
alert('User upgraded to premium successfully!');
|
||||
@@ -355,7 +354,7 @@ export function UserDetailPage() {
|
||||
if (!userId) return;
|
||||
setLoading(true);
|
||||
try {
|
||||
const { data: profileData } = await supabase.rpc('get_profile_with_auth_info', { user_id: userId }).single();
|
||||
const { data: profileData } = await supabase.rpc('get_profile_with_auth_info', { user_id: userId }).single<Profile>();
|
||||
setProfile(profileData);
|
||||
|
||||
// Fetch feature interests for the user
|
||||
|
||||
Reference in new issue
Block a user