give parents their own way in instead of the student setup form

A parent account has no grade, so the app sent the demo mother to the
"which grade are you in?" form and she never reached the parents screen.
Now an account with a name, no grade and a parent-side family link opens
straight on the parents screen (with a logout button, since it has no tab
bar), and the setup form offers "I'm a parent, not a student" for new ones.
The header's back button only shows when there is somewhere to go back to.
Found on the live site with the demo accounts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-27 01:33:39 +03:30
parent 33e539e562
commit 2b4db90fe4
5 changed files with 63 additions and 8 deletions

View File

@@ -31,15 +31,17 @@ interface Props {
profile: UserProfile;
grades: Grade[];
payment: PaymentReturn | null;
/** صفحه‌ی شروع؛ برای والد بخشِ والدین است. */
start?: Route;
onSignedOut: () => void;
onRegistered: (profile: UserProfile) => Promise<void>;
}
/** اپِ اصلی بعد از ورود: تب‌ها، صفحه‌ها و داده‌ی مشترک. */
export function MainApp({ profile, grades, payment, onSignedOut, onRegistered }: Props) {
export function MainApp({ profile, grades, payment, start, onSignedOut, onRegistered }: Props) {
return (
<AppDataProvider initialProfile={profile} grades={grades}>
<NavigatorProvider initial={{ name: payment ? 'subscription' : 'home' }}>
<NavigatorProvider initial={start ?? { name: payment ? 'subscription' : 'home' }}>
<Screens onSignedOut={onSignedOut} onRegistered={onRegistered} />
{payment && <PaymentResult payment={payment} />}
</NavigatorProvider>
@@ -88,7 +90,7 @@ function RouteView({ route, onSignedOut, onRegistered }: { route: Route } & Pick
case 'characters': return <CharactersScreen />;
case 'streak': return <StreakScreen />;
case 'support': return <SupportScreen />;
case 'family': return <FamilyScreen />;
case 'family': return <FamilyScreen onSignedOut={onSignedOut} />;
case 'invite': return <InviteScreen />;
case 'register': return <RegisterView onRegistered={onRegistered} />;
}