sojorn/sojorn_app/lib/screens/auth/auth_gate.dart
Patrick Britton 3c4680bdd7 Initial commit: Complete threaded conversation system with inline replies
**Major Features Added:**
- **Inline Reply System**: Replace compose screen with inline reply boxes
- **Thread Navigation**: Parent/child navigation with jump functionality
- **Chain Flow UI**: Reply counts, expand/collapse animations, visual hierarchy
- **Enhanced Animations**: Smooth transitions, hover effects, micro-interactions

 **Frontend Changes:**
- **ThreadedCommentWidget**: Complete rewrite with animations and navigation
- **ThreadNode Model**: Added parent references and descendant counting
- **ThreadedConversationScreen**: Integrated navigation handlers
- **PostDetailScreen**: Replaced with threaded conversation view
- **ComposeScreen**: Added reply indicators and context
- **PostActions**: Fixed visibility checks for chain buttons

 **Backend Changes:**
- **API Route**: Added /posts/:id/thread endpoint
- **Post Repository**: Include allow_chain and visibility fields in feed
- **Thread Handler**: Support for fetching post chains

 **UI/UX Improvements:**
- **Reply Context**: Clear indication when replying to specific posts
- **Character Counting**: 500 character limit with live counter
- **Visual Hierarchy**: Depth-based indentation and styling
- **Smooth Animations**: SizeTransition, FadeTransition, hover states
- **Chain Navigation**: Parent/child buttons with visual feedback

 **Technical Enhancements:**
- **Animation Controllers**: Proper lifecycle management
- **State Management**: Clean separation of concerns
- **Navigation Callbacks**: Reusable navigation system
- **Error Handling**: Graceful fallbacks and user feedback

This creates a Reddit-style threaded conversation experience with smooth
animations, inline replies, and intuitive navigation between posts in a chain.
2026-01-30 07:40:19 -06:00

54 lines
1.8 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../../providers/auth_provider.dart';
import '../../providers/onboarding_provider.dart';
import 'category_select_screen.dart';
import 'sign_in_screen.dart';
/// Auth gate - routes to sign in or home based on auth state
class AuthGate extends ConsumerWidget {
final Widget authenticatedChild;
const AuthGate({
super.key,
required this.authenticatedChild,
});
@override
Widget build(BuildContext context, WidgetRef ref) {
final isAuthenticated = ref.watch(isAuthenticatedProvider);
final user = ref.watch(currentUserProvider);
if (isAuthenticated && user != null) {
// For Go-auth users, profile is created during registration.
// For Go-auth users, profile is created during registration.
// We checks profileExistsProvider for strict onboarding completion.
final onboardingAsync = ref.watch(profileExistsProvider);
return onboardingAsync.when(
data: (isComplete) {
if (!isComplete) {
// If strictly not complete, we might need to route to category?
// Actually, if we use profileExistsProvider as the "master" switch:
// If false -> Category Select (which completes it).
// (Note: ProfileSetup is skipped as we do it at registration now, or we can handle it if we want to separate it)
return const CategorySelectScreen();
}
return authenticatedChild;
},
loading: () => const Scaffold(
body: Center(
child: CircularProgressIndicator(),
),
),
error: (error, stack) {
// On error, go to home anyway to avoid blocking the user
return authenticatedChild;
},
);
} else {
return const SignInScreen();
}
}
}