create-stackr 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +642 -0
- package/bin/cli.js +12 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +113 -0
- package/dist/cli.js.map +1 -0
- package/dist/config/dependencies.d.ts +82 -0
- package/dist/config/dependencies.d.ts.map +1 -0
- package/dist/config/dependencies.js +82 -0
- package/dist/config/dependencies.js.map +1 -0
- package/dist/config/presets.d.ts +3 -0
- package/dist/config/presets.d.ts.map +1 -0
- package/dist/config/presets.js +174 -0
- package/dist/config/presets.js.map +1 -0
- package/dist/generators/index.d.ts +40 -0
- package/dist/generators/index.d.ts.map +1 -0
- package/dist/generators/index.js +130 -0
- package/dist/generators/index.js.map +1 -0
- package/dist/generators/onboarding.d.ts +8 -0
- package/dist/generators/onboarding.d.ts.map +1 -0
- package/dist/generators/onboarding.js +141 -0
- package/dist/generators/onboarding.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +65 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts/features.d.ts +14 -0
- package/dist/prompts/features.d.ts.map +1 -0
- package/dist/prompts/features.js +96 -0
- package/dist/prompts/features.js.map +1 -0
- package/dist/prompts/index.d.ts +3 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +93 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/prompts/onboarding.d.ts +6 -0
- package/dist/prompts/onboarding.d.ts.map +1 -0
- package/dist/prompts/onboarding.js +37 -0
- package/dist/prompts/onboarding.js.map +1 -0
- package/dist/prompts/orm.d.ts +3 -0
- package/dist/prompts/orm.d.ts.map +1 -0
- package/dist/prompts/orm.js +23 -0
- package/dist/prompts/orm.js.map +1 -0
- package/dist/prompts/packageManager.d.ts +2 -0
- package/dist/prompts/packageManager.d.ts.map +1 -0
- package/dist/prompts/packageManager.js +18 -0
- package/dist/prompts/packageManager.js.map +1 -0
- package/dist/prompts/platform.d.ts +3 -0
- package/dist/prompts/platform.d.ts.map +1 -0
- package/dist/prompts/platform.js +21 -0
- package/dist/prompts/platform.js.map +1 -0
- package/dist/prompts/preset.d.ts +4 -0
- package/dist/prompts/preset.d.ts.map +1 -0
- package/dist/prompts/preset.js +165 -0
- package/dist/prompts/preset.js.map +1 -0
- package/dist/prompts/project.d.ts +2 -0
- package/dist/prompts/project.d.ts.map +1 -0
- package/dist/prompts/project.js +27 -0
- package/dist/prompts/project.js.map +1 -0
- package/dist/prompts/sdks.d.ts +2 -0
- package/dist/prompts/sdks.d.ts.map +1 -0
- package/dist/prompts/sdks.js +46 -0
- package/dist/prompts/sdks.js.map +1 -0
- package/dist/types/index.d.ts +77 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +25 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/cleanup.d.ts +5 -0
- package/dist/utils/cleanup.d.ts.map +1 -0
- package/dist/utils/cleanup.js +38 -0
- package/dist/utils/cleanup.js.map +1 -0
- package/dist/utils/copy.d.ts +10 -0
- package/dist/utils/copy.d.ts.map +1 -0
- package/dist/utils/copy.js +53 -0
- package/dist/utils/copy.js.map +1 -0
- package/dist/utils/errors.d.ts +33 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +136 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/git.d.ts +5 -0
- package/dist/utils/git.d.ts.map +1 -0
- package/dist/utils/git.js +33 -0
- package/dist/utils/git.js.map +1 -0
- package/dist/utils/logger.d.ts +9 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +22 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/package.d.ts +16 -0
- package/dist/utils/package.d.ts.map +1 -0
- package/dist/utils/package.js +86 -0
- package/dist/utils/package.js.map +1 -0
- package/dist/utils/system-validation.d.ts +9 -0
- package/dist/utils/system-validation.d.ts.map +1 -0
- package/dist/utils/system-validation.js +31 -0
- package/dist/utils/system-validation.js.map +1 -0
- package/dist/utils/template.d.ts +20 -0
- package/dist/utils/template.d.ts.map +1 -0
- package/dist/utils/template.js +234 -0
- package/dist/utils/template.js.map +1 -0
- package/dist/utils/validation.d.ts +8 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +94 -0
- package/dist/utils/validation.js.map +1 -0
- package/package.json +96 -0
- package/templates/base/backend/.dockerignore.ejs +62 -0
- package/templates/base/backend/.env.example.ejs +116 -0
- package/templates/base/backend/Dockerfile.ejs +142 -0
- package/templates/base/backend/controllers/event-queue/index.ts +20 -0
- package/templates/base/backend/controllers/event-queue/workers/user.ts +39 -0
- package/templates/base/backend/controllers/rest-api/index.ts +48 -0
- package/templates/base/backend/controllers/rest-api/plugins/auth.ts +152 -0
- package/templates/base/backend/controllers/rest-api/plugins/config.ts +64 -0
- package/templates/base/backend/controllers/rest-api/plugins/error-handler.ts +118 -0
- package/templates/base/backend/controllers/rest-api/routes/auth.ts.ejs +180 -0
- package/templates/base/backend/controllers/rest-api/routes/device-sessions.ts +197 -0
- package/templates/base/backend/controllers/rest-api/routes/oauth-web.ts.ejs +375 -0
- package/templates/base/backend/controllers/rest-api/server.ts.ejs +87 -0
- package/templates/base/backend/domain/device-session/repository.drizzle.ts +209 -0
- package/templates/base/backend/domain/device-session/repository.prisma.ts +248 -0
- package/templates/base/backend/domain/device-session/schema.ts +72 -0
- package/templates/base/backend/domain/session/repository.drizzle.ts +72 -0
- package/templates/base/backend/domain/session/repository.prisma.ts +72 -0
- package/templates/base/backend/domain/session/schema.ts +29 -0
- package/templates/base/backend/domain/user/repository.drizzle.ts +127 -0
- package/templates/base/backend/domain/user/repository.prisma.ts +115 -0
- package/templates/base/backend/domain/user/schema.ts +14 -0
- package/templates/base/backend/drizzle/schema.drizzle.ts +111 -0
- package/templates/base/backend/drizzle.config.drizzle.ts +13 -0
- package/templates/base/backend/lib/auth.drizzle.ts.ejs +104 -0
- package/templates/base/backend/lib/auth.prisma.ts.ejs +97 -0
- package/templates/base/backend/lib/constants.ts.ejs +29 -0
- package/templates/base/backend/package.json.ejs +50 -0
- package/templates/base/backend/prisma/schema.prisma.ejs +102 -0
- package/templates/base/backend/prisma.config.prisma.ts +12 -0
- package/templates/base/backend/tsconfig.json +39 -0
- package/templates/base/backend/utils/db.drizzle.ts +41 -0
- package/templates/base/backend/utils/db.prisma.ts +51 -0
- package/templates/base/backend/utils/email.ts.ejs +35 -0
- package/templates/base/backend/utils/errors.ts +348 -0
- package/templates/base/backend/utils/redis.ts.ejs +279 -0
- package/templates/base/mobile/.env.example.ejs +35 -0
- package/templates/base/mobile/.gitignore.ejs +167 -0
- package/templates/base/mobile/app/+not-found.tsx +85 -0
- package/templates/base/mobile/app/_layout.tsx.ejs +71 -0
- package/templates/base/mobile/app.json.ejs +88 -0
- package/templates/base/mobile/assets/images/adaptive-icon.png +0 -0
- package/templates/base/mobile/assets/images/favicon.png +0 -0
- package/templates/base/mobile/assets/images/icon.png +0 -0
- package/templates/base/mobile/assets/images/onboarding_page_1.png +0 -0
- package/templates/base/mobile/assets/images/onboarding_page_2.png +0 -0
- package/templates/base/mobile/assets/images/onboarding_page_3.png +0 -0
- package/templates/base/mobile/assets/images/paywall_image.png +0 -0
- package/templates/base/mobile/assets/images/splash.png +0 -0
- package/templates/base/mobile/eas.json.ejs +49 -0
- package/templates/base/mobile/metro.config.js +9 -0
- package/templates/base/mobile/package.json.ejs +53 -0
- package/templates/base/mobile/src/components/ui/Button.tsx +131 -0
- package/templates/base/mobile/src/components/ui/Card.tsx +68 -0
- package/templates/base/mobile/src/components/ui/IconSymbol.tsx +90 -0
- package/templates/base/mobile/src/components/ui/Input.tsx +142 -0
- package/templates/base/mobile/src/components/ui/LoadingSpinner.tsx +98 -0
- package/templates/base/mobile/src/components/ui/OnboardingLayout.tsx +356 -0
- package/templates/base/mobile/src/components/ui/PaywallLayout.tsx +311 -0
- package/templates/base/mobile/src/components/ui/Skeleton.tsx +58 -0
- package/templates/base/mobile/src/components/ui/index.ts +6 -0
- package/templates/base/mobile/src/constants/Theme.ts +163 -0
- package/templates/base/mobile/src/context/ThemeContext.tsx +157 -0
- package/templates/base/mobile/src/lib/auth-client.ts.ejs +51 -0
- package/templates/base/mobile/src/services/api.ts.ejs +71 -0
- package/templates/base/mobile/src/services/errorService.ts +179 -0
- package/templates/base/mobile/src/services/sdkInitializer.ts.ejs +36 -0
- package/templates/base/mobile/src/store/index.ts.ejs +18 -0
- package/templates/base/mobile/src/store/ui.store.ts +100 -0
- package/templates/base/mobile/src/utils/formatters.ts +105 -0
- package/templates/base/mobile/src/utils/logger.ts +73 -0
- package/templates/base/mobile/src/utils/responsive.ts +234 -0
- package/templates/base/mobile/tsconfig.json +32 -0
- package/templates/base/web/.env.example.ejs +26 -0
- package/templates/base/web/components.json +22 -0
- package/templates/base/web/eslint.config.mjs +18 -0
- package/templates/base/web/next.config.ts +7 -0
- package/templates/base/web/package.json.ejs +35 -0
- package/templates/base/web/postcss.config.mjs +7 -0
- package/templates/base/web/public/.gitkeep +0 -0
- package/templates/base/web/public/file.svg +1 -0
- package/templates/base/web/public/globe.svg +1 -0
- package/templates/base/web/public/next.svg +1 -0
- package/templates/base/web/public/vercel.svg +1 -0
- package/templates/base/web/public/window.svg +1 -0
- package/templates/base/web/src/app/favicon.ico +0 -0
- package/templates/base/web/src/app/globals.css +152 -0
- package/templates/base/web/src/app/layout.tsx.ejs +54 -0
- package/templates/base/web/src/app/page.tsx.ejs +92 -0
- package/templates/base/web/src/components/auth/auth-hydrator.tsx.ejs +19 -0
- package/templates/base/web/src/components/auth/protected-route.tsx.ejs +109 -0
- package/templates/base/web/src/components/providers/device-session-setup.tsx.ejs +56 -0
- package/templates/base/web/src/components/providers/theme-provider.tsx +17 -0
- package/templates/base/web/src/components/theme-toggle.tsx +34 -0
- package/templates/base/web/src/components/ui/button.tsx +62 -0
- package/templates/base/web/src/components/ui/card.tsx +92 -0
- package/templates/base/web/src/components/ui/input.tsx +21 -0
- package/templates/base/web/src/components/ui/label.tsx +24 -0
- package/templates/base/web/src/components/ui/skeleton.tsx +13 -0
- package/templates/base/web/src/components/ui/spinner.tsx +20 -0
- package/templates/base/web/src/hooks/use-device-session.ts.ejs +40 -0
- package/templates/base/web/src/hooks/use-session.ts.ejs +56 -0
- package/templates/base/web/src/lib/auth/actions.ts.ejs +334 -0
- package/templates/base/web/src/lib/auth/config.ts.ejs +65 -0
- package/templates/base/web/src/lib/auth/cookies.ts.ejs +74 -0
- package/templates/base/web/src/lib/auth/index.ts.ejs +40 -0
- package/templates/base/web/src/lib/auth/oauth.ts.ejs +72 -0
- package/templates/base/web/src/lib/auth/pkce.ts.ejs +48 -0
- package/templates/base/web/src/lib/auth/sessions.ts.ejs +135 -0
- package/templates/base/web/src/lib/auth/user-agent.ts.ejs +47 -0
- package/templates/base/web/src/lib/device/actions.ts.ejs +148 -0
- package/templates/base/web/src/lib/device/id.ts.ejs +74 -0
- package/templates/base/web/src/lib/utils.ts +6 -0
- package/templates/base/web/src/proxy.ts.ejs +66 -0
- package/templates/base/web/src/store/auth.store.ts.ejs +89 -0
- package/templates/base/web/src/store/deviceSession.store.ts.ejs +141 -0
- package/templates/base/web/tsconfig.json +34 -0
- package/templates/features/mobile/auth/app/(auth)/_layout.tsx +16 -0
- package/templates/features/mobile/auth/app/(auth)/login.tsx +86 -0
- package/templates/features/mobile/auth/app/(auth)/register.tsx +86 -0
- package/templates/features/mobile/auth/components/auth/LoginForm.tsx.ejs +349 -0
- package/templates/features/mobile/auth/components/auth/RegisterForm.tsx.ejs +407 -0
- package/templates/features/mobile/auth/components/auth/index.ts +2 -0
- package/templates/features/mobile/auth/hooks/index.ts.ejs +1 -0
- package/templates/features/mobile/auth/hooks/useAuth.ts.ejs +367 -0
- package/templates/features/mobile/auth/services/deviceSession.ts +370 -0
- package/templates/features/mobile/auth/store/deviceSession.store.ts +326 -0
- package/templates/features/mobile/onboarding/app/(onboarding)/_layout.tsx.ejs +11 -0
- package/templates/features/mobile/onboarding/app/(onboarding)/page-1.tsx.ejs +52 -0
- package/templates/features/mobile/onboarding/app/(onboarding)/page-2.tsx.ejs +52 -0
- package/templates/features/mobile/onboarding/app/(onboarding)/page-3.tsx.ejs +60 -0
- package/templates/features/mobile/paywall/app/paywall.tsx +550 -0
- package/templates/features/mobile/tabs/app/(tabs)/_layout.tsx +26 -0
- package/templates/features/mobile/tabs/app/(tabs)/index.tsx +565 -0
- package/templates/features/web/.gitkeep +0 -0
- package/templates/features/web/auth/app/(app)/dashboard/dashboard-client.tsx.ejs +166 -0
- package/templates/features/web/auth/app/(app)/dashboard/page.tsx.ejs +24 -0
- package/templates/features/web/auth/app/(app)/layout.tsx.ejs +43 -0
- package/templates/features/web/auth/app/(app)/settings/sessions/page.tsx.ejs +29 -0
- package/templates/features/web/auth/app/(app)/settings/sessions/sessions-client.tsx.ejs +77 -0
- package/templates/features/web/auth/app/(auth)/forgot-password/page.tsx.ejs +127 -0
- package/templates/features/web/auth/app/(auth)/layout.tsx.ejs +32 -0
- package/templates/features/web/auth/app/(auth)/login/page.tsx.ejs +35 -0
- package/templates/features/web/auth/app/(auth)/register/page.tsx.ejs +19 -0
- package/templates/features/web/auth/app/(auth)/reset-password/page.tsx.ejs +40 -0
- package/templates/features/web/auth/app/(auth)/verify-email/page.tsx.ejs +198 -0
- package/templates/features/web/auth/app/auth/callback/route.ts.ejs +152 -0
- package/templates/features/web/auth/components/auth/login-form.tsx.ejs +100 -0
- package/templates/features/web/auth/components/auth/oauth-buttons.tsx.ejs +126 -0
- package/templates/features/web/auth/components/auth/password-reset-form.tsx.ejs +103 -0
- package/templates/features/web/auth/components/auth/register-form.tsx.ejs +139 -0
- package/templates/features/web/auth/components/settings/session-card.tsx.ejs +132 -0
- package/templates/integrations/mobile/adjust/services/adjustService.ts.ejs +163 -0
- package/templates/integrations/mobile/adjust/store/adjust.store.ts +243 -0
- package/templates/integrations/mobile/att/services/attService.ts +84 -0
- package/templates/integrations/mobile/att/services/trackingPermissions.ts +208 -0
- package/templates/integrations/mobile/att/store/att.store.ts +162 -0
- package/templates/integrations/mobile/revenuecat/services/revenuecatService.ts.ejs +174 -0
- package/templates/integrations/mobile/revenuecat/store/revenuecat.store.ts +286 -0
- package/templates/integrations/mobile/scate/services/scateService.ts.ejs +85 -0
- package/templates/integrations/mobile/scate/store/scate.store.ts +125 -0
- package/templates/integrations/web/.gitkeep +0 -0
- package/templates/shared/.env.example.ejs +21 -0
- package/templates/shared/.gitignore.ejs +145 -0
- package/templates/shared/README.md.ejs +134 -0
- package/templates/shared/docker-compose.prod.yml.ejs +120 -0
- package/templates/shared/docker-compose.yml.ejs +129 -0
- package/templates/shared/scripts/docker-dev.sh.ejs +395 -0
- package/templates/shared/scripts/docker-prod.sh.ejs +542 -0
- package/templates/shared/scripts/setup.sh.ejs +979 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Tabs } from 'expo-router';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { useAuth } from '../../src/hooks';
|
|
4
|
+
|
|
5
|
+
export default function TabLayout() {
|
|
6
|
+
const { isAuthenticated } = useAuth();
|
|
7
|
+
|
|
8
|
+
// This layout should only render if user is authenticated
|
|
9
|
+
// The root layout handles the redirect
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<Tabs
|
|
13
|
+
screenOptions={{
|
|
14
|
+
headerShown: false,
|
|
15
|
+
tabBarStyle: { display: 'none' },
|
|
16
|
+
}}
|
|
17
|
+
>
|
|
18
|
+
<Tabs.Screen
|
|
19
|
+
name="index"
|
|
20
|
+
options={{
|
|
21
|
+
title: 'Home',
|
|
22
|
+
}}
|
|
23
|
+
/>
|
|
24
|
+
</Tabs>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
@@ -0,0 +1,565 @@
|
|
|
1
|
+
import React, { useState, useMemo } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
Text,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
SafeAreaView,
|
|
7
|
+
ScrollView,
|
|
8
|
+
Modal,
|
|
9
|
+
Pressable,
|
|
10
|
+
Alert,
|
|
11
|
+
KeyboardAvoidingView,
|
|
12
|
+
Platform,
|
|
13
|
+
} from 'react-native';
|
|
14
|
+
import { router } from 'expo-router';
|
|
15
|
+
import Constants from 'expo-constants';
|
|
16
|
+
import { LinearGradient } from 'expo-linear-gradient';
|
|
17
|
+
import { useAuth } from '../../src/hooks';
|
|
18
|
+
import { useSessionActions } from '../../src/store/deviceSession.store';
|
|
19
|
+
import { Button, Input } from '../../src/components/ui';
|
|
20
|
+
import { IconSymbol } from '../../src/components/ui/IconSymbol';
|
|
21
|
+
import { formatDisplayName } from '../../src/utils/formatters';
|
|
22
|
+
import { useAppTheme, AppTheme } from '@/context/ThemeContext';
|
|
23
|
+
|
|
24
|
+
export default function HomeScreen() {
|
|
25
|
+
const theme = useAppTheme();
|
|
26
|
+
const styles = useMemo(() => createStyles(theme), [theme]);
|
|
27
|
+
|
|
28
|
+
const { user, signOut, deleteAccount, isLoading, isAuthenticated } = useAuth();
|
|
29
|
+
const { deleteSession, initializeSession } = useSessionActions();
|
|
30
|
+
const [showDeleteModal, setShowDeleteModal] = useState(false);
|
|
31
|
+
const [deleteConfirmText, setDeleteConfirmText] = useState('');
|
|
32
|
+
const [isDeleting, setIsDeleting] = useState(false);
|
|
33
|
+
const [showDeleteSessionModal, setShowDeleteSessionModal] = useState(false);
|
|
34
|
+
const [deleteSessionConfirmText, setDeleteSessionConfirmText] = useState('');
|
|
35
|
+
const [isDeletingSession, setIsDeletingSession] = useState(false);
|
|
36
|
+
|
|
37
|
+
// Gradient colors based on theme
|
|
38
|
+
const gradientColors = theme.mode === 'dark'
|
|
39
|
+
? [theme.colors.card, 'transparent'] as const
|
|
40
|
+
: ['#ffffff', '#f8fafc'] as const; // Subtle fade for light mode
|
|
41
|
+
|
|
42
|
+
const handleLogout = async () => {
|
|
43
|
+
const result = await signOut();
|
|
44
|
+
if (!result.success) {
|
|
45
|
+
Alert.alert('Error', 'Failed to sign out. Please try again.');
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const handleDeleteAccount = async () => {
|
|
50
|
+
if (deleteConfirmText !== 'DELETE') {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
setIsDeleting(true);
|
|
55
|
+
const result = await deleteAccount();
|
|
56
|
+
setIsDeleting(false);
|
|
57
|
+
|
|
58
|
+
if (result.success) {
|
|
59
|
+
await signOut();
|
|
60
|
+
setShowDeleteModal(false);
|
|
61
|
+
setDeleteConfirmText('');
|
|
62
|
+
} else {
|
|
63
|
+
Alert.alert('Error', result.error || 'Failed to delete account. Please try again.');
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const handleDeleteSession = async () => {
|
|
68
|
+
if (deleteSessionConfirmText !== 'DELETE') {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
setIsDeletingSession(true);
|
|
73
|
+
try {
|
|
74
|
+
await deleteSession();
|
|
75
|
+
const onboardingEnabled = Constants.expoConfig?.extra?.features?.onboarding?.enabled ?? false;
|
|
76
|
+
setShowDeleteSessionModal(false);
|
|
77
|
+
setDeleteSessionConfirmText('');
|
|
78
|
+
|
|
79
|
+
if (!onboardingEnabled) {
|
|
80
|
+
await initializeSession();
|
|
81
|
+
} else {
|
|
82
|
+
router.replace('/(onboarding)/page-1');
|
|
83
|
+
}
|
|
84
|
+
} catch (error) {
|
|
85
|
+
console.error('Failed to delete/recreate session:', error);
|
|
86
|
+
setShowDeleteSessionModal(false);
|
|
87
|
+
setDeleteSessionConfirmText('');
|
|
88
|
+
} finally {
|
|
89
|
+
setIsDeletingSession(false);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const isDeleteButtonEnabled = deleteConfirmText === 'DELETE' && !isDeleting;
|
|
94
|
+
|
|
95
|
+
const features = [
|
|
96
|
+
'Authentication system',
|
|
97
|
+
'Zustand state management',
|
|
98
|
+
'Error handling',
|
|
99
|
+
'Form validation',
|
|
100
|
+
'API integration',
|
|
101
|
+
];
|
|
102
|
+
|
|
103
|
+
return (
|
|
104
|
+
<SafeAreaView style={styles.container}>
|
|
105
|
+
<ScrollView contentContainerStyle={styles.scrollContent}>
|
|
106
|
+
<View style={styles.content}>
|
|
107
|
+
<Text style={styles.title}>Welcome to Your App!</Text>
|
|
108
|
+
|
|
109
|
+
{user && (
|
|
110
|
+
<LinearGradient
|
|
111
|
+
colors={gradientColors}
|
|
112
|
+
style={styles.userInfo}
|
|
113
|
+
start={{ x: 0, y: 0 }}
|
|
114
|
+
end={{ x: 0, y: 1 }}
|
|
115
|
+
>
|
|
116
|
+
<Text style={styles.greeting}>
|
|
117
|
+
Hello, {formatDisplayName(user.name)}!
|
|
118
|
+
</Text>
|
|
119
|
+
<Text style={styles.email}>{user.email}</Text>
|
|
120
|
+
<Text style={styles.userId}>User ID: {user.id}</Text>
|
|
121
|
+
</LinearGradient>
|
|
122
|
+
)}
|
|
123
|
+
|
|
124
|
+
<LinearGradient
|
|
125
|
+
colors={gradientColors}
|
|
126
|
+
style={styles.section}
|
|
127
|
+
start={{ x: 0, y: 0 }}
|
|
128
|
+
end={{ x: 0, y: 1 }}
|
|
129
|
+
>
|
|
130
|
+
<Text style={styles.sectionTitle}>Getting Started</Text>
|
|
131
|
+
<Text style={styles.sectionText}>
|
|
132
|
+
This is your main app screen. You can now start building your amazing features!
|
|
133
|
+
</Text>
|
|
134
|
+
|
|
135
|
+
<View style={styles.featureList}>
|
|
136
|
+
{features.map((feature, index) => (
|
|
137
|
+
<View key={index} style={styles.featureRow}>
|
|
138
|
+
<View style={styles.featureIcon}>
|
|
139
|
+
<IconSymbol
|
|
140
|
+
name="checkmark.circle.fill"
|
|
141
|
+
size={16}
|
|
142
|
+
color={theme.colors.success}
|
|
143
|
+
/>
|
|
144
|
+
</View>
|
|
145
|
+
<Text style={styles.featureText}>{feature}</Text>
|
|
146
|
+
</View>
|
|
147
|
+
))}
|
|
148
|
+
</View>
|
|
149
|
+
</LinearGradient>
|
|
150
|
+
|
|
151
|
+
<View style={styles.actions}>
|
|
152
|
+
{isAuthenticated ? (
|
|
153
|
+
<>
|
|
154
|
+
<Button
|
|
155
|
+
title="Logout"
|
|
156
|
+
variant="outline"
|
|
157
|
+
onPress={handleLogout}
|
|
158
|
+
loading={isLoading}
|
|
159
|
+
style={styles.logoutButton}
|
|
160
|
+
/>
|
|
161
|
+
|
|
162
|
+
<Button
|
|
163
|
+
title="Delete Account"
|
|
164
|
+
variant="outline"
|
|
165
|
+
onPress={() => setShowDeleteModal(true)}
|
|
166
|
+
style={styles.deleteButton}
|
|
167
|
+
textStyle={styles.deleteButtonText}
|
|
168
|
+
/>
|
|
169
|
+
</>
|
|
170
|
+
) : (
|
|
171
|
+
<>
|
|
172
|
+
<Button
|
|
173
|
+
title="Sign In"
|
|
174
|
+
variant="primary"
|
|
175
|
+
onPress={() => router.push('/(auth)/login')}
|
|
176
|
+
style={styles.signInButton}
|
|
177
|
+
/>
|
|
178
|
+
|
|
179
|
+
<Button
|
|
180
|
+
title="Create Account"
|
|
181
|
+
variant="outline"
|
|
182
|
+
onPress={() => router.push('/(auth)/register')}
|
|
183
|
+
style={styles.createAccountButton}
|
|
184
|
+
/>
|
|
185
|
+
|
|
186
|
+
<Button
|
|
187
|
+
title="Delete Session"
|
|
188
|
+
variant="outline"
|
|
189
|
+
onPress={() => setShowDeleteSessionModal(true)}
|
|
190
|
+
style={styles.deleteSessionButton}
|
|
191
|
+
textStyle={styles.deleteSessionButtonText}
|
|
192
|
+
/>
|
|
193
|
+
</>
|
|
194
|
+
)}
|
|
195
|
+
</View>
|
|
196
|
+
</View>
|
|
197
|
+
</ScrollView>
|
|
198
|
+
|
|
199
|
+
{/* Delete Account Confirmation Modal */}
|
|
200
|
+
<Modal
|
|
201
|
+
visible={showDeleteModal}
|
|
202
|
+
transparent
|
|
203
|
+
animationType="fade"
|
|
204
|
+
onRequestClose={() => setShowDeleteModal(false)}
|
|
205
|
+
statusBarTranslucent
|
|
206
|
+
>
|
|
207
|
+
<KeyboardAvoidingView
|
|
208
|
+
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
|
|
209
|
+
style={styles.keyboardAvoidingModal}
|
|
210
|
+
>
|
|
211
|
+
<Pressable
|
|
212
|
+
style={styles.modalOverlay}
|
|
213
|
+
onPress={() => setShowDeleteModal(false)}
|
|
214
|
+
>
|
|
215
|
+
<Pressable
|
|
216
|
+
style={styles.modalContent}
|
|
217
|
+
onPress={(e) => e.stopPropagation()}
|
|
218
|
+
>
|
|
219
|
+
<Text style={styles.modalTitle}>Delete Account</Text>
|
|
220
|
+
|
|
221
|
+
<View style={styles.warningContainer}>
|
|
222
|
+
<Text style={styles.warningTitle}>Warning</Text>
|
|
223
|
+
<Text style={styles.warningText}>
|
|
224
|
+
This action is permanent and cannot be undone. All your account data will be deleted immediately.
|
|
225
|
+
</Text>
|
|
226
|
+
</View>
|
|
227
|
+
|
|
228
|
+
<View style={styles.gdprNotice}>
|
|
229
|
+
<Text style={styles.gdprTitle}>Third-Party Data Notice</Text>
|
|
230
|
+
<Text style={styles.gdprText}>
|
|
231
|
+
Please note that data stored by third-party services (RevenueCat, Adjust, Scate) may persist on their servers.
|
|
232
|
+
</Text>
|
|
233
|
+
</View>
|
|
234
|
+
|
|
235
|
+
<Input
|
|
236
|
+
label="Type DELETE to confirm"
|
|
237
|
+
value={deleteConfirmText}
|
|
238
|
+
onChangeText={setDeleteConfirmText}
|
|
239
|
+
placeholder="DELETE"
|
|
240
|
+
autoCapitalize="characters"
|
|
241
|
+
containerStyle={styles.confirmInput}
|
|
242
|
+
/>
|
|
243
|
+
|
|
244
|
+
<View style={styles.modalActions}>
|
|
245
|
+
<Button
|
|
246
|
+
title="Cancel"
|
|
247
|
+
variant="outline"
|
|
248
|
+
onPress={() => {
|
|
249
|
+
setShowDeleteModal(false);
|
|
250
|
+
setDeleteConfirmText('');
|
|
251
|
+
}}
|
|
252
|
+
style={styles.modalButton}
|
|
253
|
+
/>
|
|
254
|
+
|
|
255
|
+
<Button
|
|
256
|
+
title={isDeleting ? "Deleting..." : "Delete"}
|
|
257
|
+
variant="primary"
|
|
258
|
+
onPress={handleDeleteAccount}
|
|
259
|
+
disabled={!isDeleteButtonEnabled}
|
|
260
|
+
loading={isDeleting}
|
|
261
|
+
style={StyleSheet.flatten([styles.modalButton, styles.deleteConfirmButton])}
|
|
262
|
+
/>
|
|
263
|
+
</View>
|
|
264
|
+
</Pressable>
|
|
265
|
+
</Pressable>
|
|
266
|
+
</KeyboardAvoidingView>
|
|
267
|
+
</Modal>
|
|
268
|
+
|
|
269
|
+
{/* Delete Session Confirmation Modal */}
|
|
270
|
+
<Modal
|
|
271
|
+
visible={showDeleteSessionModal}
|
|
272
|
+
transparent
|
|
273
|
+
animationType="fade"
|
|
274
|
+
onRequestClose={() => setShowDeleteSessionModal(false)}
|
|
275
|
+
statusBarTranslucent
|
|
276
|
+
>
|
|
277
|
+
<KeyboardAvoidingView
|
|
278
|
+
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
|
|
279
|
+
style={styles.keyboardAvoidingModal}
|
|
280
|
+
>
|
|
281
|
+
<Pressable
|
|
282
|
+
style={styles.modalOverlay}
|
|
283
|
+
onPress={() => setShowDeleteSessionModal(false)}
|
|
284
|
+
>
|
|
285
|
+
<Pressable
|
|
286
|
+
style={styles.modalContent}
|
|
287
|
+
onPress={(e) => e.stopPropagation()}
|
|
288
|
+
>
|
|
289
|
+
<Text style={styles.modalTitle}>Delete Session</Text>
|
|
290
|
+
|
|
291
|
+
<View style={styles.warningContainer}>
|
|
292
|
+
<Text style={styles.warningTitle}>Warning</Text>
|
|
293
|
+
<Text style={styles.warningText}>
|
|
294
|
+
This will delete your anonymous session and all local data. You'll need to go through onboarding again.
|
|
295
|
+
</Text>
|
|
296
|
+
</View>
|
|
297
|
+
|
|
298
|
+
<Input
|
|
299
|
+
label="Type DELETE to confirm"
|
|
300
|
+
value={deleteSessionConfirmText}
|
|
301
|
+
onChangeText={setDeleteSessionConfirmText}
|
|
302
|
+
placeholder="DELETE"
|
|
303
|
+
autoCapitalize="characters"
|
|
304
|
+
containerStyle={styles.confirmInput}
|
|
305
|
+
/>
|
|
306
|
+
|
|
307
|
+
<View style={styles.modalActions}>
|
|
308
|
+
<Button
|
|
309
|
+
title="Cancel"
|
|
310
|
+
variant="outline"
|
|
311
|
+
onPress={() => {
|
|
312
|
+
setShowDeleteSessionModal(false);
|
|
313
|
+
setDeleteSessionConfirmText('');
|
|
314
|
+
}}
|
|
315
|
+
style={styles.modalButton}
|
|
316
|
+
/>
|
|
317
|
+
|
|
318
|
+
<Button
|
|
319
|
+
title={isDeletingSession ? "Deleting..." : "Delete"}
|
|
320
|
+
variant="primary"
|
|
321
|
+
onPress={handleDeleteSession}
|
|
322
|
+
disabled={deleteSessionConfirmText !== 'DELETE'}
|
|
323
|
+
loading={isDeletingSession}
|
|
324
|
+
style={StyleSheet.flatten([styles.modalButton, styles.deleteConfirmButton])}
|
|
325
|
+
/>
|
|
326
|
+
</View>
|
|
327
|
+
</Pressable>
|
|
328
|
+
</Pressable>
|
|
329
|
+
</KeyboardAvoidingView>
|
|
330
|
+
</Modal>
|
|
331
|
+
</SafeAreaView>
|
|
332
|
+
);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
const createStyles = (theme: AppTheme) => StyleSheet.create({
|
|
336
|
+
container: {
|
|
337
|
+
flex: 1,
|
|
338
|
+
backgroundColor: theme.colors.background,
|
|
339
|
+
},
|
|
340
|
+
|
|
341
|
+
scrollContent: {
|
|
342
|
+
flexGrow: 1,
|
|
343
|
+
},
|
|
344
|
+
|
|
345
|
+
content: {
|
|
346
|
+
flex: 1,
|
|
347
|
+
padding: theme.spacing[5],
|
|
348
|
+
},
|
|
349
|
+
|
|
350
|
+
title: {
|
|
351
|
+
fontSize: theme.typography.fontSize['3xl'],
|
|
352
|
+
fontWeight: '800',
|
|
353
|
+
color: theme.colors.text,
|
|
354
|
+
textAlign: 'center',
|
|
355
|
+
marginBottom: theme.spacing[8],
|
|
356
|
+
letterSpacing: -1,
|
|
357
|
+
},
|
|
358
|
+
|
|
359
|
+
userInfo: {
|
|
360
|
+
// Removed solid background
|
|
361
|
+
borderRadius: theme.borderRadius.xl,
|
|
362
|
+
padding: theme.spacing[5],
|
|
363
|
+
marginBottom: theme.spacing[6],
|
|
364
|
+
alignItems: 'center',
|
|
365
|
+
borderWidth: 1,
|
|
366
|
+
borderColor: theme.colors.borderLight,
|
|
367
|
+
},
|
|
368
|
+
|
|
369
|
+
greeting: {
|
|
370
|
+
fontSize: theme.typography.fontSize.lg,
|
|
371
|
+
fontWeight: '700',
|
|
372
|
+
color: theme.colors.text,
|
|
373
|
+
marginBottom: theme.spacing[2],
|
|
374
|
+
},
|
|
375
|
+
|
|
376
|
+
email: {
|
|
377
|
+
fontSize: theme.typography.fontSize.base,
|
|
378
|
+
color: theme.colors.textSecondary,
|
|
379
|
+
marginBottom: theme.spacing[1],
|
|
380
|
+
},
|
|
381
|
+
|
|
382
|
+
userId: {
|
|
383
|
+
fontSize: theme.typography.fontSize.sm,
|
|
384
|
+
color: theme.colors.textMuted,
|
|
385
|
+
},
|
|
386
|
+
|
|
387
|
+
section: {
|
|
388
|
+
// Removed solid background
|
|
389
|
+
borderRadius: theme.borderRadius.xl,
|
|
390
|
+
padding: theme.spacing[6],
|
|
391
|
+
marginBottom: theme.spacing[6],
|
|
392
|
+
borderWidth: 1,
|
|
393
|
+
borderColor: theme.colors.borderLight,
|
|
394
|
+
},
|
|
395
|
+
|
|
396
|
+
sectionTitle: {
|
|
397
|
+
fontSize: theme.typography.fontSize.lg,
|
|
398
|
+
fontWeight: '700',
|
|
399
|
+
color: theme.colors.text,
|
|
400
|
+
marginBottom: theme.spacing[3],
|
|
401
|
+
},
|
|
402
|
+
|
|
403
|
+
sectionText: {
|
|
404
|
+
fontSize: theme.typography.fontSize.base,
|
|
405
|
+
color: theme.colors.textSecondary,
|
|
406
|
+
lineHeight: 24,
|
|
407
|
+
marginBottom: theme.spacing[5],
|
|
408
|
+
},
|
|
409
|
+
|
|
410
|
+
featureList: {
|
|
411
|
+
gap: theme.spacing[3],
|
|
412
|
+
},
|
|
413
|
+
|
|
414
|
+
featureRow: {
|
|
415
|
+
flexDirection: 'row',
|
|
416
|
+
alignItems: 'center',
|
|
417
|
+
gap: theme.spacing[3],
|
|
418
|
+
},
|
|
419
|
+
|
|
420
|
+
featureIcon: {
|
|
421
|
+
width: 28,
|
|
422
|
+
height: 28,
|
|
423
|
+
borderRadius: theme.borderRadius.full,
|
|
424
|
+
backgroundColor: theme.mode === 'dark' ? 'rgba(34, 197, 94, 0.1)' : 'rgba(16, 185, 129, 0.1)',
|
|
425
|
+
alignItems: 'center',
|
|
426
|
+
justifyContent: 'center',
|
|
427
|
+
},
|
|
428
|
+
|
|
429
|
+
featureText: {
|
|
430
|
+
fontSize: theme.typography.fontSize.base,
|
|
431
|
+
color: theme.colors.text,
|
|
432
|
+
fontWeight: '500',
|
|
433
|
+
},
|
|
434
|
+
|
|
435
|
+
actions: {
|
|
436
|
+
marginTop: 'auto',
|
|
437
|
+
paddingTop: theme.spacing[5],
|
|
438
|
+
},
|
|
439
|
+
|
|
440
|
+
logoutButton: {
|
|
441
|
+
marginTop: theme.spacing[4],
|
|
442
|
+
},
|
|
443
|
+
|
|
444
|
+
deleteButton: {
|
|
445
|
+
marginTop: theme.spacing[3],
|
|
446
|
+
borderColor: theme.colors.error,
|
|
447
|
+
},
|
|
448
|
+
|
|
449
|
+
deleteButtonText: {
|
|
450
|
+
color: theme.colors.error,
|
|
451
|
+
},
|
|
452
|
+
|
|
453
|
+
signInButton: {
|
|
454
|
+
marginTop: theme.spacing[4],
|
|
455
|
+
},
|
|
456
|
+
|
|
457
|
+
createAccountButton: {
|
|
458
|
+
marginTop: theme.spacing[3],
|
|
459
|
+
},
|
|
460
|
+
|
|
461
|
+
deleteSessionButton: {
|
|
462
|
+
marginTop: theme.spacing[3],
|
|
463
|
+
borderColor: theme.colors.error,
|
|
464
|
+
},
|
|
465
|
+
|
|
466
|
+
deleteSessionButtonText: {
|
|
467
|
+
color: theme.colors.error,
|
|
468
|
+
},
|
|
469
|
+
|
|
470
|
+
// Modal styles
|
|
471
|
+
keyboardAvoidingModal: {
|
|
472
|
+
flex: 1,
|
|
473
|
+
},
|
|
474
|
+
|
|
475
|
+
modalOverlay: {
|
|
476
|
+
flex: 1,
|
|
477
|
+
backgroundColor: 'rgba(0, 0, 0, 0.7)',
|
|
478
|
+
justifyContent: 'center',
|
|
479
|
+
alignItems: 'center',
|
|
480
|
+
padding: theme.spacing[5],
|
|
481
|
+
},
|
|
482
|
+
|
|
483
|
+
modalContent: {
|
|
484
|
+
backgroundColor: theme.colors.background,
|
|
485
|
+
borderRadius: 24,
|
|
486
|
+
padding: theme.spacing[6],
|
|
487
|
+
paddingBottom: theme.spacing[12],
|
|
488
|
+
width: '100%',
|
|
489
|
+
maxWidth: 400,
|
|
490
|
+
borderWidth: 1,
|
|
491
|
+
borderColor: theme.colors.borderLight,
|
|
492
|
+
...theme.shadows.large,
|
|
493
|
+
},
|
|
494
|
+
|
|
495
|
+
modalTitle: {
|
|
496
|
+
fontSize: theme.typography.fontSize['xl'],
|
|
497
|
+
fontWeight: 'bold',
|
|
498
|
+
color: theme.colors.text,
|
|
499
|
+
marginBottom: theme.spacing[6],
|
|
500
|
+
textAlign: 'center',
|
|
501
|
+
},
|
|
502
|
+
|
|
503
|
+
warningContainer: {
|
|
504
|
+
backgroundColor: 'transparent', // No more solid gray block
|
|
505
|
+
borderRadius: theme.borderRadius.lg,
|
|
506
|
+
padding: theme.spacing[4],
|
|
507
|
+
marginBottom: theme.spacing[5],
|
|
508
|
+
borderWidth: 1,
|
|
509
|
+
borderColor: theme.colors.warning, // Outline instead
|
|
510
|
+
borderStyle: 'dashed', // Optional stylish touch
|
|
511
|
+
},
|
|
512
|
+
|
|
513
|
+
warningTitle: {
|
|
514
|
+
fontSize: theme.typography.fontSize.base,
|
|
515
|
+
fontWeight: '700',
|
|
516
|
+
color: theme.colors.warning,
|
|
517
|
+
marginBottom: theme.spacing[2],
|
|
518
|
+
},
|
|
519
|
+
|
|
520
|
+
warningText: {
|
|
521
|
+
fontSize: theme.typography.fontSize.sm,
|
|
522
|
+
color: theme.colors.textSecondary,
|
|
523
|
+
lineHeight: 20,
|
|
524
|
+
},
|
|
525
|
+
|
|
526
|
+
gdprNotice: {
|
|
527
|
+
backgroundColor: 'transparent',
|
|
528
|
+
borderRadius: theme.borderRadius.lg,
|
|
529
|
+
padding: theme.spacing[4],
|
|
530
|
+
marginBottom: theme.spacing[5],
|
|
531
|
+
borderWidth: 1,
|
|
532
|
+
borderColor: theme.colors.info,
|
|
533
|
+
},
|
|
534
|
+
|
|
535
|
+
gdprTitle: {
|
|
536
|
+
fontSize: theme.typography.fontSize.sm,
|
|
537
|
+
fontWeight: '600',
|
|
538
|
+
color: theme.colors.info,
|
|
539
|
+
marginBottom: theme.spacing[2],
|
|
540
|
+
},
|
|
541
|
+
|
|
542
|
+
gdprText: {
|
|
543
|
+
fontSize: theme.typography.fontSize.xs,
|
|
544
|
+
color: theme.colors.textMuted,
|
|
545
|
+
lineHeight: 18,
|
|
546
|
+
},
|
|
547
|
+
|
|
548
|
+
confirmInput: {
|
|
549
|
+
marginBottom: theme.spacing[6],
|
|
550
|
+
},
|
|
551
|
+
|
|
552
|
+
modalActions: {
|
|
553
|
+
flexDirection: 'row',
|
|
554
|
+
gap: theme.spacing[3],
|
|
555
|
+
},
|
|
556
|
+
|
|
557
|
+
modalButton: {
|
|
558
|
+
flex: 1,
|
|
559
|
+
},
|
|
560
|
+
|
|
561
|
+
deleteConfirmButton: {
|
|
562
|
+
backgroundColor: theme.colors.error,
|
|
563
|
+
borderWidth: 0, // Solid button
|
|
564
|
+
},
|
|
565
|
+
});
|
|
File without changes
|