refactor(onboarding): restructure onboarding routes and components
- Removed obsolete onboarding routes: complete, create-complex, index, verify-email, and verify. - Introduced new setup stepper page for onboarding process. - Created a multi-step setup component to handle complex creation with validation. - Added new schemas for complex creation and plan features. - Implemented detailed steps for complex name, location, plan selection, and court setup. - Enhanced error handling and user feedback during the onboarding process.
This commit is contained in:
@@ -6,7 +6,7 @@ import { apiClient, authClient } from '@/lib/api-client';
|
||||
import { useAuth } from '@/lib/auth';
|
||||
import { acceptStoredPendingInvite } from '@/lib/invitations';
|
||||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
import { Link, useNavigate } from '@tanstack/react-router';
|
||||
import { Link } from '@tanstack/react-router';
|
||||
import { useState } from 'react';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { z } from 'zod';
|
||||
@@ -18,12 +18,7 @@ const loginSchema = z.object({
|
||||
|
||||
type LoginForm = z.infer<typeof loginSchema>;
|
||||
|
||||
type LoginPageProps = {
|
||||
redirectTo?: string;
|
||||
};
|
||||
|
||||
export function LoginPage({ redirectTo = '/' }: LoginPageProps) {
|
||||
const navigate = useNavigate();
|
||||
export function LoginPage() {
|
||||
const { signInWithPassword } = useAuth();
|
||||
const [submitError, setSubmitError] = useState<string | null>(null);
|
||||
|
||||
@@ -42,16 +37,6 @@ export function LoginPage({ redirectTo = '/' }: LoginPageProps) {
|
||||
|
||||
async function handlePostLogin() {
|
||||
await acceptStoredPendingInvite(apiClient.complexes.acceptPendingInvitations);
|
||||
const complexes = await apiClient.complexes.listMine();
|
||||
|
||||
if (complexes.length === 0) {
|
||||
await navigate({ to: redirectTo });
|
||||
} else if (complexes.length === 1) {
|
||||
await apiClient.complexes.select({ complexId: complexes[0].id });
|
||||
navigate({ to: redirectTo });
|
||||
} else {
|
||||
navigate({ to: '/select-complex' });
|
||||
}
|
||||
}
|
||||
|
||||
const onSubmit = async (values: LoginForm) => {
|
||||
|
||||
Reference in New Issue
Block a user